Browse Source

Revert "Setting upperbound limits to some questions."

This reverts commit 5afbc527f1386e59b18b55babb1008be0509c6f1.
Michele Orrù 10 years ago
parent
commit
6d4128b81e

+ 1 - 1
src/questions/allquestions.c

@@ -103,7 +103,7 @@ void select_all_questions(void)
   /* REGISTER_QUESTION(ExampleQuestion); */
   REGISTER_QUESTION(DixonQuestion);
   REGISTER_QUESTION(PollardBrentRhoQuestion);
-  /* REGISTER_QUESTION(PollardRhoQuestion); */
+  REGISTER_QUESTION(PollardRhoQuestion);
   REGISTER_QUESTION(WilliamsQuestion);
   REGISTER_QUESTION(PollardQuestion);
   REGISTER_QUESTION(FermatQuestion);

+ 0 - 16
src/questions/metadata.c

@@ -3,7 +3,6 @@
  * \brief Certificate Metadata Probe.
  *
  */
-#include <string.h>
 
 #include <openssl/pem.h>
 #include <openssl/rsa.h>
@@ -92,13 +91,6 @@ metadata_question_ask_crt(X509* crt)
   /* Note: debian builds withouth sslv2 support
    * <https://lists.debian.org/debian-devel/2011/04/msg00049.html> */
 
-  /* brands and trivial sanity check for defaults */
-  if (strstr(sbuf, "localhost")  ||
-      strstr(sbuf, "none") ||
-      strstr(sbuf, "test"))
-    fprintf(stderr,
-            "The certificate contains dummy informations.\n");
-
   OPENSSL_free(sserial);
   BN_free(serial);
   EVP_PKEY_free(pkey);
@@ -122,14 +114,6 @@ RSA *metadata_question_ask_rsa(const RSA* rsa)
              EBITLEN, BN_num_bits(rsa->e),
              NBITLEN, BN_num_bits(rsa->n));
 
-
-  if (BN_num_bits(rsa->n) < 2048)
-    fprintf(stdout,
-            "RSA keys < 2048 are disallowed after 2013.\n"
-            "For more informations, see "
-            "<http://csrc.nist.gov/publications/nistpubs/800-131A/sp800-131A.pdf>\n");
-
-
   OPENSSL_free(s);
   OPENSSL_free(t);
   return NULL;

+ 1 - 13
src/questions/pollard.c

@@ -30,8 +30,6 @@
 #include "qa/questions/qarith.h"
 #include "qa/questions/qpollard.h"
 
-/* limits of primes. NOT used in cluster. */
-#define PRIMES_LIM 1000
 
 /**
  * \brief Pollard (p-1) factorization.
@@ -66,17 +64,9 @@ pollard1_question_ask_rsa(const RSA* rsa)
 
   BN_one(g);
   BN_one(q);
-#ifdef HAVE_OPENMPI
   for (it = primes_init();
        BN_is_one(g) && primes_next(it, p);
-       ) {
-#else
-  it = primes_init();
-  for (int lim=PRIMES_LIM;
-       lim && BN_is_one(g) && primes_next(it, p);
-       lim--) {
-#endif
-
+       )  {
     e = BN_num_bits(rsa->n) / BN_num_bits(p) + 1;
     for (k = 0; k < e && BN_is_one(g); k += m) {
       for (j = (m > e) ? e : m; j; j--) {
@@ -97,9 +87,7 @@ pollard1_question_ask_rsa(const RSA* rsa)
 
   /* replay latest epoch */
   if (!BN_cmp(g, rsa->n)) {
-#ifdef DEBUG
     fprintf(stderr, "rollback!\n");
-#endif
     BN_copy(p, back.p);
     BN_one(g);
     BN_copy(b, back.b);

+ 3 - 4
src/questions/pollardrho.c

@@ -12,7 +12,6 @@
 #include <qa/questions/qarith.h>
 #include <qa/questions/questions.h>
 
-#define ATTEMPTS 20
 
 static inline void f(BIGNUM *y, BIGNUM *n, BN_CTX *ctx)
 {
@@ -45,7 +44,7 @@ pollardbrent_question_ask_rsa(const RSA *rsa)
     *k = BN_new(),
     *diff = BN_new();
   BN_CTX *ctx = BN_CTX_new();
-  int lim;
+
 
   BN_one(r);
   BN_one(q);
@@ -53,7 +52,7 @@ pollardbrent_question_ask_rsa(const RSA *rsa)
   BN_dec2bn(&m, "100");
   BN_pseudo_rand_range(y, rsa->n);
 
-  for (lim = ATTEMPTS; BN_is_one(g) && lim; lim--) {
+  while (BN_is_one(g)) {
     BN_copy(x, y);
     for (BN_copy(i, r);
          !BN_is_zero(i);
@@ -86,7 +85,7 @@ pollardbrent_question_ask_rsa(const RSA *rsa)
       BN_gcd(g, diff, rsa->n, ctx);
     } while (BN_is_one(g));
 
-  if (!BN_is_one(g) && BN_cmp(g, rsa->n))
+  if (BN_cmp(g, rsa->n))
     ret = qa_RSA_recover(rsa, g, ctx);
 
 

+ 0 - 9
src/questions/williams+1.c

@@ -20,7 +20,6 @@
 
 
 #define MAX_ATTEMPTS 10
-#define PRIMES_LIM 1000
 
 /**
  * \brief Lucas Sequence Multiplier.
@@ -93,17 +92,9 @@ williams_factorize(BIGNUM *n, BIGNUM *v, BN_CTX *ctx)
 
   BN_one(g);
   BN_one(q);
-#ifdef HAVE_OPENMPI
   for (pit = primes_init();
        BN_is_one(g) && primes_next(pit, p);
        ) {
-#else
-  pit = primes_init();
-  for (int lim=PRIMES_LIM;
-       lim && BN_is_one(g) && primes_next(pit, p);
-       lim--) {
-#endif
-
 #ifdef DEBUG
     fprintf(stderr, "Testing prime: ");
     BN_print_fp(stderr, p);