getting service_new.c to compile, albeit it is not yet complete
[oweals/gnunet.git] / src / util / crypto_rsa.c
index c617354c972b1b6b5d67ca76514b4f2d5c13e120..443d597e4c9fad659182a3d3929111854edc8514 100644 (file)
@@ -820,7 +820,6 @@ rsa_sign_mpi (const struct GNUNET_CRYPTO_RsaPrivateKey *key,
               gcry_mpi_t value)
 {
   struct GNUNET_CRYPTO_RsaSignature *sig;
-  struct GNUNET_CRYPTO_RsaPublicKey *public_key;
   gcry_sexp_t data;
   gcry_sexp_t result;
   int rc;
@@ -841,12 +840,12 @@ rsa_sign_mpi (const struct GNUNET_CRYPTO_RsaPrivateKey *key,
     return NULL;
   }
 
+  /* Lenstra protection was first added to libgcrypt 1.6.4
+   * with commit c17f84bd02d7ee93845e92e20f6ddba814961588.
+   */
+#if GCRYPT_VERSION_NUMBER < 0x010604
   /* verify signature (guards against Lenstra's attack with fault injection...) */
-  /* Removed because Lenstra protection was first added to libgcrypt 1.6.4
-   * with commit c17f84bd02d7ee93845e92e20f6ddba814961588.  Do not run with 
-   * an earlier libgcrypt.  Or uncomment if you must.  */
-  /*
-  public_key = GNUNET_CRYPTO_rsa_private_key_get_public (key);
+  struct GNUNET_CRYPTO_RsaPublicKey *public_key = GNUNET_CRYPTO_rsa_private_key_get_public (key);
   if (0 !=
       gcry_pk_verify (result,
                       data,
@@ -859,7 +858,7 @@ rsa_sign_mpi (const struct GNUNET_CRYPTO_RsaPrivateKey *key,
     return NULL;
   }
   GNUNET_CRYPTO_rsa_public_key_free (public_key);
-  */
+#endif
 
   /* return signature */
   gcry_sexp_release (data);