]> granicus.if.org Git - openssl/commitdiff
Support TLS_FALLBACK_SCSV.
authorBodo Moeller <bodo@openssl.org>
Wed, 15 Oct 2014 02:03:28 +0000 (04:03 +0200)
committerBodo Moeller <bodo@openssl.org>
Wed, 15 Oct 2014 02:03:28 +0000 (04:03 +0200)
Reviewed-by: Stephen Henson <steve@openssl.org>
16 files changed:
CHANGES
apps/s_client.c
crypto/err/openssl.ec
ssl/d1_lib.c
ssl/dtls1.h
ssl/s23_clnt.c
ssl/s23_srvr.c
ssl/s2_lib.c
ssl/s3_enc.c
ssl/s3_lib.c
ssl/ssl.h
ssl/ssl3.h
ssl/ssl_err.c
ssl/ssl_lib.c
ssl/t1_enc.c
ssl/tls1.h

diff --git a/CHANGES b/CHANGES
index f67fe393672e68c66804e26e1cfd0e9739fb68c8..7c25d4a8572976296f3653fd1424ef441f667398 100644 (file)
--- a/CHANGES
+++ b/CHANGES
 
  Changes between 1.0.1h and 1.0.2 [xx XXX xxxx]
 
+  *) Add support for TLS_FALLBACK_SCSV.
+     Client applications doing fallback retries should call
+     SSL_set_mode(s, SSL_MODE_SEND_FALLBACK_SCSV).
+     (CVE-2014-3566)
+     [Adam Langley, Bodo Moeller]
+
   *) Accelerated NIST P-256 elliptic curve implementation for x86_64
      (other platforms pending).
      [Shay Gueron (Intel Corp), Andy Polyakov]
index 09c9b72985d75efd38dc8ed9d5bbbb875bd43cd5..d56dc8d47f11cbddc49045c9172d37fcda7ad24d 100644 (file)
@@ -341,6 +341,7 @@ static void sc_usage(void)
        BIO_printf(bio_err," -tls1_1       - just use TLSv1.1\n");
        BIO_printf(bio_err," -tls1         - just use TLSv1\n");
        BIO_printf(bio_err," -dtls1        - just use DTLSv1\n");    
+       BIO_printf(bio_err," -fallback_scsv - send TLS_FALLBACK_SCSV\n");
        BIO_printf(bio_err," -mtu          - set the link layer MTU\n");
        BIO_printf(bio_err," -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n");
        BIO_printf(bio_err," -bugs         - Switch on all SSL implementation bug workarounds\n");
@@ -650,6 +651,7 @@ int MAIN(int argc, char **argv)
        char *sess_out = NULL;
        struct sockaddr peer;
        int peerlen = sizeof(peer);
+       int fallback_scsv = 0;
        int enable_timeouts = 0 ;
        long socket_mtu = 0;
 #ifndef OPENSSL_NO_JPAKE
@@ -940,6 +942,10 @@ static char *jpake_secret = NULL;
                        meth=DTLSv1_2_client_method();
                        socket_type=SOCK_DGRAM;
                        }
+               else if (strcmp(*argv,"-fallback_scsv") == 0)
+                       {
+                       fallback_scsv = 1;
+                       }
                else if (strcmp(*argv,"-timeout") == 0)
                        enable_timeouts=1;
                else if (strcmp(*argv,"-mtu") == 0)
@@ -1439,6 +1445,10 @@ bad:
                SSL_set_session(con, sess);
                SSL_SESSION_free(sess);
                }
