tinyCrypt: Share ECDH secret calculation code-path

This commit is contained in:
Hanno Becker 2019-07-23 16:51:57 +01:00
parent 75f12d1eb9
commit a3c2c1712c
3 changed files with 21 additions and 20 deletions
library

View file

@ -4204,19 +4204,8 @@ static int ssl_in_client_key_exchange_parse( mbedtls_ssl_context *ssl,
mbedtls_ssl_suite_get_key_exchange( ciphersuite_info )
== MBEDTLS_KEY_EXCHANGE_ECDHE_RSA )
{
const struct uECC_Curve_t * uecc_curve = uECC_secp256r1();
ret = mbedtls_ssl_ecdh_read_peerkey( ssl, &p, end );
if( ret != 0 )
return( ret );
if( !uECC_shared_secret( ssl->handshake->ecdh_peerkey,
ssl->handshake->ecdh_privkey,
ssl->handshake->premaster,
uecc_curve ) )
{
if( mbedtls_ssl_ecdh_read_peerkey( ssl, &p, end ) != 0 )
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
}
}
else
#endif