From c4dafbe27fa2f98f73a6214e439dbb39527f4e8f Mon Sep 17 00:00:00 2001 From: Ashish Sharma Date: Tue, 23 Dec 2025 10:44:06 +0800 Subject: [PATCH] feat: migrates hal to PSA APIs --- components/hal/test_apps/crypto/main/aes/test_aes.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/hal/test_apps/crypto/main/aes/test_aes.c b/components/hal/test_apps/crypto/main/aes/test_aes.c index e8c1673254..9069d0f5d0 100644 --- a/components/hal/test_apps/crypto/main/aes/test_aes.c +++ b/components/hal/test_apps/crypto/main/aes/test_aes.c @@ -57,11 +57,13 @@ static void test_cbc_aes(size_t buffer_size, const uint8_t expected_cipher_end[3 TEST_ASSERT_EQUAL(0, esp_aes_crypt_cbc(&ctx, ESP_AES_ENCRYPT, buffer_size, nonce, plaintext, ciphertext)); TEST_ASSERT_EQUAL_HEX8_ARRAY(expected_cipher_end, ciphertext + buffer_size - 32, 32); + // Decrypt memcpy(nonce, iv, 16); TEST_ASSERT_EQUAL(0, esp_aes_crypt_cbc(&ctx, ESP_AES_DECRYPT, buffer_size, nonce, ciphertext, decryptedtext)); TEST_ASSERT_EQUAL_HEX8_ARRAY(plaintext, decryptedtext, buffer_size); + esp_aes_free(&ctx); // Free dynamically allocated memory @@ -222,7 +224,7 @@ static void test_cfb128_aes(size_t buffer_size, const uint8_t expected_cipher_en heap_caps_free(decryptedtext); } -#if SOC_GCM_SUPPORTED +#if CONFIG_SOC_AES_SUPPORT_GCM #define CIPHER_ID_AES 2 static void test_gcm_aes(size_t length, const uint8_t expected_last_block[16], const uint8_t expected_tag[16]) { @@ -339,7 +341,7 @@ TEST(aes, cfb128_aes_256_long_dma_test) #endif -#if SOC_GCM_SUPPORTED +#if CONFIG_SOC_AES_SUPPORT_GCM TEST(aes, gcm_aes_dma_test) { size_t length = 16; @@ -390,12 +392,12 @@ TEST_GROUP_RUNNER(aes) RUN_TEST_CASE(aes, cfb8_aes_256_long_dma_test); RUN_TEST_CASE(aes, cfb128_aes_256_long_dma_test); #endif /* CONFIG_CRYPTO_TESTAPP_USE_AES_INTERRUPT */ -#if SOC_GCM_SUPPORTED +#if CONFIG_SOC_AES_SUPPORT_GCM RUN_TEST_CASE(aes, gcm_aes_dma_test); #if CONFIG_CRYPTO_TESTAPP_USE_AES_INTERRUPT RUN_TEST_CASE(aes, gcm_aes_long_dma_test); #endif /* CONFIG_CRYPTO_TESTAPP_USE_AES_INTERRUPT */ -#endif /* SOC_GCM_SUPPORTED */ +#endif /* CONFIG_SOC_AES_SUPPORT_GCM */ #endif /* SOC_AES_SUPPORT_DMA */ }