+
+       if (fallback_scsv)
+               SSL_set_mode(con, SSL_MODE_SEND_FALLBACK_SCSV);
+
 #ifndef OPENSSL_NO_TLSEXT
        if (servername != NULL)
                {
index 8708ec886bfef53dc6a414c7a0d4e7d0db84267c..40ffc134fa75ba08f82bdb066e8e13ae0a234704 100644 (file)
@@ -74,6 +74,7 @@ R SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION                1060
 R SSL_R_TLSV1_ALERT_PROTOCOL_VERSION           1070
 R SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY      1071
 R SSL_R_TLSV1_ALERT_INTERNAL_ERROR             1080
+R SSL_R_SSLV3_ALERT_INAPPROPRIATE_FALLBACK     1086
 R SSL_R_TLSV1_ALERT_USER_CANCELLED             1090
 R SSL_R_TLSV1_ALERT_NO_RENEGOTIATION           1100
 R SSL_R_TLSV1_UNSUPPORTED_EXTENSION            1110
index 6405111066e21e9474ef13ffd56ffb890b74f033..5f7a3582cc4b3ee34e63e6c00d04446b79028c41 100644 (file)
@@ -294,6 +294,25 @@ long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg)
        case DTLS_CTRL_LISTEN:
                ret = dtls1_listen(s, parg);
                break;
+       case SSL_CTRL_CHECK_PROTO_VERSION:
+               /* For library-internal use; checks that the current protocol
+                * is the highest enabled version (according to s->ctx->method,
+                * as version negotiation may have changed s->method). */
+               if (s->version == s->ctx->method->version)
+                       return 1;
+               /* Apparently we're using a version-flexible SSL_METHOD
+                * (not at its highest protocol version). */
+               if (s->ctx->method->version == DTLS_method()->version)
+                       {
+#if DTLS_MAX_VERSION != DTLS1_2_VERSION
+#  error Code needs update for DTLS_method() support beyond DTLS1_2_VERSION.
+#endif
+                       if (!(s->options & SSL_OP_NO_DTLSv1_2))
+                               return s->version == DTLS1_2_VERSION;
+                       if (!(s->options & SSL_OP_NO_DTLSv1))
+                               return s->version == DTLS1_VERSION;
+                       }
+               return 0; /* Unexpected state; fail closed. */
 
        default:
                ret = ssl3_ctrl(s, cmd, larg, parg);
index c6edbe39f9cc1e666db453ebfb67c086c2987dfb..5cb79f1dac495606222d2f0a4d2c8d80e59e0a5d 100644 (file)
@@ -84,8 +84,11 @@ extern "C" {
 #endif
 
 #define DTLS1_VERSION                  0xFEFF
-#define DTLS1_BAD_VER                  0x0100
 #define DTLS1_2_VERSION                        0xFEFD
+#define DTLS_MAX_VERSION               DTLS1_2_VERSION
+
+#define DTLS1_BAD_VER                  0x0100
+
 /* Special value for method supporting multiple versions */
 #define DTLS_ANY_VERSION               0x1FFFF
 
@@ -287,4 +290,3 @@ typedef struct dtls1_record_data_st
 }
 #endif
 #endif
-
index deb18637ef6fea4b64ba1e651f431ca416773333..fa58862ba178e925b07420d7d5c44939d07bca35 100644 (file)
@@ -752,6 +752,9 @@ static int ssl23_get_server_hello(SSL *s)
                        goto err;
                        }
 
+               /* ensure that TLS_MAX_VERSION is up-to-date */
+               OPENSSL_assert(s->version <= TLS_MAX_VERSION);
+
                if (!ssl_security(s, SSL_SECOP_VERSION, 0, s->version, NULL))
                        {
                        SSLerr(SSL_F_SSL23_GET_SERVER_HELLO,SSL_R_VERSION_TOO_LOW);
index 484a1a6e262fb98a60bcfb307227ca4329fb3779..79d974f5a511977e1c75ebdc9d37cabcc5e25e56 100644 (file)
@@ -421,6 +421,9 @@ int ssl23_get_client_hello(SSL *s)
                        }
                }
 
