Hi everyone,
I few days I tried run on my NRF9160 DK CC310 hardware RSA crypto functions.
When I started it at first I ran security_service demo where board run random number generation.
After it I added similar code only for RSA tests. I take RSA example and added to secure_services.c folowing code:
__TZ_NONSECURE_ENTRY_FUNC
int RSA_Test(unsigned char * in_buf, unsigned char * out_buf)
{
int keysize;
int ret = 0;
mbedtls_rsa_context rsa;
mbedtls_ctr_drbg_context ctr_drbg;
keysize = 2048;
//mbedtls_snprintf( title, sizeof( title ), "RSA-%d", keysize );
mbedtls_rsa_init( &rsa, MBEDTLS_RSA_PKCS_V15, 0 );
mbedtls_rsa_gen_key( &rsa, mbedtls_ctr_drbg_random, NULL, keysize, 65537 );
if((ret = mbedtls_rsa_public( &rsa, in_buf, out_buf )) != 0)
{
return ret ;
};
return ret;
}
After fucntion RSA_Test(buf_in, buf_out) call, in output buffer I always have all zeros and function return random error value.