Topic: Error_Creating RSA key

Hi, I am using wolfssl on Infineon board, while generating RSA key using wc_MakeRsaKey() it give error during making of p value. The function return 54 instead of 0.
I'm passing these parameters to function
              ret=wc_MakeRsaKey(&rsakey, 2048, 65537, &rng);

Please suggest what is the issue.

Share

Re: Error_Creating RSA key

Hi Nikhil.Dosi,

Were both the key structure and the RNG initialized prior to calling wc_MakeRsaKey? Please find a code sample below for setup:

        #define HEAP_HINT NULL
        #define WC_RSA_EXPONENT 65537

         WC_RNG rng;
         int keySz = 2048;
         RsaKey genKey; 

         ret = wc_InitRng(&rng); 
         /* check ret val is 0 */
 #ifdef WC_RSA_BLINDING                                                                                                             
         ret = wc_RsaSetRNG(&key, &rng);                                          
        /* check ret is not less than 0 */                                                                                                                                               
 #endif

         ret = wc_InitRsaKey(&genKey, HEAP_HINT);                                 
         /* check ret val is 0 */                                                                      
         ret = wc_MakeRsaKey(&genKey, keySz, WC_RSA_EXPONENT, &rng);              
         /* check ret val is 0 */

Is this the flow of your program? If not could you sent the code you are getting the odd return value from so we can check it on our end or better yet reproduce the issue?

Warm Regards,

Kaleb