Commit 48a3219050 for openssl.org

commit 48a32190509a5e38671091062fad8ed85d01bce6
Author: Simo Sorce <simo@redhat.com>
Date:   Mon Jun 15 09:51:16 2026 -0400

    Prefix internal AES-GCM functions with ossl_

    The `aes_gcm_hw_initkey` and `generic_aes_gcm_cipher_update` functions are
    shared across multiple hardware-specific provider implementations but lacked
    the internal `ossl_` prefix. They have been renamed to
    `ossl_aes_gcm_hw_initkey` and `ossl_generic_aes_gcm_cipher_update`
    respectively to follow OpenSSL naming conventions and prevent potential
    namespace collisions.

    Signed-off-by: Simo Sorce <simo@redhat.com>

    Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
    Reviewed-by: Norbert Pocs <norbertp@openssl.org>
    Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
    MergeDate: Sat Jun 27 09:06:03 2026
    (Merged from https://github.com/openssl/openssl/pull/31472)

diff --git a/providers/implementations/ciphers/cipher_aes_gcm.h b/providers/implementations/ciphers/cipher_aes_gcm.h
index 210c1de97a..b041248b3c 100644
--- a/providers/implementations/ciphers/cipher_aes_gcm.h
+++ b/providers/implementations/ciphers/cipher_aes_gcm.h
@@ -45,12 +45,12 @@ typedef struct prov_aes_gcm_ctx_st {
     } plat;
 } PROV_AES_GCM_CTX;

-int aes_gcm_hw_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
+int ossl_aes_gcm_hw_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
     size_t keylen, aes_set_encrypt_key_fn fn_set_key,
     aes_block128_f fn_block, ctr128_f fn_ctr);

-int generic_aes_gcm_cipher_update(PROV_GCM_CTX *ctx, const unsigned char *in,
-    size_t len, unsigned char *out);
+int ossl_generic_aes_gcm_cipher_update(PROV_GCM_CTX *ctx,
+    const unsigned char *in, size_t len, unsigned char *out);

 const PROV_GCM_HW *ossl_prov_aes_hw_gcm(size_t keybits);
 #if defined(AESNI_CAPABLE)
diff --git a/providers/implementations/ciphers/cipher_aes_gcm_hw.c b/providers/implementations/ciphers/cipher_aes_gcm_hw.c
index 2bd1cb9d34..bbb7e21c31 100644
--- a/providers/implementations/ciphers/cipher_aes_gcm_hw.c
+++ b/providers/implementations/ciphers/cipher_aes_gcm_hw.c
@@ -17,7 +17,7 @@
 #include <openssl/proverr.h>
 #include "cipher_aes_gcm.h"

-int aes_gcm_hw_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
+int ossl_aes_gcm_hw_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
     size_t keylen, aes_set_encrypt_key_fn fn_set_key,
     aes_block128_f fn_block, ctr128_f fn_ctr)
 {
@@ -43,10 +43,10 @@ static int aes_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
 #ifdef HWAES_CAPABLE
     if (HWAES_CAPABLE) {
 #ifdef HWAES_ctr32_encrypt_blocks
-        return aes_gcm_hw_initkey(ctx, key, keylen, HWAES_set_encrypt_key,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen, HWAES_set_encrypt_key,
             HWAES_encrypt, HWAES_ctr32_encrypt_blocks);
 #else
-        return aes_gcm_hw_initkey(ctx, key, keylen, HWAES_set_encrypt_key,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen, HWAES_set_encrypt_key,
             HWAES_encrypt, NULL);
 #endif /* HWAES_ctr32_encrypt_blocks */
     } else
@@ -54,31 +54,31 @@ static int aes_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,

 #ifdef BSAES_CAPABLE
         if (BSAES_CAPABLE) {
-        return aes_gcm_hw_initkey(ctx, key, keylen, AES_set_encrypt_key,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen, AES_set_encrypt_key,
             AES_encrypt, (ctr128_f)ossl_bsaes_ctr32_encrypt_blocks);
     } else
 #endif /* BSAES_CAPABLE */

 #ifdef VPAES_CAPABLE
         if (VPAES_CAPABLE) {
-        return aes_gcm_hw_initkey(ctx, key, keylen, vpaes_set_encrypt_key,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen, vpaes_set_encrypt_key,
             vpaes_encrypt, NULL);
     } else
 #endif /* VPAES_CAPABLE */

     {
 #ifdef AES_CTR_ASM
-        return aes_gcm_hw_initkey(ctx, key, keylen, AES_set_encrypt_key,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen, AES_set_encrypt_key,
             AES_encrypt, (ctr128_f)AES_ctr32_encrypt);
 #else
-        return aes_gcm_hw_initkey(ctx, key, keylen, AES_set_encrypt_key,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen, AES_set_encrypt_key,
             AES_encrypt, NULL);
 #endif /* AES_CTR_ASM */
     }
 }

