Skip to content

Commit fed8d6a

Browse files
authored
Merge pull request #10814 from kojiws/fix_ecc_31bytes_on_test
Fix ECC buffer test by correcting message length
2 parents 0703dc9 + b98e43e commit fed8d6a

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43783,9 +43783,10 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ecc_test_buffers(void)
4378343783
wc_test_ret_t ret;
4378443784
word32 idx = 0;
4378543785
#ifndef WC_NO_RNG
43786-
/* pad our test message to 32 bytes so evenly divisible by AES_BLOCK_SZ */
43787-
byte in[] = "Everyone gets Friday off. ecc p";
43788-
word32 inLen = (word32)XSTRLEN((char*)in);
43786+
/* 32 bytes: evenly divisible by AES_BLOCK_SZ and meets WC_MIN_DIGEST_SIZE */
43787+
byte in[] = "Everyone gets Friday off. ecc p";
43788+
const word32 inLen = sizeof(in); /* includes null terminator */
43789+
wc_static_assert2(sizeof(in) == 32, "in[] must be exactly 32 bytes");
4378943790
byte out[256];
4379043791
byte plain[256];
4379143792
WOLFSSL_ENTER("ecc_test_buffers");
@@ -43855,7 +43856,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ecc_test_buffers(void)
4385543856

4385643857
#if defined(HAVE_ECC_ENCRYPT) && defined(HAVE_HKDF) && \
4385743858
defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128)
43858-
ret = ecc_buffers_encrypt_test(cliKey, servKey, tmpKey, in, sizeof(in), out,
43859+
ret = ecc_buffers_encrypt_test(cliKey, servKey, tmpKey, in, inLen, out,
4385943860
plain, inLen);
4386043861
if (ret != 0)
4386143862
goto done;

0 commit comments

Comments
 (0)