mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 13:25:28 +00:00
ECDH: Remove old code from mbedtls_everest_make_params
This commit is contained in:
parent
fba94e9726
commit
fb72367f96
29
3rdparty/everest/library/everest.c
vendored
Normal file → Executable file
29
3rdparty/everest/library/everest.c
vendored
Normal file → Executable file
|
@ -70,35 +70,10 @@ int mbedtls_everest_make_params( mbedtls_ecdh_context *ctx, size_t *olen,
|
||||||
int( *f_rng )( void *, unsigned char *, size_t ),
|
int( *f_rng )( void *, unsigned char *, size_t ),
|
||||||
void *p_rng )
|
void *p_rng )
|
||||||
{
|
{
|
||||||
int ret = 0;
|
|
||||||
size_t grp_len;
|
|
||||||
mbedtls_ecp_group grp;
|
|
||||||
mbedtls_ecdh_context_everest *everest_ctx = &ctx->ctx.everest_ecdh;
|
mbedtls_ecdh_context_everest *everest_ctx = &ctx->ctx.everest_ecdh;
|
||||||
mbedtls_x25519_context *x25519_ctx = ( mbedtls_x25519_context* )everest_ctx->ctx;
|
mbedtls_x25519_context *x25519_ctx = ( mbedtls_x25519_context* )everest_ctx->ctx;
|
||||||
|
if( ctx->var != MBEDTLS_ECDH_VARIANT_EVEREST ) return MBEDTLS_ERR_MPI_BAD_INPUT_DATA;
|
||||||
if( ctx->var != MBEDTLS_ECDH_VARIANT_EVEREST )
|
return mbedtls_x25519_make_params( x25519_ctx, olen, buf, blen, f_rng, p_rng );
|
||||||
return MBEDTLS_ERR_MPI_BAD_INPUT_DATA;
|
|
||||||
|
|
||||||
mbedtls_ecp_group_init( &grp );
|
|
||||||
|
|
||||||
if( ( ret = mbedtls_x25519_make_params( x25519_ctx, olen, buf, blen, f_rng, p_rng ) ) != 0 )
|
|
||||||
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
|
||||||
|
|
||||||
mbedtls_ecp_group_load( &grp, MBEDTLS_ECP_DP_CURVE25519 );
|
|
||||||
ret = mbedtls_ecp_tls_write_group( &grp, &grp_len, buf, blen );
|
|
||||||
mbedtls_ecp_group_free( &grp );
|
|
||||||
if (ret != 0)
|
|
||||||
return( ret );
|
|
||||||
|
|
||||||
buf += grp_len;
|
|
||||||
blen -= grp_len;
|
|
||||||
|
|
||||||
if( blen < 32 )
|
|
||||||
return MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL;
|
|
||||||
|
|
||||||
memcpy( x25519_ctx->peer_point, buf, 32 );
|
|
||||||
*olen = grp_len + 1 + 32;
|
|
||||||
return( ret );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_everest_read_params( mbedtls_ecdh_context *ctx,
|
int mbedtls_everest_read_params( mbedtls_ecdh_context *ctx,
|
||||||
|
|
Loading…
Reference in a new issue