mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 09:04:22 +01:00
Moving the ecdhe_computed variable into the handshake structure
This commit is contained in:
parent
34630562cd
commit
32846c62ac
@ -574,6 +574,7 @@ struct mbedtls_ssl_handshake_params
|
||||
#if defined(MBEDTLS_USE_TINYCRYPT)
|
||||
uint8_t ecdh_privkey[NUM_ECC_BYTES];
|
||||
#if defined(MBEDTLS_EARLY_KEY_COMPUTATION)
|
||||
uint8_t ecdhe_computed;
|
||||
uint8_t ecdh_publickey[2*NUM_ECC_BYTES];
|
||||
#endif /* MBEDTLS_EARLY_KEY_COMPUTATION */
|
||||
uint8_t ecdh_peerkey[2*NUM_ECC_BYTES];
|
||||
|
@ -4259,9 +4259,6 @@ 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;
|
||||
|
||||
/*
|
||||
@ -4281,14 +4278,14 @@ 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)
|
||||
/* Make sure that the ECDHE pre-computation is only done once */
|
||||
if( ecdhe_computed == 0 )
|
||||
if( ssl->handshake->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;
|
||||
ssl->handshake->ecdhe_computed = 1;
|
||||
}
|
||||
#endif /* MBEDTLS_EARLY_KEY_COMPUTATION && MBEDTLS_USE_TINYCRYPT */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user