From: Matt Caswell Date: Mon, 12 Oct 2020 16:12:03 +0000 (+0100) Subject: Make evp_pkey_ctx_get0_libctx/propq public API X-Git-Tag: openssl-3.0.0-alpha7~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=29000e43ea257bf54f6ccb2064b3744853b821b2;p=thirdparty%2Fopenssl.git 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 (Merged from https://github.com/openssl/openssl/pull/13088) --- 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_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 + +=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. + +=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: