diff options
author | jsing <> | 2018-04-11 17:47:36 +0000 |
---|---|---|
committer | jsing <> | 2018-04-11 17:47:36 +0000 |
commit | 4d132fdc372189fa2be2978dc75a3654032aaec6 (patch) | |
tree | 9d2a5aea7b060e408a6260fb778ca983ca2780bf /src | |
parent | 4a86db5884fb87b302e9846edd558538a0a73215 (diff) | |
download | openbsd-4d132fdc372189fa2be2978dc75a3654032aaec6.tar.gz openbsd-4d132fdc372189fa2be2978dc75a3654032aaec6.tar.bz2 openbsd-4d132fdc372189fa2be2978dc75a3654032aaec6.zip |
Nuke SSL_OP_TLS_ROLLBACK_BUG - this is a workaround for buggy clients from
around the SSLv3/TLSv1.0 period... and buggy clients are buggy. This also
helps to clean up the RSA key exchange code.
ok "kill it with fire" beck@ tb@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/ssl.h | 8 | ||||
-rw-r--r-- | src/lib/libssl/ssl_srvr.c | 45 |
2 files changed, 17 insertions, 36 deletions
diff --git a/src/lib/libssl/ssl.h b/src/lib/libssl/ssl.h index 78a6787d43..143dd8a003 100644 --- a/src/lib/libssl/ssl.h +++ b/src/lib/libssl/ssl.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl.h,v 1.154 2018/03/20 15:28:12 tb Exp $ */ | 1 | /* $OpenBSD: ssl.h,v 1.155 2018/04/11 17:47:36 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -507,11 +507,6 @@ struct ssl_session_st { | |||
507 | /* Set on servers to choose the cipher according to the server's | 507 | /* Set on servers to choose the cipher according to the server's |
508 | * preferences */ | 508 | * preferences */ |
509 | #define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000L | 509 | #define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000L |
510 | /* If set, a server will allow a client to issue a SSLv3.0 version number | ||
511 | * as latest version supported in the premaster secret, even when TLSv1.0 | ||
512 | * (version 3.1) was announced in the client hello. Normally this is | ||
513 | * forbidden to prevent version rollback attacks. */ | ||
514 | #define SSL_OP_TLS_ROLLBACK_BUG 0x00800000L | ||
515 | 510 | ||
516 | #define SSL_OP_NO_TLSv1 0x04000000L | 511 | #define SSL_OP_NO_TLSv1 0x04000000L |
517 | #define SSL_OP_NO_TLSv1_2 0x08000000L | 512 | #define SSL_OP_NO_TLSv1_2 0x08000000L |
@@ -545,6 +540,7 @@ struct ssl_session_st { | |||
545 | #define SSL_OP_TLSEXT_PADDING 0x0 | 540 | #define SSL_OP_TLSEXT_PADDING 0x0 |
546 | #define SSL_OP_TLS_BLOCK_PADDING_BUG 0x0 | 541 | #define SSL_OP_TLS_BLOCK_PADDING_BUG 0x0 |
547 | #define SSL_OP_TLS_D5_BUG 0x0 | 542 | #define SSL_OP_TLS_D5_BUG 0x0 |
543 | #define SSL_OP_TLS_ROLLBACK_BUG 0x0 | ||
548 | 544 | ||
549 | /* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success | 545 | /* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success |
550 | * when just a single record has been written): */ | 546 | * when just a single record has been written): */ |
diff --git a/src/lib/libssl/ssl_srvr.c b/src/lib/libssl/ssl_srvr.c index f1a0c9ae03..e72593e6b1 100644 --- a/src/lib/libssl/ssl_srvr.c +++ b/src/lib/libssl/ssl_srvr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_srvr.c,v 1.28 2018/01/28 09:21:34 inoguchi Exp $ */ | 1 | /* $OpenBSD: ssl_srvr.c,v 1.29 2018/04/11 17:47:36 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -1772,36 +1772,21 @@ ssl3_get_client_kex_rsa(SSL *s, unsigned char *p, long n) | |||
1772 | if ((al == -1) && !((p[0] == (s->client_version >> 8)) && | 1772 | if ((al == -1) && !((p[0] == (s->client_version >> 8)) && |
1773 | (p[1] == (s->client_version & 0xff)))) { | 1773 | (p[1] == (s->client_version & 0xff)))) { |
1774 | /* | 1774 | /* |
1775 | * The premaster secret must contain the same version | 1775 | * The premaster secret must contain the same version number |
1776 | * number as the ClientHello to detect version rollback | 1776 | * as the ClientHello to detect version rollback attacks |
1777 | * attacks (strangely, the protocol does not offer such | 1777 | * (strangely, the protocol does not offer such protection for |
1778 | * protection for DH ciphersuites). | 1778 | * DH ciphersuites). |
1779 | * However, buggy clients exist that send the negotiated | 1779 | * |
1780 | * protocol version instead if the server does not | 1780 | * The Klima-Pokorny-Rosa extension of Bleichenbacher's attack |
1781 | * support the requested protocol version. | 1781 | * (http://eprint.iacr.org/2003/052/) exploits the version |
1782 | * If SSL_OP_TLS_ROLLBACK_BUG is set, tolerate such | 1782 | * number check as a "bad version oracle" -- an alert would |
1783 | * clients. | 1783 | * reveal that the plaintext corresponding to some ciphertext |
1784 | * made up by the adversary is properly formatted except that | ||
1785 | * the version number is wrong. To avoid such attacks, we should | ||
1786 | * treat this just like any other decryption error. | ||
1784 | */ | 1787 | */ |
1785 | if (!((s->internal->options & SSL_OP_TLS_ROLLBACK_BUG) && | 1788 | al = SSL_AD_DECODE_ERROR; |
1786 | (p[0] == (s->version >> 8)) && | 1789 | /* SSLerror(s, SSL_R_BAD_PROTOCOL_VERSION_NUMBER); */ |
1787 | (p[1] == (s->version & 0xff)))) { | ||
1788 | al = SSL_AD_DECODE_ERROR; | ||
1789 | /* SSLerror(s, SSL_R_BAD_PROTOCOL_VERSION_NUMBER); */ | ||
1790 | |||
1791 | /* | ||
1792 | * The Klima-Pokorny-Rosa extension of | ||
1793 | * Bleichenbacher's attack | ||
1794 | * (http://eprint.iacr.org/2003/052/) exploits | ||
1795 | * the version number check as a "bad version | ||
1796 | * oracle" -- an alert would reveal that the | ||
1797 | * plaintext corresponding to some ciphertext | ||
1798 | * made up by the adversary is properly | ||
1799 | * formatted except that the version number is | ||
1800 | * wrong. | ||
1801 | * To avoid such attacks, we should treat this | ||
1802 | * just like any other decryption error. | ||
1803 | */ | ||
1804 | } | ||
1805 | } | 1790 | } |
1806 | 1791 | ||
1807 | if (al != -1) { | 1792 | if (al != -1) { |