mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 11:24:15 +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)
|
#if defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
uint8_t ecdh_privkey[NUM_ECC_BYTES];
|
uint8_t ecdh_privkey[NUM_ECC_BYTES];
|
||||||
#if defined(MBEDTLS_EARLY_KEY_COMPUTATION)
|
#if defined(MBEDTLS_EARLY_KEY_COMPUTATION)
|
||||||
|
uint8_t ecdhe_computed;
|
||||||
uint8_t ecdh_publickey[2*NUM_ECC_BYTES];
|
uint8_t ecdh_publickey[2*NUM_ECC_BYTES];
|
||||||
#endif /* MBEDTLS_EARLY_KEY_COMPUTATION */
|
#endif /* MBEDTLS_EARLY_KEY_COMPUTATION */
|
||||||
uint8_t ecdh_peerkey[2*NUM_ECC_BYTES];
|
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:
|
case MBEDTLS_SSL_HELLO_REQUEST:
|
||||||
ssl->state = MBEDTLS_SSL_CLIENT_HELLO;
|
ssl->state = MBEDTLS_SSL_CLIENT_HELLO;
|
||||||
#if defined(MBEDTLS_EARLY_KEY_COMPUTATION)
|
|
||||||
int ecdhe_computed = 0;
|
|
||||||
#endif /* MBEDTLS_EARLY_KEY_COMPUTATION */
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4281,14 +4278,14 @@ int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl )
|
|||||||
case MBEDTLS_SSL_SERVER_HELLO:
|
case MBEDTLS_SSL_SERVER_HELLO:
|
||||||
#if defined(MBEDTLS_EARLY_KEY_COMPUTATION) && defined(MBEDTLS_USE_TINYCRYPT)
|
#if defined(MBEDTLS_EARLY_KEY_COMPUTATION) && defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
/* Make sure that the ECDHE pre-computation is only done once */
|
/* 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 );
|
ret = uECC_make_key( ssl->handshake->ecdh_publickey, ssl->handshake->ecdh_privkey );
|
||||||
if( ret == UECC_FAULT_DETECTED )
|
if( ret == UECC_FAULT_DETECTED )
|
||||||
return( MBEDTLS_ERR_PLATFORM_FAULT_DETECTED );
|
return( MBEDTLS_ERR_PLATFORM_FAULT_DETECTED );
|
||||||
if( ret != UECC_SUCCESS )
|
if( ret != UECC_SUCCESS )
|
||||||
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
|
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
|
||||||
ecdhe_computed = 1;
|
ssl->handshake->ecdhe_computed = 1;
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_EARLY_KEY_COMPUTATION && MBEDTLS_USE_TINYCRYPT */
|
#endif /* MBEDTLS_EARLY_KEY_COMPUTATION && MBEDTLS_USE_TINYCRYPT */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user