@@ -582,6 +582,27 @@ static WC_MAYBE_UNUSED int test_AesCbcInit(Aes* aes, void* heap,
582582
583583#endif /* !NO_AES && HAVE_AES_CBC */
584584
585+ /* --- AES ECB id[] and init helper --- */
586+ #if !defined(NO_AES) && \
587+ (defined(HAVE_AES_ECB) || defined(WOLFSSL_AES_DIRECT))
588+ #if defined(WOLF_PRIVATE_KEY_ID) && defined(WC_TEST_AES_ECB_ID)
589+ static unsigned char testAesEcbId[] = WC_TEST_AES_ECB_ID;
590+ static int testAesEcbIdLen = (int)sizeof(testAesEcbId);
591+ #endif
592+
593+ static WC_MAYBE_UNUSED int test_AesEcbInit(Aes* aes, void* heap,
594+ int declaredDevId)
595+ {
596+ #if defined(WOLF_PRIVATE_KEY_ID) && defined(WC_TEST_AES_ECB_ID)
597+ return wc_AesInit_Id(aes, testAesEcbId, testAesEcbIdLen, heap,
598+ declaredDevId);
599+ #else
600+ return wc_AesInit(aes, heap, declaredDevId);
601+ #endif
602+ }
603+
604+ #endif /* !NO_AES && (HAVE_AES_ECB || WOLFSSL_AES_DIRECT) */
605+
585606/* --- AES GCM id[] and init helper --- */
586607#if !defined(NO_AES) && defined(HAVE_AESGCM)
587608#if defined(WOLF_PRIVATE_KEY_ID) && defined(WC_TEST_AES_GCM_ID)
@@ -1366,6 +1387,20 @@ static WC_MAYBE_UNUSED Aes* test_AesCbcNew(void* heap, int declaredDevId,
13661387}
13671388#endif /* !NO_AES && HAVE_AES_CBC */
13681389
1390+ #if !defined(NO_AES) && \
1391+ (defined(HAVE_AES_ECB) || defined(WOLFSSL_AES_DIRECT))
1392+ static WC_MAYBE_UNUSED Aes* test_AesEcbNew(void* heap, int declaredDevId,
1393+ int* ret)
1394+ {
1395+ #if defined(WOLF_PRIVATE_KEY_ID) && defined(WC_TEST_AES_ECB_ID)
1396+ return wc_AesNew_Id(testAesEcbId, testAesEcbIdLen, heap, declaredDevId,
1397+ ret);
1398+ #else
1399+ return wc_AesNew(heap, declaredDevId, ret);
1400+ #endif
1401+ }
1402+ #endif /* !NO_AES && (HAVE_AES_ECB || WOLFSSL_AES_DIRECT) */
1403+
13691404#if !defined(NO_AES) && defined(HAVE_AESGCM)
13701405static WC_MAYBE_UNUSED Aes* test_AesGcmNew(void* heap, int declaredDevId,
13711406 int* ret)
@@ -16769,20 +16804,20 @@ static wc_test_ret_t aes_ecb_direct_test(void)
1676916804#endif
1677016805
1677116806#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
16772- enc = wc_AesNew (HEAP_HINT, devId, &ret);
16807+ enc = test_AesEcbNew (HEAP_HINT, devId, &ret);
1677316808 if (enc == NULL)
1677416809 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
1677516810#ifdef HAVE_AES_DECRYPT
16776- dec = wc_AesNew (HEAP_HINT, devId, &ret);
16811+ dec = test_AesEcbNew (HEAP_HINT, devId, &ret);
1677716812 if (dec == NULL)
1677816813 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
1677916814#endif
1678016815#else
16781- ret = wc_AesInit (enc, HEAP_HINT, devId);
16816+ ret = test_AesEcbInit (enc, HEAP_HINT, devId);
1678216817 if (ret != 0)
1678316818 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
1678416819#ifdef HAVE_AES_DECRYPT
16785- ret = wc_AesInit (dec, HEAP_HINT, devId);
16820+ ret = test_AesEcbInit (dec, HEAP_HINT, devId);
1678616821 if (ret != 0)
1678716822 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
1678816823#endif
0 commit comments