return NULL;
provctx = ossl_provider_ctx(EVP_ASYM_CIPHER_provider(cip));
- return cip->gettable_ctx_params(provctx);
+ return cip->gettable_ctx_params(NULL, provctx);
}
const OSSL_PARAM *EVP_ASYM_CIPHER_settable_ctx_params(const EVP_ASYM_CIPHER *cip)
return NULL;
provctx = ossl_provider_ctx(EVP_ASYM_CIPHER_provider(cip));
- return cip->settable_ctx_params(provctx);
+ return cip->settable_ctx_params(NULL, provctx);
}
return NULL;
provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(keyexch));
- return keyexch->gettable_ctx_params(provctx);
+ return keyexch->gettable_ctx_params(NULL, provctx);
}
const OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch)
if (keyexch == NULL || keyexch->settable_ctx_params == NULL)
return NULL;
provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(keyexch));
- return keyexch->settable_ctx_params(provctx);
+ return keyexch->settable_ctx_params(NULL, provctx);
}
return NULL;
provctx = ossl_provider_ctx(EVP_KEM_provider(kem));
- return kem->gettable_ctx_params(provctx);
+ return kem->gettable_ctx_params(NULL, provctx);
}
const OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem)
return NULL;
provctx = ossl_provider_ctx(EVP_KEM_provider(kem));
- return kem->settable_ctx_params(provctx);
+ return kem->settable_ctx_params(NULL, provctx);
}
if (keymgmt->gen_settable_params == NULL)
return NULL;
- return keymgmt->gen_settable_params(provctx);
+ return keymgmt->gen_settable_params(NULL, provctx);
}
void *evp_keymgmt_gen(const EVP_KEYMGMT *keymgmt, void *genctx,
&& ctx->op.kex.exchange != NULL
&& ctx->op.kex.exchange->gettable_ctx_params != NULL) {
provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(ctx->op.kex.exchange));
- return ctx->op.kex.exchange->gettable_ctx_params(provctx);
+ return ctx->op.kex.exchange->gettable_ctx_params(ctx->op.kex.exchprovctx,
+ provctx);
}
if (EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx)
&& ctx->op.sig.signature != NULL
&& ctx->op.sig.signature->gettable_ctx_params != NULL) {
provctx = ossl_provider_ctx(
EVP_SIGNATURE_provider(ctx->op.sig.signature));
- return ctx->op.sig.signature->gettable_ctx_params(provctx);
+ return ctx->op.sig.signature->gettable_ctx_params(ctx->op.sig.sigprovctx,
+ provctx);
}
if (EVP_PKEY_CTX_IS_ASYM_CIPHER_OP(ctx)
&& ctx->op.ciph.cipher != NULL
&& ctx->op.ciph.cipher->gettable_ctx_params != NULL) {
provctx = ossl_provider_ctx(
EVP_ASYM_CIPHER_provider(ctx->op.ciph.cipher));
- return ctx->op.ciph.cipher->gettable_ctx_params(provctx);
+ return ctx->op.ciph.cipher->gettable_ctx_params(ctx->op.ciph.ciphprovctx,
+ provctx);
}
if (EVP_PKEY_CTX_IS_KEM_OP(ctx)
&& ctx->op.encap.kem != NULL
&& ctx->op.encap.kem->gettable_ctx_params != NULL) {
provctx = ossl_provider_ctx(EVP_KEM_provider(ctx->op.encap.kem));
- return ctx->op.encap.kem->gettable_ctx_params(provctx);
+ return ctx->op.encap.kem->gettable_ctx_params(ctx->op.encap.kemprovctx,
+ provctx);
}
return NULL;
}
&& ctx->op.kex.exchange != NULL
&& ctx->op.kex.exchange->settable_ctx_params != NULL) {
provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(ctx->op.kex.exchange));
- return ctx->op.kex.exchange->settable_ctx_params(provctx);
+ return ctx->op.kex.exchange->settable_ctx_params(ctx->op.kex.exchprovctx,
+ provctx);
}
if (EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx)
&& ctx->op.sig.signature != NULL
&& ctx->op.sig.signature->settable_ctx_params != NULL) {
provctx = ossl_provider_ctx(
EVP_SIGNATURE_provider(ctx->op.sig.signature));
- return ctx->op.sig.signature->settable_ctx_params(provctx);
+ return ctx->op.sig.signature->settable_ctx_params(ctx->op.sig.sigprovctx,
+ provctx);
}
if (EVP_PKEY_CTX_IS_ASYM_CIPHER_OP(ctx)
&& ctx->op.ciph.cipher != NULL
&& ctx->op.ciph.cipher->settable_ctx_params != NULL) {
provctx = ossl_provider_ctx(
EVP_ASYM_CIPHER_provider(ctx->op.ciph.cipher));
- return ctx->op.ciph.cipher->settable_ctx_params(provctx);
+ return ctx->op.ciph.cipher->settable_ctx_params(ctx->op.ciph.ciphprovctx,
+ provctx);
}
if (EVP_PKEY_CTX_IS_GEN_OP(ctx)
- && ctx->keymgmt != NULL)
- return EVP_KEYMGMT_gen_settable_params(ctx->keymgmt);
+ && ctx->keymgmt != NULL
+ && ctx->keymgmt->gen_settable_params != NULL) {
+ provctx = ossl_provider_ctx(EVP_KEYMGMT_provider(ctx->keymgmt));
+ return ctx->keymgmt->gen_settable_params(ctx->op.keymgmt.genctx,
+ provctx);
+ }
if (EVP_PKEY_CTX_IS_KEM_OP(ctx)
&& ctx->op.encap.kem != NULL
&& ctx->op.encap.kem->settable_ctx_params != NULL) {
provctx = ossl_provider_ctx(EVP_KEM_provider(ctx->op.encap.kem));
- return ctx->op.encap.kem->settable_ctx_params(provctx);
+ return ctx->op.encap.kem->settable_ctx_params(ctx->op.encap.kemprovctx,
+ provctx);
}
return NULL;
}
return NULL;
provctx = ossl_provider_ctx(EVP_SIGNATURE_provider(sig));
- return sig->gettable_ctx_params(provctx);
+ return sig->gettable_ctx_params(NULL, provctx);
}
const OSSL_PARAM *EVP_SIGNATURE_settable_ctx_params(const EVP_SIGNATURE *sig)
return NULL;
provctx = ossl_provider_ctx(EVP_SIGNATURE_provider(sig));
- return sig->settable_ctx_params(provctx);
+ return sig->settable_ctx_params(NULL, provctx);
}
static int evp_pkey_signature_init(EVP_PKEY_CTX *ctx, int operation)
/* KEM parameters */
int OSSL_FUNC_kem_get_ctx_params(void *ctx, OSSL_PARAM params[]);
- const OSSL_PARAM *OSSL_FUNC_kem_gettable_ctx_params(void *provctx);
+ const OSSL_PARAM *OSSL_FUNC_kem_gettable_ctx_params(void *ctx, void *provctx);
int OSSL_FUNC_kem_set_ctx_params(void *ctx, const OSSL_PARAM params[]);
- const OSSL_PARAM *OSSL_FUNC_kem_settable_ctx_params(void *provctx);
+ const OSSL_PARAM *OSSL_FUNC_kem_settable_ctx_params(void *ctx, void *provctx);
=head1 DESCRIPTION
/* Key Exchange parameters */
int OSSL_FUNC_keyexch_set_ctx_params(void *ctx, const OSSL_PARAM params[]);
- const OSSL_PARAM *OSSL_FUNC_keyexch_settable_ctx_params(void *provctx);
+ const OSSL_PARAM *OSSL_FUNC_keyexch_settable_ctx_params(void *ctx,
+ void *provctx);
int OSSL_FUNC_keyexch_get_ctx_params(void *ctx, OSSL_PARAM params[]);
- const OSSL_PARAM *OSSL_FUNC_keyexch_gettable_ctx_params(void *provctx);
+ const OSSL_PARAM *OSSL_FUNC_keyexch_gettable_ctx_params(void *ctx,
+ void *provctx);
=head1 DESCRIPTION
void *OSSL_FUNC_keymgmt_gen_init(void *provctx, int selection);
int OSSL_FUNC_keymgmt_gen_set_template(void *genctx, void *template);
int OSSL_FUNC_keymgmt_gen_set_params(void *genctx, const OSSL_PARAM params[]);
- const OSSL_PARAM *OSSL_FUNC_keymgmt_gen_settable_params(void *provctx);
+ const OSSL_PARAM *OSSL_FUNC_keymgmt_gen_settable_params(void *genctx,
+ void *provctx);
void *OSSL_FUNC_keymgmt_gen(void *genctx, OSSL_CALLBACK *cb, void *cbarg);
void OSSL_FUNC_keymgmt_gen_cleanup(void *genctx);
/* Signature parameters */
int OSSL_FUNC_signature_get_ctx_params(void *ctx, OSSL_PARAM params[]);
- const OSSL_PARAM *OSSL_FUNC_signature_gettable_ctx_params(void *provctx);
+ const OSSL_PARAM *OSSL_FUNC_signature_gettable_ctx_params(void *ctx,
+ void *provctx);
int OSSL_FUNC_signature_set_ctx_params(void *ctx, const OSSL_PARAM params[]);
- const OSSL_PARAM *OSSL_FUNC_signature_settable_ctx_params(void *provctx);
-
+ const OSSL_PARAM *OSSL_FUNC_signature_settable_ctx_params(void *ctx,
+ void *provctx);
/* MD parameters */
int OSSL_FUNC_signature_get_ctx_md_params(void *ctx, OSSL_PARAM params[]);
const OSSL_PARAM * OSSL_FUNC_signature_gettable_ctx_md_params(void *ctx);
OSSL_CORE_MAKE_FUNC(int, keymgmt_gen_set_params,
(void *genctx, const OSSL_PARAM params[]))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *,
- keymgmt_gen_settable_params, (void *provctx))
-OSSL_CORE_MAKE_FUNC(int, keymgmt_gen_get_params,
- (void *genctx, OSSL_PARAM params[]))
-OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *,
- keymgmt_gen_gettable_params, (void *provctx))
+ keymgmt_gen_settable_params,
+ (void *genctx, void *provctx))
OSSL_CORE_MAKE_FUNC(void *, keymgmt_gen,
(void *genctx, OSSL_CALLBACK *cb, void *cbarg))
OSSL_CORE_MAKE_FUNC(void, keymgmt_gen_cleanup, (void *genctx))
OSSL_CORE_MAKE_FUNC(int, keyexch_set_ctx_params, (void *ctx,
const OSSL_PARAM params[]))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, keyexch_settable_ctx_params,
- (void *provctx))
+ (void *ctx, void *provctx))
OSSL_CORE_MAKE_FUNC(int, keyexch_get_ctx_params, (void *ctx,
OSSL_PARAM params[]))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, keyexch_gettable_ctx_params,
- (void *provctx))
+ (void *ctx, void *provctx))
/* Signature */
OSSL_CORE_MAKE_FUNC(int, signature_get_ctx_params,
(void *ctx, OSSL_PARAM params[]))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, signature_gettable_ctx_params,
- (void *provctx))
+ (void *ctx, void *provctx))
OSSL_CORE_MAKE_FUNC(int, signature_set_ctx_params,
(void *ctx, const OSSL_PARAM params[]))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, signature_settable_ctx_params,
- (void *provctx))
+ (void *ctx, void *provctx))
OSSL_CORE_MAKE_FUNC(int, signature_get_ctx_md_params,
(void *ctx, OSSL_PARAM params[]))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, signature_gettable_ctx_md_params,
OSSL_CORE_MAKE_FUNC(int, asym_cipher_get_ctx_params,
(void *ctx, OSSL_PARAM params[]))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, asym_cipher_gettable_ctx_params,
- (void *provctx))
+ (void *ctx, void *provctx))
OSSL_CORE_MAKE_FUNC(int, asym_cipher_set_ctx_params,
(void *ctx, const OSSL_PARAM params[]))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, asym_cipher_settable_ctx_params,
- (void *provctx))
+ (void *ctx, void *provctx))
/* Asymmetric Key encapsulation */
# define OSSL_FUNC_KEM_NEWCTX 1
OSSL_CORE_MAKE_FUNC(void, kem_freectx, (void *ctx))
OSSL_CORE_MAKE_FUNC(void *, kem_dupctx, (void *ctx))
OSSL_CORE_MAKE_FUNC(int, kem_get_ctx_params, (void *ctx, OSSL_PARAM params[]))
-OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, kem_gettable_ctx_params, (void *provctx))
+OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, kem_gettable_ctx_params,
+ (void *ctx, void *provctx))
OSSL_CORE_MAKE_FUNC(int, kem_set_ctx_params,
(void *ctx, const OSSL_PARAM params[]))
-OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, kem_settable_ctx_params, (void *provctx))
+OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, kem_settable_ctx_params,
+ (void *ctx, void *provctx))
/* Encoders and decoders */
# define OSSL_FUNC_ENCODER_NEWCTX 1
OSSL_PARAM_END
};
-static const OSSL_PARAM *rsa_gettable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *rsa_gettable_ctx_params(ossl_unused void *vprsactx,
+ ossl_unused void *provctx)
{
return known_gettable_ctx_params;
}
OSSL_PARAM_END
};
-static const OSSL_PARAM *rsa_settable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *rsa_settable_ctx_params(ossl_unused void *vprsactx,
+ ossl_unused void *provctx)
{
return known_settable_ctx_params;
}
OSSL_PARAM_END
};
-static const OSSL_PARAM *sm2_gettable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *sm2_gettable_ctx_params(ossl_unused void *vpsm2ctx,
+ ossl_unused void *provctx)
{
return known_gettable_ctx_params;
}
OSSL_PARAM_END
};
-static const OSSL_PARAM *sm2_settable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *sm2_settable_ctx_params(ossl_unused void *vpsm2ctx,
+ ossl_unused void *provctx)
{
return known_settable_ctx_params;
}
OSSL_PARAM_END
};
-static const OSSL_PARAM *dh_settable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *dh_settable_ctx_params(ossl_unused void *vpdhctx,
+ ossl_unused void *provctx)
{
return known_settable_ctx_params;
}
OSSL_PARAM_END
};
-static const OSSL_PARAM *dh_gettable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *dh_gettable_ctx_params(ossl_unused void *vpdhctx,
+ ossl_unused void *provctx)
{
return known_gettable_ctx_params;
}
};
static
-const OSSL_PARAM *ecdh_settable_ctx_params(ossl_unused void *provctx)
+const OSSL_PARAM *ecdh_settable_ctx_params(ossl_unused void *vpecdhctx,
+ ossl_unused void *provctx)
{
return known_settable_ctx_params;
}
};
static
-const OSSL_PARAM *ecdh_gettable_ctx_params(ossl_unused void *provctx)
+const OSSL_PARAM *ecdh_gettable_ctx_params(ossl_unused void *vpecdhctx,
+ ossl_unused void *provctx)
{
return known_gettable_ctx_params;
}
return EVP_KDF_CTX_set_params(pkdfctx->kdfctx, params);
}
-static const OSSL_PARAM *kdf_settable_ctx_params(void *provctx,
+static const OSSL_PARAM *kdf_settable_ctx_params(ossl_unused void *vpkdfctx,
+ void *provctx,
const char *kdfname)
{
EVP_KDF *kdf = EVP_KDF_fetch(PROV_LIBCTX_OF(provctx), kdfname,
}
#define KDF_SETTABLE_CTX_PARAMS(funcname, kdfname) \
- static const OSSL_PARAM *kdf_##funcname##_settable_ctx_params(void *provctx) \
+ static const OSSL_PARAM *kdf_##funcname##_settable_ctx_params(void *vpkdfctx, \
+ void *provctx) \
{ \
- return kdf_settable_ctx_params(provctx, kdfname); \
+ return kdf_settable_ctx_params(vpkdfctx, provctx, kdfname); \
}
KDF_SETTABLE_CTX_PARAMS(tls1_prf, "TLS1-PRF")
OSSL_PARAM_END
};
-static const OSSL_PARAM *rsakem_gettable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *rsakem_gettable_ctx_params(ossl_unused void *vprsactx,
+ ossl_unused void *provctx)
{
return known_gettable_rsakem_ctx_params;
}
OSSL_PARAM_END
};
-static const OSSL_PARAM *rsakem_settable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *rsakem_settable_ctx_params(ossl_unused void *vprsactx,
+ ossl_unused void *provctx)
{
return known_settable_rsakem_ctx_params;
}
return 1;
}
-static const OSSL_PARAM *dh_gen_settable_params(void *provctx)
+static const OSSL_PARAM *dh_gen_settable_params(ossl_unused void *genctx,
+ ossl_unused void *provctx)
{
static OSSL_PARAM settable[] = {
OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME, NULL, 0),
return 1;
}
-static const OSSL_PARAM *dsa_gen_settable_params(void *provctx)
+static const OSSL_PARAM *dsa_gen_settable_params(ossl_unused void *genctx,
+ ossl_unused void *provctx)
{
static OSSL_PARAM settable[] = {
OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_FFC_TYPE, NULL, 0),
return ret;
}
-static const OSSL_PARAM *ec_gen_settable_params(void *provctx)
+static const OSSL_PARAM *ec_gen_settable_params(ossl_unused void *genctx,
+ ossl_unused void *provctx)
{
static OSSL_PARAM settable[] = {
OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME, NULL, 0),
return 1;
}
-static const OSSL_PARAM *ecx_gen_settable_params(void *provctx)
+static const OSSL_PARAM *ecx_gen_settable_params(ossl_unused void *genctx,
+ ossl_unused void *provctx)
{
static OSSL_PARAM settable[] = {
OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME, NULL, 0),
return 1;
}
-static const OSSL_PARAM *mac_gen_settable_params(void *provctx)
+static const OSSL_PARAM *mac_gen_settable_params(ossl_unused void *genctx,
+ ossl_unused void *provctx)
{
static OSSL_PARAM settable[] = {
OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_PRIV_KEY, NULL, 0),
return settable;
}
-static const OSSL_PARAM *cmac_gen_settable_params(void *provctx)
+static const OSSL_PARAM *cmac_gen_settable_params(ossl_unused void *genctx,
+ ossl_unused void *provctx)
{
static OSSL_PARAM settable[] = {
OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_PRIV_KEY, NULL, 0),
OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_RSA_MGF1_DIGEST, NULL, 0), \
OSSL_PARAM_int(OSSL_PKEY_PARAM_RSA_PSS_SALTLEN, NULL)
-static const OSSL_PARAM *rsa_gen_settable_params(void *provctx)
+static const OSSL_PARAM *rsa_gen_settable_params(ossl_unused void *genctx,
+ ossl_unused void *provctx)
{
static OSSL_PARAM settable[] = {
rsa_gen_basic,
return settable;
}
-static const OSSL_PARAM *rsapss_gen_settable_params(void *provctx)
+static const OSSL_PARAM *rsapss_gen_settable_params(ossl_unused void *genctx,
+ ossl_unused void *provctx)
{
static OSSL_PARAM settable[] = {
rsa_gen_basic,
OSSL_PARAM_END
};
-static const OSSL_PARAM *dsa_gettable_ctx_params(ossl_unused void *vctx)
+static const OSSL_PARAM *dsa_gettable_ctx_params(ossl_unused void *ctx,
+ ossl_unused void *provctx)
{
return known_gettable_ctx_params;
}
return 1;
}
-static const OSSL_PARAM known_settable_ctx_params[] = {
+static const OSSL_PARAM settable_ctx_params[] = {
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PROPERTIES, NULL, 0),
OSSL_PARAM_END
};
-static const OSSL_PARAM *dsa_settable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM settable_ctx_params_no_digest[] = {
+ OSSL_PARAM_END
+};
+
+static const OSSL_PARAM *dsa_settable_ctx_params(void *vpdsactx,
+ ossl_unused void *provctx)
{
- /*
- * TODO(3.0): Should this function return a different set of settable ctx
- * params if the ctx is being used for a DigestSign/DigestVerify? In that
- * case it is not allowed to set the digest size/digest name because the
- * digest is explicitly set as part of the init.
- * NOTE: Ideally we would check pdsactx->flag_allow_md, but this is
- * problematic because there is no nice way of passing the
- * PROV_DSA_CTX down to this function...
- * Because we have API's that dont know about their parent..
- * e.g: EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig).
- * We could pass NULL for that case (but then how useful is the check?).
- */
- return known_settable_ctx_params;
+ PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
+
+ if (pdsactx != NULL && !pdsactx->flag_allow_md)
+ return settable_ctx_params_no_digest;
+ return settable_ctx_params;
}
static int dsa_get_ctx_md_params(void *vpdsactx, OSSL_PARAM *params)
OSSL_PARAM_END
};
-static const OSSL_PARAM *ecdsa_gettable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *ecdsa_gettable_ctx_params(ossl_unused void *vctx,
+ ossl_unused void *provctx)
{
return known_gettable_ctx_params;
}
return 1;
}
-static const OSSL_PARAM known_settable_ctx_params[] = {
- OSSL_PARAM_size_t(OSSL_SIGNATURE_PARAM_DIGEST_SIZE, NULL),
+static const OSSL_PARAM settable_ctx_params[] = {
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
+ OSSL_PARAM_size_t(OSSL_SIGNATURE_PARAM_DIGEST_SIZE, NULL),
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PROPERTIES, NULL, 0),
OSSL_PARAM_uint(OSSL_SIGNATURE_PARAM_KAT, NULL),
OSSL_PARAM_END
};
-static const OSSL_PARAM *ecdsa_settable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM settable_ctx_params_no_digest[] = {
+ OSSL_PARAM_uint(OSSL_SIGNATURE_PARAM_KAT, NULL),
+ OSSL_PARAM_END
+};
+
+static const OSSL_PARAM *ecdsa_settable_ctx_params(void *vctx,
+ ossl_unused void *provctx)
{
- return known_settable_ctx_params;
+ PROV_ECDSA_CTX *ctx = (PROV_ECDSA_CTX *)vctx;
+
+ if (ctx != NULL && !ctx->flag_allow_md)
+ return settable_ctx_params_no_digest;
+ return settable_ctx_params;
}
static int ecdsa_get_ctx_md_params(void *vctx, OSSL_PARAM *params)
OSSL_PARAM_END
};
-static const OSSL_PARAM *eddsa_gettable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *eddsa_gettable_ctx_params(ossl_unused void *vpeddsactx,
+ ossl_unused void *provctx)
{
return known_gettable_ctx_params;
}
return EVP_MAC_CTX_set_params(ctx->macctx, params);
}
-static const OSSL_PARAM *mac_settable_ctx_params(void *provctx,
+static const OSSL_PARAM *mac_settable_ctx_params(ossl_unused void *ctx,
+ void *provctx,
const char *macname)
{
EVP_MAC *mac = EVP_MAC_fetch(PROV_LIBCTX_OF(provctx), macname,
}
#define MAC_SETTABLE_CTX_PARAMS(funcname, macname) \
- static const OSSL_PARAM *mac_##funcname##_settable_ctx_params(void *provctx) \
+ static const OSSL_PARAM *mac_##funcname##_settable_ctx_params(void *ctx, \
+ void *provctx) \
{ \
- return mac_settable_ctx_params(provctx, macname); \
+ return mac_settable_ctx_params(ctx, provctx, macname); \
}
MAC_SETTABLE_CTX_PARAMS(hmac, "HMAC")
OSSL_PARAM_END
};
-static const OSSL_PARAM *rsa_gettable_ctx_params(ossl_unused void *vctx)
+static const OSSL_PARAM *rsa_gettable_ctx_params(ossl_unused void *vprsactx,
+ ossl_unused void *provctx)
{
return known_gettable_ctx_params;
}
return 1;
}
-static const OSSL_PARAM known_settable_ctx_params[] = {
- OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PAD_MODE, NULL, 0),
+static const OSSL_PARAM settable_ctx_params[] = {
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PROPERTIES, NULL, 0),
+ OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PAD_MODE, NULL, 0),
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_MGF1_DIGEST, NULL, 0),
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES, NULL, 0),
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PSS_SALTLEN, NULL, 0),
OSSL_PARAM_END
};
-static const OSSL_PARAM *rsa_settable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM settable_ctx_params_no_digest[] = {
+ OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PAD_MODE, NULL, 0),
+ OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_MGF1_DIGEST, NULL, 0),
+ OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES, NULL, 0),
+ OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PSS_SALTLEN, NULL, 0),
+ OSSL_PARAM_END
+};
+
+static const OSSL_PARAM *rsa_settable_ctx_params(void *vprsactx,
+ ossl_unused void *provctx)
{
- /*
- * TODO(3.0): Should this function return a different set of settable ctx
- * params if the ctx is being used for a DigestSign/DigestVerify? In that
- * case it is not allowed to set the digest size/digest name because the
- * digest is explicitly set as part of the init.
- */
- return known_settable_ctx_params;
+ PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
+
+ if (prsactx != NULL && !prsactx->flag_allow_md)
+ return settable_ctx_params_no_digest;
+ return settable_ctx_params;
}
static int rsa_get_ctx_md_params(void *vprsactx, OSSL_PARAM *params)
OSSL_PARAM_END
};
-static const OSSL_PARAM *sm2sig_gettable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *sm2sig_gettable_ctx_params(ossl_unused void *vpsm2ctx,
+ ossl_unused void *provctx)
{
return known_gettable_ctx_params;
}
OSSL_PARAM_END
};
-static const OSSL_PARAM *sm2sig_settable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *sm2sig_settable_ctx_params(ossl_unused void *vpsm2ctx,
+ ossl_unused void *provctx)
{
/*
* TODO(3.0): Should this function return a different set of settable ctx
return 1;
}
-static const OSSL_PARAM *xor_gen_settable_params(void *provctx)
+static const OSSL_PARAM *xor_gen_settable_params(ossl_unused void *genctx,
+ ossl_unused void *provctx)
{
static OSSL_PARAM settable[] = {
OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME, NULL, 0),