From: Simo Sorce Date: Mon, 15 Jun 2026 13:59:47 +0000 (-0400) Subject: Expand AES mode macro into explicit functions X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e60d940b29504b7b1f15d1fe597ae9cdde701c8a;p=thirdparty%2Fopenssl.git Expand AES mode macro into explicit functions This removes the PROV_CIPHER_HW_aes_mode macro and replaces it with explicitly written function definitions for each AES mode (ECB, CBC, CFB128, CFB8, CFB1, OFB128, CTR). Expanding macro-generated functions improves overall code readability, allows code navigation tools to properly index the function signatures, and provides clearer stack traces during debugging. Signed-off-by: Simo Sorce Reviewed-by: Dmitry Belyavskiy Reviewed-by: Norbert Pocs Reviewed-by: Shane Lontis MergeDate: Sat Jun 27 09:06:05 2026 (Merged from https://github.com/openssl/openssl/pull/31472) --- diff --git a/providers/implementations/ciphers/cipher_aes_hw.c b/providers/implementations/ciphers/cipher_aes_hw.c index b282393d5b8..03ddb469471 100644 --- a/providers/implementations/ciphers/cipher_aes_hw.c +++ b/providers/implementations/ciphers/cipher_aes_hw.c @@ -252,16 +252,37 @@ static const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_mode(enum aes_modes mode, return aes_hw_mode; } -#define PROV_CIPHER_HW_aes_mode(ENUM_MODE, mode) \ - const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_##mode(size_t keybits) \ - { \ - return ossl_prov_cipher_hw_aes_mode(ENUM_MODE, keybits); \ - } +const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ecb(size_t keybits) +{ + return ossl_prov_cipher_hw_aes_mode(AES_MODE_ECB, keybits); +} + +const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cbc(size_t keybits) +{ + return ossl_prov_cipher_hw_aes_mode(AES_MODE_CBC, keybits); +} + +const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb128(size_t keybits) +{ + return ossl_prov_cipher_hw_aes_mode(AES_MODE_CFB128, keybits); +} + +const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb8(size_t keybits) +{ + return ossl_prov_cipher_hw_aes_mode(AES_MODE_CFB8, keybits); +} + +const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb1(size_t keybits) +{ + return ossl_prov_cipher_hw_aes_mode(AES_MODE_CFB1, keybits); +} -PROV_CIPHER_HW_aes_mode(AES_MODE_ECB, ecb) -PROV_CIPHER_HW_aes_mode(AES_MODE_CBC, cbc) -PROV_CIPHER_HW_aes_mode(AES_MODE_CFB128, cfb128) -PROV_CIPHER_HW_aes_mode(AES_MODE_CFB8, cfb8) -PROV_CIPHER_HW_aes_mode(AES_MODE_CFB1, cfb1) -PROV_CIPHER_HW_aes_mode(AES_MODE_OFB128, ofb128) -PROV_CIPHER_HW_aes_mode(AES_MODE_CTR, ctr) +const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ofb128(size_t keybits) +{ + return ossl_prov_cipher_hw_aes_mode(AES_MODE_OFB128, keybits); +} + +const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ctr(size_t keybits) +{ + return ossl_prov_cipher_hw_aes_mode(AES_MODE_CTR, keybits); +}