@ -95,6 +95,7 @@ int DecodeTLSHandshakeServerCertificate(SSLState *ssl_state, uint8_t *input, uin
Asn1Generic * cert ;
Asn1Generic * cert ;
char buffer [ 256 ] ;
char buffer [ 256 ] ;
int rc ;
int rc ;
int parsed ;
if ( input_len < 3 )
if ( input_len < 3 )
return 1 ;
return 1 ;
@ -102,16 +103,16 @@ int DecodeTLSHandshakeServerCertificate(SSLState *ssl_state, uint8_t *input, uin
certificates_length = input [ 0 ] < < 16 | input [ 1 ] < < 8 | input [ 2 ] ;
certificates_length = input [ 0 ] < < 16 | input [ 1 ] < < 8 | input [ 2 ] ;
/* check if the message is complete */
/* check if the message is complete */
if ( input_len < certificates_length + 3 )
if ( input_len < certificates_length + 3 )
return 1 ;
return 0 ;
input + = 3 ;
input + = 3 ;
ssl_state- > bytes_processed + = 3 ;
parsed = 3 ;
i = 0 ;
i = 0 ;
while ( certificates_length > 0 ) {
while ( certificates_length > 0 ) {
cur_cert_length = input [ 0 ] < < 16 | input [ 1 ] < < 8 | input [ 2 ] ;
cur_cert_length = input [ 0 ] < < 16 | input [ 1 ] < < 8 | input [ 2 ] ;
input + = 3 ;
input + = 3 ;
ssl_state- > bytes_ proces sed + = 3 ;
pa rsed + = 3 ;
cert = DecodeDer ( input , cur_cert_length ) ;
cert = DecodeDer ( input , cur_cert_length ) ;
if ( cert = = NULL ) {
if ( cert = = NULL ) {
@ -141,10 +142,10 @@ int DecodeTLSHandshakeServerCertificate(SSLState *ssl_state, uint8_t *input, uin
i + + ;
i + + ;
certificates_length - = ( cur_cert_length + 3 ) ;
certificates_length - = ( cur_cert_length + 3 ) ;
ssl_state- > bytes_ proces sed + = cur_cert_length ;
pa rsed + = cur_cert_length ;
input + = cur_cert_length ;
input + = cur_cert_length ;
}
}
ssl_state - > bytes_processed = input_len ;
return parsed ;
return 0 ;
}
}