+       /* ensure that TLS_MAX_VERSION is up-to-date */
+       OPENSSL_assert(s->version <= TLS_MAX_VERSION);
+
        if (s->version < TLS1_2_VERSION && tls1_suiteb(s))
                {
                SSLerr(SSL_F_SSL23_GET_CLIENT_HELLO,
index 41ae4e8abbfa8230d13ee59bd26d9ae762ddf6b3..41818dc6e87dfe49a3991748c9f4806090a7aba6 100644 (file)
@@ -391,6 +391,8 @@ long ssl2_ctrl(SSL *s, int cmd, long larg, void *parg)
        case SSL_CTRL_GET_SESSION_REUSED:
                ret=s->hit;
                break;
+       case SSL_CTRL_CHECK_PROTO_VERSION:
+               return ssl3_ctrl(s, SSL_CTRL_CHECK_PROTO_VERSION, larg, parg);
        default:
                break;
                }
@@ -434,7 +436,7 @@ int ssl2_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
        if (p != NULL)
                {
                l=c->id;
-               if ((l & 0xff000000) != 0x02000000) return(0);
+               if ((l & 0xff000000) != 0x02000000 && l != SSL3_CK_FALLBACK_SCSV) return(0);
                p[0]=((unsigned char)(l>>16L))&0xFF;
                p[1]=((unsigned char)(l>> 8L))&0xFF;
                p[2]=((unsigned char)(l     ))&0xFF;
index 92683e2531da9492f49974a496eae33f3c713c07..6b7132380da50a72e96104a93af39e4838bc22dc 100644 (file)
@@ -937,7 +937,7 @@ int ssl3_alert_code(int code)
        case SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE: return(SSL3_AD_HANDSHAKE_FAILURE);
        case SSL_AD_BAD_CERTIFICATE_HASH_VALUE: return(SSL3_AD_HANDSHAKE_FAILURE);
        case SSL_AD_UNKNOWN_PSK_IDENTITY:return(TLS1_AD_UNKNOWN_PSK_IDENTITY);
+       case SSL_AD_INAPPROPRIATE_FALLBACK:return(TLS1_AD_INAPPROPRIATE_FALLBACK);
        default:                        return(-1);
                }
        }
-
index bb1074c67af01e6407c01d487ff30400c9731aea..d670ff0ec00ca71824742033abc89cccc7523ff1 100644 (file)
@@ -3924,6 +3924,33 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
                return (int)sess->tlsext_ecpointformatlist_length;
                }
 #endif
+
+       case SSL_CTRL_CHECK_PROTO_VERSION:
+               /* For library-internal use; checks that the current protocol
+                * is the highest enabled version (according to s->ctx->method,
+                * as version negotiation may have changed s->method). */
+               if (s->version == s->ctx->method->version)
+                       return 1;
+               /* Apparently we're using a version-flexible SSL_METHOD
+                * (not at its highest protocol version). */
+               if (s->ctx->method->version == SSLv23_method()->version)
+                       {
+#if TLS_MAX_VERSION != TLS1_2_VERSION
+#  error Code needs update for SSLv23_method() support beyond TLS1_2_VERSION.
+#endif
+                       if (!(s->options & SSL_OP_NO_TLSv1_2))
+                               return s->version == TLS1_2_VERSION;
+                       if (!(s->options & SSL_OP_NO_TLSv1_1))
+                               return s->version == TLS1_1_VERSION;
+                       if (!(s->options & SSL_OP_NO_TLSv1))
+                               return s->version == TLS1_VERSION;
+                       if (!(s->options & SSL_OP_NO_SSLv3))
+                               return s->version == SSL3_VERSION;
+                       if (!(s->options & SSL_OP_NO_SSLv2))
+                               return s->version == SSL2_VERSION;
+                       }
+               return 0; /* Unexpected state; fail closed. */
+
        default:
                break;
                }
@@ -4844,4 +4871,3 @@ long ssl_get_algorithm2(SSL *s)
                return SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256;
        return alg2;
        }
-
index 8eb8431c35b27795f3b9a06dca5e09b605168e0e..a0db4f2a21fd5fe0fdd521473add6dcc5819037a 100644 (file)
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
@@ -685,6 +685,10 @@ struct ssl_session_st
  */
 #define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020L
 #define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040L
+/* Send TLS_FALLBACK_SCSV in the ClientHello.
+ * To be set by applications that reconnect with a downgraded protocol
+ * version; see draft-ietf-tls-downgrade-scsv-00 for details. */
+#define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080L
 
 /* Cert related flags */
 /* Many implementations ignore some aspects of the TLS standards such as
@@ -1693,6 +1697,7 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION)
 #define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE
 #define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE
 #define SSL_AD_UNKNOWN_PSK_IDENTITY     TLS1_AD_UNKNOWN_PSK_IDENTITY /* fatal */
