Can't verify signature with curve SECP384R1 #82
-
Hi, I'm testing out the module with some test function i extracted from mbedtls benchmark code. mbedtls_ecdsa_context ecdsa;
const mbedtls_ecp_curve_info *curve_info;
size_t sig_len;
int ret;
unsigned char tmp[200];
printf("mbedtls_test_sign_and_verify\n");
for(int i=0; i < 15; i++)
{
memset( buf, 0x2A + i, sizeof( buf ) );
mbedtls_ecdsa_init( &ecdsa );
printf("Generate key...\n");
if( mbedtls_ecdsa_genkey( &ecdsa, MBEDTLS_ECP_DP_SECP384R1, mbedtls_ctr_drbg_random, NULL ) != 0)
{
configASSERT(0);
}
printf("Write signature...\n");
if( mbedtls_ecdsa_write_signature( &ecdsa, MBEDTLS_MD_SHA384, buf, 48,
tmp, &sig_len, mbedtls_ctr_drbg_random, NULL ) != 0 )
{
configASSERT(0);
}
ecp_clear_precomputed( &ecdsa.grp );
printf("ECDSA mbedtls_ecdsa_read_signature...\n");
ret = mbedtls_ecdsa_read_signature( &ecdsa, buf, 48, tmp, sig_len );
printf("ret_verify = %d\n", ret);
mbedtls_ecdsa_free( &ecdsa );
} The mbedtls alternate function were copied from here: Do you have any idea of the cause? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @matteofumagalli1275 , Please check the following hints for probable causes of forever being stuck in a loop:
|
Beta Was this translation helpful? Give feedback.
Hi @matteofumagalli1275 ,
Please check the following hints for probable causes of forever being stuck in a loop: