]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix const spec in providers
authorMilan Broz <gmazyland@gmail.com>
Tue, 20 Jan 2026 14:40:18 +0000 (15:40 +0100)
committerNeil Horman <nhorman@openssl.org>
Tue, 3 Feb 2026 14:11:52 +0000 (09:11 -0500)
This patch fixes several const specifiers
(visible with non-default const-qual warning).

Signed-off-by: Milan Broz <gmazyland@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Feb  3 14:12:00 2026
(Merged from https://github.com/openssl/openssl/pull/29798)

providers/fips/self_test_data.inc
providers/implementations/ciphers/cipher_aes_gcm_siv_hw.c
providers/implementations/ciphers/cipher_chacha20_hw.c
providers/implementations/ciphers/cipher_chacha20_poly1305_hw.c
providers/implementations/ciphers/cipher_rc4_hmac_md5.c
providers/implementations/ciphers/cipher_rc4_hmac_md5_hw.c
providers/implementations/encode_decode/encode_key2text.c
providers/implementations/signature/mac_legacy_sig.c

index bc7e77bf1f9cfca814b5b1962300f7dc1886c86d..c8c907a613e26974daeee0b9322a95d69ba59f42 100644 (file)
@@ -17,8 +17,8 @@
  */
 
 /* Macros to build Self test data */
-#define ITM(x) ((void *)&x), sizeof(x)
-#define ITM_STR(x) ((void *)&x), (sizeof(x) - 1)
+#define ITM(x) ((const void *)&x), sizeof(x)
+#define ITM_STR(x) ((const void *)&x), (sizeof(x) - 1)
 
 #define ST_KAT_PARAM_END() { "", 0, NULL, 0 }
 #define ST_KAT_PARAM_BIGNUM(name, data)                                        \
index d0b6ae4b070d1faa16a6601acd1f8b7ce91f0ecf..4fd4d429190420f8206ff280d60671bd16555a9c 100644 (file)
@@ -180,7 +180,7 @@ static int aes_gcm_siv_encrypt(PROV_AES_GCM_SIV_CTX *ctx, const unsigned char *i
         ossl_polyval_ghash_hash(ctx->Htable, S_s, ctx->aad, UP16(ctx->aad_len));
     }
     if (DOWN16(len) > 0)
-        ossl_polyval_ghash_hash(ctx->Htable, S_s, (uint8_t *)in, DOWN16(len));
+        ossl_polyval_ghash_hash(ctx->Htable, S_s, in, DOWN16(len));
     if (!IS16(len)) {
         /* deal with padding - probably easier to memset the padding first rather than calculate */
         memset(padding, 0, sizeof(padding));
index 4d55f9bf826b78643656ec0c760cbd8c9814bdc6..8748aac829f408873b8799cf471d662521bd0ff6 100644 (file)
@@ -119,5 +119,5 @@ static const PROV_CIPHER_HW_CHACHA20 chacha20_hw = {
 
 const PROV_CIPHER_HW *ossl_prov_cipher_hw_chacha20(size_t keybits)
 {
-    return (PROV_CIPHER_HW *)&chacha20_hw;
+    return (const PROV_CIPHER_HW *)&chacha20_hw;
 }
index 733547a7e73237442831345d3586a2cb77214a39..aa3e08fc84a16fc1b414dfda863c07bb56000441 100644 (file)
@@ -406,5 +406,5 @@ static const PROV_CIPHER_HW_CHACHA20_POLY1305 chacha20poly1305_hw = {
 
 const PROV_CIPHER_HW *ossl_prov_cipher_hw_chacha20_poly1305(size_t keybits)
 {
-    return (PROV_CIPHER_HW *)&chacha20poly1305_hw;
+    return (const PROV_CIPHER_HW *)&chacha20poly1305_hw;
 }
index 4b7dbb74588e43c56a957ed72197571b77553077..d8a003ca4266e6ae6189f7c705adf3f120fc64b0 100644 (file)
@@ -29,7 +29,7 @@
 #define RC4_HMAC_MD5_IV_BITS 0
 #define RC4_HMAC_MD5_MODE 0
 
-#define GET_HW(ctx) ((PROV_CIPHER_HW_RC4_HMAC_MD5 *)ctx->base.hw)
+#define GET_HW(ctx) ((const PROV_CIPHER_HW_RC4_HMAC_MD5 *)ctx->base.hw)
 
 static OSSL_FUNC_cipher_encrypt_init_fn rc4_hmac_md5_einit;
 static OSSL_FUNC_cipher_decrypt_init_fn rc4_hmac_md5_dinit;
index c3fae599dd54c751a0621d7e19cd591fb3aaa81f..6d46606737566e4f36a426abc43a1af66d333c9f 100644 (file)
@@ -227,5 +227,5 @@ static const PROV_CIPHER_HW_RC4_HMAC_MD5 rc4_hmac_md5_hw = {
 
 const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc4_hmac_md5(size_t keybits)
 {
-    return (PROV_CIPHER_HW *)&rc4_hmac_md5_hw;
+    return (const PROV_CIPHER_HW *)&rc4_hmac_md5_hw;
 }
index e87532a75da302f9edad15baa30d4acadf6e5faa..20b26e7024f4e36ceebb3fda0ed64939148eb6a1 100644 (file)
@@ -443,7 +443,7 @@ static int ecx_to_text(BIO *out, const void *key, int selection)
 #ifndef OPENSSL_NO_ML_KEM
 static int ml_kem_to_text(BIO *out, const void *vkey, int selection)
 {
-    return ossl_ml_kem_key_to_text(out, (ML_KEM_KEY *)vkey, selection);
+    return ossl_ml_kem_key_to_text(out, (const ML_KEM_KEY *)vkey, selection);
 }
 #endif
 
@@ -452,7 +452,7 @@ static int ml_kem_to_text(BIO *out, const void *vkey, int selection)
 #ifndef OPENSSL_NO_SLH_DSA
 static int slh_dsa_to_text(BIO *out, const void *key, int selection)
 {
-    return ossl_slh_dsa_key_to_text(out, (SLH_DSA_KEY *)key, selection);
+    return ossl_slh_dsa_key_to_text(out, (const SLH_DSA_KEY *)key, selection);
 }
 #endif /* OPENSSL_NO_SLH_DSA */
 
@@ -618,7 +618,7 @@ err:
 #ifndef OPENSSL_NO_ML_DSA
 static int ml_dsa_to_text(BIO *out, const void *key, int selection)
 {
-    return ossl_ml_dsa_key_to_text(out, (ML_DSA_KEY *)key, selection);
+    return ossl_ml_dsa_key_to_text(out, (const ML_DSA_KEY *)key, selection);
 }
 #endif /* OPENSSL_NO_ML_DSA */
 /* ---------------------------------------------------------------------- */
index cef684b80c86d94346157884ed62d7b45bbaeafc..0ab44f7f114da1184ce6280936ab41e300a19bf5 100644 (file)
@@ -110,11 +110,11 @@ static int mac_digest_sign_init(void *vpmacctx, const char *mdname, void *vkey,
     }
 
     if (pmacctx->key->cipher.cipher != NULL)
-        ciphername = (char *)EVP_CIPHER_get0_name(pmacctx->key->cipher.cipher);
+        ciphername = EVP_CIPHER_get0_name(pmacctx->key->cipher.cipher);
 
     if (!ossl_prov_set_macctx(pmacctx->macctx,
-            (char *)ciphername,
-            (char *)mdname,
+            ciphername,
+            mdname,
             pmacctx->key->properties, params))
         return 0;