diff options
author | Frederik Wedel-Heinen <frederik.wedel-heinen@dencrypt.dk> | 2025-01-04 19:27:37 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2025-01-07 21:24:13 +0100 |
commit | 3ffa64cd4566cb2d14f6b871e02460f54e1d4da1 (patch) | |
tree | dc4b7a6bdaaaeb6f30486e7d964a5c5185033bac /crypto/evp/signature.c | |
parent | Fix a funding.json error (diff) | |
download | openssl-3ffa64cd4566cb2d14f6b871e02460f54e1d4da1.tar.xz openssl-3ffa64cd4566cb2d14f6b871e02460f54e1d4da1.zip |
Pass functions with correct signatures to the evp_generic_fetch_xxx methods
UBSan complains about functions being called with incorrect signatures.
Relates to #22896
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26318)
Diffstat (limited to '')
-rw-r--r-- | crypto/evp/signature.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/crypto/evp/signature.c b/crypto/evp/signature.c index 7d619edfae..08082108ea 100644 --- a/crypto/evp/signature.c +++ b/crypto/evp/signature.c @@ -20,6 +20,16 @@ #include "crypto/evp.h" #include "evp_local.h" +static void evp_signature_free(void *data) +{ + EVP_SIGNATURE_free(data); +} + +static int evp_signature_up_ref(void *data) +{ + return EVP_SIGNATURE_up_ref(data); +} + static EVP_SIGNATURE *evp_signature_new(OSSL_PROVIDER *prov) { EVP_SIGNATURE *signature = OPENSSL_zalloc(sizeof(EVP_SIGNATURE)); @@ -404,8 +414,8 @@ EVP_SIGNATURE *EVP_SIGNATURE_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, { return evp_generic_fetch(ctx, OSSL_OP_SIGNATURE, algorithm, properties, evp_signature_from_algorithm, - (int (*)(void *))EVP_SIGNATURE_up_ref, - (void (*)(void *))EVP_SIGNATURE_free); + evp_signature_up_ref, + evp_signature_free); } EVP_SIGNATURE *evp_signature_fetch_from_prov(OSSL_PROVIDER *prov, @@ -415,8 +425,8 @@ EVP_SIGNATURE *evp_signature_fetch_from_prov(OSSL_PROVIDER *prov, return evp_generic_fetch_from_prov(prov, OSSL_OP_SIGNATURE, algorithm, properties, evp_signature_from_algorithm, - (int (*)(void *))EVP_SIGNATURE_up_ref, - (void (*)(void *))EVP_SIGNATURE_free); + evp_signature_up_ref, + evp_signature_free); } int EVP_SIGNATURE_is_a(const EVP_SIGNATURE *signature, const char *name) @@ -448,8 +458,8 @@ void EVP_SIGNATURE_do_all_provided(OSSL_LIB_CTX *libctx, evp_generic_do_all(libctx, OSSL_OP_SIGNATURE, (void (*)(void *, void *))fn, arg, evp_signature_from_algorithm, - (int (*)(void *))EVP_SIGNATURE_up_ref, - (void (*)(void *))EVP_SIGNATURE_free); + evp_signature_up_ref, + evp_signature_free); } |