summaryrefslogtreecommitdiffstats
path: root/crypto/rand
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2022-04-28 08:15:53 +0200
committerRichard Levitte <levitte@openssl.org>2022-07-13 07:59:55 +0200
commit372f4b80e35954d19ffb255692bdd6e4807e5f7a (patch)
tree61dd8212aa1dfda056ae3ba46c0f3eaaa94a2983 /crypto/rand
parent8d222dd9ec5f1542035b55395c7d7a4b42d618b0 (diff)
Pre-declare all core dispatch table functions, and fix the internal ones
When assigning pointers to functions in an OSSL_DISPATCH table, we try to ensure that those functions are properly defined or declared with an extra declaration using the corresponding function typedefs that are defined by include/openssl/core_dispatch.h. For the core dispatch table, found in crypto/provider_core.c, it seems we forgot this habit, and thus didn't ensure well enough that the function pointers that are assigned in the table can actually be used for those dispatch table indexes. This change adds all the missing declarations, and compensates for differences with functions that do the necessary casting, making those explicit rather than implicit, thereby trying to assure that we know what we're doing. One function is not fixed in this change, because there's a controversy, a clash between the signature of BIO_ctrl() and OSSL_FUNC_BIO_ctrl_fn. They have different return types. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18198) (cherry picked from commit 9574842e90e29015daa2b071e965cec9aa885c17)
Diffstat (limited to 'crypto/rand')
-rw-r--r--crypto/rand/prov_seed.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/rand/prov_seed.c b/crypto/rand/prov_seed.c
index afa85ab76f..b394242f71 100644
--- a/crypto/rand/prov_seed.c
+++ b/crypto/rand/prov_seed.c
@@ -12,7 +12,7 @@
#include <openssl/core_dispatch.h>
#include <openssl/err.h>
-size_t ossl_rand_get_entropy(ossl_unused OSSL_CORE_HANDLE *handle,
+size_t ossl_rand_get_entropy(ossl_unused const OSSL_CORE_HANDLE *handle,
unsigned char **pout, int entropy,
size_t min_len, size_t max_len)
{
@@ -38,13 +38,13 @@ size_t ossl_rand_get_entropy(ossl_unused OSSL_CORE_HANDLE *handle,
return ret;
}
-void ossl_rand_cleanup_entropy(ossl_unused OSSL_CORE_HANDLE *handle,
+void ossl_rand_cleanup_entropy(ossl_unused const OSSL_CORE_HANDLE *handle,
unsigned char *buf, size_t len)
{
OPENSSL_secure_clear_free(buf, len);
}
-size_t ossl_rand_get_nonce(ossl_unused OSSL_CORE_HANDLE *handle,
+size_t ossl_rand_get_nonce(ossl_unused const OSSL_CORE_HANDLE *handle,
unsigned char **pout, size_t min_len, size_t max_len,
const void *salt, size_t salt_len)
{
@@ -69,7 +69,7 @@ size_t ossl_rand_get_nonce(ossl_unused OSSL_CORE_HANDLE *handle,
return ret;
}
-void ossl_rand_cleanup_nonce(ossl_unused OSSL_CORE_HANDLE *handle,
+void ossl_rand_cleanup_nonce(ossl_unused const OSSL_CORE_HANDLE *handle,
unsigned char *buf, size_t len)
{
OPENSSL_clear_free(buf, len);