Skip to content

Commit baeffb2

Browse files
authored
Merge pull request #9692 from anhu/aead
wc_XChaCha20Poly1305_Init: NULL check aead, not ad
2 parents e4e79dd + 7d7299e commit baeffb2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

wolfcrypt/src/chacha20_poly1305.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ int wc_XChaCha20Poly1305_Init(
313313
byte authKey[CHACHA20_POLY1305_AEAD_KEYSIZE];
314314
int ret;
315315

316-
if ((ad == NULL) || (nonce == NULL) || (key == NULL))
316+
if ((aead == NULL) || (ad == NULL && ad_len > 0) || (nonce == NULL) ||
317+
(key == NULL))
317318
return BAD_FUNC_ARG;
318319

319320
if ((key_len != CHACHA20_POLY1305_AEAD_KEYSIZE) ||

0 commit comments

Comments
 (0)