]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add utility function ossl_param_is_empty()
authorslontis <shane.lontis@oracle.com>
Fri, 20 Sep 2024 00:34:08 +0000 (10:34 +1000)
committerTomas Mraz <tomas@openssl.org>
Wed, 9 Oct 2024 09:13:46 +0000 (11:13 +0200)
Changed all provider implementations that have a set_ctx_params()
to call this function instead of just testing (params == NULL).This
detects the case wherean OSSL_PARAM array contains just a terminator
entry.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25499)

62 files changed:
providers/common/include/prov/providercommon.h
providers/common/provider_util.c
providers/implementations/asymciphers/rsa_enc.c
providers/implementations/asymciphers/sm2_enc.c
providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c
providers/implementations/ciphers/cipher_aes_gcm_siv.c
providers/implementations/ciphers/cipher_aes_ocb.c
providers/implementations/ciphers/cipher_aes_siv.c
providers/implementations/ciphers/cipher_aes_wrp.c
providers/implementations/ciphers/cipher_aes_xts.c
providers/implementations/ciphers/cipher_chacha20.c
providers/implementations/ciphers/cipher_chacha20_poly1305.c
providers/implementations/ciphers/cipher_rc2.c
providers/implementations/ciphers/cipher_rc4_hmac_md5.c
providers/implementations/ciphers/cipher_rc5.c
providers/implementations/ciphers/cipher_sm4_xts.c
providers/implementations/ciphers/ciphercommon.c
providers/implementations/ciphers/ciphercommon_ccm.c
providers/implementations/ciphers/ciphercommon_gcm.c
providers/implementations/digests/blake2_prov.c
providers/implementations/digests/md5_sha1_prov.c
providers/implementations/digests/mdc2_prov.c
providers/implementations/digests/sha2_prov.c
providers/implementations/digests/sha3_prov.c
providers/implementations/exchange/dh_exch.c
providers/implementations/exchange/ecdh_exch.c
providers/implementations/kdfs/argon2.c
providers/implementations/kdfs/hkdf.c
providers/implementations/kdfs/hmacdrbg_kdf.c
providers/implementations/kdfs/kbkdf.c
providers/implementations/kdfs/krb5kdf.c
providers/implementations/kdfs/pbkdf2.c
providers/implementations/kdfs/pkcs12kdf.c
providers/implementations/kdfs/pvkkdf.c
providers/implementations/kdfs/scrypt.c
providers/implementations/kdfs/sshkdf.c
providers/implementations/kdfs/sskdf.c
providers/implementations/kdfs/tls1_prf.c
providers/implementations/kdfs/x942kdf.c
providers/implementations/kem/ec_kem.c
providers/implementations/kem/ecx_kem.c
providers/implementations/kem/rsa_kem.c
providers/implementations/keymgmt/dh_kmgmt.c
providers/implementations/keymgmt/dsa_kmgmt.c
providers/implementations/keymgmt/ec_kmgmt.c
providers/implementations/keymgmt/ecx_kmgmt.c
providers/implementations/keymgmt/rsa_kmgmt.c
providers/implementations/macs/blake2_mac_impl.c
providers/implementations/macs/cmac_prov.c
providers/implementations/macs/gmac_prov.c
providers/implementations/macs/hmac_prov.c
providers/implementations/macs/kmac_prov.c
providers/implementations/macs/siphash_prov.c
providers/implementations/rands/drbg.c
providers/implementations/rands/test_rng.c
providers/implementations/signature/dsa_sig.c
providers/implementations/signature/ecdsa_sig.c
providers/implementations/signature/eddsa_sig.c
providers/implementations/signature/rsa_sig.c
providers/implementations/signature/sm2_sig.c
providers/implementations/storemgmt/file_store.c
providers/implementations/storemgmt/winstore_store.c

index 6366547e7cfbdd3e3d5b8d70fcd427beda644d1f..4a1a043a84e9d1e4d529312162ffad0920ca29ef 100644 (file)
@@ -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;
+}
index 2473754d2667293e470f4112a9eecb28cee294e0..5097d71e27ccecf25b3d12c6791f74cbff341229 100644 (file)
@@ -18,6 +18,7 @@
 # include <openssl/engine.h>
 # 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))
