Skip to content

Commit 0ec6898

Browse files
dkgkroeckx
authored andcommitted
Allow ECDHE and DHE as forward-compatible aliases for EECDH and EDH
see RT openssl#3203 Future versions of OpenSSL use the canonical terms "ECDHE" and "DHE" as configuration strings and compilation constants. This patch introduces aliases so that the stable 1.0.2 branch can be forward-compatible with code and configuration scripts that use the normalized terms, while avoiding changing any library output for stable users. Signed-off-by: Kurt Roeckx <[email protected]> Reviewed-by: Matt Caswell <[email protected]>
1 parent 1e10aee commit 0ec6898

11 files changed

+66
-15
lines changed

doc/apps/ciphers.pod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,12 @@ cipher suites using RSA key exchange.
177177
cipher suites using DH key agreement and DH certificates signed by CAs with RSA
178178
and DSS keys or either respectively.
179179

180-
=item B<kEDH>
180+
=item B<kDHE>, B<kEDH>
181181

182182
cipher suites using ephemeral DH key agreement, including anonymous cipher
183183
suites.
184184

185-
=item B<EDH>
185+
=item B<DHE>, B<EDH>
186186

187187
cipher suites using authenticated ephemeral DH key agreement.
188188

@@ -200,12 +200,12 @@ cipher suites using DH, including anonymous DH, ephemeral DH and fixed DH.
200200
cipher suites using fixed ECDH key agreement signed by CAs with RSA and ECDSA
201201
keys or either respectively.
202202

203-
=item B<kEECDH>
203+
=item B<kECDHE>, B<kEECDH>
204204

205205
cipher suites using ephemeral ECDH key agreement, including anonymous
206206
cipher suites.
207207

208-
=item B<EECDHE>
208+
=item B<ECDHE>, B<EECDH>
209209

210210
cipher suites using authenticated ephemeral ECDH key agreement.
211211

doc/ssl/SSL_CIPHER_get_name.pod

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,24 @@ If SSL_CIPHER_description() cannot handle a built-in cipher, the according
109109
description of the cipher property is B<unknown>. This case should not
110110
occur.
111111

112+
The standard terminology for ephemeral Diffie-Hellman schemes is DHE
113+
(finite field) or ECDHE (elliptic curve). This version of OpenSSL
114+
idiosyncratically reports these schemes as EDH and EECDH, even though
115+
it also accepts the standard terminology.
116+
117+
It is recommended to use the standard terminology (DHE and ECDHE)
118+
during configuration (e.g. via SSL_CTX_set_cipher_list) for clarity of
119+
configuration. OpenSSL versions after 1.0.2 will report the standard
120+
terms via SSL_CIPHER_get_name and SSL_CIPHER_description.
121+
112122
=head1 RETURN VALUES
113123

114124
See DESCRIPTION
115125

116126
=head1 SEE ALSO
117127

118128
L<ssl(3)|ssl(3)>, L<SSL_get_current_cipher(3)|SSL_get_current_cipher(3)>,
119-
L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, L<ciphers(1)|ciphers(1)>
129+
L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, L<ciphers(1)|ciphers(1)>,
130+
L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>
120131

121132
=cut

doc/ssl/SSL_CTX_set_cipher_list.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ RSA export ciphers with a keylength of 512 bits for the RSA key require
4141
a temporary 512 bit RSA key, as typically the supplied key has a length
4242
of 1024 bit (see
4343
L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>).
44-
RSA ciphers using EDH need a certificate and key and additional DH-parameters
44+
RSA ciphers using DHE need a certificate and key and additional DH-parameters
4545
(see L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>).
4646

4747
A DSA cipher can only be chosen, when a DSA certificate is available.

