mbedtls: added SOC_AES_SUPPORT_AES_192 check in esp_aes_gcm_setkey()

This commit is contained in:
harshal.patil 2022-12-07 14:22:52 +05:30
parent e0f31edab5
commit 06bb0ee077

View File

@ -28,6 +28,7 @@
#include "esp_heap_caps.h" #include "esp_heap_caps.h"
#include "soc/soc_memory_layout.h" #include "soc/soc_memory_layout.h"
#include "mbedtls/error.h"
#include <string.h> #include <string.h>
#define ESP_PUT_BE64(a, val) \ #define ESP_PUT_BE64(a, val) \
@ -245,6 +246,11 @@ int esp_aes_gcm_setkey( esp_gcm_context *ctx,
const unsigned char *key, const unsigned char *key,
unsigned int keybits ) 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) { if (keybits != 128 && keybits != 192 && keybits != 256) {
return MBEDTLS_ERR_AES_INVALID_KEY_LENGTH; return MBEDTLS_ERR_AES_INVALID_KEY_LENGTH;
} }