-only generate keys of size 914
authorChristian Grothoff <christian@grothoff.org>
Thu, 11 Oct 2012 14:12:46 +0000 (14:12 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 11 Oct 2012 14:12:46 +0000 (14:12 +0000)
src/util/gnunet-rsa.c

index cdf69384141a04e2ecca34268620dfbe5748b85e..040e66ea9ae134f226f89a7fae9f6ed8a6f20be8 100644 (file)
@@ -25,6 +25,7 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
+#include "gnunet_testing_lib-new.h"
 #include <gcrypt.h>
 
 
@@ -121,6 +122,13 @@ create_keys (const char *fn)
        break;
     }
     enc = GNUNET_CRYPTO_rsa_encode_key (pk);
+    if (GNUNET_TESTING_HOSTKEYFILESIZE != htons (enc->len))
+    {
+      /* sometimes we get a different key length because 'd' or 'u' start
+        with leading bits; skip those... */
+      make_keys++;
+      continue;
+    }
     if (htons (enc->len) != fwrite (enc, 1, htons (enc->len), f))
       {
        fprintf (stderr,