From 5d9cde25da079f82bd8f1cedbf900504c6b7a067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 22 Jan 2015 10:49:41 +0000 Subject: [PATCH] Move renego SCSV after actual ciphersuites --- library/ssl_cli.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/library/ssl_cli.c b/library/ssl_cli.c index 77ae8b4da..95699b4a8 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c @@ -633,18 +633,6 @@ static int ssl_write_client_hello( ssl_context *ssl ) // Skip writing ciphersuite length for now p += 2; - /* - * Add TLS_EMPTY_RENEGOTIATION_INFO_SCSV - */ -#if defined(POLARSSL_SSL_RENEGOTIATION) - if( ssl->renegotiation == SSL_INITIAL_HANDSHAKE ) -#endif - { - *p++ = (unsigned char)( SSL_EMPTY_RENEGOTIATION_INFO >> 8 ); - *p++ = (unsigned char)( SSL_EMPTY_RENEGOTIATION_INFO ); - n++; - } - for( i = 0; ciphersuites[i] != 0; i++ ) { ciphersuite_info = ssl_ciphersuite_from_id( ciphersuites[i] ); @@ -668,6 +656,18 @@ static int ssl_write_client_hello( ssl_context *ssl ) *p++ = (unsigned char)( ciphersuites[i] ); } + /* + * Add TLS_EMPTY_RENEGOTIATION_INFO_SCSV + */ +#if defined(POLARSSL_SSL_RENEGOTIATION) + if( ssl->renegotiation == SSL_INITIAL_HANDSHAKE ) +#endif + { + *p++ = (unsigned char)( SSL_EMPTY_RENEGOTIATION_INFO >> 8 ); + *p++ = (unsigned char)( SSL_EMPTY_RENEGOTIATION_INFO ); + n++; + } + /* Some versions of OpenSSL don't handle it correctly if not at end */ #if defined(POLARSSL_SSL_FALLBACK_SCSV) if( ssl->fallback == SSL_IS_FALLBACK )