doc/ssl/SSL_CTX_set_options.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ can only be used for signature operations (namely under export ciphers
165165
with restricted RSA keylength). By setting this option, ephemeral
166166
RSA keys are always used. This option breaks compatibility with the
167167
SSL/TLS specifications and may lead to interoperability problems with
168-
clients and should therefore never be used. Ciphers with EDH (ephemeral
168+
clients and should therefore never be used. Ciphers with DHE (ephemeral
169169
Diffie-Hellman) key exchange should be used instead.
170170

171171
=item SSL_OP_CIPHER_SERVER_PREFERENCE

doc/ssl/SSL_CTX_set_tmp_rsa_callback.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ the TLS standard, when the RSA key can be used for signing only, that is
7070
for export ciphers. Using ephemeral RSA key exchange for other purposes
7171
violates the standard and can break interoperability with clients.
7272
It is therefore strongly recommended to not use ephemeral RSA key
73-
exchange and use EDH (Ephemeral Diffie-Hellman) key exchange instead
73+
exchange and use DHE (Ephemeral Diffie-Hellman) key exchange instead
7474
in order to achieve forward secrecy (see
7575
L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>).
7676

doc/ssleay.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6026,7 +6026,7 @@ one at a time, or use 'aliases' to specify the preference and order for
60266026
the ciphers.
60276027

60286028
There are a large number of aliases, but the most importaint are
6029-
kRSA, kDHr, kDHd and kEDH for key exchange types.
6029+
kRSA, kDHr, kDHd and kDHE for key exchange types.
60306030

60316031
aRSA, aDSS, aNULL and aDH for authentication
60326032
DES, 3DES, RC4, RC2, IDEA and eNULL for ciphers

ssl/ssl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,13 @@ extern "C" {
245245
#define SSL_TXT_kDHd "kDHd"
246246
#define SSL_TXT_kDH "kDH"
247247
#define SSL_TXT_kEDH "kEDH"
248+
#define SSL_TXT_kDHE "kDHE" /* alias for kEDH */
248249
#define SSL_TXT_kKRB5 "kKRB5"
249250
#define SSL_TXT_kECDHr "kECDHr"
250251
#define SSL_TXT_kECDHe "kECDHe"
251252
#define SSL_TXT_kECDH "kECDH"
252253
#define SSL_TXT_kEECDH "kEECDH"
254+
#define SSL_TXT_kECDHE "kECDHE" /* alias for kEECDH */
253255
#define SSL_TXT_kPSK "kPSK"
254256
#define SSL_TXT_kGOST "kGOST"
255257
#define SSL_TXT_kSRP "kSRP"
@@ -269,10 +271,12 @@ extern "C" {
269271
#define SSL_TXT_DSS "DSS"
270272
#define SSL_TXT_DH "DH"
271273
#define SSL_TXT_EDH "EDH" /* same as "kEDH:-ADH" */
274+
#define SSL_TXT_DHE "DHE" /* alias for EDH */
272275
#define SSL_TXT_ADH "ADH"
273276
#define SSL_TXT_RSA "RSA"
274277
#define SSL_TXT_ECDH "ECDH"
275278
#define SSL_TXT_EECDH "EECDH" /* same as "kEECDH:-AECDH" */
279+
#define SSL_TXT_ECDHE "ECDHE" /* alias for ECDHE" */
276280
#define SSL_TXT_AECDH "AECDH"
277281
#define SSL_TXT_ECDSA "ECDSA"
278282
#define SSL_TXT_KRB5 "KRB5"

ssl/ssl3.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,17 @@ extern "C" {
155155
#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010
156156

157157
#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA 0x03000011
158+
#define SSL3_CK_DHE_DSS_DES_40_CBC_SHA SSL3_CK_EDH_DSS_DES_40_CBC_SHA
158159
#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA 0x03000012
160+
#define SSL3_CK_DHE_DSS_DES_64_CBC_SHA SSL3_CK_EDH_DSS_DES_64_CBC_SHA
159161
#define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA 0x03000013
162+
#define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA SSL3_CK_EDH_DSS_DES_192_CBC3_SHA
160163
#define SSL3_CK_EDH_RSA_DES_40_CBC_SHA 0x03000014
164+
#define SSL3_CK_DHE_RSA_DES_40_CBC_SHA SSL3_CK_EDH_RSA_DES_40_CBC_SHA
161165
#define SSL3_CK_EDH_RSA_DES_64_CBC_SHA 0x03000015
166+
#define SSL3_CK_DHE_RSA_DES_64_CBC_SHA SSL3_CK_EDH_RSA_DES_64_CBC_SHA
162167
#define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA 0x03000016
168+
#define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA SSL3_CK_EDH_RSA_DES_192_CBC3_SHA
163169

164170
#define SSL3_CK_ADH_RC4_40_MD5 0x03000017
165171
#define SSL3_CK_ADH_RC4_128_MD5 0x03000018
@@ -213,6 +219,17 @@ extern "C" {
213219
#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA"
214220
#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA"
215221

222+
#define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA "EXP-DHE-DSS-DES-CBC-SHA"
223+
#define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA "DHE-DSS-DES-CBC-SHA"
224+
#define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA "DHE-DSS-DES-CBC3-SHA"
225+
#define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA "EXP-DHE-RSA-DES-CBC-SHA"
226+
#define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA "DHE-RSA-DES-CBC-SHA"
227+
#define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA "DHE-RSA-DES-CBC3-SHA"
228+
229+
/* This next block of six "EDH" labels is for backward compatibility
230+
with older versions of OpenSSL. New code should use the six "DHE"
231+
labels above instead:
232+
*/
216233
#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA"
217234
#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA"
218235
#define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA"

ssl/ssl_ciph.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ static const SSL_CIPHER cipher_aliases[]={
242242
{0,SSL_TXT_kDHd,0, SSL_kDHd, 0,0,0,0,0,0,0,0},
243243
{0,SSL_TXT_kDH,0, SSL_kDHr|SSL_kDHd,0,0,0,0,0,0,0,0},
244244
{0,SSL_TXT_kEDH,0, SSL_kEDH, 0,0,0,0,0,0,0,0},
245+
{0,SSL_TXT_kDHE,0, SSL_kEDH, 0,0,0,0,0,0,0,0},
245246
{0,SSL_TXT_DH,0, SSL_kDHr|SSL_kDHd|SSL_kEDH,0,0,0,0,0,0,0,0},
246247

247248
{0,SSL_TXT_kKRB5,0, SSL_kKRB5, 0,0,0,0,0,0,0,0},
@@ -250,6 +251,7 @@ static const SSL_CIPHER cipher_aliases[]={
250251
{0,SSL_TXT_kECDHe,0, SSL_kECDHe,0,0,0,0,0,0,0,0},
251252
{0,SSL_TXT_kECDH,0, SSL_kECDHr|SSL_kECDHe,0,0,0,0,0,0,0,0},
252253
{0,SSL_TXT_kEECDH,0, SSL_kEECDH,0,0,0,0,0,0,0,0},
254+
{0,SSL_TXT_kECDHE,0, SSL_kEECDH,0,0,0,0,0,0,0,0},
253255
{0,SSL_TXT_ECDH,0, SSL_kECDHr|SSL_kECDHe|SSL_kEECDH,0,0,0,0,0,0,0,0},
254256

255257
{0,SSL_TXT_kPSK,0, SSL_kPSK, 0,0,0,0,0,0,0,0},
@@ -274,7 +276,9 @@ static const SSL_CIPHER cipher_aliases[]={
274276

275277
/* aliases combining key exchange and server authentication */
276278
{0,SSL_TXT_EDH,0, SSL_kEDH,~SSL_aNULL,0,0,0,0,0,0,0},
279+
{0,SSL_TXT_DHE,0, SSL_kEDH,~SSL_aNULL,0,0,0,0,0,0,0},
277280
{0,SSL_TXT_EECDH,0, SSL_kEECDH,~SSL_aNULL,0,0,0,0,0,0,0},
281+
{0,SSL_TXT_ECDHE,0, SSL_kEECDH,~SSL_aNULL,0,0,0,0,0,0,0},
278282
{0,SSL_TXT_NULL,0, 0,0,SSL_eNULL, 0,0,0,0,0,0},
279283
{0,SSL_TXT_KRB5,0, SSL_kKRB5,SSL_aKRB5,0,0,0,0,0,0,0},
280284
{0,SSL_TXT_RSA,0, SSL_kRSA,SSL_aRSA,0,0,0,0,0,0,0},
@@ -327,6 +331,19 @@ static const SSL_CIPHER cipher_aliases[]={
327331
{0,SSL_TXT_HIGH,0, 0,0,0,0,0,SSL_HIGH, 0,0,0},
328332
/* FIPS 140-2 approved ciphersuite */
329333
{0,SSL_TXT_FIPS,0, 0,0,~SSL_eNULL,0,0,SSL_FIPS, 0,0,0},
334+
/* "DHE-" aliases to "EDH-" labels (for forward compatibility) */
335+
{0,SSL3_TXT_DHE_DSS_DES_40_CBC_SHA,0,
336+
SSL_kDHE,SSL_aDSS,SSL_DES,SSL_SHA1,SSL_SSLV3,SSL_EXPORT|SSL_EXP40,0,0,0,},
337+
{0,SSL3_TXT_DHE_DSS_DES_64_CBC_SHA,0,
338+
SSL_kDHE,SSL_aDSS,SSL_DES,SSL_SHA1,SSL_SSLV3,SSL_NOT_EXP|SSL_LOW,0,0,0,},
339+
{0,SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA,0,
340+
SSL_kDHE,SSL_aDSS,SSL_3DES,SSL_SHA1,SSL_SSLV3,SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,0,0,0,},
341+
{0,SSL3_TXT_DHE_RSA_DES_40_CBC_SHA,0,
342+
SSL_kDHE,SSL_aRSA,SSL_DES,SSL_SHA1,SSL_SSLV3,SSL_EXPORT|SSL_EXP40,0,0,0,},
343+
{0,SSL3_TXT_DHE_RSA_DES_64_CBC_SHA,0,
344+
SSL_kDHE,SSL_aRSA,SSL_DES,SSL_SHA1,SSL_SSLV3,SSL_NOT_EXP|SSL_LOW,0,0,0,},
345+
{0,SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA,0,
346+
SSL_kDHE,SSL_aRSA,SSL_3DES,SSL_SHA1,SSL_SSLV3,SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,0,0,0,},
330347
};
331348
/* Search for public key algorithm with given name and
332349
* return its pkey_id if it is available. Otherwise return 0

ssl/ssl_locl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,12 @@
292292
#define SSL_kDHr 0x00000002L /* DH cert, RSA CA cert */
293293
#define SSL_kDHd 0x00000004L /* DH cert, DSA CA cert */
294294
#define SSL_kEDH 0x00000008L /* tmp DH key no DH cert */
295+
#define SSL_kDHE SSL_kEDH /* forward-compatible synonym */
295296
#define SSL_kKRB5 0x00000010L /* Kerberos5 key exchange */
296297
#define SSL_kECDHr 0x00000020L /* ECDH cert, RSA CA cert */
297298
#define SSL_kECDHe 0x00000040L /* ECDH cert, ECDSA CA cert */
298299
#define SSL_kEECDH 0x00000080L /* ephemeral ECDH */
300+
#define SSL_kECDHE SSL_kEECDH /* forward-compatible synonym */
299301
#define SSL_kPSK 0x00000100L /* PSK */
300302
#define SSL_kGOST 0x00000200L /* GOST key exchange */
301303
#define SSL_kSRP 0x00000400L /* SRP */

ssl/tls1.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -555,12 +555,12 @@ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb)
555555
#define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032
556556

557557
/* XXX
558-
* Inconsistency alert:
559-
* The OpenSSL names of ciphers with ephemeral DH here include the string
560-
* "DHE", while elsewhere it has always been "EDH".
561-
* (The alias for the list of all such ciphers also is "EDH".)
562-
* The specifications speak of "EDH"; maybe we should allow both forms
563-
* for everything. */
558+
* Backward compatibility alert:
559+
+ * Older versions of OpenSSL gave some DHE ciphers names with "EDH"
560+
+ * instead of "DHE". Going forward, we should be using DHE
561+
+ * everywhere, though we may indefinitely maintain aliases for users
562+
+ * or configurations that used "EDH"
563+
+ */
564564
#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5 "EXP1024-RC4-MD5"
565565
#define TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 "EXP1024-RC2-CBC-MD5"
566566
#define TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA "EXP1024-DES-CBC-SHA"

0 commit comments

Comments
 (0)