|
@@ -138,14 +138,6 @@ bigfraction_t* cf_next(cf_t *f)
|
|
|
exit(EXIT_FAILURE);
|
|
|
}
|
|
|
|
|
|
-static void BN_int2bn(BIGNUM** a, short int i)
|
|
|
-{
|
|
|
- if (!*a) *a = BN_new();
|
|
|
-
|
|
|
- BN_one(*a);
|
|
|
- (*a)->d[0] = i;
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
|
|
|
* \brief Square Root for bignums.
|
|
@@ -216,6 +208,7 @@ int wiener_question_ask(X509* cert)
|
|
|
|
|
|
BIGNUM *b2, *delta;
|
|
|
BN_CTX *ctx;
|
|
|
+ int bits;
|
|
|
|
|
|
rsa = X509_get_pubkey(cert)->pkey.rsa;
|
|
|
phi = BN_new();
|
|
@@ -229,11 +222,12 @@ int wiener_question_ask(X509* cert)
|
|
|
|
|
|
* generate the continued fractions approximating e/N
|
|
|
*/
|
|
|
+ bits = BN_num_bits(n);
|
|
|
cf = cf_init(NULL, e, n);
|
|
|
ctx = cf->ctx;
|
|
|
for (i=0, it = cf_next(cf);
|
|
|
|
|
|
- i!=100 && it;
|
|
|
+ i!=bits && it;
|
|
|
i++, it = cf_next(cf)) {
|
|
|
t = it->h;
|
|
|
d = it->k;
|