return( mbedtls_ecp_gen_keypair_base( grp, &grp->G, d, Q, f_rng, p_rng ) );
}
use uECC_make_key to gen ecc key pair seems cost same time compared to mbedtls_ecp_gen_keypair_base
but mbedtls_ecdh_compute_shared speed improves s lot;
int mbedtls_ecdh_compute_shared( mbedtls_ecp_group grp, mbedtls_mpi z,
const mbedtls_ecp_point Q, const mbedtls_mpi d,
int (f_rng)(void , unsigned char , size_t),
void p_rng )
{
ECDH_VALIDATE_RET( grp != NULL );
ECDH_VALIDATE_RET( Q != NULL );
ECDH_VALIDATE_RET( d != NULL );
ECDH_VALIDATE_RET( z != NULL );
int mbedtls_ecp_gen_keypair( mbedtls_ecp_group grp, mbedtls_mpi d, mbedtls_ecp_point Q, int (f_rng)(void , unsigned char , size_t), void *p_rng ) { ECP_VALIDATE_RET( grp != NULL ); ECP_VALIDATE_RET( d != NULL ); ECP_VALIDATE_RET( Q != NULL ); ECP_VALIDATE_RET( f_rng != NULL );
if 1
endif
}
use uECC_make_key to gen ecc key pair seems cost same time compared to mbedtls_ecp_gen_keypair_base but mbedtls_ecdh_compute_shared speed improves s lot;
int mbedtls_ecdh_compute_shared( mbedtls_ecp_group grp, mbedtls_mpi z, const mbedtls_ecp_point Q, const mbedtls_mpi d, int (f_rng)(void , unsigned char , size_t), void p_rng ) { ECDH_VALIDATE_RET( grp != NULL ); ECDH_VALIDATE_RET( Q != NULL ); ECDH_VALIDATE_RET( d != NULL ); ECDH_VALIDATE_RET( z != NULL );
if 1
endif