Skip to content

Commit 0fcfade

Browse files
Add missing aes NULL check to SI Labs wc_AesSetKey.
1 parent 1c7fe06 commit 0fcfade

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

wolfcrypt/src/port/silabs/silabs_aes.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ int wc_AesSetKey(Aes* aes, const byte* userKey, word32 keylen,
4848
return BUFFER_E;
4949
}
5050

51-
XMEMSET(aes, 0, sizeof(*aes));
52-
53-
if (keylen > sizeof(aes->key)) {
51+
if (aes == NULL || keylen > sizeof(aes->key)) {
5452
return BAD_FUNC_ARG;
5553
}
5654

55+
XMEMSET(aes, 0, sizeof(*aes));
56+
5757
ret = wc_AesSetIV(aes, iv);
5858
aes->rounds = keylen/4 + 6;
5959
aes->ctx.cmd_ctx = cc;

0 commit comments

Comments
 (0)