diff --git a/providers/common/include/prov/providercommon.h b/providers/common/include/prov/providercommon.h index 6366547e7cfbd..4a1a043a84e9d 100644 --- a/providers/common/include/prov/providercommon.h +++ b/providers/common/include/prov/providercommon.h @@ -22,3 +22,8 @@ void ossl_set_error_state(const char *type); /* Return true if the module is in a usable condition */ int ossl_prov_is_running(void); + +static ossl_inline int ossl_param_is_empty(const OSSL_PARAM params[]) +{ + return params == NULL || params->key == NULL; +} diff --git a/providers/common/provider_util.c b/providers/common/provider_util.c index 2473754d26672..5097d71e27cce 100644 --- a/providers/common/provider_util.c +++ b/providers/common/provider_util.c @@ -18,6 +18,7 @@ # include # include "crypto/evp.h" #endif +#include "prov/providercommon.h" #include "prov/provider_util.h" void ossl_prov_cipher_reset(PROV_CIPHER *pc) @@ -94,7 +95,7 @@ int ossl_prov_cipher_load_from_params(PROV_CIPHER *pc, const OSSL_PARAM *p; const char *propquery; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!load_common(params, &propquery, &pc->engine)) @@ -179,7 +180,7 @@ int ossl_prov_digest_load_from_params(PROV_DIGEST *pd, const OSSL_PARAM *p; const char *propquery; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!load_common(params, &propquery, &pd->engine)) diff --git a/providers/implementations/asymciphers/rsa_enc.c b/providers/implementations/asymciphers/rsa_enc.c index 3e7fd0f488ea7..6ee127caff80d 100644 --- a/providers/implementations/asymciphers/rsa_enc.c +++ b/providers/implementations/asymciphers/rsa_enc.c @@ -466,7 +466,7 @@ static int rsa_set_ctx_params(void *vprsactx, const OSSL_PARAM params[]) if (prsactx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(prsactx, OSSL_FIPS_IND_SETTABLE0, params, diff --git a/providers/implementations/asymciphers/sm2_enc.c b/providers/implementations/asymciphers/sm2_enc.c index a9d652be307ee..747190f3f9b5c 100644 --- a/providers/implementations/asymciphers/sm2_enc.c +++ b/providers/implementations/asymciphers/sm2_enc.c @@ -19,6 +19,7 @@ #include "crypto/sm2.h" #include "prov/provider_ctx.h" #include "prov/implementations.h" +#include "prov/providercommon.h" #include "prov/provider_util.h" static OSSL_FUNC_asym_cipher_newctx_fn sm2_newctx; @@ -190,7 +191,7 @@ static int sm2_set_ctx_params(void *vpsm2ctx, const OSSL_PARAM params[]) if (psm2ctx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!ossl_prov_digest_load_from_params(&psm2ctx->md, params, diff --git a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c index 51c77a3b328b8..76f53e0c7cce8 100644 --- a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c +++ b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c @@ -94,7 +94,7 @@ static int aes_set_ctx_params(void *vctx, const OSSL_PARAM params[]) EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM mb_param; # endif - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_MAC_KEY); diff --git a/providers/implementations/ciphers/cipher_aes_gcm_siv.c b/providers/implementations/ciphers/cipher_aes_gcm_siv.c index 2d4fd886583e5..c3088976714f5 100644 --- a/providers/implementations/ciphers/cipher_aes_gcm_siv.c +++ b/providers/implementations/ciphers/cipher_aes_gcm_siv.c @@ -225,7 +225,7 @@ static int ossl_aes_gcm_siv_set_ctx_params(void *vctx, const OSSL_PARAM params[] const OSSL_PARAM *p; unsigned int speed = 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_TAG); diff --git a/providers/implementations/ciphers/cipher_aes_ocb.c b/providers/implementations/ciphers/cipher_aes_ocb.c index 041a1aed22956..876ff294246c0 100644 --- a/providers/implementations/ciphers/cipher_aes_ocb.c +++ b/providers/implementations/ciphers/cipher_aes_ocb.c @@ -356,7 +356,7 @@ static int aes_ocb_set_ctx_params(void *vctx, const OSSL_PARAM params[]) const OSSL_PARAM *p; size_t sz; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_TAG); diff --git a/providers/implementations/ciphers/cipher_aes_siv.c b/providers/implementations/ciphers/cipher_aes_siv.c index bcbc17a48a93d..80b6174677516 100644 --- a/providers/implementations/ciphers/cipher_aes_siv.c +++ b/providers/implementations/ciphers/cipher_aes_siv.c @@ -202,7 +202,7 @@ static int aes_siv_set_ctx_params(void *vctx, const OSSL_PARAM params[]) const OSSL_PARAM *p; unsigned int speed = 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_TAG); diff --git a/providers/implementations/ciphers/cipher_aes_wrp.c b/providers/implementations/ciphers/cipher_aes_wrp.c index 7cbd5bd8db6b8..a3bac9b23d0af 100644 --- a/providers/implementations/ciphers/cipher_aes_wrp.c +++ b/providers/implementations/ciphers/cipher_aes_wrp.c @@ -266,7 +266,7 @@ static int aes_wrap_set_ctx_params(void *vctx, const OSSL_PARAM params[]) const OSSL_PARAM *p; size_t keylen = 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN); diff --git a/providers/implementations/ciphers/cipher_aes_xts.c b/providers/implementations/ciphers/cipher_aes_xts.c index dc70592625de9..1e0081da94ec5 100644 --- a/providers/implementations/ciphers/cipher_aes_xts.c +++ b/providers/implementations/ciphers/cipher_aes_xts.c @@ -257,7 +257,7 @@ static int aes_xts_set_ctx_params(void *vctx, const OSSL_PARAM params[]) PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; const OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN); diff --git a/providers/implementations/ciphers/cipher_chacha20.c b/providers/implementations/ciphers/cipher_chacha20.c index 5e2ad91445e7e..3d03e6b092667 100644 --- a/providers/implementations/ciphers/cipher_chacha20.c +++ b/providers/implementations/ciphers/cipher_chacha20.c @@ -126,7 +126,7 @@ static int chacha20_set_ctx_params(void *vctx, const OSSL_PARAM params[]) const OSSL_PARAM *p; size_t len; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN); diff --git a/providers/implementations/ciphers/cipher_chacha20_poly1305.c b/providers/implementations/ciphers/cipher_chacha20_poly1305.c index d5d4e1a251b1c..e0f5b7d91587e 100644 --- a/providers/implementations/ciphers/cipher_chacha20_poly1305.c +++ b/providers/implementations/ciphers/cipher_chacha20_poly1305.c @@ -167,7 +167,7 @@ static int chacha20_poly1305_set_ctx_params(void *vctx, PROV_CIPHER_HW_CHACHA20_POLY1305 *hw = (PROV_CIPHER_HW_CHACHA20_POLY1305 *)ctx->base.hw; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN); diff --git a/providers/implementations/ciphers/cipher_rc2.c b/providers/implementations/ciphers/cipher_rc2.c index 0732098832e9d..c535bd7e9724c 100644 --- a/providers/implementations/ciphers/cipher_rc2.c +++ b/providers/implementations/ciphers/cipher_rc2.c @@ -176,7 +176,7 @@ static int rc2_set_ctx_params(void *vctx, const OSSL_PARAM params[]) PROV_RC2_CTX *ctx = (PROV_RC2_CTX *)vctx; const OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!ossl_cipher_var_keylen_set_ctx_params(vctx, params)) diff --git a/providers/implementations/ciphers/cipher_rc4_hmac_md5.c b/providers/implementations/ciphers/cipher_rc4_hmac_md5.c index 82ef7890b54d6..ec18777143bba 100644 --- a/providers/implementations/ciphers/cipher_rc4_hmac_md5.c +++ b/providers/implementations/ciphers/cipher_rc4_hmac_md5.c @@ -153,7 +153,7 @@ static int rc4_hmac_md5_set_ctx_params(void *vctx, const OSSL_PARAM params[]) const OSSL_PARAM *p; size_t sz; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN); diff --git a/providers/implementations/ciphers/cipher_rc5.c b/providers/implementations/ciphers/cipher_rc5.c index 090b0488e5ff9..6fa491d83ef36 100644 --- a/providers/implementations/ciphers/cipher_rc5.c +++ b/providers/implementations/ciphers/cipher_rc5.c @@ -77,7 +77,7 @@ static int rc5_set_ctx_params(void *vctx, const OSSL_PARAM params[]) PROV_RC5_CTX *ctx = (PROV_RC5_CTX *)vctx; const OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!ossl_cipher_var_keylen_set_ctx_params(vctx, params)) diff --git a/providers/implementations/ciphers/cipher_sm4_xts.c b/providers/implementations/ciphers/cipher_sm4_xts.c index e8c28e266044c..31e86d6a8a0a8 100644 --- a/providers/implementations/ciphers/cipher_sm4_xts.c +++ b/providers/implementations/ciphers/cipher_sm4_xts.c @@ -205,7 +205,7 @@ static int sm4_xts_set_ctx_params(void *vxctx, const OSSL_PARAM params[]) PROV_SM4_XTS_CTX *xctx = (PROV_SM4_XTS_CTX *)vxctx; const OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; /*- diff --git a/providers/implementations/ciphers/ciphercommon.c b/providers/implementations/ciphers/ciphercommon.c index 78a5a7b9ef052..d29c6c298d399 100644 --- a/providers/implementations/ciphers/ciphercommon.c +++ b/providers/implementations/ciphers/ciphercommon.c @@ -115,7 +115,7 @@ int ossl_cipher_var_keylen_set_ctx_params(void *vctx, const OSSL_PARAM params[]) PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; const OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!ossl_cipher_generic_set_ctx_params(vctx, params)) @@ -625,7 +625,7 @@ int ossl_cipher_generic_set_ctx_params(void *vctx, const OSSL_PARAM params[]) PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; const OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_PADDING); diff --git a/providers/implementations/ciphers/ciphercommon_ccm.c b/providers/implementations/ciphers/ciphercommon_ccm.c index 33105911e3666..80008a8151826 100644 --- a/providers/implementations/ciphers/ciphercommon_ccm.c +++ b/providers/implementations/ciphers/ciphercommon_ccm.c @@ -71,7 +71,7 @@ int ossl_ccm_set_ctx_params(void *vctx, const OSSL_PARAM params[]) const OSSL_PARAM *p; size_t sz; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_TAG); diff --git a/providers/implementations/ciphers/ciphercommon_gcm.c b/providers/implementations/ciphers/ciphercommon_gcm.c index d7f843b376120..475693f336a45 100644 --- a/providers/implementations/ciphers/ciphercommon_gcm.c +++ b/providers/implementations/ciphers/ciphercommon_gcm.c @@ -252,7 +252,7 @@ int ossl_gcm_set_ctx_params(void *vctx, const OSSL_PARAM params[]) void *vp; int type; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; for (p = params; p->key != NULL; p++) { diff --git a/providers/implementations/digests/blake2_prov.c b/providers/implementations/digests/blake2_prov.c index 37c3e7038e075..be1ceb5ed6780 100644 --- a/providers/implementations/digests/blake2_prov.c +++ b/providers/implementations/digests/blake2_prov.c @@ -42,7 +42,7 @@ int ossl_blake##variant##_get_ctx_params(void *vctx, OSSL_PARAM params[]) \ \ if (ctx == NULL) \ return 0; \ - if (params == NULL) \ + if (ossl_param_is_empty(params)) \ return 1; \ \ p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_SIZE); \ @@ -65,7 +65,7 @@ int ossl_blake##variant##_set_ctx_params(void *vctx, const OSSL_PARAM params[]) \ if (ctx == NULL) \ return 0; \ - if (params == NULL) \ + if (ossl_param_is_empty(params)) \ return 1; \ \ p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_SIZE); \ diff --git a/providers/implementations/digests/md5_sha1_prov.c b/providers/implementations/digests/md5_sha1_prov.c index e7b8389b2b5c7..9735c3f7e40f8 100644 --- a/providers/implementations/digests/md5_sha1_prov.c +++ b/providers/implementations/digests/md5_sha1_prov.c @@ -44,7 +44,7 @@ static int md5_sha1_set_ctx_params(void *vctx, const OSSL_PARAM params[]) if (ctx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_SSL3_MS); diff --git a/providers/implementations/digests/mdc2_prov.c b/providers/implementations/digests/mdc2_prov.c index de39f8a10482e..e1fc477d21e56 100644 --- a/providers/implementations/digests/mdc2_prov.c +++ b/providers/implementations/digests/mdc2_prov.c @@ -43,7 +43,7 @@ static int mdc2_set_ctx_params(void *vctx, const OSSL_PARAM params[]) if (ctx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_PAD_TYPE); diff --git a/providers/implementations/digests/sha2_prov.c b/providers/implementations/digests/sha2_prov.c index 60f1912cc4fa8..4c35586b00edb 100644 --- a/providers/implementations/digests/sha2_prov.c +++ b/providers/implementations/digests/sha2_prov.c @@ -46,7 +46,7 @@ static int sha1_set_ctx_params(void *vctx, const OSSL_PARAM params[]) if (ctx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_SSL3_MS); diff --git a/providers/implementations/digests/sha3_prov.c b/providers/implementations/digests/sha3_prov.c index 29c23c2f09289..4a4386ff8b4db 100644 --- a/providers/implementations/digests/sha3_prov.c +++ b/providers/implementations/digests/sha3_prov.c @@ -589,7 +589,7 @@ static int shake_get_ctx_params(void *vctx, OSSL_PARAM params[]) if (ctx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_XOFLEN); @@ -625,7 +625,7 @@ static int shake_set_ctx_params(void *vctx, const OSSL_PARAM params[]) if (ctx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_XOFLEN); diff --git a/providers/implementations/exchange/dh_exch.c b/providers/implementations/exchange/dh_exch.c index b7fee87cc91a1..cfb3938810b82 100644 --- a/providers/implementations/exchange/dh_exch.c +++ b/providers/implementations/exchange/dh_exch.c @@ -347,7 +347,7 @@ static int dh_set_ctx_params(void *vpdhctx, const OSSL_PARAM params[]) if (pdhctx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(pdhctx, OSSL_FIPS_IND_SETTABLE0, params, diff --git a/providers/implementations/exchange/ecdh_exch.c b/providers/implementations/exchange/ecdh_exch.c index 760ebc51908cc..58fbc7bc09f00 100644 --- a/providers/implementations/exchange/ecdh_exch.c +++ b/providers/implementations/exchange/ecdh_exch.c @@ -253,7 +253,7 @@ int ecdh_set_ctx_params(void *vpecdhctx, const OSSL_PARAM params[]) if (pectx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(pectx, OSSL_FIPS_IND_SETTABLE0, params, diff --git a/providers/implementations/kdfs/argon2.c b/providers/implementations/kdfs/argon2.c index 6acf47fb1a95e..e3f9aa4f0f5c5 100644 --- a/providers/implementations/kdfs/argon2.c +++ b/providers/implementations/kdfs/argon2.c @@ -1394,7 +1394,7 @@ static int kdf_argon2_set_ctx_params(void *vctx, const OSSL_PARAM params[]) KDF_ARGON2 *ctx; uint32_t u32_value; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; ctx = (KDF_ARGON2 *) vctx; diff --git a/providers/implementations/kdfs/hkdf.c b/providers/implementations/kdfs/hkdf.c index c7454b00cffcc..78fc3498b208c 100644 --- a/providers/implementations/kdfs/hkdf.c +++ b/providers/implementations/kdfs/hkdf.c @@ -256,7 +256,7 @@ static int hkdf_common_set_ctx_params(KDF_HKDF *ctx, const OSSL_PARAM params[]) const OSSL_PARAM *p; int n; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (OSSL_PARAM_locate_const(params, OSSL_ALG_PARAM_DIGEST) != NULL) { @@ -323,7 +323,7 @@ static int kdf_hkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) { KDF_HKDF *ctx = vctx; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(ctx, OSSL_FIPS_IND_SETTABLE0, params, @@ -363,7 +363,7 @@ static int hkdf_common_get_ctx_params(KDF_HKDF *ctx, OSSL_PARAM params[]) { OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if ((p = OSSL_PARAM_locate(params, OSSL_KDF_PARAM_SIZE)) != NULL) { @@ -389,7 +389,7 @@ static int kdf_hkdf_get_ctx_params(void *vctx, OSSL_PARAM params[]) { KDF_HKDF *ctx = (KDF_HKDF *)vctx; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!hkdf_common_get_ctx_params(ctx, params)) @@ -841,7 +841,7 @@ static int kdf_tls1_3_set_ctx_params(void *vctx, const OSSL_PARAM params[]) const OSSL_PARAM *p; KDF_HKDF *ctx = vctx; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(ctx, OSSL_FIPS_IND_SETTABLE0, params, @@ -917,7 +917,7 @@ static int kdf_tls1_3_get_ctx_params(void *vctx, OSSL_PARAM params[]) { KDF_HKDF *ctx = (KDF_HKDF *)vctx; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!hkdf_common_get_ctx_params(ctx, params)) diff --git a/providers/implementations/kdfs/hmacdrbg_kdf.c b/providers/implementations/kdfs/hmacdrbg_kdf.c index afcb13ee319ed..9ed214c3da468 100644 --- a/providers/implementations/kdfs/hmacdrbg_kdf.c +++ b/providers/implementations/kdfs/hmacdrbg_kdf.c @@ -185,7 +185,7 @@ static int hmac_drbg_kdf_set_ctx_params(void *vctx, size_t size = 0; int md_size; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_HMACDRBG_ENTROPY); diff --git a/providers/implementations/kdfs/kbkdf.c b/providers/implementations/kdfs/kbkdf.c index a2eae5f42dc77..9ba834ac36d66 100644 --- a/providers/implementations/kdfs/kbkdf.c +++ b/providers/implementations/kdfs/kbkdf.c @@ -369,7 +369,7 @@ static int kbkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx); const OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(ctx, OSSL_FIPS_IND_SETTABLE0, params, diff --git a/providers/implementations/kdfs/krb5kdf.c b/providers/implementations/kdfs/krb5kdf.c index bc951f74171bc..719b45415c062 100644 --- a/providers/implementations/kdfs/krb5kdf.c +++ b/providers/implementations/kdfs/krb5kdf.c @@ -157,7 +157,7 @@ static int krb5kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) KRB5KDF_CTX *ctx = vctx; OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx); - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!ossl_prov_cipher_load_from_params(&ctx->cipher, params, provctx)) diff --git a/providers/implementations/kdfs/pbkdf2.c b/providers/implementations/kdfs/pbkdf2.c index 19d1149341368..d1398461482c8 100644 --- a/providers/implementations/kdfs/pbkdf2.c +++ b/providers/implementations/kdfs/pbkdf2.c @@ -259,7 +259,7 @@ static int kdf_pbkdf2_set_ctx_params(void *vctx, const OSSL_PARAM params[]) uint64_t iter, min_iter; const EVP_MD *md; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (OSSL_PARAM_locate_const(params, OSSL_ALG_PARAM_DIGEST) != NULL) { diff --git a/providers/implementations/kdfs/pkcs12kdf.c b/providers/implementations/kdfs/pkcs12kdf.c index 0679c05f931be..b4ca4fff475dc 100644 --- a/providers/implementations/kdfs/pkcs12kdf.c +++ b/providers/implementations/kdfs/pkcs12kdf.c @@ -245,7 +245,7 @@ static int kdf_pkcs12_set_ctx_params(void *vctx, const OSSL_PARAM params[]) KDF_PKCS12 *ctx = vctx; OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx); - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx)) diff --git a/providers/implementations/kdfs/pvkkdf.c b/providers/implementations/kdfs/pvkkdf.c index 85a250ff7c13c..f60092d771736 100644 --- a/providers/implementations/kdfs/pvkkdf.c +++ b/providers/implementations/kdfs/pvkkdf.c @@ -182,7 +182,7 @@ static int kdf_pvk_set_ctx_params(void *vctx, const OSSL_PARAM params[]) KDF_PVK *ctx = vctx; OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx); - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx)) diff --git a/providers/implementations/kdfs/scrypt.c b/providers/implementations/kdfs/scrypt.c index ee2d4a7d321c9..b2b0f094aae3e 100644 --- a/providers/implementations/kdfs/scrypt.c +++ b/providers/implementations/kdfs/scrypt.c @@ -219,7 +219,7 @@ static int kdf_scrypt_set_ctx_params(void *vctx, const OSSL_PARAM params[]) KDF_SCRYPT *ctx = vctx; uint64_t u64_value; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_PASSWORD)) != NULL) diff --git a/providers/implementations/kdfs/sshkdf.c b/providers/implementations/kdfs/sshkdf.c index 767ec9c71dd32..4a9b141320bf1 100644 --- a/providers/implementations/kdfs/sshkdf.c +++ b/providers/implementations/kdfs/sshkdf.c @@ -212,7 +212,7 @@ static int kdf_sshkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) KDF_SSHKDF *ctx = vctx; OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx); - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(ctx, OSSL_FIPS_IND_SETTABLE0, params, diff --git a/providers/implementations/kdfs/sskdf.c b/providers/implementations/kdfs/sskdf.c index b9612020d61fa..3c377db0058e4 100644 --- a/providers/implementations/kdfs/sskdf.c +++ b/providers/implementations/kdfs/sskdf.c @@ -557,7 +557,7 @@ static int sskdf_common_set_ctx_params(KDF_SSKDF *ctx, const OSSL_PARAM params[] size_t sz; int r; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!ossl_prov_macctx_load_from_params(&ctx->macctx, params, @@ -612,7 +612,7 @@ static int sskdf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) { KDF_SSKDF *ctx = (KDF_SSKDF *)vctx; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(ctx, OSSL_FIPS_IND_SETTABLE0, params, @@ -647,7 +647,7 @@ static int sskdf_common_get_ctx_params(KDF_SSKDF *ctx, OSSL_PARAM params[]) { OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if ((p = OSSL_PARAM_locate(params, OSSL_KDF_PARAM_SIZE)) != NULL) { @@ -662,7 +662,7 @@ static int sskdf_get_ctx_params(void *vctx, OSSL_PARAM params[]) { KDF_SSKDF *ctx = (KDF_SSKDF *)vctx; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!sskdf_common_get_ctx_params(ctx, params)) @@ -689,7 +689,7 @@ static int x963kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) { KDF_SSKDF *ctx = (KDF_SSKDF *)vctx; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(ctx, OSSL_FIPS_IND_SETTABLE0, params, diff --git a/providers/implementations/kdfs/tls1_prf.c b/providers/implementations/kdfs/tls1_prf.c index 31316401bc6b1..4b6469c00d233 100644 --- a/providers/implementations/kdfs/tls1_prf.c +++ b/providers/implementations/kdfs/tls1_prf.c @@ -286,7 +286,7 @@ static int kdf_tls1_prf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) TLS1_PRF *ctx = vctx; OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx); - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(ctx, OSSL_FIPS_IND_SETTABLE0, params, diff --git a/providers/implementations/kdfs/x942kdf.c b/providers/implementations/kdfs/x942kdf.c index 8b72a6a9f2579..63164d8b8fbe8 100644 --- a/providers/implementations/kdfs/x942kdf.c +++ b/providers/implementations/kdfs/x942kdf.c @@ -534,7 +534,7 @@ static int x942kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) const EVP_MD *md; size_t id; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(ctx, OSSL_FIPS_IND_SETTABLE0, params, diff --git a/providers/implementations/kem/ec_kem.c b/providers/implementations/kem/ec_kem.c index b82f903662388..9d8f94270eb4e 100644 --- a/providers/implementations/kem/ec_kem.c +++ b/providers/implementations/kem/ec_kem.c @@ -289,7 +289,7 @@ static int eckem_set_ctx_params(void *vctx, const OSSL_PARAM params[]) const OSSL_PARAM *p; int mode; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_KEM_PARAM_IKME); diff --git a/providers/implementations/kem/ecx_kem.c b/providers/implementations/kem/ecx_kem.c index 4a762f21534ff..b611a21fbf46f 100644 --- a/providers/implementations/kem/ecx_kem.c +++ b/providers/implementations/kem/ecx_kem.c @@ -248,7 +248,7 @@ static int ecxkem_set_ctx_params(void *vctx, const OSSL_PARAM params[]) if (ctx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_KEM_PARAM_IKME); diff --git a/providers/implementations/kem/rsa_kem.c b/providers/implementations/kem/rsa_kem.c index 0ac400cbe0996..0ae34a5ee3128 100644 --- a/providers/implementations/kem/rsa_kem.c +++ b/providers/implementations/kem/rsa_kem.c @@ -203,7 +203,7 @@ static int rsakem_set_ctx_params(void *vprsactx, const OSSL_PARAM params[]) if (prsactx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(prsactx, OSSL_FIPS_IND_SETTABLE0, params, diff --git a/providers/implementations/keymgmt/dh_kmgmt.c b/providers/implementations/keymgmt/dh_kmgmt.c index d1e1e3c0d3b25..c2ee8593557a1 100644 --- a/providers/implementations/keymgmt/dh_kmgmt.c +++ b/providers/implementations/keymgmt/dh_kmgmt.c @@ -531,7 +531,7 @@ static int dh_gen_common_set_params(void *genctx, const OSSL_PARAM params[]) if (gctx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_FFC_TYPE); diff --git a/providers/implementations/keymgmt/dsa_kmgmt.c b/providers/implementations/keymgmt/dsa_kmgmt.c index 2187568b2bd4d..3b12be27cc367 100644 --- a/providers/implementations/keymgmt/dsa_kmgmt.c +++ b/providers/implementations/keymgmt/dsa_kmgmt.c @@ -470,7 +470,7 @@ static int dsa_gen_set_params(void *genctx, const OSSL_PARAM params[]) if (gctx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(gctx, OSSL_FIPS_IND_SETTABLE0, params, @@ -562,7 +562,7 @@ static int dsa_gen_get_params(void *genctx, OSSL_PARAM *params) if (gctx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_GET_CTX_PARAM(gctx, params)) return 0; diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c index 820b66b770d4f..221909fc34cef 100644 --- a/providers/implementations/keymgmt/ec_kmgmt.c +++ b/providers/implementations/keymgmt/ec_kmgmt.c @@ -832,10 +832,9 @@ int ec_set_params(void *key, const OSSL_PARAM params[]) if (key == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; - if (!ossl_ec_group_set_params((EC_GROUP *)EC_KEY_get0_group(key), params)) return 0; diff --git a/providers/implementations/keymgmt/ecx_kmgmt.c b/providers/implementations/keymgmt/ecx_kmgmt.c index 958fc37a47f5f..5e9b80fc48ba8 100644 --- a/providers/implementations/keymgmt/ecx_kmgmt.c +++ b/providers/implementations/keymgmt/ecx_kmgmt.c @@ -411,7 +411,7 @@ static int ecx_set_params(void *key, const OSSL_PARAM params[]) ECX_KEY *ecxkey = key; const OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY); diff --git a/providers/implementations/keymgmt/rsa_kmgmt.c b/providers/implementations/keymgmt/rsa_kmgmt.c index c24cb8da88ea6..bfbcc507c3ceb 100644 --- a/providers/implementations/keymgmt/rsa_kmgmt.c +++ b/providers/implementations/keymgmt/rsa_kmgmt.c @@ -505,7 +505,7 @@ static int rsa_gen_set_params(void *genctx, const OSSL_PARAM params[]) struct rsa_gen_ctx *gctx = genctx; const OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if ((p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_RSA_BITS)) != NULL) { diff --git a/providers/implementations/macs/blake2_mac_impl.c b/providers/implementations/macs/blake2_mac_impl.c index ec22e607a0467..2ca800fad9bcd 100644 --- a/providers/implementations/macs/blake2_mac_impl.c +++ b/providers/implementations/macs/blake2_mac_impl.c @@ -191,7 +191,7 @@ 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) + if (ossl_param_is_empty(params)) return 1; if ((p = OSSL_PARAM_locate_const(params, OSSL_MAC_PARAM_SIZE)) != NULL) { diff --git a/providers/implementations/macs/cmac_prov.c b/providers/implementations/macs/cmac_prov.c index 9b2d8eb19c159..36acf4d81b8a3 100644 --- a/providers/implementations/macs/cmac_prov.c +++ b/providers/implementations/macs/cmac_prov.c @@ -250,7 +250,7 @@ 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) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(macctx, diff --git a/providers/implementations/macs/gmac_prov.c b/providers/implementations/macs/gmac_prov.c index 122df5f609070..ca9382b0a82f8 100644 --- a/providers/implementations/macs/gmac_prov.c +++ b/providers/implementations/macs/gmac_prov.c @@ -207,7 +207,7 @@ static int gmac_set_ctx_params(void *vmacctx, const OSSL_PARAM params[]) OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(macctx->provctx); const OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (ctx == NULL) return 0; diff --git a/providers/implementations/macs/hmac_prov.c b/providers/implementations/macs/hmac_prov.c index 4139204b94319..e9c3087027c6b 100644 --- a/providers/implementations/macs/hmac_prov.c +++ b/providers/implementations/macs/hmac_prov.c @@ -330,7 +330,7 @@ static int hmac_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) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(macctx, OSSL_FIPS_IND_SETTABLE0, params, diff --git a/providers/implementations/macs/kmac_prov.c b/providers/implementations/macs/kmac_prov.c index 13e6020cbb09d..8e583ed8f323c 100644 --- a/providers/implementations/macs/kmac_prov.c +++ b/providers/implementations/macs/kmac_prov.c @@ -452,7 +452,7 @@ 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) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(kctx, OSSL_FIPS_IND_SETTABLE0, params, diff --git a/providers/implementations/macs/siphash_prov.c b/providers/implementations/macs/siphash_prov.c index a54def3b85727..08a393c39c69f 100644 --- a/providers/implementations/macs/siphash_prov.c +++ b/providers/implementations/macs/siphash_prov.c @@ -198,7 +198,7 @@ static int siphash_set_params(void *vmacctx, const OSSL_PARAM *params) const OSSL_PARAM *p = NULL; size_t size; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if ((p = OSSL_PARAM_locate_const(params, OSSL_MAC_PARAM_SIZE)) != NULL) { diff --git a/providers/implementations/rands/drbg.c b/providers/implementations/rands/drbg.c index f9aa5e2fae409..81f52cc267b39 100644 --- a/providers/implementations/rands/drbg.c +++ b/providers/implementations/rands/drbg.c @@ -970,7 +970,7 @@ int ossl_drbg_set_ctx_params(PROV_DRBG *drbg, const OSSL_PARAM params[]) { const OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_DRBG_PARAM_RESEED_REQUESTS); diff --git a/providers/implementations/rands/test_rng.c b/providers/implementations/rands/test_rng.c index b1422efe7ccfe..dc53391665670 100644 --- a/providers/implementations/rands/test_rng.c +++ b/providers/implementations/rands/test_rng.c @@ -229,7 +229,7 @@ static int test_rng_set_ctx_params(void *vtest, const OSSL_PARAM params[]) void *ptr = NULL; size_t size = 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_RAND_PARAM_STRENGTH); diff --git a/providers/implementations/signature/dsa_sig.c b/providers/implementations/signature/dsa_sig.c index eb28c595b7ede..4b585bb704c29 100644 --- a/providers/implementations/signature/dsa_sig.c +++ b/providers/implementations/signature/dsa_sig.c @@ -708,17 +708,16 @@ static const OSSL_PARAM *dsa_gettable_ctx_params(ossl_unused void *ctx, return known_gettable_ctx_params; } -/* The common params for dsa_set_ctx_params and dsa_sigalg_set_ctx_params */ +/** + * @brief Setup common params for dsa_set_ctx_params and dsa_sigalg_set_ctx_params + * The caller is responsible for checking |vpdsactx| is not NULL and |params| + * is not empty. + */ static int dsa_common_set_ctx_params(void *vpdsactx, const OSSL_PARAM params[]) { PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx; const OSSL_PARAM *p; - if (pdsactx == NULL) - return 0; - if (params == NULL) - return 1; - if (!OSSL_FIPS_IND_SET_CTX_PARAM(pdsactx, OSSL_FIPS_IND_SETTABLE0, params, OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK)) return 0; @@ -749,12 +748,14 @@ static int dsa_set_ctx_params(void *vpdsactx, const OSSL_PARAM params[]) const OSSL_PARAM *p; int ret; + if (pdsactx == NULL) + return 0; + if (ossl_param_is_empty(params)) + return 1; + if ((ret = dsa_common_set_ctx_params(pdsactx, params)) <= 0) return ret; - if (params == NULL) - return 1; - p = OSSL_PARAM_locate_const(params, OSSL_SIGNATURE_PARAM_DIGEST); if (p != NULL) { char mdname[OSSL_MAX_NAME_SIZE] = "", *pmdname = mdname; @@ -952,12 +953,14 @@ static int dsa_sigalg_set_ctx_params(void *vpdsactx, const OSSL_PARAM params[]) const OSSL_PARAM *p; int ret; + if (pdsactx == NULL) + return 0; + if (ossl_param_is_empty(params)) + return 1; + if ((ret = dsa_common_set_ctx_params(pdsactx, params)) <= 0) return ret; - if (params == NULL) - return 1; - if (pdsactx->operation == EVP_PKEY_OP_VERIFYMSG) { p = OSSL_PARAM_locate_const(params, OSSL_SIGNATURE_PARAM_SIGNATURE); if (p != NULL) { diff --git a/providers/implementations/signature/ecdsa_sig.c b/providers/implementations/signature/ecdsa_sig.c index 72be2bcb62075..6fef96c86a6b6 100644 --- a/providers/implementations/signature/ecdsa_sig.c +++ b/providers/implementations/signature/ecdsa_sig.c @@ -721,17 +721,16 @@ static const OSSL_PARAM *ecdsa_gettable_ctx_params(ossl_unused void *vctx, return known_gettable_ctx_params; } -/* The common params for ecdsa_set_ctx_params and ecdsa_sigalg_set_ctx_params */ +/** + * @brief Set up common params for ecdsa_set_ctx_params and + * ecdsa_sigalg_set_ctx_params. The caller is responsible for checking |vctx| is + * not NULL and |params| is not empty. + */ static int ecdsa_common_set_ctx_params(void *vctx, const OSSL_PARAM params[]) { PROV_ECDSA_CTX *ctx = (PROV_ECDSA_CTX *)vctx; const OSSL_PARAM *p; - if (ctx == NULL) - return 0; - if (params == NULL) - return 1; - if (!OSSL_FIPS_IND_SET_CTX_PARAM(ctx, OSSL_FIPS_IND_SETTABLE0, params, OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK)) return 0; @@ -766,12 +765,14 @@ static int ecdsa_set_ctx_params(void *vctx, const OSSL_PARAM params[]) size_t mdsize = 0; int ret; + if (ctx == NULL) + return 0; + if (ossl_param_is_empty(params)) + return 1; + if ((ret = ecdsa_common_set_ctx_params(ctx, params)) <= 0) return ret; - if (params == NULL) - return 1; - p = OSSL_PARAM_locate_const(params, OSSL_SIGNATURE_PARAM_DIGEST); if (p != NULL) { char mdname[OSSL_MAX_NAME_SIZE] = "", *pmdname = mdname; @@ -970,12 +971,14 @@ static int ecdsa_sigalg_set_ctx_params(void *vctx, const OSSL_PARAM params[]) const OSSL_PARAM *p; int ret; + if (ctx == NULL) + return 0; + if (ossl_param_is_empty(params)) + return 1; + if ((ret = ecdsa_common_set_ctx_params(ctx, params)) <= 0) return ret; - if (params == NULL) - return 1; - if (ctx->operation == EVP_PKEY_OP_VERIFYMSG) { p = OSSL_PARAM_locate_const(params, OSSL_SIGNATURE_PARAM_SIGNATURE); if (p != NULL) { diff --git a/providers/implementations/signature/eddsa_sig.c b/providers/implementations/signature/eddsa_sig.c index e6689911c84cb..b045f6642ade7 100644 --- a/providers/implementations/signature/eddsa_sig.c +++ b/providers/implementations/signature/eddsa_sig.c @@ -826,7 +826,7 @@ static int eddsa_set_ctx_params(void *vpeddsactx, const OSSL_PARAM params[]) if (peddsactx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_SIGNATURE_PARAM_INSTANCE); diff --git a/providers/implementations/signature/rsa_sig.c b/providers/implementations/signature/rsa_sig.c index 53ffc547dba6b..e75b90840b9ab 100644 --- a/providers/implementations/signature/rsa_sig.c +++ b/providers/implementations/signature/rsa_sig.c @@ -1542,7 +1542,7 @@ static int rsa_set_ctx_params(void *vprsactx, const OSSL_PARAM params[]) if (prsactx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (!OSSL_FIPS_IND_SET_CTX_PARAM(prsactx, OSSL_FIPS_IND_SETTABLE0, params, @@ -1990,7 +1990,7 @@ static int rsa_sigalg_set_ctx_params(void *vprsactx, const OSSL_PARAM params[]) if (prsactx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (prsactx->operation == EVP_PKEY_OP_VERIFYMSG) { diff --git a/providers/implementations/signature/sm2_sig.c b/providers/implementations/signature/sm2_sig.c index fa7dcefaa3128..bcbbd1e245034 100644 --- a/providers/implementations/signature/sm2_sig.c +++ b/providers/implementations/signature/sm2_sig.c @@ -445,7 +445,7 @@ static int sm2sig_set_ctx_params(void *vpsm2ctx, const OSSL_PARAM params[]) if (psm2ctx == NULL) return 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_DIST_ID); diff --git a/providers/implementations/storemgmt/file_store.c b/providers/implementations/storemgmt/file_store.c index 171c74d581aeb..32d03e611b370 100644 --- a/providers/implementations/storemgmt/file_store.c +++ b/providers/implementations/storemgmt/file_store.c @@ -29,6 +29,7 @@ #include "crypto/ctype.h" /* ossl_isdigit() */ #include "prov/implementations.h" #include "prov/bio.h" +#include "prov/providercommon.h" #include "file_store_local.h" DEFINE_STACK_OF(OSSL_STORE_INFO) @@ -320,7 +321,7 @@ static int file_set_ctx_params(void *loaderctx, const OSSL_PARAM params[]) struct file_ctx_st *ctx = loaderctx; const OSSL_PARAM *p; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; if (ctx->type != IS_DIR) { diff --git a/providers/implementations/storemgmt/winstore_store.c b/providers/implementations/storemgmt/winstore_store.c index e230101d73c43..55dcc2aff2029 100644 --- a/providers/implementations/storemgmt/winstore_store.c +++ b/providers/implementations/storemgmt/winstore_store.c @@ -21,6 +21,7 @@ #include "crypto/decoder.h" #include "crypto/ctype.h" /* ossl_isdigit() */ #include "prov/implementations.h" +#include "prov/providercommon.h" #include "prov/bio.h" #include "file_store_local.h" #ifdef __CYGWIN__ @@ -119,7 +120,7 @@ static int winstore_set_ctx_params(void *loaderctx, const OSSL_PARAM params[]) const OSSL_PARAM *p; int do_reset = 0; - if (params == NULL) + if (ossl_param_is_empty(params)) return 1; p = OSSL_PARAM_locate_const(params, OSSL_STORE_PARAM_PROPERTIES);