1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-28 00:21:48 +03:00

ECDH: Add test vectors for Curve25519

The test vectors added are published in RFC 7748.
This commit is contained in:
Janos Follath
2019-02-20 10:48:49 +00:00
parent e344d0f6fc
commit ab0f71a22a
2 changed files with 16 additions and 0 deletions

View File

@ -637,6 +637,10 @@ static int ecdh_calc_secret_internal( mbedtls_ecdh_context_mbed *ctx,
return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
*olen = ctx->grp.pbits / 8 + ( ( ctx->grp.pbits % 8 ) != 0 );
if( ctx->grp.id == MBEDTLS_ECP_DP_CURVE25519 )
return mbedtls_mpi_write_binary_le( &ctx->z, buf, *olen );
return mbedtls_mpi_write_binary( &ctx->z, buf, *olen );
}