@@ -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)
@@ -1362,6 +1383,20 @@ static WC_MAYBE_UNUSED Aes* test_AesCbcNew(void* heap, int declaredDevId,
13621383}
13631384#endif /* !NO_AES && HAVE_AES_CBC */
13641385
1386+ #if !defined(NO_AES) && \
1387+ (defined(HAVE_AES_ECB) || defined(WOLFSSL_AES_DIRECT))
1388+ static WC_MAYBE_UNUSED Aes* test_AesEcbNew(void* heap, int declaredDevId,
1389+ int* ret)
1390+ {
1391+ #if defined(WOLF_PRIVATE_KEY_ID) && defined(WC_TEST_AES_ECB_ID)
1392+ return wc_AesNew_Id(testAesEcbId, testAesEcbIdLen, heap, declaredDevId,
1393+ ret);
1394+ #else
1395+ return wc_AesNew(heap, declaredDevId, ret);
1396+ #endif
1397+ }
1398+ #endif /* !NO_AES && (HAVE_AES_ECB || WOLFSSL_AES_DIRECT) */
1399+
13651400#if !defined(NO_AES) && defined(HAVE_AESGCM)
13661401static WC_MAYBE_UNUSED Aes* test_AesGcmNew(void* heap, int declaredDevId,
13671402 int* ret)
@@ -16767,20 +16802,20 @@ static wc_test_ret_t aes_ecb_direct_test(void)
1676716802#endif
1676816803
1676916804#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
16770- enc = wc_AesNew (HEAP_HINT, devId, &ret);
16805+ enc = test_AesEcbNew (HEAP_HINT, devId, &ret);
1677116806 if (enc == NULL)
1677216807 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
1677316808#ifdef HAVE_AES_DECRYPT
16774- dec = wc_AesNew (HEAP_HINT, devId, &ret);
16809+ dec = test_AesEcbNew (HEAP_HINT, devId, &ret);
1677516810 if (dec == NULL)
1677616811 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
1677716812#endif
1677816813#else
16779- ret = wc_AesInit (enc, HEAP_HINT, devId);
16814+ ret = test_AesEcbInit (enc, HEAP_HINT, devId);
1678016815 if (ret != 0)
1678116816 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
1678216817#ifdef HAVE_AES_DECRYPT
16783- ret = wc_AesInit (dec, HEAP_HINT, devId);
16818+ ret = test_AesEcbInit (dec, HEAP_HINT, devId);
1678416819 if (ret != 0)
1678516820 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
1678616821#endif
0 commit comments