Skip to content

Commit ada66e7

Browse files
committed
Deprecate the low level Diffie-Hellman functions.
Use of the low level DH functions has been informally discouraged for a long time. We now formally deprecate them. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from #11024)
1 parent 0ad05b1 commit ada66e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+440
-191
lines changed

apps/lib/s_cb.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,20 @@ static int security_callback_debug(const SSL *s, const SSL_CTX *ctx,
14341434
case SSL_SECOP_OTHER_DH:
14351435
{
14361436
DH *dh = other;
1437-
BIO_printf(sdb->out, "%d", DH_bits(dh));
1437+
EVP_PKEY *pkey = EVP_PKEY_new();
1438+
int fail = 1;
1439+
1440+
if (pkey != NULL) {
1441+
if (EVP_PKEY_set1_DH(pkey, dh)) {
1442+
BIO_printf(sdb->out, "%d", EVP_PKEY_bits(pkey));
1443+
fail = 0;
1444+
}
1445+
1446+
EVP_PKEY_free(pkey);
1447+
}
1448+
if (fail)
1449+
BIO_printf(sdb->out, "s_cb.c:security_callback_debug op=0x%x",
1450+
op);
14381451
break;
14391452
}
14401453
#endif

apps/progs.pl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@
9292

9393
my %cmd_disabler = (
9494
ciphers => "sock",
95-
gendh => "dh",
9695
pkcs12 => "des",
9796
);
9897
my %cmd_deprecated = (

crypto/dh/dh_ameth.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
* https://www.openssl.org/source/license.html
88
*/
99

10+
/*
11+
* DH low level APIs are deprecated for public use, but still ok for
12+
* internal use.
13+
*/
14+
#include "internal/deprecated.h"
15+
1016
#include <stdio.h>
1117
#include "internal/cryptlib.h"
1218
#include <openssl/x509.h>

crypto/dh/dh_asn1.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
* https://www.openssl.org/source/license.html
88
*/
99

10+
/*
11+
* DH low level APIs are deprecated for public use, but still ok for
12+
* internal use.
13+
*/
14+
#include "internal/deprecated.h"
15+
1016
#include <stdio.h>
1117
#include "internal/cryptlib.h"
1218
#include <openssl/bn.h>

crypto/dh/dh_check.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
* https://www.openssl.org/source/license.html
88
*/
99

10+
/*
11+
* DH low level APIs are deprecated for public use, but still ok for
12+
* internal use.
13+
*/
14+
#include "internal/deprecated.h"
15+
1016
#include <stdio.h>
1117
#include "internal/cryptlib.h"
1218
#include <openssl/bn.h>

crypto/dh/dh_depr.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99

1010
/* This file contains deprecated functions as wrappers to the new ones */
1111

12+
/*
13+
* DH low level APIs are deprecated for public use, but still ok for
14+
* internal use.
15+
*/
16+
#include "internal/deprecated.h"
17+
1218
#include <openssl/opensslconf.h>
1319
#ifdef OPENSSL_NO_DEPRECATED_0_9_8
1420
NON_EMPTY_TRANSLATION_UNIT

crypto/dh/dh_gen.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
* dh_depr.c as wrappers to these ones. - Geoff
1313
*/
1414

15+
/*
16+
* DH low level APIs are deprecated for public use, but still ok for
17+
* internal use.
18+
*/
19+
#include "internal/deprecated.h"
20+
1521
#include <stdio.h>
1622
#include "internal/cryptlib.h"
1723
#include <openssl/bn.h>

crypto/dh/dh_group_params.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99

1010
/* DH parameters from RFC7919 and RFC3526 */
1111

12+
/*
13+
* DH low level APIs are deprecated for public use, but still ok for
14+
* internal use.
15+
*/
16+
#include "internal/deprecated.h"
17+
1218
#include <stdio.h>
1319
#include "internal/cryptlib.h"
1420
#include "dh_local.h"

crypto/dh/dh_kdf.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
* https://www.openssl.org/source/license.html
88
*/
99

10+
/*
11+
* DH low level APIs are deprecated for public use, but still ok for
12+
* internal use.
13+
*/
14+
#include "internal/deprecated.h"
15+
1016
#include "e_os.h"
1117

1218
#ifndef OPENSSL_NO_CMS

crypto/dh/dh_key.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
* https://www.openssl.org/source/license.html
88
*/
99

10+
/*
11+
* DH low level APIs are deprecated for public use, but still ok for
12+
* internal use.
13+
*/
14+
#include "internal/deprecated.h"
15+
1016
#include <stdio.h>
1117
#include "internal/cryptlib.h"
1218
#include "dh_local.h"

0 commit comments

Comments
 (0)