-int generic_aes_gcm_cipher_update(PROV_GCM_CTX *ctx, const unsigned char *in,
-    size_t len, unsigned char *out)
+int ossl_generic_aes_gcm_cipher_update(PROV_GCM_CTX *ctx,
+    const unsigned char *in, size_t len, unsigned char *out)
 {
     if (ctx->enc) {
         if (ctx->ctr != NULL) {
@@ -146,7 +146,7 @@ static const PROV_GCM_HW aes_gcm = {
     aes_gcm_initkey,
     ossl_gcm_setiv,
     ossl_gcm_aad_update,
-    generic_aes_gcm_cipher_update,
+    ossl_generic_aes_gcm_cipher_update,
     ossl_gcm_cipher_final,
     ossl_gcm_one_shot
 };
diff --git a/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.c b/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.c
index c605cb0072..c5d8d27c94 100644
--- a/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.c
+++ b/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.c
@@ -19,7 +19,7 @@
 static int aes_ppc_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
     size_t keylen)
 {
-    return aes_gcm_hw_initkey(ctx, key, keylen, aes_p8_set_encrypt_key,
+    return ossl_aes_gcm_hw_initkey(ctx, key, keylen, aes_p8_set_encrypt_key,
         aes_p8_encrypt, aes_p8_ctr32_encrypt_blocks);
 }

diff --git a/providers/implementations/ciphers/cipher_aes_hw_aesni.c b/providers/implementations/ciphers/cipher_aes_hw_aesni.c
index 15e2d71b3e..f8ae45129b 100644
--- a/providers/implementations/ciphers/cipher_aes_hw_aesni.c
+++ b/providers/implementations/ciphers/cipher_aes_hw_aesni.c
@@ -173,7 +173,7 @@ const PROV_CIPHER_HW *ossl_prov_cipher_hw_aesni(enum aes_modes mode)
 static int aesni_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
     size_t keylen)
 {
-    return aes_gcm_hw_initkey(ctx, key, keylen, aesni_set_encrypt_key,
+    return ossl_aes_gcm_hw_initkey(ctx, key, keylen, aesni_set_encrypt_key,
         aesni_encrypt, aesni_ctr32_encrypt_blocks);
 }

@@ -181,7 +181,7 @@ static const PROV_GCM_HW aesni_gcm = {
     aesni_gcm_initkey,
     ossl_gcm_setiv,
     ossl_gcm_aad_update,
-    generic_aes_gcm_cipher_update,
+    ossl_generic_aes_gcm_cipher_update,
     ossl_gcm_cipher_final,
     ossl_gcm_one_shot
 };
diff --git a/providers/implementations/ciphers/cipher_aes_hw_armv8.c b/providers/implementations/ciphers/cipher_aes_hw_armv8.c
index da4f9fd0e3..673206b6d2 100644
--- a/providers/implementations/ciphers/cipher_aes_hw_armv8.c
+++ b/providers/implementations/ciphers/cipher_aes_hw_armv8.c
@@ -118,11 +118,11 @@ static int armv8_aes_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
     size_t keylen)
 {
     if (AES_UNROLL12_EOR3_CAPABLE) {
-        return aes_gcm_hw_initkey(ctx, key, keylen,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen,
             aes_v8_set_encrypt_key, aes_v8_encrypt,
             aes_v8_ctr32_encrypt_blocks_unroll12_eor3);
     } else {
-        return aes_gcm_hw_initkey(ctx, key, keylen,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen,
             aes_v8_set_encrypt_key, aes_v8_encrypt,
             aes_v8_ctr32_encrypt_blocks);
     }
@@ -132,7 +132,7 @@ static const PROV_GCM_HW armv8_aes_gcm = {
     armv8_aes_gcm_initkey,
     ossl_gcm_setiv,
     ossl_gcm_aad_update,
-    generic_aes_gcm_cipher_update,
+    ossl_generic_aes_gcm_cipher_update,
     ossl_gcm_cipher_final,
     ossl_gcm_one_shot
 };
diff --git a/providers/implementations/ciphers/cipher_aes_hw_rv32i.c b/providers/implementations/ciphers/cipher_aes_hw_rv32i.c
index 237f6fc20e..eeb26a8948 100644
--- a/providers/implementations/ciphers/cipher_aes_hw_rv32i.c
+++ b/providers/implementations/ciphers/cipher_aes_hw_rv32i.c
@@ -120,10 +120,10 @@ static int aes_gcm_rv32i_initkey(PROV_GCM_CTX *ctx,
     size_t keylen)
 {
     if (RISCV_HAS_ZBKB_AND_ZKND_AND_ZKNE()) {
-        return aes_gcm_hw_initkey(ctx, key, keylen,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen,
             rv32i_zbkb_zkne_set_encrypt_key, rv32i_zkne_encrypt, NULL);
     } else if (RISCV_HAS_ZKND_AND_ZKNE()) {
-        return aes_gcm_hw_initkey(ctx, key, keylen,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen,
             rv32i_zkne_set_encrypt_key, rv32i_zkne_encrypt, NULL);
     }
     return 0;
@@ -133,7 +133,7 @@ static const PROV_GCM_HW aes_gcm_rv32i = {
     aes_gcm_rv32i_initkey,
     ossl_gcm_setiv,
     ossl_gcm_aad_update,
-    generic_aes_gcm_cipher_update,
+    ossl_generic_aes_gcm_cipher_update,
     ossl_gcm_cipher_final,
     ossl_gcm_one_shot
 };
diff --git a/providers/implementations/ciphers/cipher_aes_hw_rv64i.c b/providers/implementations/ciphers/cipher_aes_hw_rv64i.c
index ba51447c42..fa1e3f2b2a 100644
--- a/providers/implementations/ciphers/cipher_aes_hw_rv64i.c
+++ b/providers/implementations/ciphers/cipher_aes_hw_rv64i.c
@@ -149,7 +149,7 @@ const PROV_CIPHER_HW *ossl_prov_cipher_hw_rv64i(enum aes_modes mode)
 static int rv64i_zknd_zkne_gcm_initkey(PROV_GCM_CTX *ctx,
     const unsigned char *key, size_t keylen)
 {
-    return aes_gcm_hw_initkey(ctx, key, keylen,
+    return ossl_aes_gcm_hw_initkey(ctx, key, keylen,
         rv64i_zkne_set_encrypt_key, rv64i_zkne_encrypt, NULL);
 }

@@ -157,7 +157,7 @@ static const PROV_GCM_HW rv64i_zknd_zkne_gcm = {
     rv64i_zknd_zkne_gcm_initkey,
     ossl_gcm_setiv,
     ossl_gcm_aad_update,
-    generic_aes_gcm_cipher_update,
+    ossl_generic_aes_gcm_cipher_update,
     ossl_gcm_cipher_final,
     ossl_gcm_one_shot
 };
@@ -173,10 +173,10 @@ static int rv64i_zvkned_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
      * For AES-192 case, we could fallback to `AES_set_encrypt_key`.
      */
     if (zvkned_key_schedule_supported(keylen)) {
-        return aes_gcm_hw_initkey(ctx, key, keylen,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen,
             rv64i_zvkned_set_encrypt_key, rv64i_zvkned_encrypt, NULL);
     } else {
-        return aes_gcm_hw_initkey(ctx, key, keylen,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen,
             AES_set_encrypt_key, rv64i_zvkned_encrypt, NULL);
     }
 }
@@ -185,7 +185,7 @@ static const PROV_GCM_HW rv64i_zvkned_gcm = {
     rv64i_zvkned_gcm_initkey,
     ossl_gcm_setiv,
     ossl_gcm_aad_update,
-    generic_aes_gcm_cipher_update,
+    ossl_generic_aes_gcm_cipher_update,
     ossl_gcm_cipher_final,
     ossl_gcm_one_shot
 };
@@ -202,11 +202,11 @@ static int rv64i_zvkb_zvkg_zvkned_gcm_initkey(PROV_GCM_CTX *ctx,
      * For AES-192 case, we could fallback to `AES_set_encrypt_key`.
      */
     if (zvkned_key_schedule_supported(keylen)) {
-        return aes_gcm_hw_initkey(ctx, key, keylen,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen,
             rv64i_zvkned_set_encrypt_key, rv64i_zvkned_encrypt,
             rv64i_zvkb_zvkned_ctr32_encrypt_blocks);
     } else {
-        return aes_gcm_hw_initkey(ctx, key, keylen,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen,
             AES_set_encrypt_key, rv64i_zvkned_encrypt,
             rv64i_zvkb_zvkned_ctr32_encrypt_blocks);
     }
@@ -216,7 +216,7 @@ static const PROV_GCM_HW rv64i_zvkb_zvkg_zvkned_gcm = {
     rv64i_zvkb_zvkg_zvkned_gcm_initkey,
     ossl_gcm_setiv,
     ossl_gcm_aad_update,
-    generic_aes_gcm_cipher_update,
+    ossl_generic_aes_gcm_cipher_update,
     ossl_gcm_cipher_final,
     ossl_gcm_one_shot
 };
diff --git a/providers/implementations/ciphers/cipher_aes_hw_t4.c b/providers/implementations/ciphers/cipher_aes_hw_t4.c
index c9549be90b..514a7a737f 100644
--- a/providers/implementations/ciphers/cipher_aes_hw_t4.c
+++ b/providers/implementations/ciphers/cipher_aes_hw_t4.c
@@ -154,15 +154,15 @@ static int t4_aes_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
 {
     switch (keylen) {
     case 16:
-        return aes_gcm_hw_initkey(ctx, key, keylen,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen,
             t4_set_encrypt_key, aes_t4_encrypt,
             (ctr128_f)aes128_t4_ctr32_encrypt);
     case 24:
-        return aes_gcm_hw_initkey(ctx, key, keylen,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen,
             t4_set_encrypt_key, aes_t4_encrypt,
             (ctr128_f)aes192_t4_ctr32_encrypt);
     case 32:
-        return aes_gcm_hw_initkey(ctx, key, keylen,
+        return ossl_aes_gcm_hw_initkey(ctx, key, keylen,
             t4_set_encrypt_key, aes_t4_encrypt,
             (ctr128_f)aes256_t4_ctr32_encrypt);
     default:
@@ -174,7 +174,7 @@ static const PROV_GCM_HW t4_aes_gcm = {
     t4_aes_gcm_initkey,
     ossl_gcm_setiv,
     ossl_gcm_aad_update,
-    generic_aes_gcm_cipher_update,
+    ossl_generic_aes_gcm_cipher_update,
     ossl_gcm_cipher_final,
     ossl_gcm_one_shot
 };