@@ -582,6 +582,26 @@ 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) && defined(HAVE_AES_ECB)
587+ #if defined(WOLF_PRIVATE_KEY_ID) && defined(WC_TEST_AES_ECB_ID)
588+ static unsigned char testAesEcbId[] = WC_TEST_AES_ECB_ID;
589+ static int testAesEcbIdLen = (int)sizeof(testAesEcbId);
590+ #endif
591+
592+ static WC_MAYBE_UNUSED int test_AesEcbInit(Aes* aes, void* heap,
593+ int declaredDevId)
594+ {
595+ #if defined(WOLF_PRIVATE_KEY_ID) && defined(WC_TEST_AES_ECB_ID)
596+ return wc_AesInit_Id(aes, testAesEcbId, testAesEcbIdLen, heap,
597+ declaredDevId);
598+ #else
599+ return wc_AesInit(aes, heap, declaredDevId);
600+ #endif
601+ }
602+
603+ #endif /* !NO_AES && HAVE_AES_ECB */
604+
585605/* --- AES GCM id[] and init helper --- */
586606#if !defined(NO_AES) && defined(HAVE_AESGCM)
587607#if defined(WOLF_PRIVATE_KEY_ID) && defined(WC_TEST_AES_GCM_ID)
@@ -1362,6 +1382,19 @@ static WC_MAYBE_UNUSED Aes* test_AesCbcNew(void* heap, int declaredDevId,
13621382}
13631383#endif /* !NO_AES && HAVE_AES_CBC */
13641384
1385+ #if !defined(NO_AES) && defined(HAVE_AES_ECB)
1386+ static WC_MAYBE_UNUSED Aes* test_AesEcbNew(void* heap, int declaredDevId,
1387+ int* ret)
1388+ {
1389+ #if defined(WOLF_PRIVATE_KEY_ID) && defined(WC_TEST_AES_ECB_ID)
1390+ return wc_AesNew_Id(testAesEcbId, testAesEcbIdLen, heap, declaredDevId,
1391+ ret);
1392+ #else
1393+ return wc_AesNew(heap, declaredDevId, ret);
1394+ #endif
1395+ }
1396+ #endif /* !NO_AES && HAVE_AES_ECB */
1397+
13651398#if !defined(NO_AES) && defined(HAVE_AESGCM)
13661399static WC_MAYBE_UNUSED Aes* test_AesGcmNew(void* heap, int declaredDevId,
13671400 int* ret)
@@ -16767,20 +16800,20 @@ static wc_test_ret_t aes_ecb_direct_test(void)
1676716800#endif
1676816801
1676916802#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
16770- enc = wc_AesNew (HEAP_HINT, devId, &ret);
16803+ enc = test_AesEcbNew (HEAP_HINT, devId, &ret);
1677116804 if (enc == NULL)
1677216805 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
1677316806#ifdef HAVE_AES_DECRYPT
16774- dec = wc_AesNew (HEAP_HINT, devId, &ret);
16807+ dec = test_AesEcbNew (HEAP_HINT, devId, &ret);
1677516808 if (dec == NULL)
1677616809 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
1677716810#endif
1677816811#else
16779- ret = wc_AesInit (enc, HEAP_HINT, devId);
16812+ ret = test_AesEcbInit (enc, HEAP_HINT, devId);
1678016813 if (ret != 0)
1678116814 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
1678216815#ifdef HAVE_AES_DECRYPT
16783- ret = wc_AesInit (dec, HEAP_HINT, devId);
16816+ ret = test_AesEcbInit (dec, HEAP_HINT, devId);
1678416817 if (ret != 0)
1678516818 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
1678616819#endif
0 commit comments