Fix checksum computation with HelloVerifyRequest

This commit is contained in:
Manuel Pégourié-Gonnard 2014-07-11 13:45:34 +02:00 committed by Paul Bakker
parent 74848811b4
commit 67427c07b2
3 changed files with 20 additions and 0 deletions

View File

@ -1766,6 +1766,7 @@ void ssl_handshake_wrapup( ssl_context *ssl );
int ssl_send_fatal_handshake_failure( ssl_context *ssl );
void ssl_reset_checksum( ssl_context *ssl );
int ssl_derive_keys( ssl_context *ssl );
int ssl_read_record( ssl_context *ssl );

View File

@ -955,7 +955,9 @@ static int ssl_parse_hello_verify_request( ssl_context *ssl )
memcpy( ssl->handshake->verify_cookie, p, cookie_len );
ssl->handshake->verify_cookie_len = cookie_len;
/* Start over at ClientHello */
ssl->state = SSL_CLIENT_HELLO;
ssl_reset_checksum( ssl );
SSL_DEBUG_MSG( 2, ( "<= parse hello verify request" ) );

View File

@ -2935,6 +2935,23 @@ void ssl_optimize_checksum( ssl_context *ssl,
}
}
void ssl_reset_checksum( ssl_context *ssl )
{
#if defined(POLARSSL_SSL_PROTO_SSL3) || defined(POLARSSL_SSL_PROTO_TLS1) || \
defined(POLARSSL_SSL_PROTO_TLS1_1)
md5_starts( &ssl->handshake->fin_md5 );
sha1_starts( &ssl->handshake->fin_sha1 );
#endif
#if defined(POLARSSL_SSL_PROTO_TLS1_2)
#if defined(POLARSSL_SHA256_C)
sha256_starts( &ssl->handshake->fin_sha256, 0 );
#endif
#if defined(POLARSSL_SHA512_C)
sha512_starts( &ssl->handshake->fin_sha512, 1 );
#endif
#endif /* POLARSSL_SSL_PROTO_TLS1_2 */
}
static void ssl_update_checksum_start( ssl_context *ssl,
const unsigned char *buf, size_t len )
{