71 #include <openssl/fips.h>
95 return FIPS_rsa_generate_key_ex(rsa, bits, e_value, cb);
97 return rsa_builtin_keygen(rsa, bits, e_value, cb);
102 BIGNUM *r0=NULL,*r1=NULL,*r2=NULL,*r3=NULL,*tmp;
103 BIGNUM local_r0,local_d,local_p;
105 int bitsp,bitsq,ok= -1,n=0;
109 if (ctx == NULL)
goto err;
115 if (r3 == NULL)
goto err;
121 if(!rsa->
n && ((rsa->
n=
BN_new()) == NULL))
goto err;
122 if(!rsa->
d && ((rsa->
d=
BN_new()) == NULL))
goto err;
123 if(!rsa->
e && ((rsa->
e=
BN_new()) == NULL))
goto err;
124 if(!rsa->
p && ((rsa->
p=
BN_new()) == NULL))
goto err;
125 if(!rsa->
q && ((rsa->
q=
BN_new()) == NULL))
goto err;
138 if (!
BN_gcd(r1,r2,rsa->
e,ctx))
goto err;
150 unsigned int degenerate = 0;
155 }
while((
BN_cmp(rsa->
p, rsa->
q) == 0) && (++degenerate < 3));
163 if (!
BN_gcd(r1,r2,rsa->
e,ctx))
goto err;
179 if (!
BN_mul(rsa->
n,rsa->
p,rsa->
q,ctx))
goto err;
184 if (!
BN_mul(r0,r1,r2,ctx))
goto err;