ECDH: Add test vectors for Curve25519
The test vectors added are published in RFC 7748.
diff --git a/library/ecdh.c b/library/ecdh.c
index c572687..30c5f9f 100644
--- a/library/ecdh.c
+++ b/library/ecdh.c
@@ -637,6 +637,10 @@
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 );
}