summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-09-22 10:36:50 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-09-26 07:13:21 +1000
commit5a9500488d2e96a917c12b8041584129810bf62c (patch)
tree3b11a833dbcbb7e492b84ea7a38ad77333b02be8
parentd3edef83f5fa378237fcece038f9aff9f89f34cd (diff)
Add EVP_KEM_gettable_ctx_params() and EVP_KEM_settable_ctx_params()
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12943)
-rw-r--r--crypto/evp/kem.c23
-rw-r--r--doc/man3/EVP_KEM_free.pod13
-rw-r--r--include/openssl/evp.h2
3 files changed, 36 insertions, 2 deletions
diff --git a/crypto/evp/kem.c b/crypto/evp/kem.c
index 6f0424075a..5b13f0130a 100644
--- a/crypto/evp/kem.c
+++ b/crypto/evp/kem.c
@@ -349,7 +349,6 @@ void EVP_KEM_do_all_provided(OPENSSL_CTX *libctx,
(void (*)(void *))EVP_KEM_free);
}
-
void EVP_KEM_names_do_all(const EVP_KEM *kem,
void (*fn)(const char *name, void *data),
void *data)
@@ -357,3 +356,25 @@ void EVP_KEM_names_do_all(const EVP_KEM *kem,
if (kem->prov != NULL)
evp_names_do_all(kem->prov, kem->name_id, fn, data);
}
+
+const OSSL_PARAM *EVP_KEM_gettable_ctx_params(const EVP_KEM *kem)
+{
+ void *provctx;
+
+ if (kem == NULL || kem->gettable_ctx_params == NULL)
+ return NULL;
+
+ provctx = ossl_provider_ctx(EVP_KEM_provider(kem));
+ return kem->gettable_ctx_params(provctx);
+}
+
+const OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem)
+{
+ void *provctx;
+
+ if (kem == NULL || kem->settable_ctx_params == NULL)
+ return NULL;
+
+ provctx = ossl_provider_ctx(EVP_KEM_provider(kem));
+ return kem->settable_ctx_params(provctx);
+}
diff --git a/doc/man3/EVP_KEM_free.pod b/doc/man3/EVP_KEM_free.pod
index 0e3ca12ae3..de3bee951d 100644
--- a/doc/man3/EVP_KEM_free.pod
+++ b/doc/man3/EVP_KEM_free.pod
@@ -4,7 +4,8 @@
EVP_KEM_fetch, EVP_KEM_free, EVP_KEM_up_ref,
EVP_KEM_number, EVP_KEM_is_a, EVP_KEM_provider,
-EVP_KEM_do_all_provided, EVP_KEM_names_do_all
+EVP_KEM_do_all_provided, EVP_KEM_names_do_all,
+EVP_KEM_gettable_ctx_params, EVP_KEM_settable_ctx_params
- Functions to manage EVP_KEM algorithm objects
=head1 SYNOPSIS
@@ -22,6 +23,8 @@ EVP_KEM_do_all_provided, EVP_KEM_names_do_all
void (*fn)(EVP_KEM *kem, void *arg), void *arg);
void EVP_KEM_names_do_all(const EVP_KEM *kem,
void (*fn)(const char *name, void *data), void *data);
+ const OSSL_PARAM *EVP_KEM_gettable_ctx_params(const EVP_KEM *kem);
+ const OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem);
=head1 DESCRIPTION
@@ -55,6 +58,11 @@ EVP_KEM_number() returns the internal dynamic number assigned to I<kem>.
EVP_KEM_names_do_all() traverses all names for I<kem>, and calls I<fn> with
each name and I<data>.
+EVP_KEM_gettable_ctx_params() and EVP_KEM_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 encapsulation algorithm using
+L<EVP_PKEY_CTX_get_params(3)> and L<EVP_PKEY_CTX_set_params(3)>.
+
=head1 RETURN VALUES
EVP_KEM_fetch() returns a pointer to an B<EVP_KEM> for success or B<NULL> for
@@ -62,6 +70,9 @@ failure.
EVP_KEM_up_ref() returns 1 for success or 0 otherwise.
+EVP_KEM_gettable_ctx_params() and EVP_KEM_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)>
diff --git a/include/openssl/evp.h b/include/openssl/evp.h
index 2948c2c542..8c9996b948 100644
--- a/include/openssl/evp.h
+++ b/include/openssl/evp.h
@@ -1687,6 +1687,8 @@ void EVP_KEM_do_all_provided(OPENSSL_CTX *libctx,
void (*fn)(EVP_KEM *wrap, void *arg), void *arg);
void EVP_KEM_names_do_all(const EVP_KEM *wrap,
void (*fn)(const char *name, void *data), void *data);
+const OSSL_PARAM *EVP_KEM_gettable_ctx_params(const EVP_KEM *kem);
+const OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem);
int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,