diff options
author | Pauli <ppzgs1@gmail.com> | 2021-03-10 18:37:07 +1000 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-03-12 08:27:30 +1000 |
commit | 5a6b62bb427e828edecf52c2280f9958d97142b6 (patch) | |
tree | 121039d5162dc7217cba2be80b79589b70d10ea5 /providers/implementations/macs | |
parent | c983a0e5214db7f0a668f5e9ddda9362ca0d6ac9 (diff) | |
download | openssl-5a6b62bb427e828edecf52c2280f9958d97142b6.zip openssl-5a6b62bb427e828edecf52c2280f9958d97142b6.tar.gz openssl-5a6b62bb427e828edecf52c2280f9958d97142b6.tar.bz2 |
update set_ctx_param MAC calls to return 1 for a NULL params
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14383)
Diffstat (limited to 'providers/implementations/macs')
-rw-r--r-- | providers/implementations/macs/blake2_mac_impl.c | 3 | ||||
-rw-r--r-- | providers/implementations/macs/cmac_prov.c | 3 | ||||
-rw-r--r-- | providers/implementations/macs/hmac_prov.c | 3 | ||||
-rw-r--r-- | providers/implementations/macs/kmac_prov.c | 3 | ||||
-rw-r--r-- | providers/implementations/macs/siphash_prov.c | 3 |
5 files changed, 15 insertions, 0 deletions
diff --git a/providers/implementations/macs/blake2_mac_impl.c b/providers/implementations/macs/blake2_mac_impl.c index 35a1622..e1ffa04 100644 --- a/providers/implementations/macs/blake2_mac_impl.c +++ b/providers/implementations/macs/blake2_mac_impl.c @@ -185,6 +185,9 @@ static int blake2_mac_set_ctx_params(void *vmacctx, const OSSL_PARAM params[]) struct blake2_mac_data_st *macctx = vmacctx; const OSSL_PARAM *p; + if (params == NULL) + return 1; + if ((p = OSSL_PARAM_locate_const(params, OSSL_MAC_PARAM_SIZE)) != NULL) { size_t size; diff --git a/providers/implementations/macs/cmac_prov.c b/providers/implementations/macs/cmac_prov.c index 9807799..0795c24 100644 --- a/providers/implementations/macs/cmac_prov.c +++ b/providers/implementations/macs/cmac_prov.c @@ -184,6 +184,9 @@ static int cmac_set_ctx_params(void *vmacctx, const OSSL_PARAM params[]) OSSL_LIB_CTX *ctx = PROV_LIBCTX_OF(macctx->provctx); const OSSL_PARAM *p; + if (params == NULL) + return 1; + if (!ossl_prov_cipher_load_from_params(&macctx->cipher, params, ctx)) return 0; diff --git a/providers/implementations/macs/hmac_prov.c b/providers/implementations/macs/hmac_prov.c index 7188232..f291e57 100644 --- a/providers/implementations/macs/hmac_prov.c +++ b/providers/implementations/macs/hmac_prov.c @@ -294,6 +294,9 @@ static int hmac_set_ctx_params(void *vmacctx, const OSSL_PARAM params[]) const OSSL_PARAM *p; int flags = 0; + if (params == NULL) + return 1; + if (!ossl_prov_digest_load_from_params(&macctx->digest, params, ctx)) return 0; diff --git a/providers/implementations/macs/kmac_prov.c b/providers/implementations/macs/kmac_prov.c index 361ff8e..8735705 100644 --- a/providers/implementations/macs/kmac_prov.c +++ b/providers/implementations/macs/kmac_prov.c @@ -379,6 +379,9 @@ static int kmac_set_ctx_params(void *vmacctx, const OSSL_PARAM *params) struct kmac_data_st *kctx = vmacctx; const OSSL_PARAM *p; + if (params == NULL) + return 1; + if ((p = OSSL_PARAM_locate_const(params, OSSL_MAC_PARAM_XOF)) != NULL && !OSSL_PARAM_get_int(p, &kctx->xof_mode)) return 0; diff --git a/providers/implementations/macs/siphash_prov.c b/providers/implementations/macs/siphash_prov.c index 3f2e326..0181d68 100644 --- a/providers/implementations/macs/siphash_prov.c +++ b/providers/implementations/macs/siphash_prov.c @@ -195,6 +195,9 @@ static int siphash_set_params(void *vmacctx, const OSSL_PARAM *params) const OSSL_PARAM *p = NULL; size_t size; + if (params == NULL) + return 1; + if ((p = OSSL_PARAM_locate_const(params, OSSL_MAC_PARAM_SIZE)) != NULL) { if (!OSSL_PARAM_get_size_t(p, &size) || !SipHash_set_hash_size(&ctx->siphash, size)) |