diff options
author | Enji Cooper <ngie@FreeBSD.org> | 2025-07-11 00:18:38 +0000 |
---|---|---|
committer | Enji Cooper <ngie@FreeBSD.org> | 2025-07-11 00:18:38 +0000 |
commit | ecf8229ffeb17a05c78fab6b973b0cccb84e25c5 (patch) | |
tree | da8cf5ccc84d9bc3fbadcf674c7d501f9ca7ab5d /crypto/evp/exchange.c | |
parent | 1c34280346af8284acdc0eae39496811d37df25d (diff) |
Diffstat (limited to 'crypto/evp/exchange.c')
-rw-r--r-- | crypto/evp/exchange.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/evp/exchange.c b/crypto/evp/exchange.c index d7a4ad142aa7..859c77ca420e 100644 --- a/crypto/evp/exchange.c +++ b/crypto/evp/exchange.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2019-2025 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 @@ -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 |