updated to nettle 3.3
This commit is contained in:
parent
4ddebebde6
commit
d3e0d6681c
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ nettle-1.15.tar.gz
|
||||
/nettle-2.7.1-hobbled.tar.gz
|
||||
/nettle-3.1.1-hobbled.tar.gz
|
||||
/nettle-3.2-hobbled.tar.xz
|
||||
/nettle-3.3-hobbled.tar.xz
|
||||
|
@ -1,95 +0,0 @@
|
||||
diff --git a/bignum.h b/bignum.h
|
||||
index 24158e0..64ed278 100644
|
||||
--- a/bignum.h
|
||||
+++ b/bignum.h
|
||||
@@ -53,6 +53,8 @@
|
||||
# define mpz_combit mpz_combit
|
||||
# define mpz_import mpz_import
|
||||
# define mpz_export mpz_export
|
||||
+/* Side-channel silent powm not available in mini-gmp. */
|
||||
+# define mpz_powm_sec mpz_pwm
|
||||
#else
|
||||
# include <gmp.h>
|
||||
#endif
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index e1ee64c..1e88477 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -236,9 +236,9 @@ fi
|
||||
# Checks for libraries
|
||||
if test "x$enable_public_key" = "xyes" ; then
|
||||
if test "x$enable_mini_gmp" = "xno" ; then
|
||||
- AC_CHECK_LIB(gmp, __gmpz_getlimbn,,
|
||||
+ AC_CHECK_LIB(gmp, __gmpz_powm_sec,,
|
||||
[AC_MSG_WARN(
|
||||
- [GNU MP not found, or not 3.1 or up, see http://gmplib.org/.
|
||||
+ [GNU MP not found, or too old. GMP-5.0 or later is needed, see http://gmplib.org/.
|
||||
Support for public key algorithms will be unavailable.])]
|
||||
enable_public_key=no)
|
||||
|
||||
diff --git a/dsa-sign.c b/dsa-sign.c
|
||||
index 62c7d4a..9d6bb18 100644
|
||||
--- a/dsa-sign.c
|
||||
+++ b/dsa-sign.c
|
||||
@@ -65,7 +65,7 @@ dsa_sign(const struct dsa_params *params,
|
||||
mpz_add_ui(k, k, 1);
|
||||
|
||||
/* Compute r = (g^k (mod p)) (mod q) */
|
||||
- mpz_powm(tmp, params->g, k, params->p);
|
||||
+ mpz_powm_sec(tmp, params->g, k, params->p);
|
||||
mpz_fdiv_r(signature->r, tmp, params->q);
|
||||
|
||||
/* Compute hash */
|
||||
diff --git a/rsa-blind.c b/rsa-blind.c
|
||||
index 7662f50..16b03d7 100644
|
||||
--- a/rsa-blind.c
|
||||
+++ b/rsa-blind.c
|
||||
@@ -61,7 +61,7 @@ _rsa_blind (const struct rsa_public_key *pub,
|
||||
while (!mpz_invert (ri, r, pub->n));
|
||||
|
||||
/* c = c*(r^e) mod n */
|
||||
- mpz_powm(r, r, pub->e, pub->n);
|
||||
+ mpz_powm_sec(r, r, pub->e, pub->n);
|
||||
mpz_mul(c, c, r);
|
||||
mpz_fdiv_r(c, c, pub->n);
|
||||
|
||||
diff --git a/rsa-sign-tr.c b/rsa-sign-tr.c
|
||||
index 3d80ed4..68233a3 100644
|
||||
--- a/rsa-sign-tr.c
|
||||
+++ b/rsa-sign-tr.c
|
||||
@@ -60,7 +60,7 @@ rsa_blind (const struct rsa_public_key *pub,
|
||||
while (!mpz_invert (ri, r, pub->n));
|
||||
|
||||
/* c = c*(r^e) mod n */
|
||||
- mpz_powm(r, r, pub->e, pub->n);
|
||||
+ mpz_powm_sec(r, r, pub->e, pub->n);
|
||||
mpz_mul(c, m, r);
|
||||
mpz_fdiv_r(c, c, pub->n);
|
||||
|
||||
@@ -97,7 +97,7 @@ rsa_compute_root_tr(const struct rsa_public_key *pub,
|
||||
|
||||
rsa_compute_root (key, xb, mb);
|
||||
|
||||
- mpz_powm(t, xb, pub->e, pub->n);
|
||||
+ mpz_powm_sec(t, xb, pub->e, pub->n);
|
||||
res = (mpz_cmp(mb, t) == 0);
|
||||
|
||||
if (res)
|
||||
diff --git a/rsa-sign.c b/rsa-sign.c
|
||||
index eba7388..4832352 100644
|
||||
--- a/rsa-sign.c
|
||||
+++ b/rsa-sign.c
|
||||
@@ -96,11 +96,11 @@ rsa_compute_root(const struct rsa_private_key *key,
|
||||
|
||||
/* Compute xq = m^d % q = (m%q)^b % q */
|
||||
mpz_fdiv_r(xq, m, key->q);
|
||||
- mpz_powm(xq, xq, key->b, key->q);
|
||||
+ mpz_powm_sec(xq, xq, key->b, key->q);
|
||||
|
||||
/* Compute xp = m^d % p = (m%p)^a % p */
|
||||
mpz_fdiv_r(xp, m, key->p);
|
||||
- mpz_powm(xp, xp, key->a, key->p);
|
||||
+ mpz_powm_sec(xp, xp, key->a, key->p);
|
||||
|
||||
/* Set xp' = (xp - xq) c % p. */
|
||||
mpz_sub(xp, xp, xq);
|
@ -1,8 +1,8 @@
|
||||
diff --git a/examples/ecc-benchmark.c b/examples/ecc-benchmark.c
|
||||
index 15df4c7..18eaae7 100644
|
||||
index 8e5e095..720d483 100644
|
||||
--- a/examples/ecc-benchmark.c
|
||||
+++ b/examples/ecc-benchmark.c
|
||||
@@ -341,8 +341,6 @@ bench_curve (const struct ecc_curve *ecc)
|
||||
@@ -330,8 +330,6 @@ bench_curve (const struct ecc_curve *ecc)
|
||||
}
|
||||
|
||||
const struct ecc_curve * const curves[] = {
|
||||
@ -12,10 +12,10 @@ index 15df4c7..18eaae7 100644
|
||||
&nettle_secp_256r1,
|
||||
&nettle_secp_384r1,
|
||||
diff --git a/examples/hogweed-benchmark.c b/examples/hogweed-benchmark.c
|
||||
index 444d7aa..24c023e 100644
|
||||
index 3fabe20..0223fe7 100644
|
||||
--- a/examples/hogweed-benchmark.c
|
||||
+++ b/examples/hogweed-benchmark.c
|
||||
@@ -394,23 +394,6 @@ bench_ecdsa_init (unsigned size)
|
||||
@@ -393,24 +393,6 @@ bench_ecdsa_init (unsigned size)
|
||||
|
||||
switch (size)
|
||||
{
|
||||
@ -24,7 +24,7 @@ index 444d7aa..24c023e 100644
|
||||
- xs = "8e8e07360350fb6b7ad8370cfd32fa8c6bba785e6e200599";
|
||||
- ys = "7f82ddb58a43d59ff8dc66053002b918b99bd01bd68d6736";
|
||||
- zs = "f2e620e086d658b4b507996988480917640e4dc107808bdd";
|
||||
- ctx->digest = hash_string (&nettle_sha1, 3, "abc");
|
||||
- ctx->digest = hash_string (&nettle_sha1, "abc");
|
||||
- ctx->digest_size = 20;
|
||||
- break;
|
||||
- case 224:
|
||||
@ -32,31 +32,32 @@ index 444d7aa..24c023e 100644
|
||||
- xs = "993bf363f4f2bc0f255f22563980449164e9c894d9efd088d7b77334";
|
||||
- ys = "b75fff9849997d02d135140e4d0030944589586e22df1fc4b629082a";
|
||||
- zs = "cdfd01838247f5de3cc70b688418046f10a2bfaca6de9ec836d48c27";
|
||||
- ctx->digest = hash_string (&nettle_sha224, 3, "abc");
|
||||
- ctx->digest = hash_string (&nettle_sha224, "abc");
|
||||
- ctx->digest_size = 28;
|
||||
- break;
|
||||
-
|
||||
/* From RFC 4754 */
|
||||
- /* From RFC 4754 */
|
||||
case 256:
|
||||
ecc = &nettle_secp_256r1;
|
||||
@@ -582,16 +565,6 @@ bench_openssl_ecdsa_init (unsigned size)
|
||||
xs = "2442A5CC 0ECD015F A3CA31DC 8E2BBC70 BF42D60C BCA20085 E0822CB0 4235E970";
|
||||
@@ -581,16 +563,6 @@ bench_openssl_ecdsa_init (unsigned size)
|
||||
|
||||
switch (size)
|
||||
{
|
||||
- case 192:
|
||||
- ctx->key = EC_KEY_new_by_curve_name (NID_X9_62_prime192v1);
|
||||
- ctx->digest_length = 24; /* truncated */
|
||||
- ctx->digest = hash_string (&nettle_sha224, 3, "abc");
|
||||
- ctx->digest = hash_string (&nettle_sha224, "abc");
|
||||
- break;
|
||||
- case 224:
|
||||
- ctx->key = EC_KEY_new_by_curve_name (NID_secp224r1);
|
||||
- ctx->digest_length = SHA224_DIGEST_SIZE;
|
||||
- ctx->digest = hash_string (&nettle_sha224, 3, "abc");
|
||||
- ctx->digest = hash_string (&nettle_sha224, "abc");
|
||||
- break;
|
||||
case 256:
|
||||
ctx->key = EC_KEY_new_by_curve_name (NID_X9_62_prime256v1);
|
||||
ctx->digest_length = SHA256_DIGEST_SIZE;
|
||||
@@ -702,14 +675,10 @@ struct alg alg_list[] = {
|
||||
@@ -701,14 +673,10 @@ struct alg alg_list[] = {
|
||||
#if 0
|
||||
{ "dsa",2048, bench_dsa_init, bench_dsa_sign, bench_dsa_verify, bench_dsa_clear },
|
||||
#endif
|
||||
@ -145,10 +146,10 @@ index 559de8e..1ca36c2 100644
|
||||
/* From RFC 4754 */
|
||||
test_ecdsa (&nettle_secp_256r1,
|
||||
diff --git a/testsuite/testutils.c b/testsuite/testutils.c
|
||||
index 1ef04c9..b96a2fc 100644
|
||||
index 6f89761..901f62b 100644
|
||||
--- a/testsuite/testutils.c
|
||||
+++ b/testsuite/testutils.c
|
||||
@@ -1224,8 +1224,6 @@ test_dsa_key(const struct dsa_params *params,
|
||||
@@ -1212,8 +1212,6 @@ test_dsa_key(const struct dsa_params *params,
|
||||
}
|
||||
|
||||
const struct ecc_curve * const ecc_curves[] = {
|
||||
@ -157,7 +158,7 @@ index 1ef04c9..b96a2fc 100644
|
||||
&nettle_secp_256r1,
|
||||
&nettle_secp_384r1,
|
||||
&nettle_secp_521r1,
|
||||
@@ -1282,20 +1280,6 @@ test_ecc_mul_a (unsigned curve, unsigned n, const mp_limb_t *p)
|
||||
@@ -1270,20 +1268,6 @@ test_ecc_mul_a (unsigned curve, unsigned n, const mp_limb_t *p)
|
||||
{
|
||||
/* For each curve, the points 2 g, 3 g and 4 g */
|
||||
static const struct ecc_ref_point ref[6][3] = {
|
16
nettle.spec
16
nettle.spec
@ -1,6 +1,6 @@
|
||||
Name: nettle
|
||||
Version: 3.2
|
||||
Release: 3%{?dist}
|
||||
Version: 3.3
|
||||
Release: 1%{?dist}
|
||||
Summary: A low-level cryptographic library
|
||||
|
||||
Group: Development/Libraries
|
||||
@ -8,11 +8,10 @@ License: LGPLv3+ or GPLv2+
|
||||
URL: http://www.lysator.liu.se/~nisse/nettle/
|
||||
Source0: %{name}-%{version}-hobbled.tar.xz
|
||||
#Source0: http://www.lysator.liu.se/~nisse/archive/%{name}-%{version}.tar.gz
|
||||
Patch0: nettle-3.1.1-remove-ecc-testsuite.patch
|
||||
Patch0: nettle-3.3-remove-ecc-testsuite.patch
|
||||
Patch1: nettle-3.2-version-h.patch
|
||||
Patch2: nettle-3.2-cache-silence.patch
|
||||
|
||||
BuildRequires: gmp-devel m4 texinfo-tex
|
||||
BuildRequires: gmp-devel, m4
|
||||
BuildRequires: libtool, automake, autoconf, gettext-devel
|
||||
|
||||
Requires(post): info
|
||||
@ -47,11 +46,10 @@ sed 's/ecc-192.c//g' -i Makefile.in
|
||||
sed 's/ecc-224.c//g' -i Makefile.in
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
%build
|
||||
autoreconf -ifv
|
||||
%configure --enable-shared --disable-arm-neon --enable-fat
|
||||
%configure --enable-shared --enable-fat
|
||||
make %{?_smp_mflags}
|
||||
|
||||
|
||||
@ -104,6 +102,10 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Jul 19 2016 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.3-1
|
||||
- New upstream release
|
||||
- Allow arm neon instructions (they are enabled via fat builds)
|
||||
|
||||
* Tue Jul 19 2016 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.2-3
|
||||
- Backported a fix for more cache silence on RSA and DSA.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user