aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Mraz <[email protected]>2025-03-04 18:43:18 +0100
committerTomas Mraz <[email protected]>2025-03-14 09:51:40 +0100
commit18a17538cf713806ad4fc81f1347c1745a2e6819 (patch)
tree0141952485bff96a90cce6bf3f59f8e00187d9ee
parentUpdated SSL_SESSION_get0_hostname() documentation to be consistent with the f... (diff)
downloadopenssl-3.1.tar.gz
openssl-3.1.zip
Keep the provided peer EVP_PKEY in the EVP_PKEY_CTX tooopenssl-3.1
Reviewed-by: Tim Hudson <[email protected]> Reviewed-by: Dmitry Belyavskiy <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/26976) (cherry picked from commit 2656922febfc36f6b44cff1c363917685633b4c5)
-rw-r--r--crypto/evp/exchange.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/evp/exchange.c b/crypto/evp/exchange.c
index d7a4ad142aa..224fd6dc868 100644
--- a/crypto/evp/exchange.c
+++ b/crypto/evp/exchange.c
@@ -430,7 +430,13 @@ int EVP_PKEY_derive_set_peer_ex(EVP_PKEY_CTX *ctx, EVP_PKEY *peer,
*/
if (provkey == NULL)
goto legacy;
- return ctx->op.kex.exchange->set_peer(ctx->op.kex.algctx, provkey);
+ ret = ctx->op.kex.exchange->set_peer(ctx->op.kex.algctx, provkey);
+ if (ret <= 0)
+ return ret;
+ EVP_PKEY_free(ctx->peerkey);
+ ctx->peerkey = peer;
+ EVP_PKEY_up_ref(peer);
+ return 1;
legacy:
#ifdef FIPS_MODULE