Make calc_verify() return the length as well

Simplifies ssl_compute_hash(), but unfortunately not so much the other uses.
This commit is contained in:
Manuel Pégourié-Gonnard 2019-05-03 11:43:28 +02:00 committed by Jarno Lamsa
parent 0d56aaac7b
commit de718b99b5
4 changed files with 46 additions and 50 deletions

View file

@ -3625,7 +3625,7 @@ static int ssl_write_certificate_verify( mbedtls_ssl_context *ssl )
unsigned char hash[48];
unsigned char *hash_start = hash;
mbedtls_md_type_t md_alg = MBEDTLS_MD_NONE;
unsigned int hashlen;
size_t hashlen;
void *rs_ctx = NULL;
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write certificate verify" ) );
@ -3674,7 +3674,7 @@ static int ssl_write_certificate_verify( mbedtls_ssl_context *ssl )
sign:
#endif
ssl->handshake->calc_verify( ssl, hash );
ssl->handshake->calc_verify( ssl, hash, &hashlen );
#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
defined(MBEDTLS_SSL_PROTO_TLS1_1)
@ -3692,7 +3692,6 @@ sign:
* sha_hash
* SHA(handshake_messages);
*/
hashlen = 36;
md_alg = MBEDTLS_MD_NONE;
/*