From a741a84289724ea33d3941b10c57e554e8ab5e09 Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Tue, 23 Aug 2016 15:43:38 +0000 Subject: [PATCH] Restore Lenstra protection for gcrypt < 1.6.4 --- src/util/crypto_rsa.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index 0e9ed99d0..443d597e4 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c @@ -840,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, @@ -858,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); -- 2.25.1