ssl_write_server_key_exchange: calculate hashlen explicitly

The pk layer can infer the hash length from the hash type. Calculate
it explicitly here anyway because it's needed for debugging purposes,
and it's needed for the upcoming feature allowing the signature
operation to be offloaded to an external cryptographic processor, as
the offloading code will need to know what length hash to copy.
This commit is contained in:
Gilles Peskine 2018-01-05 21:18:59 +01:00
parent e1efdf912f
commit ebd652fe2d

View File

@ -3135,8 +3135,7 @@ curve_matching_done:
mbedtls_md_init( &ctx );
/* Info from md_alg will be used instead */
hashlen = 0;
hashlen = mbedtls_md_get_size( md_info );
/*
* digitally-signed struct {
@ -3165,8 +3164,7 @@ curve_matching_done:
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
MBEDTLS_SSL_DEBUG_BUF( 3, "parameters hash", hash, hashlen != 0 ? hashlen :
(unsigned int) ( mbedtls_md_get_size( mbedtls_md_info_from_type( md_alg ) ) ) );
MBEDTLS_SSL_DEBUG_BUF( 3, "parameters hash", hash, hashlen );
/*
* 3.3: Compute and add the signature