From 865a72eb8f6b8353c14d3714f7c57fa9f485a64e Mon Sep 17 00:00:00 2001 From: "harshal.patil" Date: Wed, 7 Dec 2022 14:22:52 +0530 Subject: [PATCH] mbedtls: added SOC_AES_SUPPORT_AES_192 check in esp_aes_gcm_setkey() --- components/mbedtls/port/aes/esp_aes_gcm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/mbedtls/port/aes/esp_aes_gcm.c b/components/mbedtls/port/aes/esp_aes_gcm.c index 81a5bfebd6..b5a9b1ce46 100644 --- a/components/mbedtls/port/aes/esp_aes_gcm.c +++ b/components/mbedtls/port/aes/esp_aes_gcm.c @@ -40,6 +40,7 @@ #include "esp_heap_caps.h" #include "soc/soc_memory_layout.h" +#include "mbedtls/error.h" #include #define ESP_PUT_BE64(a, val) \ @@ -257,6 +258,11 @@ int esp_aes_gcm_setkey( esp_gcm_context *ctx, const unsigned char *key, unsigned int keybits ) { +#if !SOC_AES_SUPPORT_AES_192 + if (keybits == 192) { + return MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED; + } +#endif if (keybits != 128 && keybits != 192 && keybits != 256) { return MBEDTLS_ERR_AES_INVALID_KEY_LENGTH; }