From 4abc32734e231ad4c06c29eb6c627623a0a0e8fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Wed, 10 Sep 2014 12:02:46 +0000 Subject: [PATCH] No memmove: ssl_parse_finished() --- library/ssl_tls.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 08b26b313..b43acaa0f 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -3791,8 +3791,6 @@ int ssl_parse_finished( ssl_context *ssl ) return( ret ); } - ssl_hs_rm_dtls_hdr( ssl ); - if( ssl->in_msgtype != SSL_MSG_HANDSHAKE ) { SSL_DEBUG_MSG( 1, ( "bad finished message" ) ); @@ -3803,13 +3801,14 @@ int ssl_parse_finished( ssl_context *ssl ) hash_len = ( ssl->minor_ver == SSL_MINOR_VERSION_0 ) ? 36 : 12; if( ssl->in_msg[0] != SSL_HS_FINISHED || - ssl->in_hslen != 4 + hash_len ) + ssl->in_hslen != ssl_hs_hdr_len( ssl ) + hash_len ) { SSL_DEBUG_MSG( 1, ( "bad finished message" ) ); return( POLARSSL_ERR_SSL_BAD_HS_FINISHED ); } - if( safer_memcmp( ssl->in_msg + 4, buf, hash_len ) != 0 ) + if( safer_memcmp( ssl->in_msg + ssl_hs_hdr_len( ssl ), + buf, hash_len ) != 0 ) { SSL_DEBUG_MSG( 1, ( "bad finished message" ) ); return( POLARSSL_ERR_SSL_BAD_HS_FINISHED );