+#define SSL_AD_INAPPROPRIATE_FALLBACK  TLS1_AD_INAPPROPRIATE_FALLBACK /* fatal */
 
 #define SSL_ERROR_NONE                 0
 #define SSL_ERROR_SSL                  1
@@ -1832,11 +1837,14 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION)
 #define SSL_CTRL_SELECT_CURRENT_CERT           116
 #define SSL_CTRL_SET_CURRENT_CERT              117
 
+#define SSL_CTRL_SET_DH_AUTO                   118
+#define SSL_CTRL_CHECK_PROTO_VERSION           119
+
+
 #define SSL_CERT_SET_FIRST                     1
 #define SSL_CERT_SET_NEXT                      2
 #define SSL_CERT_SET_SERVER                    3
 
-#define SSL_CTRL_SET_DH_AUTO                   118
 
 #define DTLSv1_get_timeout(ssl, arg) \
        SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)arg)
@@ -2869,6 +2877,7 @@ void ERR_load_SSL_strings(void);
 #define SSL_R_HTTP_REQUEST                              156
 #define SSL_R_ILLEGAL_PADDING                           283
 #define SSL_R_ILLEGAL_SUITEB_DIGEST                     380
+#define SSL_R_INAPPROPRIATE_FALLBACK                    373
 #define SSL_R_INCONSISTENT_COMPRESSION                  340
 #define SSL_R_INVALID_CHALLENGE_LENGTH                  158
 #define SSL_R_INVALID_COMMAND                           280
@@ -3027,6 +3036,7 @@ void ERR_load_SSL_strings(void);
 #define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED             1021
 #define SSL_R_TLSV1_ALERT_DECRYPT_ERROR                         1051
 #define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION            1060
+#define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK        1086
 #define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY                 1071
 #define SSL_R_TLSV1_ALERT_INTERNAL_ERROR                1080
 #define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION              1100