index 3e7fd0f488ea7d9e7207ccb0acc0c841256e09d6..6ee127caff80dc86bdfa67508e3ce29dd363aa80 100644 (file)
@@ -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,
index a9d652be307ee737a670579d9035fe9bf9447d53..747190f3f9b5cebab7ca443bc33a0b8cf2169b75 100644 (file)
@@ -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,
index 51c77a3b328b801d1b2c8ccfe7d618e796c73873..76f53e0c7cce81d959df241535640058c8be8232 100644 (file)
@@ -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);
index 2d4fd886583e50bea3baf26e1093be8e5026a4b6..c3088976714f58f87721ffcdd8b6f8c71992be9d 100644 (file)
@@ -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);
index 041a1aed22956289313b73641809a2d248d75a34..876ff294246c0d52cbf2ff53b4d499e8724cd1ed 100644 (file)
@@ -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);
index bcbc17a48a93d5ee6e9655454699e148c1b9e665..80b6174677516934c2b723880e9d1b5f387ad9ec 100644 (file)
@@ -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);
index 7cbd5bd8db6b8aa7b56031168cb56c5ec39c47b7..a3bac9b23d0af9db244d54c38b20a33a533a3746 100644 (file)
@@ -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);
index dc70592625de9ed2cec88b1e0b6e6918f75a6a70..1e0081da94ec5f0e32f6b1a7e40088d915422b34 100644 (file)
@@ -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);
index 5e2ad91445e7eca180d4037b8ff77f9df4ad6c57..3d03e6b092667c00ad101a6991728628b031ab5b 100644 (file)
@@ -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);
index d5d4e1a251b1c54afbe6503f4a6ff8ff24cf3de7..e0f5b7d91587e06e48313ed863ece6fa95c54adc 100644 (file)
@@ -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);
index 0732098832e9dad77f08a754a1b946bf9334092d..c535bd7e9724cb17e2889b93ef98c5c13cb147a7 100644 (file)
@@ -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))
index 82ef7890b54d6706513cd3571839e2c223df1f39..ec18777143bbad5b05d38f44e8b131cb8921c126 100644 (file)
@@ -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);
index 090b0488e5ff9b8ba58e2ea38ff8fdc20b396e8d..6fa491d83ef366c780cba3cf066aa44a881e1705 100644 (file)
@@ -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))
index e8c28e266044ceb280d48976bb5445516d1d0033..31e86d6a8a0a832de1b7b1c9f4ac2f343845332d 100644 (file)
@@ -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;
 
     /*-
index 78a5a7b9ef0520a37cfeac2bddc6b104731d13a5..d29c6c298d399fdcbe16caa7ccb4f6981060e946 100644 (file)
@@ -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);
index 33105911e36668518ea64250e3d04eb7df8f4717..80008a81518266edf23888e254f4fb2aae1066fe 100644 (file)
@@ -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);
index d7f843b3761203d595593683d9e49f7d0dce076f..475693f336a4598342de30edd8fe2ee77732d5f6 100644 (file)
@@ -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++) {
index 37c3e7038e07536edd0fff9ce2ca0795fd02fabd..be1ceb5ed6780917b21dcaf9664890333ff15c09 100644 (file)
@@ -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); \
index e7b8389b2b5c7b7eb97f0ed9425d17d3fb028ede..9735c3f7e40f80f63b9f5157ffcd754cff9903f1 100644 (file)
@@ -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);
index de39f8a10482e55784af8628fc00d2dde28b2505..e1fc477d21e56fb27c6d07022588b9a6b393bf33 100644 (file)
@@ -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);
index 60f1912cc4fa883799855adcccfc84106694bb4a..4c35586b00edb23337fa22d682fcf820d3a9455e 100644 (file)
@@ -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);
index 29c23c2f09289b1002ed0058f8f7f705d3c603cd..4a4386ff8b4db632e3fb4302b255cd0adc119bc1 100644 (file)
@@ -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);
index b7fee87cc91a13d53e5f98ae88ff0eb0d0ec6629..cfb3938810b821ac0a9b62edfd49580816077ed2 100644 (file)
@@ -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,
index 760ebc51908cc0ad7164a85f4faf989de2f43fa9..58fbc7bc09f0014a0083f0c5b999d15cc964ee46 100644 (file)
@@ -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,
index 6acf47fb1a95ed9e952224b03a5499e89e7ff55a..e3f9aa4f0f5c565f215eda3a40a63238168710e9 100644 (file)
@@ -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;
index c7454b00cffccb35c56e5c7481bb900f3bceb3e0..78fc3498b208c9f89afcb397a7bf09622f97a6c0 100644 (file)
@@ -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))
index afcb13ee319edffc0acc4b5b6e75458504e5948c..9ed214c3da468c82a701ff4e8f824fd11dfe8ac1 100644 (file)
@@ -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);
index a2eae5f42dc77ccb50a3b6af94f38bc00f187307..9ba834ac36d666b66ed7cb740c5fea5e50cd7aec 100644 (file)
@@ -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,
index bc951f74171bcb9db6ed45b6e1f5f0710d5304f9..719b45415c062ecf27833863dffab0d16a47ac53 100644 (file)
@@ -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))
index 19d11493413685c551a892c9579cf562d7ffe07c..d1398461482c86e457beb72f456937fc694a2a51 100644 (file)
@@ -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) {
index 0679c05f931be90e753860acaeabf16683d78162..b4ca4fff475dcaa91ad405d798943b61f59cb3fb 100644 (file)
@@ -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))
index 85a250ff7c13cba33a656618784fff7d45741300..f60092d7717362cb33987769434c15c395084ae1 100644 (file)
@@ -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))
index ee2d4a7d321c9697f746761dbb11325246e6cb02..b2b0f094aae3e21ba53757aece7fff2696425bb7 100644 (file)
@@ -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)
index 767ec9c71dd320b6549a5f5d5c9d1c17967d93b5..4a9b141320bf14abfe6eb147eb9cc9b6cf25fc44 100644 (file)
@@ -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,
index b9612020d61fa4984e91515a12038b3330823eea..3c377db0058e4e4871891d65930cb17ab9be7c83 100644 (file)
@@ -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,
index 31316401bc6b18912fd2aedd1eecbfe424aa1adb..4b6469c00d23399eb1243d89b08430ccbf672146 100644 (file)
@@ -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,
index 8b72a6a9f257936c013ee8fbd574455ac7e564ee..63164d8b8fbe8b26c7c9fd2348260bc1e0ea48d9 100644 (file)
@@ -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,
index b82f9036623882b954becbeaeee37ed12b2099a3..9d8f94270eb4ef8137739406984e309b4389cd48 100644 (file)
@@ -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);
index 4a762f21534ffddafb1c8fa660450f6adb486d9c..b611a21fbf46fe517d17e9304ae6571c3ea74048 100644 (file)
@@ -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);
index 0ac400cbe09967b4d39541788d745303702262fd..0ae34a5ee3128c3779248d2e8e4cb7ef0c21cff6 100644 (file)
@@ -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,
index d1e1e3c0d3b25ab3129666cbeffe3deb919d9dc0..c2ee8593557a11bdb2caba0615ca7081133da931 100644 (file)
@@ -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);
index 2187568b2bd4d03a09f370ed288777c2352e001d..3b12be27cc36733a2d45fbe46c4ef061ad5ee42c 100644 (file)
@@ -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;
index 820b66b770d4f9826e636940efb41a7691c88ebb..221909fc34cef0e9d975dcf9f5583031eb301824 100644 (file)
@@ -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;
 
index 958fc37a47f5f6a462618f4284a4bab0dce316ab..5e9b80fc48ba8d7e55543a621ce2aef204facf93 100644 (file)
@@ -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);
index c24cb8da88ea603c744601e078515595a3fd200d..bfbcc507c3ceb66a56d216ad4b4725a6613f6aae 100644 (file)
@@ -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) {
index ec22e607a0467b5c92f75bb2fe1c6f759c643b79..2ca800fad9bcd3cf465d18679e53f18b3d3a0850 100644 (file)
@@ -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) {
index 9b2d8eb19c159bc6848c62c6be611fb457c67e36..36acf4d81b8a38f19a5ed902de52fec936296ed3 100644 (file)
@@ -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,
index 122df5f60907019819ca19e2ad8c4d09371f2a7f..ca9382b0a82f83973c43b54c48cc1cca0a9a970e 100644 (file)
@@ -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;
index 4139204b943190bd8972068b2460912584a6e63a..e9c3087027c6b07990a36b0e5125dd6e0ab25f17 100644 (file)
@@ -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,
index 13e6020cbb09d005a300ce6dd4fb5e09bbbc8f9d..8e583ed8f323ca4bb8ebf9abedf1dd28b650cbb4 100644 (file)
@@ -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,
index a54def3b8572725979675932780d4aa1af24ec53..08a393c39c69f7b8a4c0de4766f7abee76665973 100644 (file)
@@ -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) {
index f9aa5e2fae409f13e904fabe47ccb737bdf71132..81f52cc267b3962aa70539e36a561bbeb2bd06e0 100644 (file)
@@ -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);
index b1422efe7ccfee074345ad06112ffbfdf9d13ac8..dc5339166567001b8b60f66438c17a52c677c7ab 100644 (file)
@@ -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);
index eb28c595b7ede241c13b8ee0a467f536a211314b..4b585bb704c297af4002ba5cafd1e195702aab0e 100644 (file)
@@ -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) {
index 72be2bcb62075c9f3a84e89438a387f5b741ed42..6fef96c86a6b68f4f953cbcc13b60b4e0ec56b52 100644 (file)
@@ -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) {
index e6689911c84cb292108e65317636a31f916cdc3e..b045f6642ade7b0591849ac939499304d59df11b 100644 (file)
@@ -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);
index 53ffc547dba6b27a1b032196fca9b65ebb17461a..e75b90840b9ab2602466e32c63f0df11f6ecc238 100644 (file)
@@ -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) {
index fa7dcefaa31282f3a116138df5afe97a2fd89757..bcbbd1e2450349c7418cfd42820b48a08cacc8ad 100644 (file)
@@ -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);
index 171c74d581aebf4473c9745db4bae2a17c655dc6..32d03e611b3709e66c635ab6e6e397afbe42c1ab 100644 (file)
@@ -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) {
index e230101d73c43c3f305b75e11bc6c8b4fc68d56d..55dcc2aff20292aedde699faa7eb6902d4a8b7d7 100644 (file)
@@ -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);