The openssl provider app will now display these params.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12396)
int print_param_types(const char *thing, const OSSL_PARAM *pdefs, int indent)
{
if (pdefs == NULL) {
- BIO_printf(bio_out, "%*sNo declared %s\n", indent, "", thing);
+ return 1;
} else if (pdefs->key == NULL) {
/*
* An empty list? This shouldn't happen, but let's just make sure to
void (*collect_names_fn)(void *method, STACK_OF(OPENSSL_CSTRING) *names);
void *method;
const OSSL_PARAM *gettable_params;
+ const OSSL_PARAM *settable_params;
const OSSL_PARAM *gettable_ctx_params;
const OSSL_PARAM *settable_ctx_params;
+ const OSSL_PARAM *gen_settable_params;
};
struct meta_st {
BIO_printf(bio_out, "%*s%s ", meta->indent, "", meta->label);
print_method_names(bio_out, info);
BIO_printf(bio_out, "\n");
+ print_param_types("settable keygen parameters",
+ info->gen_settable_params, meta->subindent);
+ print_param_types("settable algorithm parameters",
+ info->settable_params, meta->subindent);
print_param_types("retrievable algorithm parameters",
info->gettable_params, meta->subindent);
- print_param_types("retrievable operation parameters",
- info->gettable_ctx_params, meta->subindent);
print_param_types("settable operation parameters",
info->settable_ctx_params, meta->subindent);
+ print_param_types("retrievable operation parameters",
+ info->gettable_ctx_params, meta->subindent);
break;
}
meta->first = 0;
{
INFO info;
+ memset(&info, 0, sizeof(info));
info.collect_names_fn = collect_names_fn;
info.method = method;
info.gettable_params = gettable_params;
meta->total++;
}
+static void do_keymgmt_method(void *method,
+ void (*collect_names_fn)(void *method,
+ STACK_OF(OPENSSL_CSTRING)
+ *names),
+ const OSSL_PARAM *gettable_params,
+ const OSSL_PARAM *settable_params,
+ const OSSL_PARAM *gen_settable_params,
+ META *meta)
+{
+ INFO info;
+
+ memset(&info, 0, sizeof(info));
+ info.collect_names_fn = collect_names_fn;
+ info.method = method;
+ info.gettable_params = gettable_params;
+ info.settable_params = settable_params;
+ info.gen_settable_params = gen_settable_params;
+ meta->fn(meta, &info);
+ meta->total++;
+}
+
static void do_cipher(EVP_CIPHER *cipher, void *meta)
{
do_method(cipher, collect_cipher_names,
static void do_keymgmt(EVP_KEYMGMT *keymgmt, void *meta)
{
- do_method(keymgmt, collect_keymgmt_names,
-/*
- * TODO(3.0) Enable when KEYMGMT and KEYEXCH have gettables and settables
- */
-#if 0
- EVP_KEYMGMT_gettable_params(keymgmt),
- EVP_KEYMGMT_gettable_ctx_params(keymgmt),
- EVP_KEYMGMT_settable_ctx_params(keymgmt),
-#else
- NULL, NULL, NULL,
-#endif
- meta);
+ do_keymgmt_method(keymgmt, collect_keymgmt_names,
+ EVP_KEYMGMT_gettable_params(keymgmt),
+ EVP_KEYMGMT_settable_params(keymgmt),
+ EVP_KEYMGMT_gen_settable_params(keymgmt),
+ meta);
}
static void do_keyexch(EVP_KEYEXCH *keyexch, void *meta)
{
do_method(keyexch, collect_keyexch_names,
-/*
- * TODO(3.0) Enable when KEYMGMT and KEYEXCH have gettables and settables
- */
-#if 0
- EVP_KEYEXCH_gettable_params(keyexch),
+ NULL,
EVP_KEYEXCH_gettable_ctx_params(keyexch),
EVP_KEYEXCH_settable_ctx_params(keyexch),
-#else
- NULL, NULL, NULL,
-#endif
meta);
}
static void do_signature(EVP_SIGNATURE *signature, void *meta)
{
do_method(signature, collect_signature_names,
-/*
- * TODO(3.0) Enable when KEYMGMT and SIGNATURE have gettables and settables
- */
-#if 0
- EVP_SIGNATURE_gettable_params(signature),
+ NULL,
EVP_SIGNATURE_gettable_ctx_params(signature),
EVP_SIGNATURE_settable_ctx_params(signature),
-#else
- NULL, NULL, NULL,
-#endif
meta);
}
if (keyexch->prov != NULL)
evp_names_do_all(keyexch->prov, keyexch->name_id, fn, data);
}
+
+const OSSL_PARAM *EVP_KEYEXCH_gettable_ctx_params(const EVP_KEYEXCH *keyexch)
+{
+ void *provctx;
+
+ if (keyexch == NULL || keyexch->gettable_ctx_params == NULL)
+ return NULL;
+
+ provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(keyexch));
+ return keyexch->gettable_ctx_params(provctx);
+}
+
+const OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch)
+{
+ void *provctx;
+
+ if (keyexch == NULL || keyexch->settable_ctx_params == NULL)
+ return NULL;
+ provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(keyexch));
+ return keyexch->settable_ctx_params(provctx);
+}
#include "crypto/evp.h"
#include "evp_local.h"
-
static void *keymgmt_new(void)
{
EVP_KEYMGMT *keymgmt = NULL;
return keymgmt->gen_set_params(genctx, params);
}
-const OSSL_PARAM *evp_keymgmt_gen_settable_params(const EVP_KEYMGMT *keymgmt)
+const OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt)
{
void *provctx = ossl_provider_ctx(EVP_KEYMGMT_provider(keymgmt));
return keymgmt->get_params(keydata, params);
}
-const OSSL_PARAM *evp_keymgmt_gettable_params(const EVP_KEYMGMT *keymgmt)
+const OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt)
{
void *provctx = ossl_provider_ctx(EVP_KEYMGMT_provider(keymgmt));
return keymgmt->set_params(keydata, params);
}
-const OSSL_PARAM *evp_keymgmt_settable_params(const EVP_KEYMGMT *keymgmt)
+const OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt)
{
void *provctx = ossl_provider_ctx(EVP_KEYMGMT_provider(keymgmt));
|| pkey->keymgmt == NULL
|| pkey->keydata == NULL)
return 0;
- return evp_keymgmt_gettable_params(pkey->keymgmt);
+ return EVP_KEYMGMT_gettable_params(pkey->keymgmt);
}
int EVP_PKEY_get_bn_param(EVP_PKEY *pkey, const char *key_name, BIGNUM **bn)
}
if (EVP_PKEY_CTX_IS_GEN_OP(ctx)
&& ctx->keymgmt != NULL)
- return evp_keymgmt_gen_settable_params(ctx->keymgmt);
+ return EVP_KEYMGMT_gen_settable_params(ctx->keymgmt);
return NULL;
}
evp_names_do_all(signature->prov, signature->name_id, fn, data);
}
+const OSSL_PARAM *EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig)
+{
+ void *provctx;
+
+ if (sig == NULL || sig->gettable_ctx_params == NULL)
+ return NULL;
+
+ provctx = ossl_provider_ctx(EVP_SIGNATURE_provider(sig));
+ return sig->gettable_ctx_params(provctx);
+}
+
+const OSSL_PARAM *EVP_SIGNATURE_settable_ctx_params(const EVP_SIGNATURE *sig)
+{
+ void *provctx;
+
+ if (sig == NULL || sig->settable_ctx_params == NULL)
+ return NULL;
+
+ provctx = ossl_provider_ctx(EVP_SIGNATURE_provider(sig));
+ return sig->settable_ctx_params(provctx);
+}
+
static int evp_pkey_signature_init(EVP_PKEY_CTX *ctx, int operation)
{
int ret = 0;
=head1 NAME
evp_keymgmt_newdata, evp_keymgmt_freedata,
-evp_keymgmt_get_params, evp_keymgmt_gettable_params,
+evp_keymgmt_get_params,
evp_keymgmt_has, evp_keymgmt_validate,
evp_keymgmt_import, evp_keymgmt_import_types,
evp_keymgmt_export, evp_keymgmt_export_types
void evp_keymgmt_freedata(const EVP_KEYMGMT *keymgmt, void *keyddata);
int evp_keymgmt_get_params(const EVP_KEYMGMT *keymgmt,
void *keydata, OSSL_PARAM params[]);
- const OSSL_PARAM *evp_keymgmt_gettable_params(const EVP_KEYMGMT *keymgmt);
int evp_keymgmt_has(const EVP_KEYMGMT *keymgmt, void *keyddata, int selection);
int evp_keymgmt_validate(const EVP_KEYMGMT *keymgmt, void *keydata,
evp_keymgmt_get_params() calls the method's get_params() function.
-evp_keymgmt_gettable_params() calls the method's gettable_params()
-function.
-
evp_keymgmt_has() calls the method's has() function.
evp_keymgmt_validate() calls the method's validate() function.
evp_keymgmt_newdata() returns a pointer to a provider side key object,
or NULL on error.
-evp_keymgmt_gettable_params(), evp_keymgmt_import_types(), and
-evp_keymgmt_export_types() return parameter descriptor for importing
-and exporting key data, or NULL if there are no such descriptors.
+evp_keymgmt_import_types(), and evp_keymgmt_export_types() return a parameter
+descriptor for importing and exporting key data, or NULL if there are no such
+descriptors.
All other functions return 1 on success and 0 on error.
EVP_KEYEXCH_fetch, EVP_KEYEXCH_free, EVP_KEYEXCH_up_ref, EVP_KEYEXCH_provider,
EVP_KEYEXCH_is_a, EVP_KEYEXCH_do_all_provided,
-EVP_KEYEXCH_number, EVP_KEYEXCH_names_do_all
+EVP_KEYEXCH_number, EVP_KEYEXCH_names_do_all,
+EVP_KEYEXCH_gettable_ctx_params, EVP_KEYEXCH_settable_ctx_params
- Functions to manage EVP_KEYEXCH algorithm objects
=head1 SYNOPSIS
void EVP_KEYEXCH_names_do_all(const EVP_KEYEXCH *exchange,
void (*fn)(const char *name, void *data),
void *data);
+ const OSSL_PARAM *EVP_KEYEXCH_gettable_ctx_params(const EVP_KEYEXCH *keyexch);
+ const OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch);
=head1 DESCRIPTION
of the implementations, calls I<fn> with the implementation method and
I<data> as arguments.
+EVP_KEYEXCH_gettable_ctx_params() and EVP_KEYEXCH_settable_ctx_params() return
+a constant B<OSSL_PARAM> array that describes the names and types of key
+parameters that can be retrieved or set by a key exchange algorithm using
+L<EVP_PKEY_CTX_get_params(3)> and L<EVP_PKEY_CTX_set_params(3)>.
+
=head1 RETURN VALUES
EVP_KEYEXCH_fetch() returns a pointer to a B<EVP_KEYEXCH> for success
EVP_KEYEXCH_number() returns an integer.
+EVP_KEYEXCH_gettable_ctx_params() and EVP_KEYEXCH_settable_ctx_params() return
+a constant B<OSSL_PARAM> array or NULL on error.
+
=head1 SEE ALSO
L<provider(7)/Fetching algorithms>, L<OSSL_PROVIDER(3)>
=head1 COPYRIGHT
-Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use
this file except in compliance with the License. You can obtain a copy
EVP_KEYMGMT_is_a,
EVP_KEYMGMT_number,
EVP_KEYMGMT_do_all_provided,
-EVP_KEYMGMT_names_do_all
+EVP_KEYMGMT_names_do_all,
+EVP_KEYMGMT_gettable_params,
+EVP_KEYMGMT_settable_params,
+EVP_KEYMGMT_gen_settable_params
- EVP key management routines
=head1 SYNOPSIS
void EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,
void (*fn)(const char *name, void *data),
void *data);
+ const OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt);
+ const OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt);
+ const OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt);
=head1 DESCRIPTION
of the implementations, calls I<fn> with the implementation method and
I<data> as arguments.
+EVP_KEYMGMT_gettable_params() and EVP_KEYMGMT_settable_params() return a
+constant B<OSSL_PARAM> array that describes the names and types of key
+parameters that can be retrieved or set.
+EVP_KEYMGMT_gettable_params() is used by L<EVP_PKEY_gettable_params(3)>.
+See L<OSSL_PARAM(3)> for the use of B<OSSL_PARAM> as a parameter descriptor.
+
+EVP_KEYMGMT_gen_settable_params() returns a constant B<OSSL_PARAM> array that
+describes the names and types of key generation parameters that can be set via
+L<EVP_PKEY_CTX_set_params(3)>.
+
=head1 NOTES
EVP_KEYMGMT_fetch() may be called implicitly by other fetching
EVP_KEYMGMT_number() returns an integer.
+EVP_KEYMGMT_gettable_params(), EVP_KEYMGMT_settable_params() and
+EVP_KEYMGMT_gen_settable_params() return a constant B<OSSL_PARAM> array or
+NULL on error.
+
=head1 SEE ALSO
L<EVP_MD_fetch(3)>, L<OPENSSL_CTX(3)>
=head1 COPYRIGHT
-Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use
this file except in compliance with the License. You can obtain a copy
EVP_SIGNATURE_fetch, EVP_SIGNATURE_free, EVP_SIGNATURE_up_ref,
EVP_SIGNATURE_number, EVP_SIGNATURE_is_a, EVP_SIGNATURE_provider,
-EVP_SIGNATURE_do_all_provided, EVP_SIGNATURE_names_do_all
+EVP_SIGNATURE_do_all_provided, EVP_SIGNATURE_names_do_all,
+EVP_SIGNATURE_gettable_ctx_params, EVP_SIGNATURE_settable_ctx_params
- Functions to manage EVP_SIGNATURE algorithm objects
=head1 SYNOPSIS
void EVP_SIGNATURE_names_do_all(const EVP_SIGNATURE *signature,
void (*fn)(const char *name, void *data),
void *data);
+ const OSSL_PARAM *EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig);
+ const OSSL_PARAM *EVP_SIGNATURE_settable_ctx_params(const EVP_SIGNATURE *sig);
=head1 DESCRIPTION
EVP_SIGNATURE_names_do_all() traverses all names for I<signature>, and calls
I<fn> with each name and I<data>.
+EVP_SIGNATURE_gettable_ctx_params() and EVP_SIGNATURE_settable_ctx_params()
+return a constant B<OSSL_PARAM> array that describes the names and types of key
+parameters that can be retrieved or set by a signature algorithm using
+L<EVP_PKEY_CTX_get_params(3)> and L<EVP_PKEY_CTX_set_params(3)>.
+
=head1 RETURN VALUES
EVP_SIGNATURE_fetch() returns a pointer to an B<EVP_SIGNATURE> for success
EVP_SIGNATURE_up_ref() returns 1 for success or 0 otherwise.
+EVP_SIGNATURE_gettable_ctx_params() and EVP_SIGNATURE_settable_ctx_params()
+return a constant B<OSSL_PARAM> array or NULL on error.
+
=head1 SEE ALSO
L<provider(7)/Fetching algorithms>, L<OSSL_PROVIDER(3)>
=head1 COPYRIGHT
-Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use
this file except in compliance with the License. You can obtain a copy
void evp_keymgmt_freedata(const EVP_KEYMGMT *keymgmt, void *keyddata);
int evp_keymgmt_get_params(const EVP_KEYMGMT *keymgmt,
void *keydata, OSSL_PARAM params[]);
-const OSSL_PARAM *evp_keymgmt_gettable_params(const EVP_KEYMGMT *keymgmt);
int evp_keymgmt_set_params(const EVP_KEYMGMT *keymgmt,
void *keydata, const OSSL_PARAM params[]);
-const OSSL_PARAM *evp_keymgmt_settable_params(const EVP_KEYMGMT *keymgmt);
-
void *evp_keymgmt_gen_init(const EVP_KEYMGMT *keymgmt, int selection);
int evp_keymgmt_gen_set_template(const EVP_KEYMGMT *keymgmt, void *genctx,
void *template);
int evp_keymgmt_gen_set_params(const EVP_KEYMGMT *keymgmt, void *genctx,
const OSSL_PARAM params[]);
-const OSSL_PARAM *
-evp_keymgmt_gen_settable_params(const EVP_KEYMGMT *keymgmt);
void *evp_keymgmt_gen(const EVP_KEYMGMT *keymgmt, void *genctx,
OSSL_CALLBACK *cb, void *cbarg);
void evp_keymgmt_gen_cleanup(const EVP_KEYMGMT *keymgmt, void *genctx);
void EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,
void (*fn)(const char *name, void *data),
void *data);
+const OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt);
+const OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt);
+const OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt);
EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
void EVP_SIGNATURE_names_do_all(const EVP_SIGNATURE *signature,
void (*fn)(const char *name, void *data),
void *data);
+const OSSL_PARAM *EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig);
+const OSSL_PARAM *EVP_SIGNATURE_settable_ctx_params(const EVP_SIGNATURE *sig);
void EVP_ASYM_CIPHER_free(EVP_ASYM_CIPHER *cipher);
int EVP_ASYM_CIPHER_up_ref(EVP_ASYM_CIPHER *cipher);
void EVP_KEYEXCH_names_do_all(const EVP_KEYEXCH *keyexch,
void (*fn)(const char *name, void *data),
void *data);
+const OSSL_PARAM *EVP_KEYEXCH_gettable_ctx_params(const EVP_KEYEXCH *keyexch);
+const OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch);
void EVP_add_alg_module(void);
EVP_PKEY_CTX_get0_dh_kdf_ukm ? 3_0_0 EXIST::FUNCTION:DH
EVP_CIPHER_CTX_get_iv_state ? 3_0_0 EXIST::FUNCTION:
EVP_CIPHER_CTX_get_iv ? 3_0_0 EXIST::FUNCTION:
+EVP_KEYMGMT_gettable_params ? 3_0_0 EXIST::FUNCTION:
+EVP_KEYMGMT_settable_params ? 3_0_0 EXIST::FUNCTION:
+EVP_KEYMGMT_gen_settable_params ? 3_0_0 EXIST::FUNCTION:
+EVP_SIGNATURE_gettable_ctx_params ? 3_0_0 EXIST::FUNCTION:
+EVP_SIGNATURE_settable_ctx_params ? 3_0_0 EXIST::FUNCTION:
+EVP_KEYEXCH_gettable_ctx_params ? 3_0_0 EXIST::FUNCTION:
+EVP_KEYEXCH_settable_ctx_params ? 3_0_0 EXIST::FUNCTION: