summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-10-12 17:12:03 +0100
committerMatt Caswell <matt@openssl.org>2020-10-15 10:00:28 +0100
commit29000e43ea257bf54f6ccb2064b3744853b821b2 (patch)
tree37790003f0f3683ec8cc8836499afb2844b90fa9
parent0d30e15a57fdd9c27a9148c17289a1005345f0c7 (diff)
downloadopenssl-new-29000e43ea257bf54f6ccb2064b3744853b821b2.tar.gz
Make evp_pkey_ctx_get0_libctx/propq public API
These were previously added as an internal API. But since the CMS code needs them, other code might do too. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13088)
-rw-r--r--crypto/cms/cms_ec.c5
-rw-r--r--crypto/evp/pmeth_lib.c4
-rw-r--r--doc/man3/EVP_PKEY_CTX_get0_libctx.pod45
-rw-r--r--include/crypto/evp.h2
-rw-r--r--include/openssl/evp.h3
-rw-r--r--util/libcrypto.num2
6 files changed, 54 insertions, 7 deletions
diff --git a/crypto/cms/cms_ec.c b/crypto/cms/cms_ec.c
index 394c8b4dc3..ca2294ebc3 100644
--- a/crypto/cms/cms_ec.c
+++ b/crypto/cms/cms_ec.c
@@ -100,10 +100,9 @@ static int ecdh_cms_set_peerkey(EVP_PKEY_CTX *pctx,
if (!EVP_PKEY_copy_parameters(pkpeer, pk))
goto err;
} else {
- /* TODO(3.0): Should the get0_libctx/propq calls actually be public API? */
pkpeer = pkey_type2param(atype, aval,
- evp_pkey_ctx_get0_libctx(pctx),
- evp_pkey_ctx_get0_propq(pctx));
+ EVP_PKEY_CTX_get0_libctx(pctx),
+ EVP_PKEY_CTX_get0_propq(pctx));
if (pkpeer == NULL)
goto err;
}
diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c
index 8cd95956f8..042035a75a 100644
--- a/crypto/evp/pmeth_lib.c
+++ b/crypto/evp/pmeth_lib.c
@@ -1762,12 +1762,12 @@ int evp_pkey_ctx_use_cached_data(EVP_PKEY_CTX *ctx)
return ret;
}
-OPENSSL_CTX *evp_pkey_ctx_get0_libctx(EVP_PKEY_CTX *ctx)
+OPENSSL_CTX *EVP_PKEY_CTX_get0_libctx(EVP_PKEY_CTX *ctx)
{
return ctx->libctx;
}
-const char *evp_pkey_ctx_get0_propq(EVP_PKEY_CTX *ctx)
+const char *EVP_PKEY_CTX_get0_propq(EVP_PKEY_CTX *ctx)
{
return ctx->propquery;
}
diff --git a/doc/man3/EVP_PKEY_CTX_get0_libctx.pod b/doc/man3/EVP_PKEY_CTX_get0_libctx.pod
new file mode 100644
index 0000000000..2536ae820e
--- /dev/null
+++ b/doc/man3/EVP_PKEY_CTX_get0_libctx.pod
@@ -0,0 +1,45 @@
+=pod
+
+=head1 NAME
+
+EVP_PKEY_CTX_get0_libctx,
+EVP_PKEY_CTX_get0_propq
+- functions for getting OPENSSL_CTX and property query data from an EVP_PKEY_CTX
+
+=head1 SYNOPSIS
+
+ #include <openssl/evp.h>
+
+ OPENSSL_CTX *EVP_PKEY_CTX_get0_libctx(EVP_PKEY_CTX *ctx);
+ const char *EVP_PKEY_CTX_get0_propq(EVP_PKEY_CTX *ctx);
+
+=head1 DESCRIPTION
+
+The EVP_PKEY_CTX_get0_libctx() and EVP_PKEY_CTX_get0_propq() functions obtain
+the OPENSSL_CTX and property query string values respectively that were
+associated with the EVP_PKEY_CTX when it was constructed.
+
+=head1 RETURN VALUES
+
+EVP_PKEY_CTX_get0_libctx() and EVP_PKEY_CTX_get0_propq() functions return the
+OPENSSL_CTX and property query string associated with the EVP_PKEY_CTX or NULL
+if they are not set. The returned values should not be freed by the caller.
+
+=head1 SEE ALSO
+
+L<EVP_PKEY_CTX_new(3)>
+
+=head1 HISTORY
+
+All functions were added in OpenSSL 3.0.
+
+=head1 COPYRIGHT
+
+Copyright 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
+in the file LICENSE in the source distribution or at
+L<https://www.openssl.org/source/license.html>.
+
+=cut
diff --git a/include/crypto/evp.h b/include/crypto/evp.h
index 86b85960e7..ac20b5b512 100644
--- a/include/crypto/evp.h
+++ b/include/crypto/evp.h
@@ -835,8 +835,6 @@ int evp_pkey_ctx_get1_id_len_prov(EVP_PKEY_CTX *ctx, size_t *id_len);
int evp_pkey_ctx_use_cached_data(EVP_PKEY_CTX *ctx);
#endif /* !defined(FIPS_MODULE) */
-OPENSSL_CTX *evp_pkey_ctx_get0_libctx(EVP_PKEY_CTX *ctx);
-const char *evp_pkey_ctx_get0_propq(EVP_PKEY_CTX *ctx);
void evp_method_store_flush(OPENSSL_CTX *libctx);
int evp_set_default_properties_int(OPENSSL_CTX *libctx, const char *propq,
int loadconfig);
diff --git a/include/openssl/evp.h b/include/openssl/evp.h
index 8c2d00813c..5527709be0 100644
--- a/include/openssl/evp.h
+++ b/include/openssl/evp.h
@@ -1966,6 +1966,9 @@ int EVP_hex2ctrl(int (*cb)(void *ctx, int cmd, void *buf, size_t buflen),
int EVP_PKEY_CTX_set_group_name(EVP_PKEY_CTX *ctx, const char *name);
int EVP_PKEY_CTX_get_group_name(EVP_PKEY_CTX *ctx, char *name, size_t namelen);
+OPENSSL_CTX *EVP_PKEY_CTX_get0_libctx(EVP_PKEY_CTX *ctx);
+const char *EVP_PKEY_CTX_get0_propq(EVP_PKEY_CTX *ctx);
+
# ifdef __cplusplus
}
# endif
diff --git a/util/libcrypto.num b/util/libcrypto.num
index fb0069c9e8..12ba103689 100644
--- a/util/libcrypto.num
+++ b/util/libcrypto.num
@@ -5288,3 +5288,5 @@ PKCS7_type_is_other ? 3_0_0 EXIST::FUNCTION:
PKCS7_get_octet_string ? 3_0_0 EXIST::FUNCTION:
OSSL_DECODER_from_data ? 3_0_0 EXIST::FUNCTION:
OSSL_ENCODER_to_data ? 3_0_0 EXIST::FUNCTION:
+EVP_PKEY_CTX_get0_libctx ? 3_0_0 EXIST::FUNCTION:
+EVP_PKEY_CTX_get0_propq ? 3_0_0 EXIST::FUNCTION: