mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 18:05:40 +01:00
Making sure that the ECDHE pre-computation is only done once.
This commit is contained in:
parent
c162895030
commit
34630562cd
@ -4259,6 +4259,9 @@ int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
case MBEDTLS_SSL_HELLO_REQUEST:
|
||||
ssl->state = MBEDTLS_SSL_CLIENT_HELLO;
|
||||
#if defined(MBEDTLS_EARLY_KEY_COMPUTATION)
|
||||
int ecdhe_computed = 0;
|
||||
#endif /* MBEDTLS_EARLY_KEY_COMPUTATION */
|
||||
break;
|
||||
|
||||
/*
|
||||
@ -4277,11 +4280,16 @@ int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl )
|
||||
*/
|
||||
case MBEDTLS_SSL_SERVER_HELLO:
|
||||
#if defined(MBEDTLS_EARLY_KEY_COMPUTATION) && defined(MBEDTLS_USE_TINYCRYPT)
|
||||
ret = uECC_make_key( ssl->handshake->ecdh_publickey, ssl->handshake->ecdh_privkey );
|
||||
if( ret == UECC_FAULT_DETECTED )
|
||||
return( MBEDTLS_ERR_PLATFORM_FAULT_DETECTED );
|
||||
if( ret != UECC_SUCCESS )
|
||||
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
|
||||
/* Make sure that the ECDHE pre-computation is only done once */
|
||||
if( ecdhe_computed == 0 )
|
||||
{
|
||||
ret = uECC_make_key( ssl->handshake->ecdh_publickey, ssl->handshake->ecdh_privkey );
|
||||
if( ret == UECC_FAULT_DETECTED )
|
||||
return( MBEDTLS_ERR_PLATFORM_FAULT_DETECTED );
|
||||
if( ret != UECC_SUCCESS )
|
||||
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
|
||||
ecdhe_computed = 1;
|
||||
}
|
||||
#endif /* MBEDTLS_EARLY_KEY_COMPUTATION && MBEDTLS_USE_TINYCRYPT */
|
||||
|
||||
ret = ssl_parse_server_hello( ssl );
|
||||
|
Loading…
Reference in New Issue
Block a user