index 29cb184c68a2b0dbb7131a0d876ecae98ea08675..276a7761b2676b0c55d69a896dc6d4eb3894074b 100644 (file)
 extern "C" {
 #endif
 
-/* Signalling cipher suite value: from draft-ietf-tls-renegotiation-03.txt */
+/* Signalling cipher suite value from RFC 5746
+ * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) */
 #define SSL3_CK_SCSV                           0x030000FF
 
+/* Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00
+ * (TLS_FALLBACK_SCSV) */
+#define SSL3_CK_FALLBACK_SCSV                  0x03005600
+
 #define SSL3_CK_RSA_NULL_MD5                   0x03000001
 #define SSL3_CK_RSA_NULL_SHA                   0x03000002
 #define SSL3_CK_RSA_RC4_40_MD5                         0x03000003
index 796e2b64efa069f5cf40a1528af6617484c53b11..fabdc884b93746a46a346167a03c1c3935776e46 100644 (file)
@@ -404,6 +404,7 @@ static ERR_STRING_DATA SSL_str_reasons[]=
 {ERR_REASON(SSL_R_HTTP_REQUEST)          ,"http request"},
 {ERR_REASON(SSL_R_ILLEGAL_PADDING)       ,"illegal padding"},
 {ERR_REASON(SSL_R_ILLEGAL_SUITEB_DIGEST) ,"illegal Suite B digest"},
+{ERR_REASON(SSL_R_INAPPROPRIATE_FALLBACK),"inappropriate fallback"},
 {ERR_REASON(SSL_R_INCONSISTENT_COMPRESSION),"inconsistent compression"},
 {ERR_REASON(SSL_R_INVALID_CHALLENGE_LENGTH),"invalid challenge length"},
 {ERR_REASON(SSL_R_INVALID_COMMAND)       ,"invalid command"},
@@ -562,6 +563,7 @@ static ERR_STRING_DATA SSL_str_reasons[]=
 {ERR_REASON(SSL_R_TLSV1_ALERT_DECRYPTION_FAILED),"tlsv1 alert decryption failed"},
 {ERR_REASON(SSL_R_TLSV1_ALERT_DECRYPT_ERROR),"tlsv1 alert decrypt error"},
 {ERR_REASON(SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION),"tlsv1 alert export restriction"},
+{ERR_REASON(SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK),"tlsv1 alert inappropriate fallback"},
 {ERR_REASON(SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY),"tlsv1 alert insufficient security"},
 {ERR_REASON(SSL_R_TLSV1_ALERT_INTERNAL_ERROR),"tlsv1 alert internal error"},
 {ERR_REASON(SSL_R_TLSV1_ALERT_NO_RENEGOTIATION),"tlsv1 alert no renegotiation"},
index 6a33b9ddff50e765d22e23ca9d1b781926bd3e8f..c336a85aa31df0dfb8195cbf38be2aeb96e2235f 100644 (file)
@@ -1491,12 +1491,14 @@ int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char *p,
        int i,j=0;
        SSL_CIPHER *c;
        unsigned char *q;
-       int no_scsv = s->renegotiate;
+       int empty_reneg_info_scsv = !s->renegotiate;
        /* Set disabled masks for this session */
        ssl_set_client_disabled(s);
 
        if (sk == NULL) return(0);
        q=p;
+       if (put_cb == NULL)
+               put_cb = s->method->put_cipher_by_char;
 
        for (i=0; i<sk_SSL_CIPHER_num(sk); i++)
                {
@@ -1507,29 +1509,40 @@ int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char *p,
 #ifdef OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL
                if (c->id == SSL3_CK_SCSV)
                        {
-                       if (no_scsv)
+                       if (!empty_reneg_info_scsv)
                                continue;
                        else
-                               no_scsv = 1;
+                               empty_reneg_info_scsv = 0;
                        }
 #endif
-               j = put_cb ? put_cb(c,p) : ssl_put_cipher_by_char(s,c,p);
+               j = put_cb(c,p);
                p+=j;
                }
-       /* If p == q, no ciphers and caller indicates an error. Otherwise
-        * add SCSV if not renegotiating.
-        */
-       if (p != q && !no_scsv)
+       /* If p == q, no ciphers; caller indicates an error.
+        * Otherwise, add applicable SCSVs. */
+       if (p != q)
                {
-               static SSL_CIPHER scsv =
+               if (empty_reneg_info_scsv)
                        {
-                       0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0
-                       };
-               j = put_cb ? put_cb(&scsv,p) : ssl_put_cipher_by_char(s,&scsv,p);
-               p+=j;
+                       static SSL_CIPHER scsv =
+                               {
+                               0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0
+                               };
+                       j = put_cb(&scsv,p);
+                       p+=j;
 #ifdef OPENSSL_RI_DEBUG
-               fprintf(stderr, "SCSV sent by client\n");
+                       fprintf(stderr, "TLS_EMPTY_RENEGOTIATION_INFO_SCSV sent by client\n");
 #endif
+                       }
+               if (s->mode & SSL_MODE_SEND_FALLBACK_SCSV)
+                       {
+                       static SSL_CIPHER scsv =
+                               {
+                               0, NULL, SSL3_CK_FALLBACK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0
+                               };
+                       j = put_cb(&scsv,p);
+                       p+=j;
+                       }
                }
 
        return(p-q);
@@ -1541,11 +1554,12 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num,
        const SSL_CIPHER *c;
        STACK_OF(SSL_CIPHER) *sk;
        int i,n;
+
        if (s->s3)
                s->s3->send_connection_binding = 0;
 
        n=ssl_put_cipher_by_char(s,NULL,NULL);
-       if ((num%n) != 0)
+       if (n == 0 || (num%n) != 0)
                {
                SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);
                return(NULL);
