Skip to content

Commit 8f8b4e6

Browse files
night1riderZackLabPC
authored andcommitted
Addressing Feedback, Adding Null Checks and Mutex Around TRNG
1 parent fe7987f commit 8f8b4e6

3 files changed

Lines changed: 162 additions & 72 deletions

File tree

wolfcrypt/src/aes.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,7 +2209,8 @@ static void AesEncrypt_C(Aes* aes, const byte* inBlock, byte* outBlock,
22092209
}
22102210

22112211
#if defined(HAVE_AES_ECB) && !(defined(WOLFSSL_IMX6_CAAM) && \
2212-
!defined(NO_IMX6_CAAM_AES) && !defined(WOLFSSL_QNX_CAAM))
2212+
!defined(NO_IMX6_CAAM_AES) && !defined(WOLFSSL_QNX_CAAM)) && \
2213+
!defined(MAX3266X_AES)
22132214
/* Encrypt a number of blocks using AES.
22142215
*
22152216
* @param [in] aes AES object.
@@ -3187,7 +3188,8 @@ static void AesDecrypt_C(Aes* aes, const byte* inBlock, byte* outBlock,
31873188
}
31883189

31893190
#if defined(HAVE_AES_ECB) && !(defined(WOLFSSL_IMX6_CAAM) && \
3190-
!defined(NO_IMX6_CAAM_AES) && !defined(WOLFSSL_QNX_CAAM))
3191+
!defined(NO_IMX6_CAAM_AES) && !defined(WOLFSSL_QNX_CAAM)) && \
3192+
!defined(MAX3266X_AES)
31913193
/* Decrypt a number of blocks using AES.
31923194
*
31933195
* @param [in] aes AES object.
@@ -5422,8 +5424,8 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
54225424
return BAD_LENGTH_E;
54235425
#else
54245426
return BAD_FUNC_ARG;
5425-
}
54265427
#endif
5428+
}
54275429
if (sz == 0) {
54285430
return 0;
54295431
}
@@ -5462,8 +5464,8 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
54625464
return BAD_LENGTH_E;
54635465
#else
54645466
return BAD_FUNC_ARG;
5465-
}
54665467
#endif
5468+
}
54675469
if (sz == 0) {
54685470
return 0;
54695471
}
@@ -11532,8 +11534,8 @@ int wc_AesEcbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
1153211534
return status;
1153311535
}
1153411536

11535-
status = wc_MXC_TPU_AesEncrypt(in, aes->reg, aes->key, MXC_TPU_MODE_ECB,
11536-
sz, out, keySize);
11537+
status = wc_MXC_TPU_AesEncrypt(in, (byte*)aes->reg, (byte*)aes->key,
11538+
MXC_TPU_MODE_ECB, sz, out, keySize);
1153711539

1153811540
return status;
1153911541
}
@@ -11552,8 +11554,8 @@ int wc_AesEcbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
1155211554
return status;
1155311555
}
1155411556

11555-
status = wc_MXC_TPU_AesDecrypt(in, aes->reg, aes->key, MXC_TPU_MODE_ECB,
11556-
sz, out, keySize);
11557+
status = wc_MXC_TPU_AesDecrypt(in, (byte*)aes->reg, (byte*)aes->key,
11558+
MXC_TPU_MODE_ECB, sz, out, keySize);
1155711559

1155811560
return status;
1155911561
}

wolfcrypt/src/port/maxim/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ hardware.
8383
- SHA-384
8484
- SHA-512
8585

86+
Please note that when using `MAX3266X_SHA` there will be a limitation when
87+
attempting to do a larger sized hash as the SDK for the hardware currently
88+
expects a the whole msg buffer to be given.
89+
8690
`#define MAX3266X_MATH` (Replaces math operation calls for algos
8791
like RSA and ECC key generation):
8892

0 commit comments

Comments
 (0)