X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=ssl%2Fssl_lib.c;h=0f7a7f1dfc1082f97a62382e397471cd848d0818;hb=eadfa019b3c82d07fb173eb34f09604c82e99a1f;hp=8d37e4914a4a19b9885cef53cef3c71590b1d1c6;hpb=ef51b4b9b469fc93a91de47b63a143a3c60c5530;p=openssl.git diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 8d37e4914a..0f7a7f1dfc 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -1369,19 +1369,19 @@ int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char *p, j = put_cb ? put_cb(c,p) : ssl_put_cipher_by_char(s,c,p); p+=j; } - /* If p == q, no ciphers and caller indicates an error, otherwise - * add MCSV + /* If p == q, no ciphers and caller indicates an error. Otherwise + * add SCSV if not renegotiating. */ - if (p != q) + if (p != q && !s->new_session) { - static SSL_CIPHER msvc = + static SSL_CIPHER scsv = { - 0, NULL, SSL3_CK_MCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - j = put_cb ? put_cb(&msvc,p) : ssl_put_cipher_by_char(s,&msvc,p); + j = put_cb ? put_cb(&scsv,p) : ssl_put_cipher_by_char(s,&scsv,p); p+=j; #ifdef OPENSSL_RI_DEBUG - fprintf(stderr, "MCSV sent by client\n"); + fprintf(stderr, "SCSV sent by client\n"); #endif } @@ -1413,15 +1413,22 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num, for (i=0; is3 && (n != 3 || !p[0]) && - (p[n-2] == ((SSL3_CK_MCSV >> 8) & 0xff)) && - (p[n-1] == (SSL3_CK_MCSV & 0xff))) + (p[n-2] == ((SSL3_CK_SCSV >> 8) & 0xff)) && + (p[n-1] == (SSL3_CK_SCSV & 0xff))) { + /* SCSV fatal if renegotiating */ + if (s->new_session) + { + SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING); + ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE); + goto err; + } s->s3->send_connection_binding = 1; p += n; #ifdef OPENSSL_RI_DEBUG - fprintf(stderr, "MCSV received by server\n"); + fprintf(stderr, "SCSV received by server\n"); #endif continue; } @@ -1680,7 +1687,7 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth) /* Default is to connect to non-RI servers. When RI is more widely * deployed might change this. */ - ret->options = SSL_OP_LEGACY_SERVER_CONNECT; + ret->options |= SSL_OP_LEGACY_SERVER_CONNECT; return(ret); err: