From afedef5eea9c7ef22c1e35039854f216b631d02e Mon Sep 17 00:00:00 2001 From: Xavier Chapron Date: Fri, 18 Apr 2025 09:24:05 +0200 Subject: [PATCH] Constify cipher_wrap:mbedtls_cipher_base_lookup_table This structure is initialized during the compilation and there is no reason it changes. Making it const allows the compiler to put it in .rodata section instead of .data one. Signed-off-by: Xavier Chapron --- library/cipher_wrap.c | 2 +- library/cipher_wrap.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/cipher_wrap.c b/library/cipher_wrap.c index d2fee22e2b..b4c21ee395 100644 --- a/library/cipher_wrap.c +++ b/library/cipher_wrap.c @@ -2425,7 +2425,7 @@ const mbedtls_cipher_definition_t mbedtls_cipher_definitions[] = sizeof(mbedtls_cipher_definitions[0])) int mbedtls_cipher_supported[NUM_CIPHERS]; -const mbedtls_cipher_base_t *mbedtls_cipher_base_lookup_table[] = { +const mbedtls_cipher_base_t * const mbedtls_cipher_base_lookup_table[] = { #if defined(MBEDTLS_AES_C) [MBEDTLS_CIPHER_BASE_INDEX_AES] = &aes_info, #endif diff --git a/library/cipher_wrap.h b/library/cipher_wrap.h index f22915120d..9564c5efe1 100644 --- a/library/cipher_wrap.h +++ b/library/cipher_wrap.h @@ -169,7 +169,7 @@ extern const mbedtls_cipher_definition_t mbedtls_cipher_definitions[]; extern int mbedtls_cipher_supported[]; -extern const mbedtls_cipher_base_t *mbedtls_cipher_base_lookup_table[]; +extern const mbedtls_cipher_base_t * const mbedtls_cipher_base_lookup_table[]; #ifdef __cplusplus }