summaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2021-03-02 15:52:00 +0000
committerMatt Caswell <matt@openssl.org>2021-03-08 15:13:09 +0000
commit7bc0fdd3fd4535e06c35b92d71afab9a6de94cc5 (patch)
tree2e57cd75e2b81a4ae2bc8d375096e094f8b5b0e5 /crypto/dh
parentcc57dc962516410f6269023c8a93913617414b5e (diff)
Make the EVP_PKEY_get0* functions have a const return type
OTC have decided that the EVP_PKEY_get0* functions should have a const return type. This is a breaking change to emphasise that these values should be considered as immutable. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14319)
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_ameth.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c
index 338f308934..18f4c9955e 100644
--- a/crypto/dh/dh_ameth.c
+++ b/crypto/dh/dh_ameth.c
@@ -433,7 +433,10 @@ static int dh_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
{
switch (op) {
case ASN1_PKEY_CTRL_SET1_TLS_ENCPT:
- return ossl_dh_buf2key(EVP_PKEY_get0_DH(pkey), arg2, arg1);
+ /* We should only be here if we have a legacy key */
+ if (!ossl_assert(evp_pkey_is_legacy(pkey)))
+ return 0;
+ return ossl_dh_buf2key(evp_pkey_get0_DH_int(pkey), arg2, arg1);
case ASN1_PKEY_CTRL_GET1_TLS_ENCPT:
return ossl_dh_key2buf(EVP_PKEY_get0_DH(pkey), arg2, 0, 1);
default: