Hi,
I also experienced going into an infinite loop using BN_generate_prime_ex() function. I my case it was because I didn't fully understand how to use 'add' and 'rem' parameters. I am now assuming they should be used as in dh_builtin_genparams(), in dh_gen.c.

I am not qualified to discuss how the underlying logic should have been coded, but only considering the programming style, I am quite sure that 'looping' from inside a 'for' instruction using various 'goto' can be avoided.
For  example :
probable_prime(), 'again' and 'loop' tags, line 383 and 390,
or probable_prime_dh_safe(), line 476 (OpenSSL v1.0.2).

Le 16/01/2014 11:35, Nischal a écrit :
Hi,
We are using openSSL in OpenAT-FXT modem. the version used is 0.9.8h. When I
am calling function to generate keys, it goes into infinite loop inside the
function and system got crashed.
By entering traces, I checked the flow of code
Code is given below ----
const int kBits = 4096;
RSA *rsa = RSA_new();
BIGNUM *f4 = BN_new();
BN_GENCB *cb = NULL;
BN_set_word(f4, RSA_F4);
static const char rnd_seed[] = "string to make the random number generator
think it has entropy";
RAND_seed(rnd_seed, sizeof(rnd_seed));
ret = RSA_generate_key_ex(rsa, kBits, f4, cb);
   rsa_builtin_keygen(rsa, bits, e_value, cb);
     BN_generate_prime_ex(rsa->p, bitsp, 0, NULL, NULL, cb)Hi all,
       i=BN_is_prime_fasttest_ex(ret,checks,ctx,0,cb);       //this function
returns 0, so it goes back on loop: to make a random number
          j = witness(check, A, A1, A1_odd, k, ctx, mont);   //witness is
returning 1

Any help to solve the problem be appreciated
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]




______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to