Skip to content

Commit 29e2f21

Browse files
authored
Merge pull request #9224 from kareem-wolfssl/zd20527
Fix swapped WOLFSSL_SILABS_SHA384/SHA512 defines in sha512.c.
2 parents db4d2af + 8fbc39e commit 29e2f21

2 files changed

Lines changed: 8 additions & 7 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;

wolfcrypt/src/sha512.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
!defined(WOLFSSL_QNX_CAAM)
126126
/* functions defined in wolfcrypt/src/port/caam/caam_sha.c */
127127

128-
#elif defined(WOLFSSL_SILABS_SHA384)
128+
#elif defined(WOLFSSL_SILABS_SHA512)
129129
/* functions defined in wolfcrypt/src/port/silabs/silabs_hash.c */
130130

131131
#elif defined(WOLFSSL_KCAPI_HASH)
@@ -1211,7 +1211,7 @@ int wc_Sha512Update(wc_Sha512* sha512, const byte* data, word32 len)
12111211

12121212
#endif /* WOLFSSL_SHA512 */
12131213

1214-
#endif /* WOLFSSL_IMX6_CAAM || WOLFSSL_SILABS_SHA384 */
1214+
#endif /* WOLFSSL_IMX6_CAAM || WOLFSSL_SILABS_SHA512 */
12151215

12161216

12171217
#if defined(WOLFSSL_KCAPI_HASH)
@@ -1387,6 +1387,7 @@ static WC_INLINE int Sha512Final(wc_Sha512* sha512)
13871387
#elif defined(MAX3266X_SHA)
13881388
/* Functions defined in wolfcrypt/src/port/maxim/max3266x.c */
13891389
#elif defined(STM32_HASH_SHA512)
1390+
#elif defined(WOLFSSL_SILABS_SHA512)
13901391
#else
13911392

13921393
static int Sha512FinalRaw(wc_Sha512* sha512, byte* hash, word32 digestSz)
@@ -1630,7 +1631,7 @@ int wc_Sha512Transform(wc_Sha512* sha, const unsigned char* data)
16301631
return ret;
16311632
}
16321633

1633-
#elif defined(WOLFSSL_SILABS_SHA512)
1634+
#elif defined(WOLFSSL_SILABS_SHA384)
16341635
/* functions defined in wolfcrypt/src/port/silabs/silabs_hash.c */
16351636

16361637
#elif defined(WOLFSSL_KCAPI_HASH)
@@ -1895,7 +1896,7 @@ int wc_InitSha384_ex(wc_Sha384* sha384, void* heap, int devId)
18951896
return ret;
18961897
}
18971898

1898-
#endif /* WOLFSSL_IMX6_CAAM || WOLFSSL_SILABS_SHA512 || WOLFSSL_KCAPI_HASH */
1899+
#endif /* WOLFSSL_IMX6_CAAM || WOLFSSL_SILABS_SHA384 || WOLFSSL_KCAPI_HASH */
18991900

19001901
#if defined(MAX3266X_SHA)
19011902
/* Functions defined in wolfcrypt/src/port/maxim/max3266x.c */

0 commit comments

Comments
 (0)