@@ -1570,7 +1584,7 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num,
 
        for (i=0; i<num; i+=n)
                {
-               /* Check for SCSV */
+               /* Check for TLS_EMPTY_RENEGOTIATION_INFO_SCSV */
                if (s->s3 && (n != 3 || !p[0]) &&
                        (p[n-2] == ((SSL3_CK_SCSV >> 8) & 0xff)) &&
                        (p[n-1] == (SSL3_CK_SCSV & 0xff)))
@@ -1590,6 +1604,23 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num,
                        continue;
                        }
 
+               /* Check for TLS_FALLBACK_SCSV */
+               if ((n != 3 || !p[0]) &&
+                       (p[n-2] == ((SSL3_CK_FALLBACK_SCSV >> 8) & 0xff)) &&
+                       (p[n-1] == (SSL3_CK_FALLBACK_SCSV & 0xff)))
+                       {
+                       /* The SCSV indicates that the client previously tried a higher version.
+                        * Fail if the current version is an unexpected downgrade. */
+                       if (!SSL_ctrl(s, SSL_CTRL_CHECK_PROTO_VERSION, 0, NULL))
+                               {
+                               SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_INAPPROPRIATE_FALLBACK);
+                               if (s->s3)
+                                       ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_INAPPROPRIATE_FALLBACK);
+                               goto err;
+                               }
+                       continue;
+                       }
+
                c=ssl_get_cipher_by_char(s,p);
                p+=n;
                if (c != NULL)
index 98cf468f7ab4a6286b35b94fc84534615bf938be..47ff82b1e45a747293b5cdb65b3eef5b76bb7968 100644 (file)
@@ -1278,6 +1278,7 @@ int tls1_alert_code(int code)
        case SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE: return(TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE);
        case SSL_AD_BAD_CERTIFICATE_HASH_VALUE: return(TLS1_AD_BAD_CERTIFICATE_HASH_VALUE);
        case SSL_AD_UNKNOWN_PSK_IDENTITY:return(TLS1_AD_UNKNOWN_PSK_IDENTITY);
+       case SSL_AD_INAPPROPRIATE_FALLBACK:return(TLS1_AD_INAPPROPRIATE_FALLBACK);
 #if 0 /* not appropriate for TLS, not used for DTLS */
        case DTLS1_AD_MISSING_HANDSHAKE_MESSAGE: return 
                                          (DTLS1_AD_MISSING_HANDSHAKE_MESSAGE);
index c90fbee038f1e0c53e75c9ddc533933162368aa4..e8188ec5cfb8c36abeae8ed34ff511ce2eb7d02b 100644 (file)
@@ -164,17 +164,19 @@ extern "C" {
 
 #define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES   0
 
+#define TLS1_VERSION                   0x0301
+#define TLS1_1_VERSION                 0x0302
 #define TLS1_2_VERSION                 0x0303
-#define TLS1_2_VERSION_MAJOR           0x03
-#define TLS1_2_VERSION_MINOR           0x03
+#define TLS_MAX_VERSION                        TLS1_2_VERSION
+
+#define TLS1_VERSION_MAJOR             0x03
+#define TLS1_VERSION_MINOR             0x01
 
-#define TLS1_1_VERSION                 0x0302
 #define TLS1_1_VERSION_MAJOR           0x03
 #define TLS1_1_VERSION_MINOR           0x02
 
-#define TLS1_VERSION                   0x0301
-#define TLS1_VERSION_MAJOR             0x03
-#define TLS1_VERSION_MINOR             0x01
+#define TLS1_2_VERSION_MAJOR           0x03
+#define TLS1_2_VERSION_MINOR           0x03
 
 #define TLS1_get_version(s) \
                ((s->version >> 8) == TLS1_VERSION_MAJOR ? s->version : 0)
@@ -192,6 +194,7 @@ extern "C" {
 #define TLS1_AD_PROTOCOL_VERSION       70      /* fatal */
 #define TLS1_AD_INSUFFICIENT_SECURITY  71      /* fatal */
 #define TLS1_AD_INTERNAL_ERROR         80      /* fatal */
+#define TLS1_AD_INAPPROPRIATE_FALLBACK 86      /* fatal */
 #define TLS1_AD_USER_CANCELLED         90
 #define TLS1_AD_NO_RENEGOTIATION       100
 /* codes 110-114 are from RFC3546 */