We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 976e4b2 commit f140546Copy full SHA for f140546
1 file changed
wolfcrypt/src/port/atmel/atmel.c
@@ -467,6 +467,16 @@ int atmel_ecc_create_key(int slotId, byte* peerKey)
467
int atmel_ecc_sign(int slotId, const byte* message, byte* signature)
468
{
469
int ret;
470
+#ifndef WC_ALLOW_ECC_ZERO_HASH
471
+ byte hashIsZero = 0;
472
+ word32 zIdx;
473
+
474
+ /* defensive sanity check on all 0's hash */
475
+ for (zIdx = 0; zIdx < ATECC_KEY_SIZE; zIdx++)
476
+ hashIsZero |= message[zIdx];
477
+ if (hashIsZero == 0)
478
+ return ECC_BAD_ARG_E;
479
+#endif
480
481
ret = atcab_sign(slotId, message, signature);
482
ret = atmel_ecc_translate_err(ret);
0 commit comments