- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I am trying to generate a RSA 1024 bit key pair with an infineon XMC4500 f100k1024. At the moment, I generate the key pair externally with openssl. Then, to sign and verify data, I use the mbedtls package with no problem. Generating this RSA key pair with this package I had no success.
I tried to use the functions available on mbedtls to generate a key pair ( mbedtls_ctr_drbg_seed and mbedtls_rsa_gen_key), however, during one of the functions (on mbedtls_rsa_gen_key, when finding a Q prime I guess), the program ends up on a hard fault situation.
#define KEY_SIZE 1024
#define EXPONENT 65537
void create_rsa_keys() {
uint8_t error_found = 0;
mbedtls_rsa_context rsa;
mbedtls_rsa_init( &rsa, MBEDTLS_RSA_PKCS_V15, 0 );
const char *pers = "rsa_genkey";
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ctr_drbg_init( &ctr_drbg );
mbedtls_entropy_init( &entropy );
error_found = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy,
(const unsigned char *) pers, strlen( pers ));
if( error_found != 0 ){
error_found = 100;
}
error_found = mbedtls_rsa_gen_key( &rsa, mbedtls_ctr_drbg_random, &ctr_drbg, KEY_SIZE,
EXPONENT );
if( error_found != 0 ){
error_found = 100;
}
error_found = 1;
}
Can you tell if I am doing something wrong? There are any more packages that can be used to create RSA keys on a microcontroller unit?
Solved! Go to Solution.
- Labels:
-
XMC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @KevinGrennanson,
Can you please take a look at the following thread: https://community.infineon.com/t5/XMC/How-can-i-properly-generate-a-1024-bit-rsa-key-pair-with-a-XMC...
Regards,
Nikhil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @KevinGrennanson,
Can you please take a look at the following thread: https://community.infineon.com/t5/XMC/How-can-i-properly-generate-a-1024-bit-rsa-key-pair-with-a-XMC...
Regards,
Nikhil