3rdparty: Make proper use of mbedtls_platform_zeroize in Everest x25519
This commit is contained in:
parent
fb779f1700
commit
088ef49681
1 changed files with 3 additions and 2 deletions
5
3rdparty/everest/library/x25519.c
vendored
5
3rdparty/everest/library/x25519.c
vendored
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
void mbedtls_x25519_init( mbedtls_x25519_context *ctx )
|
||||
{
|
||||
memset( ctx, 0, sizeof( mbedtls_x25519_context ) );
|
||||
mbedtls_platform_zeroize( ctx, sizeof( mbedtls_x25519_context ) );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -138,7 +138,8 @@ int mbedtls_x25519_calc_secret( mbedtls_x25519_context *ctx, size_t *olen,
|
|||
Hacl_Curve25519_crypto_scalarmult( buf, ctx->our_secret, ctx->peer_point);
|
||||
|
||||
/* Wipe the DH secret and don't let the peer chose a small subgroup point */
|
||||
memset( ctx->our_secret, 0, MBEDTLS_X25519_KEY_SIZE_BYTES );
|
||||
mbedtls_platform_zeroize( ctx->our_secret, MBEDTLS_X25519_KEY_SIZE_BYTES );
|
||||
|
||||
if( memcmp( buf, ctx->our_secret, MBEDTLS_X25519_KEY_SIZE_BYTES) == 0 )
|
||||
return MBEDTLS_ERR_ECP_RANDOM_FAILED;
|
||||
|
||||
|
|
Loading…
Reference in a new issue