]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
remove const qualifier in isc__crypto_*
authorAydın Mercan <aydin@isc.org>
Tue, 12 Aug 2025 09:51:38 +0000 (12:51 +0300)
committerAydın Mercan <aydin@isc.org>
Mon, 25 Aug 2025 11:22:53 +0000 (14:22 +0300)
The `EVP_MD *` pointers assigned with `EVP_MD_fetch` aren't const
qualified, adding a correctness issue.

lib/isc/crypto.c
lib/isc/include/isc/crypto.h

index 9e4347794f7478ab3cfa8e6e4e3886e264ac0718..ad5156c3647d3f5b0c5c8845fff75ae2a8075bd8 100644 (file)
@@ -33,12 +33,12 @@ static isc_mem_t *isc__crypto_mctx = NULL;
 static OSSL_PROVIDER *base = NULL, *fips = NULL;
 #endif /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
 
-const EVP_MD *isc__crypto_md5 = NULL;
-const EVP_MD *isc__crypto_sha1 = NULL;
-const EVP_MD *isc__crypto_sha224 = NULL;
-const EVP_MD *isc__crypto_sha256 = NULL;
-const EVP_MD *isc__crypto_sha384 = NULL;
-const EVP_MD *isc__crypto_sha512 = NULL;
+EVP_MD *isc__crypto_md5 = NULL;
+EVP_MD *isc__crypto_sha1 = NULL;
+EVP_MD *isc__crypto_sha224 = NULL;
+EVP_MD *isc__crypto_sha256 = NULL;
+EVP_MD *isc__crypto_sha384 = NULL;
+EVP_MD *isc__crypto_sha512 = NULL;
 
 #if OPENSSL_VERSION_NUMBER >= 0x30000000L
 #define md_register_algorithm(alg, algname)                            \
@@ -50,12 +50,12 @@ const EVP_MD *isc__crypto_sha512 = NULL;
                }                                                      \
        }
 
-#define md_unregister_algorithm(alg)                             \
-       {                                                        \
-               if (isc__crypto_##alg != NULL) {                 \
-                       EVP_MD_free(UNCONST(isc__crypto_##alg)); \
-                       isc__crypto_##alg = NULL;                \
-               }                                                \
+#define md_unregister_algorithm(alg)                    \
+       {                                               \
+               if (isc__crypto_##alg != NULL) {        \
+                       EVP_MD_free(isc__crypto_##alg); \
+                       isc__crypto_##alg = NULL;       \
+               }                                       \
        }
 #else /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
 #define md_register_algorithm(alg, algname)      \
index 14bdd4693318cdbaeaf0decfbc574ce3fa624e41..a7dc9f45a4d12d2cc02f56a6a88107b4bbd35902 100644 (file)
 
 #include <isc/types.h>
 
-extern const EVP_MD *isc__crypto_md5;
-extern const EVP_MD *isc__crypto_sha1;
-extern const EVP_MD *isc__crypto_sha224;
-extern const EVP_MD *isc__crypto_sha256;
-extern const EVP_MD *isc__crypto_sha384;
-extern const EVP_MD *isc__crypto_sha512;
+extern EVP_MD *isc__crypto_md5;
+extern EVP_MD *isc__crypto_sha1;
+extern EVP_MD *isc__crypto_sha224;
+extern EVP_MD *isc__crypto_sha256;
+extern EVP_MD *isc__crypto_sha384;
+extern EVP_MD *isc__crypto_sha512;
 
 bool
 isc_crypto_fips_mode(void);