]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Make evp_pkey_ctx_get0_libctx/propq public API
authorMatt Caswell <matt@openssl.org>
Mon, 12 Oct 2020 16:12:03 +0000 (17:12 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 15 Oct 2020 09:00:28 +0000 (10:00 +0100)
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)

crypto/cms/cms_ec.c
crypto/evp/pmeth_lib.c
doc/man3/EVP_PKEY_CTX_get0_libctx.pod [new file with mode: 0644]
include/crypto/evp.h
include/openssl/evp.h
util/libcrypto.num

index 394c8b4dc34ac8af47e1573b077d791004ab4ae3..ca2294ebc309429ab1bbc60ee43af5af5e1fbf23 100644 (file)
@@ -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;
     }
index 8cd95956f898df4524b4432aa729d4a50700cd07..042035a75a84b7541816ee9689c5536b23d82e4b 100644 (file)
@@ -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 (file)
index 0000000..2536ae8
--- /dev/null
@@ -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
index 86b85960e7d2f4b5be7879c7442dd6838565356c..ac20b5b51209ed81e51aeed1959adb8281e2e13e 100644 (file)
@@ -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);
index 8c2d00813ca6324f2a4daac594a61de9035d4905..5527709be08975f43c8de1b6c75f7a9fc8047217 100644 (file)
@@ -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
index fb0069c9e866b0d2a85c8ed0b13c9515feeea982..12ba1036890709a408aa3e8d80352ed3058a7957 100644 (file)
@@ -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: