Compare commits
No commits in common. "c10s" and "c8" have entirely different histories.
@ -1 +0,0 @@
|
||||
1
|
28
.gitignore
vendored
28
.gitignore
vendored
@ -1,27 +1 @@
|
||||
nettle-1.15.tar.gz
|
||||
/nettle-2.4.tar.gz
|
||||
/nettle-2.6.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
|
||||
/nettle-3.4.tar.gz.sig
|
||||
/nettle-3.4.tar.gz
|
||||
/nettle-3.4-hobbled.tar.xz
|
||||
/nettle-3.4.1rc1.tar.gz.sig
|
||||
/nettle-3.4.1rc1.tar.gz
|
||||
/nettle-3.5-hobbled.tar.xz
|
||||
/nettle-3.5.1-hobbled.tar.xz
|
||||
/nettle-3.4.1rc1-hobbled.tar.xz
|
||||
/nettle-3.6-hobbled.tar.xz
|
||||
/nettle-3.7-hobbled.tar.xz
|
||||
/nettle-3.7.1-hobbled.tar.xz
|
||||
/nettle-3.7.2-hobbled.tar.xz
|
||||
/nettle-3.7.3-hobbled.tar.xz
|
||||
/nettle-3.8-hobbled.tar.xz
|
||||
/gmp-6.2.1.tar.xz
|
||||
/nettle-3.9.1-hobbled.tar.xz
|
||||
/nettle-3.10-hobbled.tar.xz
|
||||
/nettle-3.10.tar.gz
|
||||
/nettle-3.10.tar.gz.sig
|
||||
/nettle-release-keyring.gpg
|
||||
SOURCES/nettle-3.4.1-hobbled.tar.xz
|
||||
|
1
.nettle.metadata
Normal file
1
.nettle.metadata
Normal file
@ -0,0 +1 @@
|
||||
be5faff0092a6d78186484374c0ea20465eb218c SOURCES/nettle-3.4.1-hobbled.tar.xz
|
181
SOURCES/nettle-3.3-remove-ecc-testsuite.patch
Normal file
181
SOURCES/nettle-3.3-remove-ecc-testsuite.patch
Normal file
@ -0,0 +1,181 @@
|
||||
diff --git a/examples/ecc-benchmark.c b/examples/ecc-benchmark.c
|
||||
index 8e5e095..720d483 100644
|
||||
--- a/examples/ecc-benchmark.c
|
||||
+++ b/examples/ecc-benchmark.c
|
||||
@@ -330,8 +330,6 @@ bench_curve (const struct ecc_curve *ecc)
|
||||
}
|
||||
|
||||
const struct ecc_curve * const curves[] = {
|
||||
- &nettle_secp_192r1,
|
||||
- &nettle_secp_224r1,
|
||||
&_nettle_curve25519,
|
||||
&nettle_secp_256r1,
|
||||
&nettle_secp_384r1,
|
||||
diff --git a/examples/hogweed-benchmark.c b/examples/hogweed-benchmark.c
|
||||
index 3fabe20..0223fe7 100644
|
||||
--- a/examples/hogweed-benchmark.c
|
||||
+++ b/examples/hogweed-benchmark.c
|
||||
@@ -393,24 +393,6 @@ bench_ecdsa_init (unsigned size)
|
||||
|
||||
switch (size)
|
||||
{
|
||||
- case 192:
|
||||
- ecc = &nettle_secp_192r1;
|
||||
- xs = "8e8e07360350fb6b7ad8370cfd32fa8c6bba785e6e200599";
|
||||
- ys = "7f82ddb58a43d59ff8dc66053002b918b99bd01bd68d6736";
|
||||
- zs = "f2e620e086d658b4b507996988480917640e4dc107808bdd";
|
||||
- ctx->digest = hash_string (&nettle_sha1, "abc");
|
||||
- ctx->digest_size = 20;
|
||||
- break;
|
||||
- case 224:
|
||||
- ecc = &nettle_secp_224r1;
|
||||
- xs = "993bf363f4f2bc0f255f22563980449164e9c894d9efd088d7b77334";
|
||||
- ys = "b75fff9849997d02d135140e4d0030944589586e22df1fc4b629082a";
|
||||
- zs = "cdfd01838247f5de3cc70b688418046f10a2bfaca6de9ec836d48c27";
|
||||
- ctx->digest = hash_string (&nettle_sha224, "abc");
|
||||
- ctx->digest_size = 28;
|
||||
- break;
|
||||
-
|
||||
- /* From RFC 4754 */
|
||||
case 256:
|
||||
ecc = &nettle_secp_256r1;
|
||||
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, "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, "abc");
|
||||
- break;
|
||||
case 256:
|
||||
ctx->key = EC_KEY_new_by_curve_name (NID_X9_62_prime256v1);
|
||||
ctx->digest_length = SHA256_DIGEST_SIZE;
|
||||
@@ -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
|
||||
- { "ecdsa", 192, bench_ecdsa_init, bench_ecdsa_sign, bench_ecdsa_verify, bench_ecdsa_clear },
|
||||
- { "ecdsa", 224, bench_ecdsa_init, bench_ecdsa_sign, bench_ecdsa_verify, bench_ecdsa_clear },
|
||||
{ "ecdsa", 256, bench_ecdsa_init, bench_ecdsa_sign, bench_ecdsa_verify, bench_ecdsa_clear },
|
||||
{ "ecdsa", 384, bench_ecdsa_init, bench_ecdsa_sign, bench_ecdsa_verify, bench_ecdsa_clear },
|
||||
{ "ecdsa", 521, bench_ecdsa_init, bench_ecdsa_sign, bench_ecdsa_verify, bench_ecdsa_clear },
|
||||
#if WITH_OPENSSL
|
||||
- { "ecdsa (openssl)", 192, bench_openssl_ecdsa_init, bench_openssl_ecdsa_sign, bench_openssl_ecdsa_verify, bench_openssl_ecdsa_clear },
|
||||
- { "ecdsa (openssl)", 224, bench_openssl_ecdsa_init, bench_openssl_ecdsa_sign, bench_openssl_ecdsa_verify, bench_openssl_ecdsa_clear },
|
||||
{ "ecdsa (openssl)", 256, bench_openssl_ecdsa_init, bench_openssl_ecdsa_sign, bench_openssl_ecdsa_verify, bench_openssl_ecdsa_clear },
|
||||
{ "ecdsa (openssl)", 384, bench_openssl_ecdsa_init, bench_openssl_ecdsa_sign, bench_openssl_ecdsa_verify, bench_openssl_ecdsa_clear },
|
||||
{ "ecdsa (openssl)", 521, bench_openssl_ecdsa_init, bench_openssl_ecdsa_sign, bench_openssl_ecdsa_verify, bench_openssl_ecdsa_clear },
|
||||
diff --git a/testsuite/ecdh-test.c b/testsuite/ecdh-test.c
|
||||
index 5a2b39d..08870b1 100644
|
||||
--- a/testsuite/ecdh-test.c
|
||||
+++ b/testsuite/ecdh-test.c
|
||||
@@ -138,26 +138,6 @@ test_dh (const char *name, const struct ecc_curve *ecc,
|
||||
void
|
||||
test_main(void)
|
||||
{
|
||||
- test_dh ("secp-192r1", &nettle_secp_192r1,
|
||||
- "3406157206141798348095184987208239421004566462391397236532",
|
||||
- "1050363442265225480786760666329560655512990381040021438562",
|
||||
- "5298249600854377235107392014200406283816103564916230704184",
|
||||
- "738368960171459956677260317271477822683777845013274506165",
|
||||
- "2585840779771604687467445319428618542927556223024046979917",
|
||||
- "293088185788565313717816218507714888251468410990708684573",
|
||||
- "149293809021051532782730990145509724807636529827149481690",
|
||||
- "2891131861147398318714693938158856874319184314120776776192");
|
||||
-
|
||||
- test_dh ("secp-224r1", &nettle_secp_224r1,
|
||||
- "1321072106881784386340709783538698930880431939595776773514895067682",
|
||||
- "6768311794185371282972144247871764855860666277647541840973645586477",
|
||||
- "2880077809069104378181313860274147139049600284805670362929579614547",
|
||||
- "13934723037778859565852601874354272638301919827851286722006496784914",
|
||||
- "373124771833407982305885866158843810218322878380632071540538232035",
|
||||
- "24223309755162432227459925493224336241652868856405241018762887667883",
|
||||
- "8330362698029245839097779050425944245826040430538860338085968752913",
|
||||
- "24167244512472228715617822000878192535267113543393576038737592837010");
|
||||
-
|
||||
test_dh ("secp-256r1", &nettle_secp_256r1,
|
||||
"94731533361265297353914491124013058635674217345912524033267198103710636378786",
|
||||
"22441589863306126152768848344973918725077248391248404659242620344938484650846",
|
||||
diff --git a/testsuite/ecdsa-sign-test.c b/testsuite/ecdsa-sign-test.c
|
||||
index 559de8e..1ca36c2 100644
|
||||
--- a/testsuite/ecdsa-sign-test.c
|
||||
+++ b/testsuite/ecdsa-sign-test.c
|
||||
@@ -60,37 +60,6 @@ test_main (void)
|
||||
{
|
||||
/* Test cases for the smaller groups, verified with a
|
||||
proof-of-concept implementation done for Yubico AB. */
|
||||
- test_ecdsa (&nettle_secp_192r1,
|
||||
- "DC51D3866A15BACDE33D96F992FCA99D"
|
||||
- "A7E6EF0934E70975", /* z */
|
||||
-
|
||||
- "9E56F509196784D963D1C0A401510EE7"
|
||||
- "ADA3DCC5DEE04B15", /* k */
|
||||
-
|
||||
- SHEX("BA7816BF8F01CFEA414140DE5DAE2223"
|
||||
- "B00361A396177A9C"), /* h */
|
||||
-
|
||||
- "8c478db6a5c131540cebc739f9c0a9a8"
|
||||
- "c720c2abdd14a891", /* r */
|
||||
-
|
||||
- "a91fb738f9f175d72f9c98527e881c36"
|
||||
- "8de68cb55ffe589"); /* s */
|
||||
-
|
||||
- test_ecdsa (&nettle_secp_224r1,
|
||||
- "446df0a771ed58403ca9cb316e617f6b"
|
||||
- "158420465d00a69601e22858", /* z */
|
||||
-
|
||||
- "4c13f1905ad7eb201178bc08e0c9267b"
|
||||
- "4751c15d5e1831ca214c33f4", /* z */
|
||||
-
|
||||
- SHEX("1b28a611fe62ab3649350525d06703ba"
|
||||
- "4b979a1e543566fd5caa85c6"), /* h */
|
||||
-
|
||||
- "2cc280778f3d067df6d3adbe3a6aad63"
|
||||
- "bc75f08f5c5f915411902a99", /* r */
|
||||
-
|
||||
- "d0f069fd0f108eb07b7bbc54c8d6c88d"
|
||||
- "f2715c38a95c31a2b486995f"); /* s */
|
||||
|
||||
/* From RFC 4754 */
|
||||
test_ecdsa (&nettle_secp_256r1,
|
||||
diff --git a/testsuite/testutils.c b/testsuite/testutils.c
|
||||
index 6f89761..901f62b 100644
|
||||
--- a/testsuite/testutils.c
|
||||
+++ b/testsuite/testutils.c
|
||||
@@ -1212,8 +1212,6 @@ test_dsa_key(const struct dsa_params *params,
|
||||
}
|
||||
|
||||
const struct ecc_curve * const ecc_curves[] = {
|
||||
- &nettle_secp_192r1,
|
||||
- &nettle_secp_224r1,
|
||||
&nettle_secp_256r1,
|
||||
&nettle_secp_384r1,
|
||||
&nettle_secp_521r1,
|
||||
@@ -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] = {
|
||||
- { { "dafebf5828783f2ad35534631588a3f629a70fb16982a888",
|
||||
- "dd6bda0d993da0fa46b27bbc141b868f59331afa5c7e93ab" },
|
||||
- { "76e32a2557599e6edcd283201fb2b9aadfd0d359cbb263da",
|
||||
- "782c37e372ba4520aa62e0fed121d49ef3b543660cfd05fd" },
|
||||
- { "35433907297cc378b0015703374729d7a4fe46647084e4ba",
|
||||
- "a2649984f2135c301ea3acb0776cd4f125389b311db3be32" }
|
||||
- },
|
||||
- { { "706a46dc76dcb76798e60e6d89474788d16dc18032d268fd1a704fa6",
|
||||
- "1c2b76a7bc25e7702a704fa986892849fca629487acf3709d2e4e8bb" },
|
||||
- { "df1b1d66a551d0d31eff822558b9d2cc75c2180279fe0d08fd896d04",
|
||||
- "a3f7f03cadd0be444c0aa56830130ddf77d317344e1af3591981a925" },
|
||||
- { "ae99feebb5d26945b54892092a8aee02912930fa41cd114e40447301",
|
||||
- "482580a0ec5bc47e88bc8c378632cd196cb3fa058a7114eb03054c9" },
|
||||
- },
|
||||
{ { "7cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc47669978",
|
||||
"7775510db8ed040293d9ac69f7430dbba7dade63ce982299e04b79d227873d1" },
|
||||
{ "5ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c",
|
12
SOURCES/nettle-3.4-annocheck.patch
Normal file
12
SOURCES/nettle-3.4-annocheck.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -up nettle-3.4/Makefile.in.annocheck nettle-3.4/Makefile.in
|
||||
--- nettle-3.4/Makefile.in.annocheck 2018-10-16 15:06:53.340138708 +0200
|
||||
+++ nettle-3.4/Makefile.in 2018-10-16 15:12:25.150276379 +0200
|
||||
@@ -377,7 +377,7 @@ ecc-25519.$(OBJEXT): ecc-25519.h
|
||||
|
||||
.asm.$(OBJEXT): $(srcdir)/asm.m4 machine.m4 config.m4
|
||||
$(M4) $(srcdir)/asm.m4 machine.m4 config.m4 $< >$*.s
|
||||
- $(COMPILE) -c $*.s
|
||||
+ $(COMPILE) -c -Wa,--generate-missing-build-notes=yes $*.s
|
||||
@echo "$@ : $< $(srcdir)/asm.m4 machine.m4 config.m4" >$@.d
|
||||
|
||||
# Texinfo rules
|
109
SOURCES/nettle-3.4.1-ecdsa-verify.patch
Normal file
109
SOURCES/nettle-3.4.1-ecdsa-verify.patch
Normal file
@ -0,0 +1,109 @@
|
||||
From 932ea29845da1ae350d9c056cb2cb0379a66d642 Mon Sep 17 00:00:00 2001
|
||||
From: Daiki Ueno <dueno@redhat.com>
|
||||
Date: Tue, 30 Mar 2021 09:22:47 +0200
|
||||
Subject: [PATCH] Port upstream hardening of EC scaler multiplication
|
||||
|
||||
Some internal functions used in point multiplications are known to
|
||||
misbehave if the scaler is out-of-range. This performs canonical
|
||||
reduction on scalers, before point multiplication.
|
||||
|
||||
Signed-off-by: Daiki Ueno <dueno@redhat.com>
|
||||
---
|
||||
ecc-ecdsa-sign.c | 7 +++++--
|
||||
ecc-ecdsa-verify.c | 14 ++++++++++++--
|
||||
eddsa-hash.c | 9 +++++++--
|
||||
3 files changed, 24 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/ecc-ecdsa-sign.c b/ecc-ecdsa-sign.c
|
||||
index 3b9e9cc1..45062528 100644
|
||||
--- a/ecc-ecdsa-sign.c
|
||||
+++ b/ecc-ecdsa-sign.c
|
||||
@@ -62,6 +62,8 @@ ecc_ecdsa_sign (const struct ecc_curve *ecc,
|
||||
mp_limb_t *rp, mp_limb_t *sp,
|
||||
mp_limb_t *scratch)
|
||||
{
|
||||
+ mp_limb_t cy;
|
||||
+
|
||||
#define P scratch
|
||||
#define kinv scratch /* Needs 5*ecc->p.size for computation */
|
||||
#define hp (scratch + ecc->p.size) /* NOTE: ecc->p.size + 1 limbs! */
|
||||
@@ -91,8 +93,9 @@ ecc_ecdsa_sign (const struct ecc_curve *ecc,
|
||||
ecc_modq_mul (ecc, tp, zp, rp);
|
||||
ecc_modq_add (ecc, hp, hp, tp);
|
||||
ecc_modq_mul (ecc, tp, hp, kinv);
|
||||
-
|
||||
- mpn_copyi (sp, tp, ecc->p.size);
|
||||
+ /* Ensure canonical reduction. */
|
||||
+ cy = mpn_sub_n (sp, tp, ecc->q.m, ecc->q.size);
|
||||
+ cnd_copy (cy, sp, tp, ecc->q.size);
|
||||
#undef P
|
||||
#undef hp
|
||||
#undef kinv
|
||||
diff --git a/ecc-ecdsa-verify.c b/ecc-ecdsa-verify.c
|
||||
index d7f5b684..6b8acb07 100644
|
||||
--- a/ecc-ecdsa-verify.c
|
||||
+++ b/ecc-ecdsa-verify.c
|
||||
@@ -75,6 +75,8 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
|
||||
const mp_limb_t *rp, const mp_limb_t *sp,
|
||||
mp_limb_t *scratch)
|
||||
{
|
||||
+ mp_limb_t cy;
|
||||
+
|
||||
/* Procedure, according to RFC 6090, "KT-I". q denotes the group
|
||||
order.
|
||||
|
||||
@@ -98,6 +100,7 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
|
||||
#define P1 (scratch + 4*ecc->p.size)
|
||||
#define sinv (scratch)
|
||||
#define hp (scratch + ecc->p.size)
|
||||
+#define tp (scratch + 4*ecc->p.size)
|
||||
|
||||
if (! (ecdsa_in_range (ecc, rp)
|
||||
&& ecdsa_in_range (ecc, sp)))
|
||||
@@ -112,10 +115,16 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
|
||||
|
||||
/* u1 = h / s, P1 = u1 * G */
|
||||
ecc_hash (&ecc->q, hp, length, digest);
|
||||
- ecc_modq_mul (ecc, u1, hp, sinv);
|
||||
+ ecc_modq_mul (ecc, tp, hp, sinv);
|
||||
+ /* Ensure canonical reduction. */
|
||||
+ cy = mpn_sub_n (u1, tp, ecc->q.m, ecc->q.size);
|
||||
+ cnd_copy (cy, u1, tp, ecc->q.size);
|
||||
|
||||
/* u2 = r / s, P2 = u2 * Y */
|
||||
- ecc_modq_mul (ecc, u2, rp, sinv);
|
||||
+ ecc_modq_mul (ecc, hp, rp, sinv);
|
||||
+ /* Ensure canonical reduction. */
|
||||
+ cy = mpn_sub_n (u2, hp, ecc->q.m, ecc->q.size);
|
||||
+ cnd_copy (cy, u2, hp, ecc->q.size);
|
||||
|
||||
/* Total storage: 5*ecc->p.size + ecc->mul_itch */
|
||||
ecc->mul (ecc, P2, u2, pp, u2 + ecc->p.size);
|
||||
@@ -154,4 +163,5 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
|
||||
#undef u2
|
||||
#undef hp
|
||||
#undef u1
|
||||
+#undef tp
|
||||
}
|
||||
diff --git a/eddsa-hash.c b/eddsa-hash.c
|
||||
index 4fb79f1b..53c6fc49 100644
|
||||
--- a/eddsa-hash.c
|
||||
+++ b/eddsa-hash.c
|
||||
@@ -45,7 +45,12 @@ void
|
||||
_eddsa_hash (const struct ecc_modulo *m,
|
||||
mp_limb_t *rp, const uint8_t *digest)
|
||||
{
|
||||
+ mp_limb_t cy;
|
||||
+
|
||||
size_t nbytes = 1 + m->bit_size / 8;
|
||||
- mpn_set_base256_le (rp, 2*m->size, digest, 2*nbytes);
|
||||
- m->mod (m, rp);
|
||||
+ mpn_set_base256_le (rp + m->size, 2*m->size, digest, 2*nbytes);
|
||||
+ m->mod (m, rp + m->size);
|
||||
+ /* Ensure canonical reduction. */
|
||||
+ cy = mpn_sub_n (rp, rp + m->size, m->m, m->size);
|
||||
+ cnd_copy (cy, rp, rp + m->size, m->size);
|
||||
}
|
||||
--
|
||||
2.30.2
|
||||
|
210
SOURCES/nettle-3.4.1-enable-intel-cet.patch
Normal file
210
SOURCES/nettle-3.4.1-enable-intel-cet.patch
Normal file
@ -0,0 +1,210 @@
|
||||
diff --git a/asm.m4 b/asm.m4
|
||||
index 8da47201..59d64098 100644
|
||||
--- a/asm.m4
|
||||
+++ b/asm.m4
|
||||
@@ -32,7 +32,7 @@ define(<GMP_NUMB_BITS>,<>)dnl
|
||||
define(<PROLOGUE>,
|
||||
<.globl C_NAME($1)
|
||||
DECLARE_FUNC(C_NAME($1))
|
||||
-C_NAME($1):>)
|
||||
+C_NAME($1): ASM_X86_ENDBR>)
|
||||
|
||||
define(<EPILOGUE>,
|
||||
<ifelse(ELF_STYLE,yes,
|
||||
--- a/config.m4.in 2018-12-04 21:56:06.000000000 +0100
|
||||
+++ b/config.m4.in 2020-05-15 11:25:42.350465132 +0200
|
||||
@@ -7,6 +7,9 @@
|
||||
define(<ALIGN_LOG>, <@ASM_ALIGN_LOG@>)dnl
|
||||
define(<W64_ABI>, <@W64_ABI@>)dnl
|
||||
define(<RODATA>, <@ASM_RODATA@>)dnl
|
||||
+define(<ASM_X86_ENDBR>,<@ASM_X86_ENDBR@>)dnl
|
||||
+define(<ASM_X86_MARK_CET_ALIGN>,<@ASM_X86_MARK_CET_ALIGN@>)dnl
|
||||
divert(1)
|
||||
+@ASM_X86_MARK_CET@
|
||||
@ASM_MARK_NOEXEC_STACK@
|
||||
divert
|
||||
--- a/configure.ac 2018-12-04 21:56:06.000000000 +0100
|
||||
+++ b/configure.ac 2020-05-15 11:46:39.152373137 +0200
|
||||
@@ -787,6 +787,68 @@
|
||||
ASM_ALIGN_LOG="$nettle_cv_asm_align_log"
|
||||
fi
|
||||
|
||||
+dnl Define
|
||||
+dnl 1. ASM_X86_ENDBR for endbr32/endbr64.
|
||||
+dnl 2. ASM_X86_MARK_CET to add a .note.gnu.property section to mark
|
||||
+dnl Intel CET support if needed.
|
||||
+dnl 3. ASM_X86_MARK_CET_ALIGN to align ASM_X86_MARK_CET.
|
||||
+AC_CACHE_CHECK([if Intel CET is enabled],
|
||||
+ [nettle_cv_asm_x86_intel_cet],
|
||||
+ [AC_TRY_COMPILE([
|
||||
+#ifndef __CET__
|
||||
+#error Intel CET is not enabled
|
||||
+#endif
|
||||
+ ], [],
|
||||
+ [nettle_cv_asm_x86_intel_cet=yes],
|
||||
+ [nettle_cv_asm_x86_intel_cet=no])])
|
||||
+if test "$nettle_cv_asm_x86_intel_cet" = yes; then
|
||||
+ case $ABI in
|
||||
+ 32|standard)
|
||||
+ ASM_X86_ENDBR=endbr32
|
||||
+ ASM_X86_MARK_CET_ALIGN=2
|
||||
+ ;;
|
||||
+ 64)
|
||||
+ ASM_X86_ENDBR=endbr64
|
||||
+ ASM_X86_MARK_CET_ALIGN=3
|
||||
+ ;;
|
||||
+ x32)
|
||||
+ ASM_X86_ENDBR=endbr64
|
||||
+ ASM_X86_MARK_CET_ALIGN=2
|
||||
+ ;;
|
||||
+ esac
|
||||
+ AC_CACHE_CHECK([if .note.gnu.property section is needed],
|
||||
+ [nettle_cv_asm_x86_gnu_property],
|
||||
+ [AC_TRY_COMPILE([
|
||||
+#if !defined __ELF__ || !defined __CET__
|
||||
+#error GNU property is not needed
|
||||
+#endif
|
||||
+ ], [],
|
||||
+ [nettle_cv_asm_x86_gnu_property=yes],
|
||||
+ [nettle_cv_asm_x86_gnu_property=no])])
|
||||
+else
|
||||
+ nettle_cv_asm_x86_gnu_property=no
|
||||
+fi
|
||||
+if test "$nettle_cv_asm_x86_gnu_property" = yes; then
|
||||
+ ASM_X86_MARK_CET='
|
||||
+ .pushsection ".note.gnu.property", "a"
|
||||
+ .p2align ASM_X86_MARK_CET_ALIGN
|
||||
+ .long 1f - 0f
|
||||
+ .long 4f - 1f
|
||||
+ .long 5
|
||||
+0:
|
||||
+ .asciz "GNU"
|
||||
+1:
|
||||
+ .p2align ASM_X86_MARK_CET_ALIGN
|
||||
+ .long 0xc0000002
|
||||
+ .long 3f - 2f
|
||||
+2:
|
||||
+ .long 3
|
||||
+3:
|
||||
+ .p2align ASM_X86_MARK_CET_ALIGN
|
||||
+4:
|
||||
+ .popsection'
|
||||
+fi
|
||||
+
|
||||
AC_SUBST(ASM_SYMBOL_PREFIX)
|
||||
AC_SUBST(ASM_ELF_STYLE)
|
||||
AC_SUBST(ASM_COFF_STYLE)
|
||||
@@ -796,6 +858,9 @@
|
||||
AC_SUBST(ASM_ALIGN_LOG)
|
||||
AC_SUBST(W64_ABI)
|
||||
AC_SUBST(EMULATOR)
|
||||
+AC_SUBST(ASM_X86_ENDBR)
|
||||
+AC_SUBST(ASM_X86_MARK_CET)
|
||||
+AC_SUBST(ASM_X86_MARK_CET_ALIGN)
|
||||
|
||||
AC_SUBST(LIBNETTLE_MAJOR)
|
||||
AC_SUBST(LIBNETTLE_MINOR)
|
||||
diff --git a/testsuite/.test-rules.make b/testsuite/.test-rules.make
|
||||
index 922a2c7f..9de8f412 100644
|
||||
--- a/testsuite/.test-rules.make
|
||||
+++ b/testsuite/.test-rules.make
|
||||
@@ -178,6 +178,9 @@ xts-test$(EXEEXT): xts-test.$(OBJEXT)
|
||||
pbkdf2-test$(EXEEXT): pbkdf2-test.$(OBJEXT)
|
||||
$(LINK) pbkdf2-test.$(OBJEXT) $(TEST_OBJS) -o pbkdf2-test$(EXEEXT)
|
||||
|
||||
+x86-ibt-test$(EXEEXT): x86-ibt-test.$(OBJEXT)
|
||||
+ $(LINK) x86-ibt-test.$(OBJEXT) $(TEST_OBJS) -o x86-ibt-test$(EXEEXT)
|
||||
+
|
||||
sexp-test$(EXEEXT): sexp-test.$(OBJEXT)
|
||||
$(LINK) sexp-test.$(OBJEXT) $(TEST_OBJS) -o sexp-test$(EXEEXT)
|
||||
|
||||
--- a/testsuite/Makefile.in 2018-12-04 21:56:06.000000000 +0100
|
||||
+++ b/testsuite/Makefile.in 2020-05-15 11:21:15.673321598 +0200
|
||||
@@ -31,7 +31,8 @@
|
||||
hmac-test.c umac-test.c \
|
||||
meta-hash-test.c meta-cipher-test.c\
|
||||
meta-aead-test.c meta-armor-test.c \
|
||||
- buffer-test.c yarrow-test.c pbkdf2-test.c
|
||||
+ buffer-test.c yarrow-test.c pbkdf2-test.c \
|
||||
+ x86-ibt-test.c
|
||||
|
||||
TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
|
||||
rsa2sexp-test.c sexp2rsa-test.c \
|
||||
diff --git a/testsuite/x86-ibt-test.c b/testsuite/x86-ibt-test.c
|
||||
new file mode 100644
|
||||
index 00000000..1f3d1d67
|
||||
--- /dev/null
|
||||
+++ b/testsuite/x86-ibt-test.c
|
||||
@@ -0,0 +1,69 @@
|
||||
+#include "testutils.h"
|
||||
+#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) \
|
||||
+ && defined(__CET__) && defined(__linux__)
|
||||
+#include <signal.h>
|
||||
+
|
||||
+static void
|
||||
+segfault_handler(int signo)
|
||||
+{
|
||||
+ exit(0);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+ibt_violation(void)
|
||||
+{
|
||||
+#ifdef __i386__
|
||||
+ unsigned int reg;
|
||||
+ asm volatile("lea 1f, %0\n\t"
|
||||
+ "jmp *%0\n"
|
||||
+ "1:" : "=r" (reg));
|
||||
+#else
|
||||
+ unsigned long long reg;
|
||||
+ asm volatile("lea 1f(%%rip), %0\n\t"
|
||||
+ "jmp *%0\n"
|
||||
+ "1:" : "=r" (reg));
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+#ifdef __i386__
|
||||
+static unsigned int
|
||||
+_get_ssp(void)
|
||||
+{
|
||||
+ unsigned int ssp;
|
||||
+ asm volatile("xor %0, %0\n\trdsspd %0" : "=r" (ssp));
|
||||
+ return ssp;
|
||||
+}
|
||||
+#else
|
||||
+static unsigned long long
|
||||
+_get_ssp(void)
|
||||
+{
|
||||
+ unsigned long long ssp;
|
||||
+ asm volatile("xor %0, %0\n\trdsspq %0" : "=r" (ssp));
|
||||
+ return ssp;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+void
|
||||
+test_main(void)
|
||||
+{
|
||||
+ /* NB: This test should trigger SIGSEGV on CET platforms. _get_ssp
|
||||
+ returns the address of shadow stack pointer. If the address of
|
||||
+ shadow stack pointer is 0, SHSTK is disabled and we assume that
|
||||
+ IBT is also disabled. */
|
||||
+ if (_get_ssp() == 0)
|
||||
+ {
|
||||
+ ibt_violation();
|
||||
+ SKIP();
|
||||
+ }
|
||||
+
|
||||
+ signal(SIGSEGV, segfault_handler);
|
||||
+ ibt_violation();
|
||||
+ FAIL();
|
||||
+}
|
||||
+#else
|
||||
+void
|
||||
+test_main(void)
|
||||
+{
|
||||
+ SKIP();
|
||||
+}
|
||||
+#endif
|
||||
--
|
||||
2.25.4
|
||||
|
1142
SOURCES/nettle-3.4.1-powerpc64-aes-asm.patch
Normal file
1142
SOURCES/nettle-3.4.1-powerpc64-aes-asm.patch
Normal file
File diff suppressed because it is too large
Load Diff
1519
SOURCES/nettle-3.4.1-powerpc64-ghash-asm.patch
Normal file
1519
SOURCES/nettle-3.4.1-powerpc64-ghash-asm.patch
Normal file
File diff suppressed because it is too large
Load Diff
609
SOURCES/nettle-3.4.1-rsa-decrypt.patch
Normal file
609
SOURCES/nettle-3.4.1-rsa-decrypt.patch
Normal file
@ -0,0 +1,609 @@
|
||||
From 5646ca77ee92de0ae33e7d2e0a3383c61a4091ed Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
|
||||
Date: Thu, 6 May 2021 21:30:23 +0200
|
||||
Subject: [PATCH 1/4] Add check that message length to _pkcs1_sec_decrypt is
|
||||
valid.
|
||||
|
||||
* pkcs1-sec-decrypt.c (_pkcs1_sec_decrypt): Check that message
|
||||
length is valid, for given key size.
|
||||
* testsuite/rsa-sec-decrypt-test.c (test_main): Add test cases for
|
||||
calls to rsa_sec_decrypt specifying a too large message length.
|
||||
|
||||
(cherry picked from commit 7616541e6eff73353bf682c62e3a68e4fe696707)
|
||||
---
|
||||
ChangeLog | 8 ++++++++
|
||||
pkcs1-sec-decrypt.c | 4 +++-
|
||||
testsuite/rsa-sec-decrypt-test.c | 17 ++++++++++++++++-
|
||||
3 files changed, 27 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ChangeLog b/ChangeLog
|
||||
index 4c7338a1..7cd0455e 100644
|
||||
--- a/ChangeLog
|
||||
+++ b/ChangeLog
|
||||
@@ -1,3 +1,11 @@
|
||||
+2021-05-06 Niels Möller <nisse@lysator.liu.se>
|
||||
+
|
||||
+ Bug fixes merged from from 3.7.3 release (starting from 2021-05-06).
|
||||
+ * pkcs1-sec-decrypt.c (_pkcs1_sec_decrypt): Check that message
|
||||
+ length is valid, for given key size.
|
||||
+ * testsuite/rsa-sec-decrypt-test.c (test_main): Add test cases for
|
||||
+ calls to rsa_sec_decrypt specifying a too large message length.
|
||||
+
|
||||
2018-12-04 Niels Möller <nisse@lysator.liu.se>
|
||||
|
||||
* Released nettle-3.4.1.
|
||||
diff --git a/pkcs1-sec-decrypt.c b/pkcs1-sec-decrypt.c
|
||||
index 722044b0..02fd07e1 100644
|
||||
--- a/pkcs1-sec-decrypt.c
|
||||
+++ b/pkcs1-sec-decrypt.c
|
||||
@@ -64,7 +64,9 @@ _pkcs1_sec_decrypt (size_t length, uint8_t *message,
|
||||
volatile int ok;
|
||||
size_t i, t;
|
||||
|
||||
- assert (padded_message_length >= length);
|
||||
+ /* Message independent branch */
|
||||
+ if (length + 11 > padded_message_length)
|
||||
+ return 0;
|
||||
|
||||
t = padded_message_length - length - 1;
|
||||
|
||||
diff --git a/testsuite/rsa-sec-decrypt-test.c b/testsuite/rsa-sec-decrypt-test.c
|
||||
index 64f0b13c..4a9f301b 100644
|
||||
--- a/testsuite/rsa-sec-decrypt-test.c
|
||||
+++ b/testsuite/rsa-sec-decrypt-test.c
|
||||
@@ -55,6 +55,7 @@ rsa_decrypt_for_test(const struct rsa_public_key *pub,
|
||||
#endif
|
||||
|
||||
#define PAYLOAD_SIZE 50
|
||||
+#define DECRYPTED_SIZE 256
|
||||
void
|
||||
test_main(void)
|
||||
{
|
||||
@@ -63,7 +64,7 @@ test_main(void)
|
||||
struct knuth_lfib_ctx random_ctx;
|
||||
|
||||
uint8_t plaintext[PAYLOAD_SIZE];
|
||||
- uint8_t decrypted[PAYLOAD_SIZE];
|
||||
+ uint8_t decrypted[DECRYPTED_SIZE];
|
||||
uint8_t verifybad[PAYLOAD_SIZE];
|
||||
unsigned n_size = 1024;
|
||||
mpz_t gibberish;
|
||||
@@ -98,6 +99,20 @@ test_main(void)
|
||||
PAYLOAD_SIZE, decrypted, gibberish) == 1);
|
||||
ASSERT (MEMEQ (PAYLOAD_SIZE, plaintext, decrypted));
|
||||
|
||||
+ ASSERT (pub.size > 10);
|
||||
+ ASSERT (pub.size <= DECRYPTED_SIZE);
|
||||
+
|
||||
+ /* Check that too large message length is rejected, largest
|
||||
+ valid size is pub.size - 11. */
|
||||
+ ASSERT (!rsa_decrypt_for_test (&pub, &key, &random_ctx,
|
||||
+ (nettle_random_func *) knuth_lfib_random,
|
||||
+ pub.size - 10, decrypted, gibberish));
|
||||
+
|
||||
+ /* This case used to result in arithmetic underflow and a crash. */
|
||||
+ ASSERT (!rsa_decrypt_for_test (&pub, &key, &random_ctx,
|
||||
+ (nettle_random_func *) knuth_lfib_random,
|
||||
+ pub.size, decrypted, gibberish));
|
||||
+
|
||||
/* bad one */
|
||||
memcpy(decrypted, verifybad, PAYLOAD_SIZE);
|
||||
nettle_mpz_random_size(garbage, &random_ctx,
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From 743cdf38353f6dd5d3d91eadc769106cfc116301 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
|
||||
Date: Tue, 8 Jun 2021 21:30:48 +0200
|
||||
Subject: [PATCH 2/4] Fix comment typos.
|
||||
|
||||
(cherry picked from commit 0a714543136de97c7fd34f1c6ac1592dc5036879)
|
||||
---
|
||||
pkcs1-sec-decrypt.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pkcs1-sec-decrypt.c b/pkcs1-sec-decrypt.c
|
||||
index 02fd07e1..a7f85c2e 100644
|
||||
--- a/pkcs1-sec-decrypt.c
|
||||
+++ b/pkcs1-sec-decrypt.c
|
||||
@@ -102,8 +102,8 @@ _pkcs1_sec_decrypt_variable(size_t *length, uint8_t *message,
|
||||
|
||||
/* length is discovered in a side-channel silent way.
|
||||
* not_found goes to 0 when the terminator is found.
|
||||
- * offset strts at 3 as it includes the terminator and
|
||||
- * the fomat bytes already */
|
||||
+ * offset starts at 3 as it includes the terminator and
|
||||
+ * the format bytes already */
|
||||
offset = 3;
|
||||
for (i = 2; i < padded_message_length; i++)
|
||||
{
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From dfce46c4540d2abf040073070cff15f9d1708050 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
|
||||
Date: Tue, 8 Jun 2021 21:31:39 +0200
|
||||
Subject: [PATCH 3/4] Change _rsa_sec_compute_root_tr to take a fix input size.
|
||||
|
||||
Improves consistency with _rsa_sec_compute_root, and fixes zero-input bug.
|
||||
|
||||
(cherry picked from commit 485b5e2820a057e873b1ba812fdb39cae4adf98c)
|
||||
---
|
||||
ChangeLog | 17 +++++++++-
|
||||
rsa-decrypt-tr.c | 7 ++---
|
||||
rsa-internal.h | 4 +--
|
||||
rsa-sec-decrypt.c | 9 ++++--
|
||||
rsa-sign-tr.c | 61 +++++++++++++++++-------------------
|
||||
testsuite/rsa-encrypt-test.c | 14 ++++++++-
|
||||
6 files changed, 69 insertions(+), 43 deletions(-)
|
||||
|
||||
diff --git a/ChangeLog b/ChangeLog
|
||||
index 7cd0455e..ae660fc0 100644
|
||||
--- a/ChangeLog
|
||||
+++ b/ChangeLog
|
||||
@@ -1,6 +1,21 @@
|
||||
-2021-05-06 Niels Möller <nisse@lysator.liu.se>
|
||||
+2021-05-14 Niels Möller <nisse@lysator.liu.se>
|
||||
|
||||
Bug fixes merged from from 3.7.3 release (starting from 2021-05-06).
|
||||
+ * rsa-sign-tr.c (rsa_sec_blind): Delete mn argument.
|
||||
+ (_rsa_sec_compute_root_tr): Delete mn argument, instead require
|
||||
+ that input size matches key size. Rearrange use of temporary
|
||||
+ storage, to support in-place operation, x == m. Update all
|
||||
+ callers.
|
||||
+
|
||||
+ * rsa-decrypt-tr.c (rsa_decrypt_tr): Make zero-padded copy of
|
||||
+ input, for calling _rsa_sec_compute_root_tr.
|
||||
+ * rsa-sec-decrypt.c (rsa_sec_decrypt): Likewise.
|
||||
+
|
||||
+ * testsuite/rsa-encrypt-test.c (test_main): Test calling all of
|
||||
+ rsa_decrypt, rsa_decrypt_tr, and rsa_sec_decrypt with zero input.
|
||||
+
|
||||
+2021-05-06 Niels Möller <nisse@lysator.liu.se>
|
||||
+
|
||||
* pkcs1-sec-decrypt.c (_pkcs1_sec_decrypt): Check that message
|
||||
length is valid, for given key size.
|
||||
* testsuite/rsa-sec-decrypt-test.c (test_main): Add test cases for
|
||||
diff --git a/rsa-decrypt-tr.c b/rsa-decrypt-tr.c
|
||||
index 5dfb91b1..c118e852 100644
|
||||
--- a/rsa-decrypt-tr.c
|
||||
+++ b/rsa-decrypt-tr.c
|
||||
@@ -52,14 +52,13 @@ rsa_decrypt_tr(const struct rsa_public_key *pub,
|
||||
mp_size_t key_limb_size;
|
||||
int res;
|
||||
|
||||
- key_limb_size = NETTLE_OCTET_SIZE_TO_LIMB_SIZE(key->size);
|
||||
+ key_limb_size = mpz_size(pub->n);
|
||||
|
||||
TMP_GMP_ALLOC (m, key_limb_size);
|
||||
TMP_GMP_ALLOC (em, key->size);
|
||||
+ mpz_limbs_copy(m, gibberish, key_limb_size);
|
||||
|
||||
- res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, m,
|
||||
- mpz_limbs_read(gibberish),
|
||||
- mpz_size(gibberish));
|
||||
+ res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, m, m);
|
||||
|
||||
mpn_get_base256 (em, key->size, m, key_limb_size);
|
||||
|
||||
diff --git a/rsa-internal.h b/rsa-internal.h
|
||||
index bd667bc2..64a7edf6 100644
|
||||
--- a/rsa-internal.h
|
||||
+++ b/rsa-internal.h
|
||||
@@ -53,12 +53,12 @@ _rsa_sec_compute_root(const struct rsa_private_key *key,
|
||||
mp_limb_t *scratch);
|
||||
|
||||
/* Safe side-channel silent variant, using RSA blinding, and checking the
|
||||
- * result after CRT. */
|
||||
+ * result after CRT. In-place calls, with x == m, is allowed. */
|
||||
int
|
||||
_rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
|
||||
const struct rsa_private_key *key,
|
||||
void *random_ctx, nettle_random_func *random,
|
||||
- mp_limb_t *x, const mp_limb_t *m, size_t mn);
|
||||
+ mp_limb_t *x, const mp_limb_t *m);
|
||||
|
||||
/* additional resistance to memory access side-channel attacks.
|
||||
* Note: message buffer is returned unchanged on error */
|
||||
diff --git a/rsa-sec-decrypt.c b/rsa-sec-decrypt.c
|
||||
index e6a4b267..633a6852 100644
|
||||
--- a/rsa-sec-decrypt.c
|
||||
+++ b/rsa-sec-decrypt.c
|
||||
@@ -57,9 +57,12 @@ rsa_sec_decrypt(const struct rsa_public_key *pub,
|
||||
TMP_GMP_ALLOC (m, mpz_size(pub->n));
|
||||
TMP_GMP_ALLOC (em, key->size);
|
||||
|
||||
- res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, m,
|
||||
- mpz_limbs_read(gibberish),
|
||||
- mpz_size(gibberish));
|
||||
+ /* We need a copy because m can be shorter than key_size,
|
||||
+ * but _rsa_sec_compute_root_tr expect all inputs to be
|
||||
+ * normalized to a key_size long buffer length */
|
||||
+ mpz_limbs_copy(m, gibberish, mpz_size(pub->n));
|
||||
+
|
||||
+ res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, m, m);
|
||||
|
||||
mpn_get_base256 (em, key->size, m, mpz_size(pub->n));
|
||||
|
||||
diff --git a/rsa-sign-tr.c b/rsa-sign-tr.c
|
||||
index 59c9bd07..141a52c7 100644
|
||||
--- a/rsa-sign-tr.c
|
||||
+++ b/rsa-sign-tr.c
|
||||
@@ -131,35 +131,34 @@ int
|
||||
_rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
|
||||
const struct rsa_private_key *key,
|
||||
void *random_ctx, nettle_random_func *random,
|
||||
- mp_limb_t *x, const mp_limb_t *m, size_t mn)
|
||||
+ mp_limb_t *x, const mp_limb_t *m)
|
||||
{
|
||||
+ mp_size_t nn;
|
||||
mpz_t mz;
|
||||
mpz_t xz;
|
||||
int res;
|
||||
|
||||
- mpz_init(mz);
|
||||
mpz_init(xz);
|
||||
|
||||
- mpn_copyi(mpz_limbs_write(mz, mn), m, mn);
|
||||
- mpz_limbs_finish(mz, mn);
|
||||
+ nn = mpz_size (pub->n);
|
||||
|
||||
- res = rsa_compute_root_tr(pub, key, random_ctx, random, xz, mz);
|
||||
+ res = rsa_compute_root_tr(pub, key, random_ctx, random, xz,
|
||||
+ mpz_roinit_n(mz, m, nn));
|
||||
|
||||
if (res)
|
||||
- mpz_limbs_copy(x, xz, mpz_size(pub->n));
|
||||
+ mpz_limbs_copy(x, xz, nn);
|
||||
|
||||
- mpz_clear(mz);
|
||||
mpz_clear(xz);
|
||||
return res;
|
||||
}
|
||||
#else
|
||||
/* Blinds m, by computing c = m r^e (mod n), for a random r. Also
|
||||
- returns the inverse (ri), for use by rsa_unblind. */
|
||||
+ returns the inverse (ri), for use by rsa_unblind. Must have c != m,
|
||||
+ no in-place operation.*/
|
||||
static void
|
||||
rsa_sec_blind (const struct rsa_public_key *pub,
|
||||
void *random_ctx, nettle_random_func *random,
|
||||
- mp_limb_t *c, mp_limb_t *ri, const mp_limb_t *m,
|
||||
- mp_size_t mn)
|
||||
+ mp_limb_t *c, mp_limb_t *ri, const mp_limb_t *m)
|
||||
{
|
||||
const mp_limb_t *ep = mpz_limbs_read (pub->e);
|
||||
const mp_limb_t *np = mpz_limbs_read (pub->n);
|
||||
@@ -177,15 +176,15 @@ rsa_sec_blind (const struct rsa_public_key *pub,
|
||||
|
||||
/* c = m*(r^e) mod n */
|
||||
itch = mpn_sec_powm_itch(nn, ebn, nn);
|
||||
- i2 = mpn_sec_mul_itch(nn, mn);
|
||||
+ i2 = mpn_sec_mul_itch(nn, nn);
|
||||
itch = MAX(itch, i2);
|
||||
- i2 = mpn_sec_div_r_itch(nn + mn, nn);
|
||||
+ i2 = mpn_sec_div_r_itch(2*nn, nn);
|
||||
itch = MAX(itch, i2);
|
||||
i2 = mpn_sec_invert_itch(nn);
|
||||
itch = MAX(itch, i2);
|
||||
|
||||
- TMP_GMP_ALLOC (tp, nn + mn + itch);
|
||||
- scratch = tp + nn + mn;
|
||||
+ TMP_GMP_ALLOC (tp, 2*nn + itch);
|
||||
+ scratch = tp + 2*nn;
|
||||
|
||||
/* ri = r^(-1) */
|
||||
do
|
||||
@@ -198,9 +197,8 @@ rsa_sec_blind (const struct rsa_public_key *pub,
|
||||
while (!mpn_sec_invert (ri, tp, np, nn, 2 * nn * GMP_NUMB_BITS, scratch));
|
||||
|
||||
mpn_sec_powm (c, rp, nn, ep, ebn, np, nn, scratch);
|
||||
- /* normally mn == nn, but m can be smaller in some cases */
|
||||
- mpn_sec_mul (tp, c, nn, m, mn, scratch);
|
||||
- mpn_sec_div_r (tp, nn + mn, np, nn, scratch);
|
||||
+ mpn_sec_mul (tp, c, nn, m, nn, scratch);
|
||||
+ mpn_sec_div_r (tp, 2*nn, np, nn, scratch);
|
||||
mpn_copyi(c, tp, nn);
|
||||
|
||||
TMP_GMP_FREE (r);
|
||||
@@ -208,7 +206,7 @@ rsa_sec_blind (const struct rsa_public_key *pub,
|
||||
TMP_GMP_FREE (tp);
|
||||
}
|
||||
|
||||
-/* m = c ri mod n */
|
||||
+/* m = c ri mod n. Allows x == c. */
|
||||
static void
|
||||
rsa_sec_unblind (const struct rsa_public_key *pub,
|
||||
mp_limb_t *x, mp_limb_t *ri, const mp_limb_t *c)
|
||||
@@ -298,7 +296,7 @@ int
|
||||
_rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
|
||||
const struct rsa_private_key *key,
|
||||
void *random_ctx, nettle_random_func *random,
|
||||
- mp_limb_t *x, const mp_limb_t *m, size_t mn)
|
||||
+ mp_limb_t *x, const mp_limb_t *m)
|
||||
{
|
||||
TMP_GMP_DECL (c, mp_limb_t);
|
||||
TMP_GMP_DECL (ri, mp_limb_t);
|
||||
@@ -306,7 +304,7 @@ _rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
|
||||
size_t key_limb_size;
|
||||
int ret;
|
||||
|
||||
- key_limb_size = NETTLE_OCTET_SIZE_TO_LIMB_SIZE(key->size);
|
||||
+ key_limb_size = mpz_size(pub->n);
|
||||
|
||||
/* mpz_powm_sec handles only odd moduli. If p, q or n is even, the
|
||||
key is invalid and rejected by rsa_private_key_prepare. However,
|
||||
@@ -320,19 +318,18 @@ _rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
|
||||
}
|
||||
|
||||
assert(mpz_size(pub->n) == key_limb_size);
|
||||
- assert(mn <= key_limb_size);
|
||||
|
||||
TMP_GMP_ALLOC (c, key_limb_size);
|
||||
TMP_GMP_ALLOC (ri, key_limb_size);
|
||||
TMP_GMP_ALLOC (scratch, _rsa_sec_compute_root_itch(key));
|
||||
|
||||
- rsa_sec_blind (pub, random_ctx, random, x, ri, m, mn);
|
||||
+ rsa_sec_blind (pub, random_ctx, random, c, ri, m);
|
||||
|
||||
- _rsa_sec_compute_root(key, c, x, scratch);
|
||||
+ _rsa_sec_compute_root(key, x, c, scratch);
|
||||
|
||||
- ret = rsa_sec_check_root(pub, c, x);
|
||||
+ ret = rsa_sec_check_root(pub, x, c);
|
||||
|
||||
- rsa_sec_unblind(pub, x, ri, c);
|
||||
+ rsa_sec_unblind(pub, x, ri, x);
|
||||
|
||||
cnd_mpn_zero(1 - ret, x, key_limb_size);
|
||||
|
||||
@@ -356,17 +353,17 @@ rsa_compute_root_tr(const struct rsa_public_key *pub,
|
||||
mpz_t x, const mpz_t m)
|
||||
{
|
||||
TMP_GMP_DECL (l, mp_limb_t);
|
||||
+ mp_size_t nn = mpz_size(pub->n);
|
||||
int res;
|
||||
|
||||
- mp_size_t l_size = NETTLE_OCTET_SIZE_TO_LIMB_SIZE(key->size);
|
||||
- TMP_GMP_ALLOC (l, l_size);
|
||||
+ TMP_GMP_ALLOC (l, nn);
|
||||
+ mpz_limbs_copy(l, m, nn);
|
||||
|
||||
- res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, l,
|
||||
- mpz_limbs_read(m), mpz_size(m));
|
||||
+ res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, l, l);
|
||||
if (res) {
|
||||
- mp_limb_t *xp = mpz_limbs_write (x, l_size);
|
||||
- mpn_copyi (xp, l, l_size);
|
||||
- mpz_limbs_finish (x, l_size);
|
||||
+ mp_limb_t *xp = mpz_limbs_write (x, nn);
|
||||
+ mpn_copyi (xp, l, nn);
|
||||
+ mpz_limbs_finish (x, nn);
|
||||
}
|
||||
|
||||
TMP_GMP_FREE (l);
|
||||
diff --git a/testsuite/rsa-encrypt-test.c b/testsuite/rsa-encrypt-test.c
|
||||
index 87525f78..d3bc374b 100644
|
||||
--- a/testsuite/rsa-encrypt-test.c
|
||||
+++ b/testsuite/rsa-encrypt-test.c
|
||||
@@ -19,6 +19,7 @@ test_main(void)
|
||||
uint8_t after;
|
||||
|
||||
mpz_t gibberish;
|
||||
+ mpz_t zero;
|
||||
|
||||
rsa_private_key_init(&key);
|
||||
rsa_public_key_init(&pub);
|
||||
@@ -101,6 +102,17 @@ test_main(void)
|
||||
ASSERT(decrypted[decrypted_length] == after);
|
||||
ASSERT(decrypted[0] == 'A');
|
||||
|
||||
+ /* Test zero input. */
|
||||
+ mpz_init_set_ui (zero, 0);
|
||||
+ decrypted_length = msg_length;
|
||||
+ ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, zero));
|
||||
+ ASSERT(!rsa_decrypt_tr(&pub, &key,
|
||||
+ &lfib, (nettle_random_func *) knuth_lfib_random,
|
||||
+ &decrypted_length, decrypted, zero));
|
||||
+ ASSERT(!rsa_sec_decrypt(&pub, &key,
|
||||
+ &lfib, (nettle_random_func *) knuth_lfib_random,
|
||||
+ decrypted_length, decrypted, zero));
|
||||
+ ASSERT(decrypted_length == msg_length);
|
||||
|
||||
/* Test invalid key. */
|
||||
mpz_add_ui (key.q, key.q, 2);
|
||||
@@ -112,6 +124,6 @@ test_main(void)
|
||||
rsa_private_key_clear(&key);
|
||||
rsa_public_key_clear(&pub);
|
||||
mpz_clear(gibberish);
|
||||
+ mpz_clear(zero);
|
||||
free(decrypted);
|
||||
}
|
||||
-
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From f601611b3c315aba373c0ab2ddf24772e88c1b3e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
|
||||
Date: Tue, 8 Jun 2021 21:32:38 +0200
|
||||
Subject: [PATCH 4/4] Add input check to rsa_decrypt family of functions.
|
||||
|
||||
(cherry picked from commit 0ad0b5df315665250dfdaa4a1e087f4799edaefe)
|
||||
---
|
||||
ChangeLog | 10 +++++++++-
|
||||
rsa-decrypt-tr.c | 4 ++++
|
||||
rsa-decrypt.c | 10 ++++++++++
|
||||
rsa-sec-decrypt.c | 4 ++++
|
||||
rsa.h | 5 +++--
|
||||
testsuite/rsa-encrypt-test.c | 38 ++++++++++++++++++++++++++++++------
|
||||
6 files changed, 62 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/ChangeLog b/ChangeLog
|
||||
index ae660fc0..27f022db 100644
|
||||
--- a/ChangeLog
|
||||
+++ b/ChangeLog
|
||||
@@ -1,6 +1,14 @@
|
||||
-2021-05-14 Niels Möller <nisse@lysator.liu.se>
|
||||
+2021-05-17 Niels Möller <nisse@lysator.liu.se>
|
||||
|
||||
Bug fixes merged from from 3.7.3 release (starting from 2021-05-06).
|
||||
+ * rsa-decrypt-tr.c (rsa_decrypt_tr): Check up-front that input is
|
||||
+ in range.
|
||||
+ * rsa-sec-decrypt.c (rsa_sec_decrypt): Likewise.
|
||||
+ * rsa-decrypt.c (rsa_decrypt): Likewise.
|
||||
+ * testsuite/rsa-encrypt-test.c (test_main): Add tests with input > n.
|
||||
+
|
||||
+2021-05-14 Niels Möller <nisse@lysator.liu.se>
|
||||
+
|
||||
* rsa-sign-tr.c (rsa_sec_blind): Delete mn argument.
|
||||
(_rsa_sec_compute_root_tr): Delete mn argument, instead require
|
||||
that input size matches key size. Rearrange use of temporary
|
||||
diff --git a/rsa-decrypt-tr.c b/rsa-decrypt-tr.c
|
||||
index c118e852..1ba3d286 100644
|
||||
--- a/rsa-decrypt-tr.c
|
||||
+++ b/rsa-decrypt-tr.c
|
||||
@@ -52,6 +52,10 @@ rsa_decrypt_tr(const struct rsa_public_key *pub,
|
||||
mp_size_t key_limb_size;
|
||||
int res;
|
||||
|
||||
+ /* First check that input is in range. */
|
||||
+ if (mpz_sgn (gibberish) < 0 || mpz_cmp (gibberish, pub->n) >= 0)
|
||||
+ return 0;
|
||||
+
|
||||
key_limb_size = mpz_size(pub->n);
|
||||
|
||||
TMP_GMP_ALLOC (m, key_limb_size);
|
||||
diff --git a/rsa-decrypt.c b/rsa-decrypt.c
|
||||
index 7681439d..540d8baa 100644
|
||||
--- a/rsa-decrypt.c
|
||||
+++ b/rsa-decrypt.c
|
||||
@@ -48,6 +48,16 @@ rsa_decrypt(const struct rsa_private_key *key,
|
||||
int res;
|
||||
|
||||
mpz_init(m);
|
||||
+
|
||||
+ /* First check that input is in range. Since we don't have the
|
||||
+ public key available here, we need to reconstruct n. */
|
||||
+ mpz_mul (m, key->p, key->q);
|
||||
+ if (mpz_sgn (gibberish) < 0 || mpz_cmp (gibberish, m) >= 0)
|
||||
+ {
|
||||
+ mpz_clear (m);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
rsa_compute_root(key, m, gibberish);
|
||||
|
||||
res = pkcs1_decrypt (key->size, m, length, message);
|
||||
diff --git a/rsa-sec-decrypt.c b/rsa-sec-decrypt.c
|
||||
index 633a6852..53113c69 100644
|
||||
--- a/rsa-sec-decrypt.c
|
||||
+++ b/rsa-sec-decrypt.c
|
||||
@@ -54,6 +54,10 @@ rsa_sec_decrypt(const struct rsa_public_key *pub,
|
||||
TMP_GMP_DECL (em, uint8_t);
|
||||
int res;
|
||||
|
||||
+ /* First check that input is in range. */
|
||||
+ if (mpz_sgn (gibberish) < 0 || mpz_cmp (gibberish, pub->n) >= 0)
|
||||
+ return 0;
|
||||
+
|
||||
TMP_GMP_ALLOC (m, mpz_size(pub->n));
|
||||
TMP_GMP_ALLOC (em, key->size);
|
||||
|
||||
diff --git a/rsa.h b/rsa.h
|
||||
index 0aac6a26..54c35688 100644
|
||||
--- a/rsa.h
|
||||
+++ b/rsa.h
|
||||
@@ -433,13 +433,14 @@ rsa_sec_decrypt(const struct rsa_public_key *pub,
|
||||
size_t length, uint8_t *message,
|
||||
const mpz_t gibberish);
|
||||
|
||||
-/* Compute x, the e:th root of m. Calling it with x == m is allowed. */
|
||||
+/* Compute x, the e:th root of m. Calling it with x == m is allowed.
|
||||
+ It is required that 0 <= m < n. */
|
||||
void
|
||||
rsa_compute_root(const struct rsa_private_key *key,
|
||||
mpz_t x, const mpz_t m);
|
||||
|
||||
/* Safer variant, using RSA blinding, and checking the result after
|
||||
- CRT. */
|
||||
+ CRT. It is required that 0 <= m < n. */
|
||||
int
|
||||
rsa_compute_root_tr(const struct rsa_public_key *pub,
|
||||
const struct rsa_private_key *key,
|
||||
diff --git a/testsuite/rsa-encrypt-test.c b/testsuite/rsa-encrypt-test.c
|
||||
index d3bc374b..d1a440f6 100644
|
||||
--- a/testsuite/rsa-encrypt-test.c
|
||||
+++ b/testsuite/rsa-encrypt-test.c
|
||||
@@ -19,11 +19,12 @@ test_main(void)
|
||||
uint8_t after;
|
||||
|
||||
mpz_t gibberish;
|
||||
- mpz_t zero;
|
||||
+ mpz_t bad_input;
|
||||
|
||||
rsa_private_key_init(&key);
|
||||
rsa_public_key_init(&pub);
|
||||
mpz_init(gibberish);
|
||||
+ mpz_init(bad_input);
|
||||
|
||||
knuth_lfib_init(&lfib, 17);
|
||||
|
||||
@@ -103,15 +104,40 @@ test_main(void)
|
||||
ASSERT(decrypted[0] == 'A');
|
||||
|
||||
/* Test zero input. */
|
||||
- mpz_init_set_ui (zero, 0);
|
||||
+ mpz_set_ui (bad_input, 0);
|
||||
decrypted_length = msg_length;
|
||||
- ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, zero));
|
||||
+ ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, bad_input));
|
||||
ASSERT(!rsa_decrypt_tr(&pub, &key,
|
||||
&lfib, (nettle_random_func *) knuth_lfib_random,
|
||||
- &decrypted_length, decrypted, zero));
|
||||
+ &decrypted_length, decrypted, bad_input));
|
||||
ASSERT(!rsa_sec_decrypt(&pub, &key,
|
||||
&lfib, (nettle_random_func *) knuth_lfib_random,
|
||||
- decrypted_length, decrypted, zero));
|
||||
+ decrypted_length, decrypted, bad_input));
|
||||
+ ASSERT(decrypted_length == msg_length);
|
||||
+
|
||||
+ /* Test input that is slightly larger than n */
|
||||
+ mpz_add(bad_input, gibberish, pub.n);
|
||||
+ decrypted_length = msg_length;
|
||||
+ ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, bad_input));
|
||||
+ ASSERT(!rsa_decrypt_tr(&pub, &key,
|
||||
+ &lfib, (nettle_random_func *) knuth_lfib_random,
|
||||
+ &decrypted_length, decrypted, bad_input));
|
||||
+ ASSERT(!rsa_sec_decrypt(&pub, &key,
|
||||
+ &lfib, (nettle_random_func *) knuth_lfib_random,
|
||||
+ decrypted_length, decrypted, bad_input));
|
||||
+ ASSERT(decrypted_length == msg_length);
|
||||
+
|
||||
+ /* Test input that is considerably larger than n */
|
||||
+ mpz_mul_2exp (bad_input, pub.n, 100);
|
||||
+ mpz_add (bad_input, bad_input, gibberish);
|
||||
+ decrypted_length = msg_length;
|
||||
+ ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, bad_input));
|
||||
+ ASSERT(!rsa_decrypt_tr(&pub, &key,
|
||||
+ &lfib, (nettle_random_func *) knuth_lfib_random,
|
||||
+ &decrypted_length, decrypted, bad_input));
|
||||
+ ASSERT(!rsa_sec_decrypt(&pub, &key,
|
||||
+ &lfib, (nettle_random_func *) knuth_lfib_random,
|
||||
+ decrypted_length, decrypted, bad_input));
|
||||
ASSERT(decrypted_length == msg_length);
|
||||
|
||||
/* Test invalid key. */
|
||||
@@ -124,6 +150,6 @@ test_main(void)
|
||||
rsa_private_key_clear(&key);
|
||||
rsa_public_key_clear(&pub);
|
||||
mpz_clear(gibberish);
|
||||
- mpz_clear(zero);
|
||||
+ mpz_clear(bad_input);
|
||||
free(decrypted);
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
281
SPECS/nettle.spec
Normal file
281
SPECS/nettle.spec
Normal file
@ -0,0 +1,281 @@
|
||||
%bcond_without fips
|
||||
|
||||
Name: nettle
|
||||
Version: 3.4.1
|
||||
Release: 7%{?dist}
|
||||
Summary: A low-level cryptographic library
|
||||
|
||||
Group: Development/Libraries
|
||||
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.3-remove-ecc-testsuite.patch
|
||||
Patch1: nettle-3.4-annocheck.patch
|
||||
Patch2: nettle-3.4.1-enable-intel-cet.patch
|
||||
# https://lists.lysator.liu.se/pipermail/nettle-bugs/2021/009458.html
|
||||
Patch3: nettle-3.4.1-ecdsa-verify.patch
|
||||
Patch4: nettle-3.4.1-powerpc64-aes-asm.patch
|
||||
Patch5: nettle-3.4.1-powerpc64-ghash-asm.patch
|
||||
Patch6: nettle-3.4.1-rsa-decrypt.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gmp-devel, m4
|
||||
BuildRequires: libtool, automake, autoconf, gettext-devel
|
||||
%if %{with fips}
|
||||
BuildRequires: fipscheck
|
||||
%endif
|
||||
|
||||
Requires(post): info
|
||||
Requires(preun): info
|
||||
|
||||
|
||||
%package devel
|
||||
Summary: Development headers for a low-level cryptographic library
|
||||
Group: Development/Libraries
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: gmp-devel%{?_isa}
|
||||
|
||||
%description
|
||||
Nettle is a cryptographic library that is designed to fit easily in more
|
||||
or less any context: In crypto toolkits for object-oriented languages
|
||||
(C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in
|
||||
kernel space.
|
||||
|
||||
%description devel
|
||||
Nettle is a cryptographic library that is designed to fit easily in more
|
||||
or less any context: In crypto toolkits for object-oriented languages
|
||||
(C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in
|
||||
kernel space. This package contains the files needed for developing
|
||||
applications with nettle.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
# Disable -ggdb3 which makes debugedit unhappy
|
||||
sed s/ggdb3/g/ -i configure
|
||||
sed 's/ecc-192.c//g' -i Makefile.in
|
||||
sed 's/ecc-224.c//g' -i Makefile.in
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
|
||||
%build
|
||||
autoreconf -ifv
|
||||
%configure --enable-shared --enable-fat
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%if %{with fips}
|
||||
%define __spec_install_post \
|
||||
%{?__debug_package:%{__debug_install_post}} \
|
||||
%{__arch_install_post} \
|
||||
%{__os_install_post} \
|
||||
fipshmac -d $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_libdir}/libnettle.so.6.* \
|
||||
fipshmac -d $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_libdir}/libhogweed.so.4.* \
|
||||
file=`basename $RPM_BUILD_ROOT%{_libdir}/libnettle.so.6.*.hmac` && mv $RPM_BUILD_ROOT%{_libdir}/$file $RPM_BUILD_ROOT%{_libdir}/.$file && ln -s .$file $RPM_BUILD_ROOT%{_libdir}/.libnettle.so.6.hmac \
|
||||
file=`basename $RPM_BUILD_ROOT%{_libdir}/libhogweed.so.4.*.hmac` && mv $RPM_BUILD_ROOT%{_libdir}/$file $RPM_BUILD_ROOT%{_libdir}/.$file && ln -s .$file $RPM_BUILD_ROOT%{_libdir}/.libhogweed.so.4.hmac \
|
||||
%{nil}
|
||||
%endif
|
||||
|
||||
%install
|
||||
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
|
||||
make install-shared DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
|
||||
mkdir -p $RPM_BUILD_ROOT%{_infodir}
|
||||
install -p -m 644 nettle.info $RPM_BUILD_ROOT%{_infodir}/
|
||||
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
|
||||
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
||||
rm -f $RPM_BUILD_ROOT%{_bindir}/nettle-lfib-stream
|
||||
rm -f $RPM_BUILD_ROOT%{_bindir}/pkcs1-conv
|
||||
rm -f $RPM_BUILD_ROOT%{_bindir}/sexp-conv
|
||||
rm -f $RPM_BUILD_ROOT%{_bindir}/nettle-hash
|
||||
rm -f $RPM_BUILD_ROOT%{_bindir}/nettle-pbkdf2
|
||||
|
||||
chmod 0755 $RPM_BUILD_ROOT%{_libdir}/libnettle.so.6.*
|
||||
chmod 0755 $RPM_BUILD_ROOT%{_libdir}/libhogweed.so.4.*
|
||||
|
||||
%check
|
||||
make check
|
||||
|
||||
%files
|
||||
%doc AUTHORS NEWS README TODO
|
||||
%license COPYINGv2 COPYING.LESSERv3
|
||||
%{_infodir}/nettle.info.gz
|
||||
%{_libdir}/libnettle.so.6
|
||||
%{_libdir}/libnettle.so.6.*
|
||||
%{_libdir}/libhogweed.so.4
|
||||
%{_libdir}/libhogweed.so.4.*
|
||||
%if %{with fips}
|
||||
%{_libdir}/.libhogweed.so.*.hmac
|
||||
%{_libdir}/.libnettle.so.*.hmac
|
||||
%endif
|
||||
|
||||
%files devel
|
||||
%doc descore.README nettle.html nettle.pdf
|
||||
%{_includedir}/nettle
|
||||
%{_libdir}/libnettle.so
|
||||
%{_libdir}/libhogweed.so
|
||||
%{_libdir}/pkgconfig/hogweed.pc
|
||||
%{_libdir}/pkgconfig/nettle.pc
|
||||
|
||||
%post
|
||||
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :
|
||||
/sbin/ldconfig
|
||||
|
||||
%preun
|
||||
if [ $1 = 0 ]; then
|
||||
/sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
|
||||
fi
|
||||
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Jul 14 2021 Daiki Ueno <dueno@redhat.com> - 3.4.1-7
|
||||
- Backport CVE-2021-3580 from upstream 3.7.3 release (#1967990)
|
||||
|
||||
* Wed Jul 14 2021 Daiki Ueno <dueno@redhat.com> - 3.4.1-6
|
||||
- Enable CTR mode optimization when the block size is 16
|
||||
|
||||
* Wed Jun 30 2021 Daiki Ueno <dueno@redhat.com> - 3.4.1-5
|
||||
- Backport powerpc64 optimization patches from upstream (#1855228)
|
||||
Patch from Christopher M. Riedl.
|
||||
|
||||
* Wed Apr 7 2021 Daiki Ueno <dueno@redhat.com> - 3.4.1-4
|
||||
- Fix patch application
|
||||
|
||||
* Tue Mar 30 2021 Daiki Ueno <dueno@redhat.com> - 3.4.1-3
|
||||
- Port fixes for potential miscalculation in ecdsa_verify (#1942925)
|
||||
|
||||
* Fri May 15 2020 Anderson Sasaki <ansasaki@redhat.com> - 3.4.1-2
|
||||
- Enable Intel CET support (#1737542)
|
||||
|
||||
* Tue Dec 11 2018 Daiki Ueno <dueno@redhat.com> - 3.4.1-1
|
||||
- New upstream release
|
||||
|
||||
* Tue Oct 16 2018 Tomáš Mráz <tmraz@redhat.com> - 3.4-4
|
||||
- Cover the gaps in annotation coverage for assembler sources
|
||||
- Add .hmac checksums for FIPS mode integrity checking
|
||||
|
||||
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.4-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Mon Nov 20 2017 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.4-1
|
||||
- New upstream release
|
||||
|
||||
* Wed Aug 09 2017 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.3-5
|
||||
- Removed executables from the library to allow parallel installation
|
||||
of x86-64 and x86 packages. The executables had testing purpose, and
|
||||
may be re-introduced in a separate package if needed.
|
||||
|
||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||
|
||||
* 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.
|
||||
|
||||
* Thu Feb 18 2016 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.2-2
|
||||
- Enabled fat builds by default
|
||||
|
||||
* Wed Feb 3 2016 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.2-1
|
||||
- updated to 3.2 (#1301310)
|
||||
- Fixed CVE-2015-8803 secp256r1 calculation bug (#1304305)
|
||||
|
||||
* Wed Dec 9 2015 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.1.1-6
|
||||
- Made version.h architecture independent (#1289938)
|
||||
|
||||
* Wed Dec 2 2015 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.1.1-5
|
||||
- Disabled arm-neon unconditionally (#1287298)
|
||||
|
||||
* Thu Oct 22 2015 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.1.1-4
|
||||
- Fixed SHA3 implementation to conform to published version (#1252935)
|
||||
|
||||
* Sun Aug 2 2015 Peter Robinson <pbrobinson@fedoraproject.org> 3.1.1-3
|
||||
- No need to ship license in devel too
|
||||
- Drop ChangeLog as details are in NEWS
|
||||
|
||||
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||
|
||||
* Thu Apr 30 2015 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.1.1-1
|
||||
- Updated to nettle 3.1.1
|
||||
|
||||
* Sat Feb 21 2015 Till Maas <opensource@till.name> - 2.7.1-6
|
||||
- Rebuilt for Fedora 23 Change
|
||||
https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code
|
||||
|
||||
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.1-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||
|
||||
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.1-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||
|
||||
* Fri Jan 10 2014 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.7.1-3
|
||||
- Corrected bug number in previous comment.
|
||||
|
||||
* Fri Dec 13 2013 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.7.1-2
|
||||
- Added patch nettle-tmpalloc.patch to solve #1051455
|
||||
|
||||
* Mon Nov 25 2013 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.7.1-1
|
||||
- Updated to nettle 2.7.1
|
||||
|
||||
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||
|
||||
* Wed Feb 6 2013 Tomáš Mráz <tmraz@redhat.com> - 2.6-2
|
||||
- nettle includes use gmp.h
|
||||
|
||||
* Tue Feb 5 2013 Tomáš Mráz <tmraz@redhat.com> - 2.6-1
|
||||
- New upstream release
|
||||
|
||||
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||
|
||||
* Thu Jul 05 2012 David Woodhouse <dwmw2@infradead.org> - 2.4-3
|
||||
- Remove explicit buildroot handling and defattr.
|
||||
|
||||
* Wed Jul 04 2012 David Woodhouse <dwmw2@infradead.org> - 2.4-2
|
||||
- Review feedback
|
||||
|
||||
* Mon Jun 18 2012 David Woodhouse <dwmw2@infradead.org> - 2.4-1
|
||||
- Revive package (GnuTLS needs it), disable static, update to current release 2.4
|
||||
|
||||
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.15-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.15-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Thu Apr 10 2008 Ian Weller <ianweller@gmail.com> 1.15-5
|
||||
- Moved static lib to -static
|
||||
|
||||
* Mon Mar 24 2008 Ian Weller <ianweller@gmail.com> 1.15-4
|
||||
- Added libraries and ldconfig
|
||||
|
||||
* Mon Feb 18 2008 Ian Weller <ianweller@gmail.com> 1.15-3
|
||||
- Added provides -static to -devel
|
||||
|
||||
* Sun Feb 17 2008 Ian Weller <ianweller@gmail.com> 1.15-2
|
||||
- Removed redundant requires
|
||||
- Removed redundant documentation between packages
|
||||
- Fixed license tag
|
||||
- Fixed -devel description
|
||||
- Added the static library back to -devel
|
||||
- Added make clean
|
||||
|
||||
* Fri Feb 08 2008 Ian Weller <ianweller@gmail.com> 1.15-1
|
||||
- First package build.
|
207
changelog
207
changelog
@ -1,207 +0,0 @@
|
||||
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.9.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Mon Jun 5 2023 Daiki Ueno <dueno@redhat.com> - 3.9.1-1
|
||||
- Update to nettle 3.9.1
|
||||
|
||||
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.8-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.8-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Fri Jun 3 2022 Daiki Ueno <dueno@redhat.com> - 3.8-1
|
||||
- Update to nettle 3.8
|
||||
|
||||
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.3-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Mon Jun 7 2021 Daiki Ueno <dueno@redhat.com> - 3.7.3-1
|
||||
- Update to nettle 3.7.3
|
||||
|
||||
* Sun Mar 21 2021 Daiki Ueno <dueno@redhat.com> - 3.7.2-1
|
||||
- Update to nettle 3.7.2
|
||||
- Merge nettle-3.6-remove-ecc-testsuite.patch to hobble-nettle script
|
||||
|
||||
* Tue Mar 9 2021 Daiki Ueno <dueno@redhat.com> - 3.7.1-1
|
||||
- Update to nettle 3.7.1
|
||||
|
||||
* Wed Feb 10 2021 Daiki Ueno <dueno@redhat.com> - 3.7-3
|
||||
- Port a fix for chacha counter issue on ppc64le
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.7-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Mon Jan 11 2021 Daiki Ueno <dueno@redhat.com> - 3.7-1
|
||||
- Update to nettle 3.7
|
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Tue Jul 14 2020 Tom Stellard <tstellar@redhat.com> - 3.6-2
|
||||
- Use make macros
|
||||
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
|
||||
|
||||
* Mon May 4 2020 Daiki Ueno <dueno@redhat.com> - 3.6-1
|
||||
- Update to nettle 3.6
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.1-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Thu Oct 31 2019 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.5.1-4
|
||||
- New upstream release
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.1-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Tue Jul 16 2019 Daiki Ueno <dueno@redhat.com> - 3.5.1-2
|
||||
- Rebuild with bootstrap enabled
|
||||
|
||||
* Mon Jul 15 2019 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.5.1-1
|
||||
- New upstream release
|
||||
|
||||
* Wed Apr 24 2019 Björn Esser <besser82@fedoraproject.org> - 3.4.1rc1-3
|
||||
- Remove hardcoded gzip suffix from GNU info pages
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.1rc1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Fri Nov 30 2018 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.4.1rc1-1
|
||||
- New upstream release; provides API for constant memory access RSA operations
|
||||
|
||||
* Tue Oct 16 2018 Tomáš Mráz <tmraz@redhat.com> - 3.4-7
|
||||
- Generate the .hmac checksums unless --without fips is used
|
||||
|
||||
* Tue Oct 16 2018 Tomáš Mráz <tmraz@redhat.com> - 3.4-6
|
||||
- Cover the gaps in annotation coverage for assembler sources
|
||||
|
||||
* Fri Aug 31 2018 Leigh Scott <leigh123linux@googlemail.com> - 3.4-5
|
||||
- update libary versions used for fips
|
||||
|
||||
* Sat Jul 28 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.4-4
|
||||
- Replace obsolete scriptlets
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.4-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.4-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Mon Nov 20 2017 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.4-1
|
||||
- New upstream release
|
||||
|
||||
* Wed Aug 09 2017 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.3-5
|
||||
- Removed executables from the library to allow parallel installation
|
||||
of x86-64 and x86 packages. The executables had testing purpose, and
|
||||
may be re-introduced in a separate package if needed.
|
||||
|
||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||
|
||||
* 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.
|
||||
|
||||
* Thu Feb 18 2016 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.2-2
|
||||
- Enabled fat builds by default
|
||||
|
||||
* Wed Feb 3 2016 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.2-1
|
||||
- updated to 3.2 (#1301310)
|
||||
- Fixed CVE-2015-8803 secp256r1 calculation bug (#1304305)
|
||||
|
||||
* Wed Dec 9 2015 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.1.1-6
|
||||
- Made version.h architecture independent (#1289938)
|
||||
|
||||
* Wed Dec 2 2015 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.1.1-5
|
||||
- Disabled arm-neon unconditionally (#1287298)
|
||||
|
||||
* Thu Oct 22 2015 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.1.1-4
|
||||
- Fixed SHA3 implementation to conform to published version (#1252935)
|
||||
|
||||
* Sun Aug 2 2015 Peter Robinson <pbrobinson@fedoraproject.org> 3.1.1-3
|
||||
- No need to ship license in devel too
|
||||
- Drop ChangeLog as details are in NEWS
|
||||
|
||||
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||
|
||||
* Thu Apr 30 2015 Nikos Mavrogiannopoulos <nmav@redhat.com> - 3.1.1-1
|
||||
- Updated to nettle 3.1.1
|
||||
|
||||
* Sat Feb 21 2015 Till Maas <opensource@till.name> - 2.7.1-6
|
||||
- Rebuilt for Fedora 23 Change
|
||||
https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code
|
||||
|
||||
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.1-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||
|
||||
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.1-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||
|
||||
* Fri Jan 10 2014 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.7.1-3
|
||||
- Corrected bug number in previous comment.
|
||||
|
||||
* Fri Dec 13 2013 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.7.1-2
|
||||
- Added patch nettle-tmpalloc.patch to solve #1051455
|
||||
|
||||
* Mon Nov 25 2013 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.7.1-1
|
||||
- Updated to nettle 2.7.1
|
||||
|
||||
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||
|
||||
* Wed Feb 6 2013 Tomáš Mráz <tmraz@redhat.com> - 2.6-2
|
||||
- nettle includes use gmp.h
|
||||
|
||||
* Tue Feb 5 2013 Tomáš Mráz <tmraz@redhat.com> - 2.6-1
|
||||
- New upstream release
|
||||
|
||||
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||
|
||||
* Thu Jul 05 2012 David Woodhouse <dwmw2@infradead.org> - 2.4-3
|
||||
- Remove explicit buildroot handling and defattr.
|
||||
|
||||
* Wed Jul 04 2012 David Woodhouse <dwmw2@infradead.org> - 2.4-2
|
||||
- Review feedback
|
||||
|
||||
* Mon Jun 18 2012 David Woodhouse <dwmw2@infradead.org> - 2.4-1
|
||||
- Revive package (GnuTLS needs it), disable static, update to current release 2.4
|
||||
|
||||
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.15-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.15-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Thu Apr 10 2008 Ian Weller <ianweller@gmail.com> 1.15-5
|
||||
- Moved static lib to -static
|
||||
|
||||
* Mon Mar 24 2008 Ian Weller <ianweller@gmail.com> 1.15-4
|
||||
- Added libraries and ldconfig
|
||||
|
||||
* Mon Feb 18 2008 Ian Weller <ianweller@gmail.com> 1.15-3
|
||||
- Added provides -static to -devel
|
||||
|
||||
* Sun Feb 17 2008 Ian Weller <ianweller@gmail.com> 1.15-2
|
||||
- Removed redundant requires
|
||||
- Removed redundant documentation between packages
|
||||
- Fixed license tag
|
||||
- Fixed -devel description
|
||||
- Added the static library back to -devel
|
||||
- Added make clean
|
||||
|
||||
* Fri Feb 08 2008 Ian Weller <ianweller@gmail.com> 1.15-1
|
||||
- First package build.
|
23
gating.yaml
23
gating.yaml
@ -1,23 +0,0 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- fedora-*
|
||||
decision_contexts: [bodhi_update_push_testing]
|
||||
subject_type: koji_build
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- fedora-*
|
||||
decision_contexts: [bodhi_update_push_stable]
|
||||
subject_type: koji_build
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-10
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/ci/fips-disabled-buildroot-enabled.functional}
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/ci/fips-disabled-buildroot-disabled.functional}
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/ci/fips-enabled-buildroot-enabled.functional}
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/ci/fips-enabled-buildroot-disabled.functional}
|
File diff suppressed because it is too large
Load Diff
@ -1,53 +0,0 @@
|
||||
diff -r e3123b88d012 memory.c
|
||||
--- a/memory.c Tue Aug 16 22:02:45 2022 +0200
|
||||
+++ b/memory.c Fri Aug 19 06:25:37 2022 +0900
|
||||
@@ -29,7 +29,8 @@
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include <stdio.h>
|
||||
-#include <stdlib.h> /* for malloc, realloc, free */
|
||||
+#include <stdlib.h> /* for malloc, free */
|
||||
+#include <string.h> /* for memcpy, explicit_bzero */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
@@ -98,11 +99,28 @@
|
||||
new_size += 2 * GMP_LIMB_BYTES;
|
||||
#endif
|
||||
|
||||
- ret = realloc (oldptr, new_size);
|
||||
- if (ret == 0)
|
||||
+ if (new_size == 0)
|
||||
+ {
|
||||
+ explicit_bzero (oldptr, old_size);
|
||||
+ free (oldptr);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ else if (old_size == new_size)
|
||||
+ return oldptr;
|
||||
+ else
|
||||
{
|
||||
- fprintf (stderr, "GNU MP: Cannot reallocate memory (old_size=%lu new_size=%lu)\n", (long) old_size, (long) new_size);
|
||||
- abort ();
|
||||
+ /* We can't simply call realloc, as it may allocate memory from
|
||||
+ a different arena. */
|
||||
+ ret = malloc (new_size);
|
||||
+ if (ret == NULL)
|
||||
+ {
|
||||
+ fprintf (stderr, "GNU MP: Cannot reallocate memory (old_size=%lu new_size=%lu)\n", (long) old_size, (long) new_size);
|
||||
+ explicit_bzero(oldptr, old_size);
|
||||
+ abort();
|
||||
+ }
|
||||
+ memcpy (ret, oldptr, MIN(old_size, new_size));
|
||||
+ explicit_bzero (oldptr, old_size);
|
||||
+ free (oldptr);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -141,5 +159,6 @@
|
||||
blk_ptr = p - 1;
|
||||
}
|
||||
#endif
|
||||
+ explicit_bzero (blk_ptr, blk_size);
|
||||
free (blk_ptr);
|
||||
}
|
637
hobble-nettle
637
hobble-nettle
@ -1,637 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -x
|
||||
|
||||
if [ "$1" = "-e" ] ; then
|
||||
CMD="cat < /dev/null >"
|
||||
else
|
||||
CMD="rm -f"
|
||||
fi
|
||||
|
||||
# ECC-192, 224
|
||||
for f in ecc-secp192r1.c ecc-secp224r1.c; do
|
||||
eval "$CMD $f"
|
||||
done
|
||||
|
||||
# SM4
|
||||
for f in gcm-sm4-meta.c gcm-sm4.c sm4-meta.c sm4.c sm4.h testsuite/sm4-test.c; do
|
||||
eval "$CMD $f"
|
||||
done
|
||||
|
||||
patch -p1 << '__EOF__'
|
||||
From 4f46c4f64358d19f73ac9ba2f78c39bbffa04a57 Mon Sep 17 00:00:00 2001
|
||||
From: Daiki Ueno <dueno@redhat.com>
|
||||
Date: Sun, 21 Mar 2021 11:09:51 +0100
|
||||
Subject: [PATCH 1/2] Remove secp192r1 and secp224r1 support
|
||||
|
||||
---
|
||||
Makefile.in | 22 ++----------
|
||||
eccdata.c | 67 +----------------------------------
|
||||
examples/ecc-benchmark.c | 2 --
|
||||
examples/hogweed-benchmark.c | 17 ---------
|
||||
testsuite/ecdh-test.c | 40 ---------------------
|
||||
testsuite/ecdsa-sign-test.c | 46 ------------------------
|
||||
testsuite/ecdsa-verify-test.c | 28 ---------------
|
||||
testsuite/testutils.c | 22 +-----------
|
||||
8 files changed, 4 insertions(+), 240 deletions(-)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 2bf7f1e8..8e3df0a0 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -204,7 +204,7 @@ hogweed_SOURCES = sexp.c sexp-format.c \
|
||||
ecc-mod-arith.c ecc-pp1-redc.c ecc-pm1-redc.c \
|
||||
ecc-curve25519.c ecc-curve448.c \
|
||||
ecc-gost-gc256b.c ecc-gost-gc512a.c \
|
||||
- ecc-secp192r1.c ecc-secp224r1.c ecc-secp256r1.c \
|
||||
+ ecc-secp256r1.c \
|
||||
ecc-secp384r1.c ecc-secp521r1.c \
|
||||
ecc-size.c ecc-j-to-a.c ecc-a-to-j.c \
|
||||
ecc-dup-jj.c ecc-add-jja.c ecc-add-jjj.c ecc-nonsec-add-jjj.c \
|
||||
@@ -358,22 +358,6 @@ des.$(OBJEXT): des.c des.h $(des_headers)
|
||||
|
||||
# Generate ECC files, with roughly 16 KB of tables per curve.
|
||||
|
||||
-# Some reasonable choices for 192:
|
||||
-# k = 8, c = 6, S = 256, T = 40 ( 32 A + 8 D) 12 KB
|
||||
-# k = 14, c = 7, S = 256, T = 42 ( 28 A + 14 D) 12 KB
|
||||
-# k = 11, c = 6, S = 192, T = 44 ( 33 A + 11 D) 9 KB
|
||||
-# k = 16, c = 6, S = 128, T = 48 ( 32 A + 16 D) 6 KB
|
||||
-ecc-secp192r1.h: eccdata.stamp
|
||||
- ./eccdata$(EXEEXT_FOR_BUILD) secp192r1 8 6 $(NUMB_BITS) > $@T && mv $@T $@
|
||||
-
|
||||
-# Some reasonable choices for 224:
|
||||
-# k = 16, c = 7, S = 256, T = 48 ( 32 A + 16 D) ~16 KB
|
||||
-# k = 10, c = 6, S = 256, T = 50 ( 40 A + 10 D) ~16 KB
|
||||
-# k = 13, c = 6, S = 192, T = 52 ( 39 A + 13 D) ~12 KB
|
||||
-# k = 9, c = 5, S = 160, T = 54 ( 45 A + 9 D) ~10 KB
|
||||
-ecc-secp224r1.h: eccdata.stamp
|
||||
- ./eccdata$(EXEEXT_FOR_BUILD) secp224r1 16 7 $(NUMB_BITS) > $@T && mv $@T $@
|
||||
-
|
||||
# Some reasonable choices for 256:
|
||||
# k = 9, c = 6, S = 320, T = 54 ( 45 A + 9 D) 20 KB
|
||||
# k = 11, c = 6, S = 256, T = 55 ( 44 A + 11 D) 16 KB
|
||||
@@ -433,8 +417,6 @@ ecc-curve25519.$(OBJEXT): ecc-curve25519.h
|
||||
ecc-curve448.$(OBJEXT): ecc-curve448.h
|
||||
ecc-gost-gc256b.$(OBJEXT): ecc-gost-gc256b.h
|
||||
ecc-gost-gc512a.$(OBJEXT): ecc-gost-gc512a.h
|
||||
-ecc-secp192r1.$(OBJEXT): ecc-secp192r1.h
|
||||
-ecc-secp224r1.$(OBJEXT): ecc-secp224r1.h
|
||||
ecc-secp256r1.$(OBJEXT): ecc-secp256r1.h
|
||||
ecc-secp384r1.$(OBJEXT): ecc-secp384r1.h
|
||||
ecc-secp521r1.$(OBJEXT): ecc-secp521r1.h
|
||||
@@ -681,7 +663,7 @@ clean-here:
|
||||
-rm -f $(TARGETS) *.$(OBJEXT) *.$(OBJEXT).d *.s *.so *.dll *.a \
|
||||
ecc-curve25519.h ecc-curve448.h \
|
||||
ecc-gost-gc256b.h ecc-gost-gc512a.h \
|
||||
- ecc-secp192r1.h ecc-secp224r1.h ecc-secp256r1.h \
|
||||
+ ecc-secp256r1.h \
|
||||
ecc-secp384r1.h ecc-secp521r1.h \
|
||||
aesdata$(EXEEXT_FOR_BUILD) \
|
||||
desdata$(EXEEXT_FOR_BUILD) \
|
||||
diff --git a/eccdata.c b/eccdata.c
|
||||
index 3f8e3f13..06afb200 100644
|
||||
--- a/eccdata.c
|
||||
+++ b/eccdata.c
|
||||
@@ -435,72 +435,7 @@ ecc_curve_init_str (struct ecc_curve *ecc, enum ecc_type type,
|
||||
static void
|
||||
ecc_curve_init (struct ecc_curve *ecc, const char *curve)
|
||||
{
|
||||
- if (!strcmp (curve, "secp192r1"))
|
||||
- {
|
||||
- ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS,
|
||||
- /* p = 2^{192} - 2^{64} - 1 */
|
||||
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"
|
||||
- "FFFFFFFFFFFFFFFF",
|
||||
-
|
||||
- "64210519e59c80e70fa7e9ab72243049"
|
||||
- "feb8deecc146b9b1",
|
||||
-
|
||||
- "ffffffffffffffffffffffff99def836"
|
||||
- "146bc9b1b4d22831",
|
||||
-
|
||||
- "188da80eb03090f67cbf20eb43a18800"
|
||||
- "f4ff0afd82ff1012",
|
||||
-
|
||||
- "07192b95ffc8da78631011ed6b24cdd5"
|
||||
- "73f977a11e794811");
|
||||
- ecc->ref = ecc_alloc (3);
|
||||
- ecc_set_str (&ecc->ref[0], /* 2 g */
|
||||
- "dafebf5828783f2ad35534631588a3f629a70fb16982a888",
|
||||
- "dd6bda0d993da0fa46b27bbc141b868f59331afa5c7e93ab");
|
||||
-
|
||||
- ecc_set_str (&ecc->ref[1], /* 3 g */
|
||||
- "76e32a2557599e6edcd283201fb2b9aadfd0d359cbb263da",
|
||||
- "782c37e372ba4520aa62e0fed121d49ef3b543660cfd05fd");
|
||||
-
|
||||
- ecc_set_str (&ecc->ref[2], /* 4 g */
|
||||
- "35433907297cc378b0015703374729d7a4fe46647084e4ba",
|
||||
- "a2649984f2135c301ea3acb0776cd4f125389b311db3be32");
|
||||
-
|
||||
- }
|
||||
- else if (!strcmp (curve, "secp224r1"))
|
||||
- {
|
||||
- ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS,
|
||||
- /* p = 2^{224} - 2^{96} + 1 */
|
||||
- "ffffffffffffffffffffffffffffffff"
|
||||
- "000000000000000000000001",
|
||||
-
|
||||
- "b4050a850c04b3abf54132565044b0b7"
|
||||
- "d7bfd8ba270b39432355ffb4",
|
||||
-
|
||||
- "ffffffffffffffffffffffffffff16a2"
|
||||
- "e0b8f03e13dd29455c5c2a3d",
|
||||
-
|
||||
- "b70e0cbd6bb4bf7f321390b94a03c1d3"
|
||||
- "56c21122343280d6115c1d21",
|
||||
-
|
||||
- "bd376388b5f723fb4c22dfe6cd4375a0"
|
||||
- "5a07476444d5819985007e34");
|
||||
-
|
||||
- ecc->ref = ecc_alloc (3);
|
||||
- ecc_set_str (&ecc->ref[0], /* 2 g */
|
||||
- "706a46dc76dcb76798e60e6d89474788d16dc18032d268fd1a704fa6",
|
||||
- "1c2b76a7bc25e7702a704fa986892849fca629487acf3709d2e4e8bb");
|
||||
-
|
||||
- ecc_set_str (&ecc->ref[1], /* 3 g */
|
||||
- "df1b1d66a551d0d31eff822558b9d2cc75c2180279fe0d08fd896d04",
|
||||
- "a3f7f03cadd0be444c0aa56830130ddf77d317344e1af3591981a925");
|
||||
-
|
||||
- ecc_set_str (&ecc->ref[2], /* 4 g */
|
||||
- "ae99feebb5d26945b54892092a8aee02912930fa41cd114e40447301",
|
||||
- "482580a0ec5bc47e88bc8c378632cd196cb3fa058a7114eb03054c9");
|
||||
-
|
||||
- }
|
||||
- else if (!strcmp (curve, "secp256r1"))
|
||||
+ if (!strcmp (curve, "secp256r1"))
|
||||
{
|
||||
ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS,
|
||||
/* p = 2^{256} - 2^{224} + 2^{192} + 2^{96} - 1 */
|
||||
diff --git a/examples/ecc-benchmark.c b/examples/ecc-benchmark.c
|
||||
index 7e857f80..0bffe7a9 100644
|
||||
--- a/examples/ecc-benchmark.c
|
||||
+++ b/examples/ecc-benchmark.c
|
||||
@@ -314,8 +314,6 @@ bench_curve (const struct ecc_curve *ecc)
|
||||
}
|
||||
|
||||
const struct ecc_curve * const curves[] = {
|
||||
- &_nettle_secp_192r1,
|
||||
- &_nettle_secp_224r1,
|
||||
&_nettle_curve25519,
|
||||
&_nettle_secp_256r1,
|
||||
&_nettle_secp_384r1,
|
||||
diff --git a/examples/hogweed-benchmark.c b/examples/hogweed-benchmark.c
|
||||
index 3f858833..44c9cea5 100644
|
||||
--- a/examples/hogweed-benchmark.c
|
||||
+++ b/examples/hogweed-benchmark.c
|
||||
@@ -410,23 +410,6 @@ bench_ecdsa_init (unsigned size)
|
||||
|
||||
switch (size)
|
||||
{
|
||||
- case 192:
|
||||
- ecc = &_nettle_secp_192r1;
|
||||
- xs = "8e8e07360350fb6b7ad8370cfd32fa8c6bba785e6e200599";
|
||||
- ys = "7f82ddb58a43d59ff8dc66053002b918b99bd01bd68d6736";
|
||||
- zs = "f2e620e086d658b4b507996988480917640e4dc107808bdd";
|
||||
- ctx->digest = hash_string (&nettle_sha1, "abc");
|
||||
- ctx->digest_size = 20;
|
||||
- break;
|
||||
- case 224:
|
||||
- ecc = &_nettle_secp_224r1;
|
||||
- xs = "993bf363f4f2bc0f255f22563980449164e9c894d9efd088d7b77334";
|
||||
- ys = "b75fff9849997d02d135140e4d0030944589586e22df1fc4b629082a";
|
||||
- zs = "cdfd01838247f5de3cc70b688418046f10a2bfaca6de9ec836d48c27";
|
||||
- ctx->digest = hash_string (&nettle_sha224, "abc");
|
||||
- ctx->digest_size = 28;
|
||||
- break;
|
||||
-
|
||||
/* From RFC 4754 */
|
||||
case 256:
|
||||
ecc = &_nettle_secp_256r1;
|
||||
diff --git a/testsuite/ecdh-test.c b/testsuite/ecdh-test.c
|
||||
index ff4f7233..2be26b19 100644
|
||||
--- a/testsuite/ecdh-test.c
|
||||
+++ b/testsuite/ecdh-test.c
|
||||
@@ -159,46 +159,6 @@ test_public_key (const char *label, const struct ecc_curve *ecc,
|
||||
void
|
||||
test_main(void)
|
||||
{
|
||||
- test_public_key ("(0,0) with secp-192r1", &_nettle_secp_192r1, "0", "0", 0);
|
||||
- test_public_key (
|
||||
- "(P,0) with secp-192r1", &_nettle_secp_192r1,
|
||||
- "6277101735386680763835789423207666416083908700390324961279",
|
||||
- "0", 0);
|
||||
- test_public_key (
|
||||
- "(0,P) with secp-192r1", &_nettle_secp_192r1, "0",
|
||||
- "6277101735386680763835789423207666416083908700390324961279",
|
||||
- 0);
|
||||
- test_public_key (
|
||||
- "(P,P) with secp-192r1", &_nettle_secp_192r1,
|
||||
- "6277101735386680763835789423207666416083908700390324961279",
|
||||
- "6277101735386680763835789423207666416083908700390324961279",
|
||||
- 0);
|
||||
- test_public_key ("(1,2) with secp-192r1", &_nettle_secp_192r1, "1", "2", 0);
|
||||
- test_public_key ("(X,Y) with secp-192r1", &_nettle_secp_192r1,
|
||||
- "1050363442265225480786760666329560655512990381040021438562",
|
||||
- "5298249600854377235107392014200406283816103564916230704184",
|
||||
- 1);
|
||||
-
|
||||
- test_dh ("secp-192r1", &_nettle_secp_192r1,
|
||||
- "3406157206141798348095184987208239421004566462391397236532",
|
||||
- "1050363442265225480786760666329560655512990381040021438562",
|
||||
- "5298249600854377235107392014200406283816103564916230704184",
|
||||
- "738368960171459956677260317271477822683777845013274506165",
|
||||
- "2585840779771604687467445319428618542927556223024046979917",
|
||||
- "293088185788565313717816218507714888251468410990708684573",
|
||||
- "149293809021051532782730990145509724807636529827149481690",
|
||||
- "2891131861147398318714693938158856874319184314120776776192");
|
||||
-
|
||||
- test_dh ("secp-224r1", &_nettle_secp_224r1,
|
||||
- "1321072106881784386340709783538698930880431939595776773514895067682",
|
||||
- "6768311794185371282972144247871764855860666277647541840973645586477",
|
||||
- "2880077809069104378181313860274147139049600284805670362929579614547",
|
||||
- "13934723037778859565852601874354272638301919827851286722006496784914",
|
||||
- "373124771833407982305885866158843810218322878380632071540538232035",
|
||||
- "24223309755162432227459925493224336241652868856405241018762887667883",
|
||||
- "8330362698029245839097779050425944245826040430538860338085968752913",
|
||||
- "24167244512472228715617822000878192535267113543393576038737592837010");
|
||||
-
|
||||
test_dh ("secp-256r1", &_nettle_secp_256r1,
|
||||
"94731533361265297353914491124013058635674217345912524033267198103710636378786",
|
||||
"22441589863306126152768848344973918725077248391248404659242620344938484650846",
|
||||
diff --git a/testsuite/ecdsa-sign-test.c b/testsuite/ecdsa-sign-test.c
|
||||
index 46fc2738..4816de82 100644
|
||||
--- a/testsuite/ecdsa-sign-test.c
|
||||
+++ b/testsuite/ecdsa-sign-test.c
|
||||
@@ -74,18 +74,6 @@ test_main (void)
|
||||
if (test_side_channel)
|
||||
SKIP();
|
||||
#endif
|
||||
- /* Producing the signature for corresponding test in
|
||||
- ecdsa-verify-test.c, with special u1 and u2. */
|
||||
- test_ecdsa (&_nettle_secp_224r1,
|
||||
- "99b5b787484def12894ca507058b3bf5"
|
||||
- "43d72d82fa7721d2e805e5e6",
|
||||
- "2",
|
||||
- SHEX("cdb887ac805a3b42e22d224c85482053"
|
||||
- "16c755d4a736bb2032c92553"),
|
||||
- "706a46dc76dcb76798e60e6d89474788"
|
||||
- "d16dc18032d268fd1a704fa6", /* r */
|
||||
- "3a41e1423b1853e8aa89747b1f987364"
|
||||
- "44705d6d6d8371ea1f578f2e"); /* s */
|
||||
|
||||
/* Produce a signature where verify operation results in a point duplication. */
|
||||
test_ecdsa (&_nettle_secp_256r1,
|
||||
@@ -99,40 +87,6 @@ test_main (void)
|
||||
"53f097727a0e0dc284a0daa0da0ab77d"
|
||||
"5792ae67ed075d1f8d5bda0f853fa093"); /* s */
|
||||
|
||||
- /* Test cases for the smaller groups, verified with a
|
||||
- proof-of-concept implementation done for Yubico AB. */
|
||||
- test_ecdsa (&_nettle_secp_192r1,
|
||||
- "DC51D3866A15BACDE33D96F992FCA99D"
|
||||
- "A7E6EF0934E70975", /* z */
|
||||
-
|
||||
- "9E56F509196784D963D1C0A401510EE7"
|
||||
- "ADA3DCC5DEE04B15", /* k */
|
||||
-
|
||||
- SHEX("BA7816BF8F01CFEA414140DE5DAE2223"
|
||||
- "B00361A396177A9C"), /* h */
|
||||
-
|
||||
- "8c478db6a5c131540cebc739f9c0a9a8"
|
||||
- "c720c2abdd14a891", /* r */
|
||||
-
|
||||
- "a91fb738f9f175d72f9c98527e881c36"
|
||||
- "8de68cb55ffe589"); /* s */
|
||||
-
|
||||
- test_ecdsa (&_nettle_secp_224r1,
|
||||
- "446df0a771ed58403ca9cb316e617f6b"
|
||||
- "158420465d00a69601e22858", /* z */
|
||||
-
|
||||
- "4c13f1905ad7eb201178bc08e0c9267b"
|
||||
- "4751c15d5e1831ca214c33f4", /* z */
|
||||
-
|
||||
- SHEX("1b28a611fe62ab3649350525d06703ba"
|
||||
- "4b979a1e543566fd5caa85c6"), /* h */
|
||||
-
|
||||
- "2cc280778f3d067df6d3adbe3a6aad63"
|
||||
- "bc75f08f5c5f915411902a99", /* r */
|
||||
-
|
||||
- "d0f069fd0f108eb07b7bbc54c8d6c88d"
|
||||
- "f2715c38a95c31a2b486995f"); /* s */
|
||||
-
|
||||
/* From RFC 4754 */
|
||||
test_ecdsa (&_nettle_secp_256r1,
|
||||
"DC51D386 6A15BACD E33D96F9 92FCA99D"
|
||||
diff --git a/testsuite/ecdsa-verify-test.c b/testsuite/ecdsa-verify-test.c
|
||||
index 8d527000..eb5449da 100644
|
||||
--- a/testsuite/ecdsa-verify-test.c
|
||||
+++ b/testsuite/ecdsa-verify-test.c
|
||||
@@ -81,34 +81,6 @@ test_ecdsa (const struct ecc_curve *ecc,
|
||||
void
|
||||
test_main (void)
|
||||
{
|
||||
- /* Corresponds to nonce k = 2 and private key z =
|
||||
- 0x99b5b787484def12894ca507058b3bf543d72d82fa7721d2e805e5e6. z and
|
||||
- hash are chosen so that intermediate scalars in the verify
|
||||
- equations are u1 = 0x6b245680e700, u2 =
|
||||
- 259da6542d4ba7d21ad916c3bd57f811. These values require canonical
|
||||
- reduction of the scalars. Bug caused by missing canonical
|
||||
- reduction reported by Guido Vranken. */
|
||||
- test_ecdsa (&_nettle_secp_224r1,
|
||||
- "9e7e6cc6b1bdfa8ee039b66ad85e5490"
|
||||
- "7be706a900a3cba1c8fdd014", /* x */
|
||||
- "74855db3f7c1b4097ae095745fc915e3"
|
||||
- "8a79d2a1de28f282eafb22ba", /* y */
|
||||
-
|
||||
- SHEX("cdb887ac805a3b42e22d224c85482053"
|
||||
- "16c755d4a736bb2032c92553"),
|
||||
- "706a46dc76dcb76798e60e6d89474788"
|
||||
- "d16dc18032d268fd1a704fa6", /* r */
|
||||
- "3a41e1423b1853e8aa89747b1f987364"
|
||||
- "44705d6d6d8371ea1f578f2e"); /* s */
|
||||
-
|
||||
- /* Test case provided by Guido Vranken, from oss-fuzz */
|
||||
- test_ecdsa (&_nettle_secp_192r1,
|
||||
- "14683086 f1734c6d e68743a6 48181b54 a74d4c5b 383eb6a8", /* x */
|
||||
- " 1e2584 2ab8b2b0 4017f655 1b5e4058 a2aa0612 2dae9344", /* y */
|
||||
- SHEX("00"), /* h == 0 corner case*/
|
||||
- "952800792ed19341fdeeec047f2514f3b0f150d6066151fb", /* r */
|
||||
- "ec5971222014878b50d7a19d8954bc871e7e65b00b860ffb"); /* s */
|
||||
-
|
||||
/* Test case provided by Guido Vranken, from oss-fuzz. Triggers
|
||||
point duplication in the verify operation by using private key =
|
||||
1 (public key = generator) and hash = r. */
|
||||
diff --git a/testsuite/testutils.c b/testsuite/testutils.c
|
||||
index dcd653c1..b35248b9 100644
|
||||
--- a/testsuite/testutils.c
|
||||
+++ b/testsuite/testutils.c
|
||||
@@ -2142,8 +2142,6 @@ test_dsa_key(const struct dsa_params *params,
|
||||
}
|
||||
|
||||
const struct ecc_curve * const ecc_curves[] = {
|
||||
- &_nettle_secp_192r1,
|
||||
- &_nettle_secp_224r1,
|
||||
&_nettle_secp_256r1,
|
||||
&_nettle_secp_384r1,
|
||||
&_nettle_secp_521r1,
|
||||
@@ -2267,25 +2265,7 @@ test_ecc_point (const struct ecc_curve *ecc,
|
||||
}
|
||||
|
||||
/* For each curve, the points g, 2 g, 3 g and 4 g */
|
||||
-static const struct ecc_ref_point ecc_ref[9][4] = {
|
||||
- { { "188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012",
|
||||
- "07192b95ffc8da78631011ed6b24cdd573f977a11e794811" },
|
||||
- { "dafebf5828783f2ad35534631588a3f629a70fb16982a888",
|
||||
- "dd6bda0d993da0fa46b27bbc141b868f59331afa5c7e93ab" },
|
||||
- { "76e32a2557599e6edcd283201fb2b9aadfd0d359cbb263da",
|
||||
- "782c37e372ba4520aa62e0fed121d49ef3b543660cfd05fd" },
|
||||
- { "35433907297cc378b0015703374729d7a4fe46647084e4ba",
|
||||
- "a2649984f2135c301ea3acb0776cd4f125389b311db3be32" }
|
||||
- },
|
||||
- { { "b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21",
|
||||
- "bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34" },
|
||||
- { "706a46dc76dcb76798e60e6d89474788d16dc18032d268fd1a704fa6",
|
||||
- "1c2b76a7bc25e7702a704fa986892849fca629487acf3709d2e4e8bb" },
|
||||
- { "df1b1d66a551d0d31eff822558b9d2cc75c2180279fe0d08fd896d04",
|
||||
- "a3f7f03cadd0be444c0aa56830130ddf77d317344e1af3591981a925" },
|
||||
- { "ae99feebb5d26945b54892092a8aee02912930fa41cd114e40447301",
|
||||
- "482580a0ec5bc47e88bc8c378632cd196cb3fa058a7114eb03054c9" },
|
||||
- },
|
||||
+static const struct ecc_ref_point ecc_ref[7][4] = {
|
||||
{ { "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",
|
||||
"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5" },
|
||||
{ "7cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc47669978",
|
||||
--
|
||||
2.45.1
|
||||
|
||||
|
||||
From fda2e8fb058076715763346ae0b5cb4bb3eea5dd Mon Sep 17 00:00:00 2001
|
||||
From: Daiki Ueno <dueno@redhat.com>
|
||||
Date: Wed, 1 Nov 2023 09:21:16 +0900
|
||||
Subject: [PATCH 2/2] Remove SM4 cipher support
|
||||
|
||||
---
|
||||
Makefile.in | 4 +---
|
||||
examples/nettle-benchmark.c | 2 --
|
||||
gcm.h | 23 -----------------------
|
||||
nettle-meta-aeads.c | 1 -
|
||||
nettle-meta-ciphers.c | 1 -
|
||||
nettle-meta.h | 3 ---
|
||||
testsuite/Makefile.in | 2 +-
|
||||
testsuite/gcm-test.c | 18 ------------------
|
||||
testsuite/meta-aead-test.c | 1 -
|
||||
testsuite/meta-cipher-test.c | 1 -
|
||||
10 files changed, 2 insertions(+), 54 deletions(-)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 8e3df0a0..6a762008 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -117,7 +117,6 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c aes-decrypt-table.c \
|
||||
gcm-aes256.c gcm-aes256-meta.c \
|
||||
gcm-camellia128.c gcm-camellia128-meta.c \
|
||||
gcm-camellia256.c gcm-camellia256-meta.c \
|
||||
- gcm-sm4.c gcm-sm4-meta.c \
|
||||
cmac.c cmac64.c cmac-aes128.c cmac-aes256.c cmac-des3.c \
|
||||
cmac-aes128-meta.c cmac-aes256-meta.c cmac-des3-meta.c \
|
||||
gost28147.c gosthash94.c gosthash94-meta.c \
|
||||
@@ -157,7 +156,6 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c aes-decrypt-table.c \
|
||||
serpent-meta.c \
|
||||
streebog.c streebog-meta.c \
|
||||
twofish.c twofish-meta.c \
|
||||
- sm4.c sm4-meta.c \
|
||||
umac-nh.c umac-nh-n.c umac-l2.c umac-l3.c \
|
||||
umac-poly64.c umac-poly128.c umac-set-key.c \
|
||||
umac32.c umac64.c umac96.c umac128.c \
|
||||
@@ -245,7 +243,7 @@ HEADERS = aes.h arcfour.h arctwo.h asn1.h blowfish.h balloon.h \
|
||||
ocb.h pbkdf2.h \
|
||||
pgp.h pkcs1.h pss.h pss-mgf1.h realloc.h ripemd160.h rsa.h \
|
||||
salsa20.h sexp.h serpent.h \
|
||||
- sha.h sha1.h sha2.h sha3.h sm3.h sm4.h streebog.h twofish.h \
|
||||
+ sha.h sha1.h sha2.h sha3.h sm3.h streebog.h twofish.h \
|
||||
umac.h yarrow.h xts.h poly1305.h nist-keywrap.h \
|
||||
drbg-ctr.h
|
||||
|
||||
diff --git a/examples/nettle-benchmark.c b/examples/nettle-benchmark.c
|
||||
index 2a11a694..991d5bee 100644
|
||||
--- a/examples/nettle-benchmark.c
|
||||
+++ b/examples/nettle-benchmark.c
|
||||
@@ -64,7 +64,6 @@
|
||||
#include "sha1.h"
|
||||
#include "sha2.h"
|
||||
#include "sha3.h"
|
||||
-#include "sm4.h"
|
||||
#include "twofish.h"
|
||||
#include "umac.h"
|
||||
#include "cmac.h"
|
||||
@@ -937,7 +936,6 @@ main(int argc, char **argv)
|
||||
&nettle_des3,
|
||||
&nettle_serpent256,
|
||||
&nettle_twofish128, &nettle_twofish192, &nettle_twofish256,
|
||||
- &nettle_sm4,
|
||||
NULL
|
||||
};
|
||||
|
||||
diff --git a/gcm.h b/gcm.h
|
||||
index 39af5ab0..68c6c1ba 100644
|
||||
--- a/gcm.h
|
||||
+++ b/gcm.h
|
||||
@@ -40,7 +40,6 @@
|
||||
|
||||
#include "aes.h"
|
||||
#include "camellia.h"
|
||||
-#include "sm4.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -96,13 +95,6 @@ extern "C" {
|
||||
#define gcm_camellia256_decrypt nettle_gcm_camellia256_decrypt
|
||||
#define gcm_camellia256_digest nettle_gcm_camellia256_digest
|
||||
|
||||
-#define gcm_sm4_set_key nettle_gcm_sm4_set_key
|
||||
-#define gcm_sm4_set_iv nettle_gcm_sm4_set_iv
|
||||
-#define gcm_sm4_update nettle_gcm_sm4_update
|
||||
-#define gcm_sm4_encrypt nettle_gcm_sm4_encrypt
|
||||
-#define gcm_sm4_decrypt nettle_gcm_sm4_decrypt
|
||||
-#define gcm_sm4_digest nettle_gcm_sm4_digest
|
||||
-
|
||||
#define GCM_BLOCK_SIZE 16
|
||||
#define GCM_IV_SIZE (GCM_BLOCK_SIZE - 4)
|
||||
#define GCM_DIGEST_SIZE 16
|
||||
@@ -331,21 +323,6 @@ void gcm_camellia256_digest(struct gcm_camellia256_ctx *ctx,
|
||||
size_t length, uint8_t *digest);
|
||||
|
||||
|
||||
-struct gcm_sm4_ctx GCM_CTX(struct sm4_ctx);
|
||||
-
|
||||
-void gcm_sm4_set_key(struct gcm_sm4_ctx *ctx, const uint8_t *key);
|
||||
-void gcm_sm4_set_iv(struct gcm_sm4_ctx *ctx,
|
||||
- size_t length, const uint8_t *iv);
|
||||
-void gcm_sm4_update(struct gcm_sm4_ctx *ctx,
|
||||
- size_t length, const uint8_t *data);
|
||||
-void gcm_sm4_encrypt(struct gcm_sm4_ctx *ctx,
|
||||
- size_t length, uint8_t *dst, const uint8_t *src);
|
||||
-void gcm_sm4_decrypt(struct gcm_sm4_ctx *ctx,
|
||||
- size_t length, uint8_t *dst, const uint8_t *src);
|
||||
-void gcm_sm4_digest(struct gcm_sm4_ctx *ctx,
|
||||
- size_t length, uint8_t *digest);
|
||||
-
|
||||
-
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
diff --git a/nettle-meta-aeads.c b/nettle-meta-aeads.c
|
||||
index 78f38a3c..c99cc465 100644
|
||||
--- a/nettle-meta-aeads.c
|
||||
+++ b/nettle-meta-aeads.c
|
||||
@@ -43,7 +43,6 @@ const struct nettle_aead * const _nettle_aeads[] = {
|
||||
&nettle_gcm_aes256,
|
||||
&nettle_gcm_camellia128,
|
||||
&nettle_gcm_camellia256,
|
||||
- &nettle_gcm_sm4,
|
||||
&nettle_eax_aes128,
|
||||
&nettle_chacha_poly1305,
|
||||
NULL
|
||||
diff --git a/nettle-meta-ciphers.c b/nettle-meta-ciphers.c
|
||||
index f8d691cf..49cb47a7 100644
|
||||
--- a/nettle-meta-ciphers.c
|
||||
+++ b/nettle-meta-ciphers.c
|
||||
@@ -54,7 +54,6 @@ const struct nettle_cipher * const _nettle_ciphers[] = {
|
||||
&nettle_arctwo64,
|
||||
&nettle_arctwo128,
|
||||
&nettle_arctwo_gutmann128,
|
||||
- &nettle_sm4,
|
||||
NULL
|
||||
};
|
||||
|
||||
diff --git a/nettle-meta.h b/nettle-meta.h
|
||||
index 19dc96c5..d684947e 100644
|
||||
--- a/nettle-meta.h
|
||||
+++ b/nettle-meta.h
|
||||
@@ -89,8 +89,6 @@ extern const struct nettle_cipher nettle_arctwo64;
|
||||
extern const struct nettle_cipher nettle_arctwo128;
|
||||
extern const struct nettle_cipher nettle_arctwo_gutmann128;
|
||||
|
||||
-extern const struct nettle_cipher nettle_sm4;
|
||||
-
|
||||
struct nettle_hash
|
||||
{
|
||||
const char *name;
|
||||
@@ -200,7 +198,6 @@ extern const struct nettle_aead nettle_gcm_aes192;
|
||||
extern const struct nettle_aead nettle_gcm_aes256;
|
||||
extern const struct nettle_aead nettle_gcm_camellia128;
|
||||
extern const struct nettle_aead nettle_gcm_camellia256;
|
||||
-extern const struct nettle_aead nettle_gcm_sm4;
|
||||
extern const struct nettle_aead nettle_eax_aes128;
|
||||
extern const struct nettle_aead nettle_chacha_poly1305;
|
||||
|
||||
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
|
||||
index 0699fa0d..f5db4bca 100644
|
||||
--- a/testsuite/Makefile.in
|
||||
+++ b/testsuite/Makefile.in
|
||||
@@ -25,7 +25,7 @@ TS_NETTLE_SOURCES = aes-test.c aes-keywrap-test.c arcfour-test.c arctwo-test.c \
|
||||
sha3-permute-test.c sha3-224-test.c sha3-256-test.c \
|
||||
sha3-384-test.c sha3-512-test.c \
|
||||
shake128-test.c shake256-test.c \
|
||||
- streebog-test.c sm3-test.c sm4-test.c \
|
||||
+ streebog-test.c sm3-test.c \
|
||||
serpent-test.c twofish-test.c version-test.c \
|
||||
knuth-lfib-test.c \
|
||||
cbc-test.c cfb-test.c ctr-test.c gcm-test.c eax-test.c ccm-test.c \
|
||||
diff --git a/testsuite/gcm-test.c b/testsuite/gcm-test.c
|
||||
index e8228ed7..e0501963 100644
|
||||
--- a/testsuite/gcm-test.c
|
||||
+++ b/testsuite/gcm-test.c
|
||||
@@ -825,24 +825,6 @@ test_main(void)
|
||||
"16aedbf5a0de6a57 a637b39b"), /* iv */
|
||||
SHEX("5791883f822013f8bd136fc36fb9946b")); /* tag */
|
||||
|
||||
- /*
|
||||
- * GCM-SM4 Test Vectors from
|
||||
- * https://datatracker.ietf.org/doc/html/rfc8998
|
||||
- */
|
||||
- test_aead(&nettle_gcm_sm4, NULL,
|
||||
- SHEX("0123456789ABCDEFFEDCBA9876543210"),
|
||||
- SHEX("FEEDFACEDEADBEEFFEEDFACEDEADBEEFABADDAD2"),
|
||||
- SHEX("AAAAAAAAAAAAAAAABBBBBBBBBBBBBBBB"
|
||||
- "CCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDD"
|
||||
- "EEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFF"
|
||||
- "EEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAA"),
|
||||
- SHEX("17F399F08C67D5EE19D0DC9969C4BB7D"
|
||||
- "5FD46FD3756489069157B282BB200735"
|
||||
- "D82710CA5C22F0CCFA7CBF93D496AC15"
|
||||
- "A56834CBCF98C397B4024A2691233B8D"),
|
||||
- SHEX("00001234567800000000ABCD"),
|
||||
- SHEX("83DE3541E4C2B58177E065A9BF7B62EC"));
|
||||
-
|
||||
/* Test gcm_hash, with varying message size, keys and iv all zero.
|
||||
Not compared to any other implementation. */
|
||||
test_gcm_hash (SDATA("a"),
|
||||
diff --git a/testsuite/meta-aead-test.c b/testsuite/meta-aead-test.c
|
||||
index ceeca227..1fcede40 100644
|
||||
--- a/testsuite/meta-aead-test.c
|
||||
+++ b/testsuite/meta-aead-test.c
|
||||
@@ -8,7 +8,6 @@ const char* aeads[] = {
|
||||
"gcm_aes256",
|
||||
"gcm_camellia128",
|
||||
"gcm_camellia256",
|
||||
- "gcm_sm4",
|
||||
"eax_aes128",
|
||||
"chacha_poly1305",
|
||||
};
|
||||
diff --git a/testsuite/meta-cipher-test.c b/testsuite/meta-cipher-test.c
|
||||
index 912fac5a..046fbdaf 100644
|
||||
--- a/testsuite/meta-cipher-test.c
|
||||
+++ b/testsuite/meta-cipher-test.c
|
||||
@@ -20,7 +20,6 @@ const char* ciphers[] = {
|
||||
"twofish128",
|
||||
"twofish192",
|
||||
"twofish256",
|
||||
- "sm4"
|
||||
};
|
||||
|
||||
void
|
||||
--
|
||||
2.45.1
|
||||
|
||||
__EOF__
|
@ -1,748 +0,0 @@
|
||||
From b0b1656a6cfd76a12522b66efb60b05ab23921ee Mon Sep 17 00:00:00 2001
|
||||
From: Daiki Ueno <dueno@redhat.com>
|
||||
Date: Wed, 24 Jul 2024 15:19:01 +0900
|
||||
Subject: [PATCH 1/3] Add --disable-sm3 configure option
|
||||
|
||||
Signed-off-by: Daiki Ueno <dueno@redhat.com>
|
||||
---
|
||||
Makefile.in | 8 +++++---
|
||||
configure.ac | 14 ++++++++++++++
|
||||
examples/nettle-benchmark.c | 8 +++++++-
|
||||
nettle-meta-hashes.c | 2 ++
|
||||
nettle-meta-macs.c | 2 ++
|
||||
testsuite/Makefile.in | 4 +++-
|
||||
testsuite/hmac-test.c | 2 ++
|
||||
testsuite/meta-hash-test.c | 2 ++
|
||||
testsuite/meta-mac-test.c | 2 ++
|
||||
9 files changed, 39 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 2bf7f1e8..a6057237 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -123,10 +123,10 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c aes-decrypt-table.c \
|
||||
gost28147.c gosthash94.c gosthash94-meta.c \
|
||||
hmac.c hmac-gosthash94.c hmac-md5.c hmac-ripemd160.c \
|
||||
hmac-sha1.c hmac-sha224.c hmac-sha256.c hmac-sha384.c \
|
||||
- hmac-sha512.c hmac-streebog.c hmac-sm3.c \
|
||||
+ hmac-sha512.c hmac-streebog.c \
|
||||
hmac-md5-meta.c hmac-ripemd160-meta.c hmac-sha1-meta.c \
|
||||
hmac-sha224-meta.c hmac-sha256-meta.c hmac-sha384-meta.c \
|
||||
- hmac-sha512-meta.c hmac-streebog-meta.c hmac-sm3-meta.c \
|
||||
+ hmac-sha512-meta.c hmac-streebog-meta.c \
|
||||
knuth-lfib.c hkdf.c \
|
||||
md2.c md2-meta.c md4.c md4-meta.c \
|
||||
md5.c md5-compat.c md5-meta.c \
|
||||
@@ -152,7 +152,6 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c aes-decrypt-table.c \
|
||||
sha3-224.c sha3-224-meta.c sha3-256.c sha3-256-meta.c \
|
||||
sha3-384.c sha3-384-meta.c sha3-512.c sha3-512-meta.c \
|
||||
sha3-shake.c shake128.c shake256.c \
|
||||
- sm3.c sm3-meta.c \
|
||||
serpent-set-key.c serpent-encrypt.c serpent-decrypt.c \
|
||||
serpent-meta.c \
|
||||
streebog.c streebog-meta.c \
|
||||
@@ -227,6 +226,9 @@ hogweed_SOURCES = sexp.c sexp-format.c \
|
||||
ed448-shake256.c ed448-shake256-pubkey.c \
|
||||
ed448-shake256-sign.c ed448-shake256-verify.c
|
||||
|
||||
+
|
||||
+nettle_SOURCES += @IF_SM3@ hmac-sm3.c hmac-sm3-meta.c sm3.c sm3-meta.c
|
||||
+
|
||||
OPT_SOURCES = fat-arm.c fat-arm64.c fat-ppc.c fat-s390x.c fat-x86_64.c mini-gmp.c
|
||||
|
||||
HEADERS = aes.h arcfour.h arctwo.h asn1.h blowfish.h balloon.h \
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 4f27e663..98a94c33 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -124,6 +124,10 @@ AC_ARG_ENABLE(mini-gmp,
|
||||
AS_HELP_STRING([--enable-mini-gmp], [Enable mini-gmp, used instead of libgmp.]),,
|
||||
[enable_mini_gmp=no])
|
||||
|
||||
+AC_ARG_ENABLE(sm3,
|
||||
+ AS_HELP_STRING([--disable-sm3], [Disable SM3 hash algorithm]),,
|
||||
+ [enable_sm3=yes])
|
||||
+
|
||||
AC_ARG_VAR(ASM_FLAGS, [Extra flags for processing assembly source files])
|
||||
|
||||
if test "x$enable_mini_gmp" = xyes ; then
|
||||
@@ -1157,6 +1161,15 @@ else
|
||||
IF_MINI_GMP='#'
|
||||
fi
|
||||
|
||||
+AH_TEMPLATE([WITH_SM3], [Defined if SM3 hash algorithm is enabled])
|
||||
+
|
||||
+if test "x$enable_sm3" = xyes ; then
|
||||
+ AC_DEFINE(WITH_SM3)
|
||||
+ IF_SM3=''
|
||||
+else
|
||||
+ IF_SM3='#'
|
||||
+fi
|
||||
+
|
||||
AC_SUBST(IF_HOGWEED)
|
||||
AC_SUBST(IF_STATIC)
|
||||
AC_SUBST(IF_SHARED)
|
||||
@@ -1165,6 +1178,7 @@ AC_SUBST(IF_DLOPEN_TEST)
|
||||
AC_SUBST(IF_DOCUMENTATION)
|
||||
AC_SUBST(IF_DLL)
|
||||
AC_SUBST(IF_MINI_GMP)
|
||||
+AC_SUBST(IF_SM3)
|
||||
|
||||
OPENSSL_LIBFLAGS=''
|
||||
|
||||
diff --git a/examples/nettle-benchmark.c b/examples/nettle-benchmark.c
|
||||
index 2a11a694..36835854 100644
|
||||
--- a/examples/nettle-benchmark.c
|
||||
+++ b/examples/nettle-benchmark.c
|
||||
@@ -901,6 +901,12 @@ bench_ghash_update(void)
|
||||
# define OPENSSL(x)
|
||||
#endif
|
||||
|
||||
+#if WITH_SM3
|
||||
+# define SM3(x) x,
|
||||
+#else
|
||||
+# define SM3(x)
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -920,7 +926,7 @@ main(int argc, char **argv)
|
||||
&nettle_sha3_384, &nettle_sha3_512,
|
||||
&nettle_ripemd160, &nettle_gosthash94,
|
||||
&nettle_gosthash94cp, &nettle_streebog256,
|
||||
- &nettle_streebog512, &nettle_sm3,
|
||||
+ &nettle_streebog512, SM3(&nettle_sm3)
|
||||
NULL
|
||||
};
|
||||
|
||||
diff --git a/nettle-meta-hashes.c b/nettle-meta-hashes.c
|
||||
index 2245dfb7..6d4563d9 100644
|
||||
--- a/nettle-meta-hashes.c
|
||||
+++ b/nettle-meta-hashes.c
|
||||
@@ -57,7 +57,9 @@ const struct nettle_hash * const _nettle_hashes[] = {
|
||||
&nettle_sha3_512,
|
||||
&nettle_streebog256,
|
||||
&nettle_streebog512,
|
||||
+#if WITH_SM3
|
||||
&nettle_sm3,
|
||||
+#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
diff --git a/nettle-meta-macs.c b/nettle-meta-macs.c
|
||||
index 40aa6dcd..aae87491 100644
|
||||
--- a/nettle-meta-macs.c
|
||||
+++ b/nettle-meta-macs.c
|
||||
@@ -50,7 +50,9 @@ const struct nettle_mac * const _nettle_macs[] = {
|
||||
&nettle_hmac_sha512,
|
||||
&nettle_hmac_streebog256,
|
||||
&nettle_hmac_streebog512,
|
||||
+#if WITH_SM3
|
||||
&nettle_hmac_sm3,
|
||||
+#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
|
||||
index 0699fa0d..a45ddf77 100644
|
||||
--- a/testsuite/Makefile.in
|
||||
+++ b/testsuite/Makefile.in
|
||||
@@ -25,7 +25,7 @@ TS_NETTLE_SOURCES = aes-test.c aes-keywrap-test.c arcfour-test.c arctwo-test.c \
|
||||
sha3-permute-test.c sha3-224-test.c sha3-256-test.c \
|
||||
sha3-384-test.c sha3-512-test.c \
|
||||
shake128-test.c shake256-test.c \
|
||||
- streebog-test.c sm3-test.c sm4-test.c \
|
||||
+ streebog-test.c sm4-test.c \
|
||||
serpent-test.c twofish-test.c version-test.c \
|
||||
knuth-lfib-test.c \
|
||||
cbc-test.c cfb-test.c ctr-test.c gcm-test.c eax-test.c ccm-test.c \
|
||||
@@ -60,6 +60,8 @@ TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
|
||||
gostdsa-sign-test.c gostdsa-verify-test.c \
|
||||
gostdsa-keygen-test.c gostdsa-vko-test.c
|
||||
|
||||
+TS_NETTLE_SOURCES += @IF_SM3@ sm3-test.c
|
||||
+
|
||||
TS_SOURCES = $(TS_NETTLE_SOURCES) $(TS_HOGWEED_SOURCES)
|
||||
CXX_SOURCES = cxx-test.cxx
|
||||
|
||||
diff --git a/testsuite/hmac-test.c b/testsuite/hmac-test.c
|
||||
index 0d1fb44c..ac9c2a1f 100644
|
||||
--- a/testsuite/hmac-test.c
|
||||
+++ b/testsuite/hmac-test.c
|
||||
@@ -884,9 +884,11 @@ test_main(void)
|
||||
SHEX("a1aa5f7de402d7b3d323f2991c8d4534"
|
||||
"013137010a83754fd0af6d7cd4922ed9"));
|
||||
|
||||
+#if WITH_SM3
|
||||
HMAC_TEST(sm3,
|
||||
SDATA("monkey monkey monkey monkey"),
|
||||
SDATA("abc"),
|
||||
SHEX("7a9388e2ca5343b5d76e7c2c3d84f239"
|
||||
"f306c0b60d5e0dc4d2771e42860a6a2b"));
|
||||
+#endif
|
||||
}
|
||||
diff --git a/testsuite/meta-hash-test.c b/testsuite/meta-hash-test.c
|
||||
index ec4e0d1e..8427e0a1 100644
|
||||
--- a/testsuite/meta-hash-test.c
|
||||
+++ b/testsuite/meta-hash-test.c
|
||||
@@ -24,7 +24,9 @@ const char* hashes[] = {
|
||||
"sha3_512",
|
||||
"streebog256",
|
||||
"streebog512",
|
||||
+#if WITH_SM3
|
||||
"sm3",
|
||||
+#endif
|
||||
};
|
||||
|
||||
void
|
||||
diff --git a/testsuite/meta-mac-test.c b/testsuite/meta-mac-test.c
|
||||
index 0ff82810..186db92b 100644
|
||||
--- a/testsuite/meta-mac-test.c
|
||||
+++ b/testsuite/meta-mac-test.c
|
||||
@@ -14,7 +14,9 @@ const char* macs[] = {
|
||||
"hmac_sha512",
|
||||
"hmac_streebog256",
|
||||
"hmac_streebog512",
|
||||
+#if WITH_SM3
|
||||
"hmac_sm3",
|
||||
+#endif
|
||||
};
|
||||
|
||||
void
|
||||
--
|
||||
2.46.0
|
||||
|
||||
|
||||
From c57b85b677600006eb0fe32b09097d7073e36e75 Mon Sep 17 00:00:00 2001
|
||||
From: Daiki Ueno <dueno@redhat.com>
|
||||
Date: Wed, 24 Jul 2024 15:28:13 +0900
|
||||
Subject: [PATCH 2/3] Add --disable-sm4 configure option
|
||||
|
||||
Signed-off-by: Daiki Ueno <dueno@redhat.com>
|
||||
---
|
||||
Makefile.in | 3 +--
|
||||
configure.ac | 14 ++++++++++++++
|
||||
examples/nettle-benchmark.c | 8 +++++++-
|
||||
nettle-meta-aeads.c | 2 ++
|
||||
nettle-meta-ciphers.c | 2 ++
|
||||
testsuite/Makefile.in | 3 ++-
|
||||
testsuite/gcm-test.c | 2 ++
|
||||
testsuite/meta-aead-test.c | 2 ++
|
||||
testsuite/meta-cipher-test.c | 4 +++-
|
||||
9 files changed, 35 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index a6057237..aa44a1ca 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -117,7 +117,6 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c aes-decrypt-table.c \
|
||||
gcm-aes256.c gcm-aes256-meta.c \
|
||||
gcm-camellia128.c gcm-camellia128-meta.c \
|
||||
gcm-camellia256.c gcm-camellia256-meta.c \
|
||||
- gcm-sm4.c gcm-sm4-meta.c \
|
||||
cmac.c cmac64.c cmac-aes128.c cmac-aes256.c cmac-des3.c \
|
||||
cmac-aes128-meta.c cmac-aes256-meta.c cmac-des3-meta.c \
|
||||
gost28147.c gosthash94.c gosthash94-meta.c \
|
||||
@@ -156,7 +155,6 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c aes-decrypt-table.c \
|
||||
serpent-meta.c \
|
||||
streebog.c streebog-meta.c \
|
||||
twofish.c twofish-meta.c \
|
||||
- sm4.c sm4-meta.c \
|
||||
umac-nh.c umac-nh-n.c umac-l2.c umac-l3.c \
|
||||
umac-poly64.c umac-poly128.c umac-set-key.c \
|
||||
umac32.c umac64.c umac96.c umac128.c \
|
||||
@@ -228,6 +226,7 @@ hogweed_SOURCES = sexp.c sexp-format.c \
|
||||
|
||||
|
||||
nettle_SOURCES += @IF_SM3@ hmac-sm3.c hmac-sm3-meta.c sm3.c sm3-meta.c
|
||||
+nettle_SOURCES += @IF_SM4@ gcm-sm4.c gcm-sm4-meta.c sm4.c sm4-meta.c
|
||||
|
||||
OPT_SOURCES = fat-arm.c fat-arm64.c fat-ppc.c fat-s390x.c fat-x86_64.c mini-gmp.c
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 98a94c33..37c0d621 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -128,6 +128,10 @@ AC_ARG_ENABLE(sm3,
|
||||
AS_HELP_STRING([--disable-sm3], [Disable SM3 hash algorithm]),,
|
||||
[enable_sm3=yes])
|
||||
|
||||
+AC_ARG_ENABLE(sm4,
|
||||
+ AS_HELP_STRING([--disable-sm4], [Disable SM4 symmetric cipher algorithm]),,
|
||||
+ [enable_sm4=yes])
|
||||
+
|
||||
AC_ARG_VAR(ASM_FLAGS, [Extra flags for processing assembly source files])
|
||||
|
||||
if test "x$enable_mini_gmp" = xyes ; then
|
||||
@@ -1170,6 +1174,15 @@ else
|
||||
IF_SM3='#'
|
||||
fi
|
||||
|
||||
+AH_TEMPLATE([WITH_SM4], [Defined if SM4 symmetric cipher is enabled])
|
||||
+
|
||||
+if test "x$enable_sm4" = xyes ; then
|
||||
+ AC_DEFINE(WITH_SM4)
|
||||
+ IF_SM4=''
|
||||
+else
|
||||
+ IF_SM4='#'
|
||||
+fi
|
||||
+
|
||||
AC_SUBST(IF_HOGWEED)
|
||||
AC_SUBST(IF_STATIC)
|
||||
AC_SUBST(IF_SHARED)
|
||||
@@ -1179,6 +1192,7 @@ AC_SUBST(IF_DOCUMENTATION)
|
||||
AC_SUBST(IF_DLL)
|
||||
AC_SUBST(IF_MINI_GMP)
|
||||
AC_SUBST(IF_SM3)
|
||||
+AC_SUBST(IF_SM4)
|
||||
|
||||
OPENSSL_LIBFLAGS=''
|
||||
|
||||
diff --git a/examples/nettle-benchmark.c b/examples/nettle-benchmark.c
|
||||
index 36835854..66f92f6e 100644
|
||||
--- a/examples/nettle-benchmark.c
|
||||
+++ b/examples/nettle-benchmark.c
|
||||
@@ -907,6 +907,12 @@ bench_ghash_update(void)
|
||||
# define SM3(x)
|
||||
#endif
|
||||
|
||||
+#if WITH_SM4
|
||||
+# define SM4(x) x,
|
||||
+#else
|
||||
+# define SM4(x)
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -943,7 +949,7 @@ main(int argc, char **argv)
|
||||
&nettle_des3,
|
||||
&nettle_serpent256,
|
||||
&nettle_twofish128, &nettle_twofish192, &nettle_twofish256,
|
||||
- &nettle_sm4,
|
||||
+ SM4(&nettle_sm4)
|
||||
NULL
|
||||
};
|
||||
|
||||
diff --git a/nettle-meta-aeads.c b/nettle-meta-aeads.c
|
||||
index 78f38a3c..c94fecd5 100644
|
||||
--- a/nettle-meta-aeads.c
|
||||
+++ b/nettle-meta-aeads.c
|
||||
@@ -43,7 +43,9 @@ const struct nettle_aead * const _nettle_aeads[] = {
|
||||
&nettle_gcm_aes256,
|
||||
&nettle_gcm_camellia128,
|
||||
&nettle_gcm_camellia256,
|
||||
+#if WITH_SM4
|
||||
&nettle_gcm_sm4,
|
||||
+#endif
|
||||
&nettle_eax_aes128,
|
||||
&nettle_chacha_poly1305,
|
||||
NULL
|
||||
diff --git a/nettle-meta-ciphers.c b/nettle-meta-ciphers.c
|
||||
index f8d691cf..6a84a43a 100644
|
||||
--- a/nettle-meta-ciphers.c
|
||||
+++ b/nettle-meta-ciphers.c
|
||||
@@ -54,7 +54,9 @@ const struct nettle_cipher * const _nettle_ciphers[] = {
|
||||
&nettle_arctwo64,
|
||||
&nettle_arctwo128,
|
||||
&nettle_arctwo_gutmann128,
|
||||
+#if WITH_SM4
|
||||
&nettle_sm4,
|
||||
+#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
|
||||
index a45ddf77..3483f409 100644
|
||||
--- a/testsuite/Makefile.in
|
||||
+++ b/testsuite/Makefile.in
|
||||
@@ -25,7 +25,7 @@ TS_NETTLE_SOURCES = aes-test.c aes-keywrap-test.c arcfour-test.c arctwo-test.c \
|
||||
sha3-permute-test.c sha3-224-test.c sha3-256-test.c \
|
||||
sha3-384-test.c sha3-512-test.c \
|
||||
shake128-test.c shake256-test.c \
|
||||
- streebog-test.c sm4-test.c \
|
||||
+ streebog-test.c \
|
||||
serpent-test.c twofish-test.c version-test.c \
|
||||
knuth-lfib-test.c \
|
||||
cbc-test.c cfb-test.c ctr-test.c gcm-test.c eax-test.c ccm-test.c \
|
||||
@@ -61,6 +61,7 @@ TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
|
||||
gostdsa-keygen-test.c gostdsa-vko-test.c
|
||||
|
||||
TS_NETTLE_SOURCES += @IF_SM3@ sm3-test.c
|
||||
+TS_NETTLE_SOURCES += @IF_SM4@ sm4-test.c
|
||||
|
||||
TS_SOURCES = $(TS_NETTLE_SOURCES) $(TS_HOGWEED_SOURCES)
|
||||
CXX_SOURCES = cxx-test.cxx
|
||||
diff --git a/testsuite/gcm-test.c b/testsuite/gcm-test.c
|
||||
index e8228ed7..fad9184a 100644
|
||||
--- a/testsuite/gcm-test.c
|
||||
+++ b/testsuite/gcm-test.c
|
||||
@@ -825,6 +825,7 @@ test_main(void)
|
||||
"16aedbf5a0de6a57 a637b39b"), /* iv */
|
||||
SHEX("5791883f822013f8bd136fc36fb9946b")); /* tag */
|
||||
|
||||
+#if WITH_SM4
|
||||
/*
|
||||
* GCM-SM4 Test Vectors from
|
||||
* https://datatracker.ietf.org/doc/html/rfc8998
|
||||
@@ -842,6 +843,7 @@ test_main(void)
|
||||
"A56834CBCF98C397B4024A2691233B8D"),
|
||||
SHEX("00001234567800000000ABCD"),
|
||||
SHEX("83DE3541E4C2B58177E065A9BF7B62EC"));
|
||||
+#endif
|
||||
|
||||
/* Test gcm_hash, with varying message size, keys and iv all zero.
|
||||
Not compared to any other implementation. */
|
||||
diff --git a/testsuite/meta-aead-test.c b/testsuite/meta-aead-test.c
|
||||
index ceeca227..d1a3193f 100644
|
||||
--- a/testsuite/meta-aead-test.c
|
||||
+++ b/testsuite/meta-aead-test.c
|
||||
@@ -8,7 +8,9 @@ const char* aeads[] = {
|
||||
"gcm_aes256",
|
||||
"gcm_camellia128",
|
||||
"gcm_camellia256",
|
||||
+#if WITH_SM4
|
||||
"gcm_sm4",
|
||||
+#endif
|
||||
"eax_aes128",
|
||||
"chacha_poly1305",
|
||||
};
|
||||
diff --git a/testsuite/meta-cipher-test.c b/testsuite/meta-cipher-test.c
|
||||
index 912fac5a..b57fcbe1 100644
|
||||
--- a/testsuite/meta-cipher-test.c
|
||||
+++ b/testsuite/meta-cipher-test.c
|
||||
@@ -20,7 +20,9 @@ const char* ciphers[] = {
|
||||
"twofish128",
|
||||
"twofish192",
|
||||
"twofish256",
|
||||
- "sm4"
|
||||
+#if WITH_SM4
|
||||
+ "sm4",
|
||||
+#endif
|
||||
};
|
||||
|
||||
void
|
||||
--
|
||||
2.46.0
|
||||
|
||||
|
||||
From 3d3a27508cea6bdbeacc0473bb1a9d8c130585bf Mon Sep 17 00:00:00 2001
|
||||
From: Daiki Ueno <dueno@redhat.com>
|
||||
Date: Thu, 22 Aug 2024 10:49:46 +0900
|
||||
Subject: [PATCH 3/3] Add --disable-ecc-{secp192r1,secp224r1} configure option
|
||||
|
||||
Signed-off-by: Daiki Ueno <dueno@redhat.com>
|
||||
---
|
||||
Makefile.in | 5 ++++-
|
||||
configure.ac | 36 ++++++++++++++++++++++++++++++++++-
|
||||
examples/ecc-benchmark.c | 4 ++++
|
||||
examples/hogweed-benchmark.c | 6 ++++++
|
||||
testsuite/ecdh-test.c | 4 ++++
|
||||
testsuite/ecdsa-sign-test.c | 6 ++++++
|
||||
testsuite/ecdsa-verify-test.c | 4 ++++
|
||||
testsuite/testutils.c | 10 +++++++++-
|
||||
8 files changed, 72 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index aa44a1ca..6b1ec720 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -201,7 +201,7 @@ hogweed_SOURCES = sexp.c sexp-format.c \
|
||||
ecc-mod-arith.c ecc-pp1-redc.c ecc-pm1-redc.c \
|
||||
ecc-curve25519.c ecc-curve448.c \
|
||||
ecc-gost-gc256b.c ecc-gost-gc512a.c \
|
||||
- ecc-secp192r1.c ecc-secp224r1.c ecc-secp256r1.c \
|
||||
+ ecc-secp256r1.c \
|
||||
ecc-secp384r1.c ecc-secp521r1.c \
|
||||
ecc-size.c ecc-j-to-a.c ecc-a-to-j.c \
|
||||
ecc-dup-jj.c ecc-add-jja.c ecc-add-jjj.c ecc-nonsec-add-jjj.c \
|
||||
@@ -228,6 +228,9 @@ hogweed_SOURCES = sexp.c sexp-format.c \
|
||||
nettle_SOURCES += @IF_SM3@ hmac-sm3.c hmac-sm3-meta.c sm3.c sm3-meta.c
|
||||
nettle_SOURCES += @IF_SM4@ gcm-sm4.c gcm-sm4-meta.c sm4.c sm4-meta.c
|
||||
|
||||
+hogweed_SOURCES += @IF_ECC_SECP192R1@ ecc-secp192r1.c
|
||||
+hogweed_SOURCES += @IF_ECC_SECP224R1@ ecc-secp224r1.c
|
||||
+
|
||||
OPT_SOURCES = fat-arm.c fat-arm64.c fat-ppc.c fat-s390x.c fat-x86_64.c mini-gmp.c
|
||||
|
||||
HEADERS = aes.h arcfour.h arctwo.h asn1.h blowfish.h balloon.h \
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 37c0d621..64b73753 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -132,6 +132,14 @@ AC_ARG_ENABLE(sm4,
|
||||
AS_HELP_STRING([--disable-sm4], [Disable SM4 symmetric cipher algorithm]),,
|
||||
[enable_sm4=yes])
|
||||
|
||||
+AC_ARG_ENABLE(ecc-secp192r1,
|
||||
+ AS_HELP_STRING([--disable-ecc-secp192r1], [Disable NIST secp192r1 curve]),,
|
||||
+ [enable_ecc_secp192r1=yes])
|
||||
+
|
||||
+AC_ARG_ENABLE(ecc-secp224r1,
|
||||
+ AS_HELP_STRING([--disable-ecc-secp224r1], [Disable NIST secp224r1 curve]),,
|
||||
+ [enable_ecc_secp224r1=yes])
|
||||
+
|
||||
AC_ARG_VAR(ASM_FLAGS, [Extra flags for processing assembly source files])
|
||||
|
||||
if test "x$enable_mini_gmp" = xyes ; then
|
||||
@@ -624,9 +632,15 @@ asm_nettle_optional_list="cpuid.asm cpu-facility.asm \
|
||||
|
||||
asm_hogweed_optional_list=""
|
||||
if test "x$enable_public_key" = "xyes" ; then
|
||||
- asm_hogweed_optional_list="ecc-secp192r1-modp.asm ecc-secp224r1-modp.asm \
|
||||
+ asm_hogweed_optional_list="\
|
||||
ecc-secp256r1-redc.asm ecc-secp384r1-modp.asm ecc-secp521r1-modp.asm \
|
||||
ecc-curve25519-modp.asm ecc-curve448-modp.asm"
|
||||
+ if test "x$enable_ecc_secp192r1" = "xyes" ; then
|
||||
+ asm_hogweed_optional_list="ecc-secp192r1-modp.asm $asm_hogweed_optional_list"
|
||||
+ fi
|
||||
+ if test "x$enable_ecc_secp224r1" = "xyes" ; then
|
||||
+ asm_hogweed_optional_list="ecc-secp224r1-modp.asm $asm_hogweed_optional_list"
|
||||
+ fi
|
||||
fi
|
||||
|
||||
OPT_NETTLE_OBJS=""
|
||||
@@ -1183,6 +1197,24 @@ else
|
||||
IF_SM4='#'
|
||||
fi
|
||||
|
||||
+AH_TEMPLATE([WITH_ECC_SECP192R1], [Defined if NIST secp192r1 curve is enabled])
|
||||
+
|
||||
+if test "x$enable_ecc_secp192r1" = xyes ; then
|
||||
+ AC_DEFINE(WITH_ECC_SECP192R1)
|
||||
+ IF_ECC_SECP192R1=''
|
||||
+else
|
||||
+ IF_ECC_SECP192R1='#'
|
||||
+fi
|
||||
+
|
||||
+AH_TEMPLATE([WITH_ECC_SECP224R1], [Defined if NIST secp224r1 curve is enabled])
|
||||
+
|
||||
+if test "x$enable_ecc_secp224r1" = xyes ; then
|
||||
+ AC_DEFINE(WITH_ECC_SECP224R1)
|
||||
+ IF_ECC_SECP224R1=''
|
||||
+else
|
||||
+ IF_ECC_SECP224R1='#'
|
||||
+fi
|
||||
+
|
||||
AC_SUBST(IF_HOGWEED)
|
||||
AC_SUBST(IF_STATIC)
|
||||
AC_SUBST(IF_SHARED)
|
||||
@@ -1193,6 +1225,8 @@ AC_SUBST(IF_DLL)
|
||||
AC_SUBST(IF_MINI_GMP)
|
||||
AC_SUBST(IF_SM3)
|
||||
AC_SUBST(IF_SM4)
|
||||
+AC_SUBST(IF_ECC_SECP192R1)
|
||||
+AC_SUBST(IF_ECC_SECP224R1)
|
||||
|
||||
OPENSSL_LIBFLAGS=''
|
||||
|
||||
diff --git a/examples/ecc-benchmark.c b/examples/ecc-benchmark.c
|
||||
index 7e857f80..ebcced65 100644
|
||||
--- a/examples/ecc-benchmark.c
|
||||
+++ b/examples/ecc-benchmark.c
|
||||
@@ -314,8 +314,12 @@ bench_curve (const struct ecc_curve *ecc)
|
||||
}
|
||||
|
||||
const struct ecc_curve * const curves[] = {
|
||||
+#if WITH_ECC_SECP192R1
|
||||
&_nettle_secp_192r1,
|
||||
+#endif
|
||||
+#if WITH_ECC_SECP224R1
|
||||
&_nettle_secp_224r1,
|
||||
+#endif
|
||||
&_nettle_curve25519,
|
||||
&_nettle_secp_256r1,
|
||||
&_nettle_secp_384r1,
|
||||
diff --git a/examples/hogweed-benchmark.c b/examples/hogweed-benchmark.c
|
||||
index 3f858833..df608ffa 100644
|
||||
--- a/examples/hogweed-benchmark.c
|
||||
+++ b/examples/hogweed-benchmark.c
|
||||
@@ -410,6 +410,7 @@ bench_ecdsa_init (unsigned size)
|
||||
|
||||
switch (size)
|
||||
{
|
||||
+#if WITH_ECC_SECP192R1
|
||||
case 192:
|
||||
ecc = &_nettle_secp_192r1;
|
||||
xs = "8e8e07360350fb6b7ad8370cfd32fa8c6bba785e6e200599";
|
||||
@@ -418,6 +419,8 @@ bench_ecdsa_init (unsigned size)
|
||||
ctx->digest = hash_string (&nettle_sha1, "abc");
|
||||
ctx->digest_size = 20;
|
||||
break;
|
||||
+#endif
|
||||
+#if WITH_ECC_SECP224R1
|
||||
case 224:
|
||||
ecc = &_nettle_secp_224r1;
|
||||
xs = "993bf363f4f2bc0f255f22563980449164e9c894d9efd088d7b77334";
|
||||
@@ -426,6 +429,7 @@ bench_ecdsa_init (unsigned size)
|
||||
ctx->digest = hash_string (&nettle_sha224, "abc");
|
||||
ctx->digest_size = 28;
|
||||
break;
|
||||
+#endif
|
||||
|
||||
/* From RFC 4754 */
|
||||
case 256:
|
||||
@@ -864,7 +868,9 @@ struct alg alg_list[] = {
|
||||
#if 0
|
||||
{ "dsa",2048, bench_dsa_init, bench_dsa_sign, bench_dsa_verify, bench_dsa_clear },
|
||||
#endif
|
||||
+#if WITH_ECC_SECP192R1
|
||||
{ "ecdsa", 192, bench_ecdsa_init, bench_ecdsa_sign, bench_ecdsa_verify, bench_ecdsa_clear },
|
||||
+#endif
|
||||
{ "ecdsa", 224, bench_ecdsa_init, bench_ecdsa_sign, bench_ecdsa_verify, bench_ecdsa_clear },
|
||||
{ "ecdsa", 256, bench_ecdsa_init, bench_ecdsa_sign, bench_ecdsa_verify, bench_ecdsa_clear },
|
||||
{ "ecdsa", 384, bench_ecdsa_init, bench_ecdsa_sign, bench_ecdsa_verify, bench_ecdsa_clear },
|
||||
diff --git a/testsuite/ecdh-test.c b/testsuite/ecdh-test.c
|
||||
index ff4f7233..f852d813 100644
|
||||
--- a/testsuite/ecdh-test.c
|
||||
+++ b/testsuite/ecdh-test.c
|
||||
@@ -159,6 +159,7 @@ test_public_key (const char *label, const struct ecc_curve *ecc,
|
||||
void
|
||||
test_main(void)
|
||||
{
|
||||
+#if WITH_ECC_SECP192R1
|
||||
test_public_key ("(0,0) with secp-192r1", &_nettle_secp_192r1, "0", "0", 0);
|
||||
test_public_key (
|
||||
"(P,0) with secp-192r1", &_nettle_secp_192r1,
|
||||
@@ -188,7 +189,9 @@ test_main(void)
|
||||
"293088185788565313717816218507714888251468410990708684573",
|
||||
"149293809021051532782730990145509724807636529827149481690",
|
||||
"2891131861147398318714693938158856874319184314120776776192");
|
||||
+#endif
|
||||
|
||||
+#if WITH_ECC_SECP224R1
|
||||
test_dh ("secp-224r1", &_nettle_secp_224r1,
|
||||
"1321072106881784386340709783538698930880431939595776773514895067682",
|
||||
"6768311794185371282972144247871764855860666277647541840973645586477",
|
||||
@@ -198,6 +201,7 @@ test_main(void)
|
||||
"24223309755162432227459925493224336241652868856405241018762887667883",
|
||||
"8330362698029245839097779050425944245826040430538860338085968752913",
|
||||
"24167244512472228715617822000878192535267113543393576038737592837010");
|
||||
+#endif
|
||||
|
||||
test_dh ("secp-256r1", &_nettle_secp_256r1,
|
||||
"94731533361265297353914491124013058635674217345912524033267198103710636378786",
|
||||
diff --git a/testsuite/ecdsa-sign-test.c b/testsuite/ecdsa-sign-test.c
|
||||
index 46fc2738..aa44adb5 100644
|
||||
--- a/testsuite/ecdsa-sign-test.c
|
||||
+++ b/testsuite/ecdsa-sign-test.c
|
||||
@@ -74,6 +74,7 @@ test_main (void)
|
||||
if (test_side_channel)
|
||||
SKIP();
|
||||
#endif
|
||||
+#if WITH_ECC_SECP224R1
|
||||
/* Producing the signature for corresponding test in
|
||||
ecdsa-verify-test.c, with special u1 and u2. */
|
||||
test_ecdsa (&_nettle_secp_224r1,
|
||||
@@ -86,6 +87,7 @@ test_main (void)
|
||||
"d16dc18032d268fd1a704fa6", /* r */
|
||||
"3a41e1423b1853e8aa89747b1f987364"
|
||||
"44705d6d6d8371ea1f578f2e"); /* s */
|
||||
+#endif
|
||||
|
||||
/* Produce a signature where verify operation results in a point duplication. */
|
||||
test_ecdsa (&_nettle_secp_256r1,
|
||||
@@ -99,6 +101,7 @@ test_main (void)
|
||||
"53f097727a0e0dc284a0daa0da0ab77d"
|
||||
"5792ae67ed075d1f8d5bda0f853fa093"); /* s */
|
||||
|
||||
+#if WITH_ECC_SECP192R1
|
||||
/* Test cases for the smaller groups, verified with a
|
||||
proof-of-concept implementation done for Yubico AB. */
|
||||
test_ecdsa (&_nettle_secp_192r1,
|
||||
@@ -116,7 +119,9 @@ test_main (void)
|
||||
|
||||
"a91fb738f9f175d72f9c98527e881c36"
|
||||
"8de68cb55ffe589"); /* s */
|
||||
+#endif
|
||||
|
||||
+#if WITH_ECC_SECP224R1
|
||||
test_ecdsa (&_nettle_secp_224r1,
|
||||
"446df0a771ed58403ca9cb316e617f6b"
|
||||
"158420465d00a69601e22858", /* z */
|
||||
@@ -132,6 +137,7 @@ test_main (void)
|
||||
|
||||
"d0f069fd0f108eb07b7bbc54c8d6c88d"
|
||||
"f2715c38a95c31a2b486995f"); /* s */
|
||||
+#endif
|
||||
|
||||
/* From RFC 4754 */
|
||||
test_ecdsa (&_nettle_secp_256r1,
|
||||
diff --git a/testsuite/ecdsa-verify-test.c b/testsuite/ecdsa-verify-test.c
|
||||
index 8d527000..1fa69f09 100644
|
||||
--- a/testsuite/ecdsa-verify-test.c
|
||||
+++ b/testsuite/ecdsa-verify-test.c
|
||||
@@ -81,6 +81,7 @@ test_ecdsa (const struct ecc_curve *ecc,
|
||||
void
|
||||
test_main (void)
|
||||
{
|
||||
+#if WITH_ECC_SECP224R1
|
||||
/* Corresponds to nonce k = 2 and private key z =
|
||||
0x99b5b787484def12894ca507058b3bf543d72d82fa7721d2e805e5e6. z and
|
||||
hash are chosen so that intermediate scalars in the verify
|
||||
@@ -100,7 +101,9 @@ test_main (void)
|
||||
"d16dc18032d268fd1a704fa6", /* r */
|
||||
"3a41e1423b1853e8aa89747b1f987364"
|
||||
"44705d6d6d8371ea1f578f2e"); /* s */
|
||||
+#endif
|
||||
|
||||
+#if WITH_ECC_SECP192R1
|
||||
/* Test case provided by Guido Vranken, from oss-fuzz */
|
||||
test_ecdsa (&_nettle_secp_192r1,
|
||||
"14683086 f1734c6d e68743a6 48181b54 a74d4c5b 383eb6a8", /* x */
|
||||
@@ -108,6 +111,7 @@ test_main (void)
|
||||
SHEX("00"), /* h == 0 corner case*/
|
||||
"952800792ed19341fdeeec047f2514f3b0f150d6066151fb", /* r */
|
||||
"ec5971222014878b50d7a19d8954bc871e7e65b00b860ffb"); /* s */
|
||||
+#endif
|
||||
|
||||
/* Test case provided by Guido Vranken, from oss-fuzz. Triggers
|
||||
point duplication in the verify operation by using private key =
|
||||
diff --git a/testsuite/testutils.c b/testsuite/testutils.c
|
||||
index dcd653c1..b7a1c2c9 100644
|
||||
--- a/testsuite/testutils.c
|
||||
+++ b/testsuite/testutils.c
|
||||
@@ -2142,8 +2142,12 @@ test_dsa_key(const struct dsa_params *params,
|
||||
}
|
||||
|
||||
const struct ecc_curve * const ecc_curves[] = {
|
||||
+#if WITH_ECC_SECP192R1
|
||||
&_nettle_secp_192r1,
|
||||
+#endif
|
||||
+#if WITH_ECC_SECP224R1
|
||||
&_nettle_secp_224r1,
|
||||
+#endif
|
||||
&_nettle_secp_256r1,
|
||||
&_nettle_secp_384r1,
|
||||
&_nettle_secp_521r1,
|
||||
@@ -2267,7 +2271,8 @@ test_ecc_point (const struct ecc_curve *ecc,
|
||||
}
|
||||
|
||||
/* For each curve, the points g, 2 g, 3 g and 4 g */
|
||||
-static const struct ecc_ref_point ecc_ref[9][4] = {
|
||||
+static const struct ecc_ref_point ecc_ref[][4] = {
|
||||
+#if WITH_ECC_SECP192R1
|
||||
{ { "188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012",
|
||||
"07192b95ffc8da78631011ed6b24cdd573f977a11e794811" },
|
||||
{ "dafebf5828783f2ad35534631588a3f629a70fb16982a888",
|
||||
@@ -2277,6 +2282,8 @@ static const struct ecc_ref_point ecc_ref[9][4] = {
|
||||
{ "35433907297cc378b0015703374729d7a4fe46647084e4ba",
|
||||
"a2649984f2135c301ea3acb0776cd4f125389b311db3be32" }
|
||||
},
|
||||
+#endif
|
||||
+#if WITH_ECC_SECP224R1
|
||||
{ { "b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21",
|
||||
"bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34" },
|
||||
{ "706a46dc76dcb76798e60e6d89474788d16dc18032d268fd1a704fa6",
|
||||
@@ -2286,6 +2293,7 @@ static const struct ecc_ref_point ecc_ref[9][4] = {
|
||||
{ "ae99feebb5d26945b54892092a8aee02912930fa41cd114e40447301",
|
||||
"482580a0ec5bc47e88bc8c378632cd196cb3fa058a7114eb03054c9" },
|
||||
},
|
||||
+#endif
|
||||
{ { "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",
|
||||
"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5" },
|
||||
{ "7cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc47669978",
|
||||
--
|
||||
2.46.0
|
||||
|
@ -1,334 +0,0 @@
|
||||
From 24a4cb910a51f35dff89842e8cce27f88e8e78c3 Mon Sep 17 00:00:00 2001
|
||||
From: Daiki Ueno <dueno@redhat.com>
|
||||
Date: Wed, 24 Aug 2022 17:19:57 +0900
|
||||
Subject: [PATCH] Clear any intermediate data allocate on stack
|
||||
|
||||
Signed-off-by: Daiki Ueno <dueno@redhat.com>
|
||||
---
|
||||
cbc.c | 3 +++
|
||||
cfb.c | 13 +++++++++++++
|
||||
ctr.c | 4 ++++
|
||||
ctr16.c | 2 ++
|
||||
ecc-random.c | 3 +++
|
||||
ecdsa-keygen.c | 2 ++
|
||||
ecdsa-sign.c | 2 ++
|
||||
ed25519-sha512-sign.c | 2 ++
|
||||
ed448-shake256-sign.c | 2 ++
|
||||
gostdsa-sign.c | 2 ++
|
||||
hmac.c | 10 +++++++---
|
||||
nettle-internal.h | 5 +++++
|
||||
pbkdf2.c | 5 ++++-
|
||||
pss-mgf1.c | 5 ++++-
|
||||
pss.c | 4 ++++
|
||||
15 files changed, 59 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/cbc.c b/cbc.c
|
||||
index 76b6492d..b9da3aa0 100644
|
||||
--- a/cbc.c
|
||||
+++ b/cbc.c
|
||||
@@ -128,6 +128,9 @@ cbc_decrypt(const void *ctx, nettle_cipher_func *f,
|
||||
length - block_size);
|
||||
/* Writes first block. */
|
||||
memxor3(dst, buffer, initial_iv, block_size);
|
||||
+
|
||||
+ TMP_CLEAR(buffer, buffer_size);
|
||||
+ TMP_CLEAR(initial_iv, block_size);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/cfb.c b/cfb.c
|
||||
index b9da3159..b1b01b9e 100644
|
||||
--- a/cfb.c
|
||||
+++ b/cfb.c
|
||||
@@ -83,6 +83,8 @@ cfb_encrypt(const void *ctx, nettle_cipher_func *f,
|
||||
/* We do not care about updating IV here. This is the last call in
|
||||
* message sequence and one has to set IV afterwards anyway */
|
||||
}
|
||||
+
|
||||
+ TMP_CLEAR(buffer, block_size);
|
||||
}
|
||||
|
||||
/* Don't allocate any more space than this on the stack */
|
||||
@@ -115,6 +117,8 @@ cfb_decrypt(const void *ctx, nettle_cipher_func *f,
|
||||
|
||||
f(ctx, block_size, buffer, iv);
|
||||
memxor3(dst + length, src + length, buffer, left);
|
||||
+
|
||||
+ TMP_CLEAR(buffer, block_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -160,6 +164,9 @@ cfb_decrypt(const void *ctx, nettle_cipher_func *f,
|
||||
f(ctx, block_size, buffer, iv);
|
||||
memxor(dst, buffer, left);
|
||||
}
|
||||
+
|
||||
+ TMP_CLEAR(buffer, buffer_size);
|
||||
+ TMP_CLEAR(initial_iv, block_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,6 +203,9 @@ cfb8_encrypt(const void *ctx, nettle_cipher_func *f,
|
||||
pos ++;
|
||||
}
|
||||
memcpy(iv, buffer + pos, block_size);
|
||||
+
|
||||
+ TMP_CLEAR(buffer, block_size * 2);
|
||||
+ TMP_CLEAR(outbuf, block_size);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -235,4 +245,7 @@ cfb8_decrypt(const void *ctx, nettle_cipher_func *f,
|
||||
}
|
||||
|
||||
memcpy(iv, buffer + i, block_size);
|
||||
+
|
||||
+ TMP_CLEAR(buffer, block_size * 2);
|
||||
+ TMP_CLEAR(outbuf, block_size * 2);
|
||||
}
|
||||
diff --git a/ctr.c b/ctr.c
|
||||
index 8c6b4626..217d1abb 100644
|
||||
--- a/ctr.c
|
||||
+++ b/ctr.c
|
||||
@@ -137,6 +137,8 @@ ctr_crypt(const void *ctx, nettle_cipher_func *f,
|
||||
f(ctx, block_size, block, ctr);
|
||||
INCREMENT(block_size, ctr);
|
||||
memxor3(dst + filled, src + filled, block, length - filled);
|
||||
+
|
||||
+ TMP_CLEAR(block, block_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -173,5 +175,7 @@ ctr_crypt(const void *ctx, nettle_cipher_func *f,
|
||||
INCREMENT(block_size, ctr);
|
||||
memxor(dst, buffer, length);
|
||||
}
|
||||
+
|
||||
+ TMP_CLEAR(buffer, buffer_size);
|
||||
}
|
||||
}
|
||||
diff --git a/ctr16.c b/ctr16.c
|
||||
index d744d2a9..ec0abd72 100644
|
||||
--- a/ctr16.c
|
||||
+++ b/ctr16.c
|
||||
@@ -102,5 +102,7 @@ _nettle_ctr_crypt16(const void *ctx, nettle_cipher_func *f,
|
||||
done:
|
||||
memxor3 (dst + i, src + i, buffer->b, length - i);
|
||||
}
|
||||
+
|
||||
+ TMP_CLEAR(buffer, MIN(blocks, CTR_BUFFER_LIMIT / 16));
|
||||
}
|
||||
}
|
||||
diff --git a/ecc-random.c b/ecc-random.c
|
||||
index a7b48d6a..676f5933 100644
|
||||
--- a/ecc-random.c
|
||||
+++ b/ecc-random.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
+#include <string.h>
|
||||
|
||||
#include "ecc.h"
|
||||
#include "ecc-internal.h"
|
||||
@@ -79,4 +80,6 @@ ecc_scalar_random (struct ecc_scalar *x,
|
||||
TMP_ALLOC (scratch, ECC_MOD_RANDOM_ITCH (x->ecc->q.size));
|
||||
|
||||
ecc_mod_random (&x->ecc->q, x->p, random_ctx, random, scratch);
|
||||
+
|
||||
+ TMP_CLEAR (scratch, ECC_MOD_RANDOM_ITCH (x->ecc->q.size));
|
||||
}
|
||||
diff --git a/ecdsa-keygen.c b/ecdsa-keygen.c
|
||||
index 870282b0..05dd827a 100644
|
||||
--- a/ecdsa-keygen.c
|
||||
+++ b/ecdsa-keygen.c
|
||||
@@ -59,4 +59,6 @@ ecdsa_generate_keypair (struct ecc_point *pub,
|
||||
ecc_mod_random (&ecc->q, key->p, random_ctx, random, p);
|
||||
ecc->mul_g (ecc, p, key->p, p + 3*ecc->p.size);
|
||||
ecc->h_to_a (ecc, 0, pub->p, p, p + 3*ecc->p.size);
|
||||
+
|
||||
+ TMP_CLEAR (p, itch);
|
||||
}
|
||||
diff --git a/ecdsa-sign.c b/ecdsa-sign.c
|
||||
index e6fb3287..e6b960bf 100644
|
||||
--- a/ecdsa-sign.c
|
||||
+++ b/ecdsa-sign.c
|
||||
@@ -68,4 +68,6 @@ ecdsa_sign (const struct ecc_scalar *key,
|
||||
mpz_limbs_finish (signature->s, size);
|
||||
}
|
||||
while (mpz_sgn (signature->r) == 0 || mpz_sgn (signature->s) == 0);
|
||||
+
|
||||
+ TMP_CLEAR (k, size + ECC_ECDSA_SIGN_ITCH (size));
|
||||
}
|
||||
diff --git a/ed25519-sha512-sign.c b/ed25519-sha512-sign.c
|
||||
index 389a157e..52a46ea5 100644
|
||||
--- a/ed25519-sha512-sign.c
|
||||
+++ b/ed25519-sha512-sign.c
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include "ecc-internal.h"
|
||||
#include "sha2.h"
|
||||
+#include <string.h>
|
||||
|
||||
void
|
||||
ed25519_sha512_sign (const uint8_t *pub,
|
||||
@@ -61,6 +62,7 @@ ed25519_sha512_sign (const uint8_t *pub,
|
||||
length, msg, signature, scratch_out);
|
||||
|
||||
gmp_free_limbs (scratch, itch);
|
||||
+ explicit_bzero (digest, sizeof(digest));
|
||||
#undef k1
|
||||
#undef k2
|
||||
#undef scratch_out
|
||||
diff --git a/ed448-shake256-sign.c b/ed448-shake256-sign.c
|
||||
index c524593d..01abf457 100644
|
||||
--- a/ed448-shake256-sign.c
|
||||
+++ b/ed448-shake256-sign.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "ecc-internal.h"
|
||||
#include "eddsa-internal.h"
|
||||
#include "sha3.h"
|
||||
+#include <string.h>
|
||||
|
||||
void
|
||||
ed448_shake256_sign (const uint8_t *pub,
|
||||
@@ -63,6 +64,7 @@ ed448_shake256_sign (const uint8_t *pub,
|
||||
length, msg, signature, scratch_out);
|
||||
|
||||
gmp_free_limbs (scratch, itch);
|
||||
+ explicit_bzero (digest, sizeof(digest));
|
||||
#undef k1
|
||||
#undef k2
|
||||
#undef scratch_out
|
||||
diff --git a/gostdsa-sign.c b/gostdsa-sign.c
|
||||
index 892c0742..a7e0c21d 100644
|
||||
--- a/gostdsa-sign.c
|
||||
+++ b/gostdsa-sign.c
|
||||
@@ -71,4 +71,6 @@ gostdsa_sign (const struct ecc_scalar *key,
|
||||
mpz_limbs_finish (signature->s, size);
|
||||
}
|
||||
while (mpz_sgn (signature->r) == 0 || mpz_sgn (signature->s) == 0);
|
||||
+
|
||||
+ TMP_CLEAR (k, size + ECC_GOSTDSA_SIGN_ITCH (size));
|
||||
}
|
||||
diff --git a/hmac.c b/hmac.c
|
||||
index ea356970..6a55551b 100644
|
||||
--- a/hmac.c
|
||||
+++ b/hmac.c
|
||||
@@ -53,6 +53,8 @@ hmac_set_key(void *outer, void *inner, void *state,
|
||||
{
|
||||
TMP_DECL(pad, uint8_t, NETTLE_MAX_HASH_BLOCK_SIZE);
|
||||
TMP_ALLOC(pad, hash->block_size);
|
||||
+ TMP_DECL(digest, uint8_t, NETTLE_MAX_HASH_DIGEST_SIZE);
|
||||
+ TMP_ALLOC(digest, hash->digest_size);
|
||||
|
||||
hash->init(outer);
|
||||
hash->init(inner);
|
||||
@@ -62,9 +64,6 @@ hmac_set_key(void *outer, void *inner, void *state,
|
||||
/* Reduce key to the algorithm's hash size. Use the area pointed
|
||||
* to by state for the temporary state. */
|
||||
|
||||
- TMP_DECL(digest, uint8_t, NETTLE_MAX_HASH_DIGEST_SIZE);
|
||||
- TMP_ALLOC(digest, hash->digest_size);
|
||||
-
|
||||
hash->init(state);
|
||||
hash->update(state, key_length, key);
|
||||
hash->digest(state, hash->digest_size, digest);
|
||||
@@ -86,6 +85,9 @@ hmac_set_key(void *outer, void *inner, void *state,
|
||||
hash->update(inner, hash->block_size, pad);
|
||||
|
||||
memcpy(state, inner, hash->context_size);
|
||||
+
|
||||
+ TMP_CLEAR(pad, hash->block_size);
|
||||
+ TMP_CLEAR(digest, hash->digest_size);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -112,4 +114,6 @@ hmac_digest(const void *outer, const void *inner, void *state,
|
||||
hash->digest(state, length, dst);
|
||||
|
||||
memcpy(state, inner, hash->context_size);
|
||||
+
|
||||
+ TMP_CLEAR(digest, hash->digest_size);
|
||||
}
|
||||
diff --git a/nettle-internal.h b/nettle-internal.h
|
||||
index c41f3ee0..62b89e11 100644
|
||||
--- a/nettle-internal.h
|
||||
+++ b/nettle-internal.h
|
||||
@@ -76,6 +76,11 @@
|
||||
do { assert((size_t)(size) <= (sizeof(name))); } while (0)
|
||||
#endif
|
||||
|
||||
+#include <string.h> /* explicit_bzero */
|
||||
+
|
||||
+#define TMP_CLEAR(name, size) (explicit_bzero (name, sizeof (*name) * (size)))
|
||||
+#define TMP_CLEAR_ALIGN(name, size) (explicit_bzero (name, size))
|
||||
+
|
||||
/* Limits that apply to systems that don't have alloca */
|
||||
#define NETTLE_MAX_HASH_BLOCK_SIZE 144 /* For sha3_224*/
|
||||
#define NETTLE_MAX_HASH_DIGEST_SIZE 64
|
||||
diff --git a/pbkdf2.c b/pbkdf2.c
|
||||
index 291d138a..a8ecba5b 100644
|
||||
--- a/pbkdf2.c
|
||||
+++ b/pbkdf2.c
|
||||
@@ -92,8 +92,11 @@ pbkdf2 (void *mac_ctx,
|
||||
if (length <= digest_size)
|
||||
{
|
||||
memcpy (dst, T, length);
|
||||
- return;
|
||||
+ break;
|
||||
}
|
||||
memcpy (dst, T, digest_size);
|
||||
}
|
||||
+
|
||||
+ TMP_CLEAR (U, digest_size);
|
||||
+ TMP_CLEAR (T, digest_size);
|
||||
}
|
||||
diff --git a/pss-mgf1.c b/pss-mgf1.c
|
||||
index 3f5e204b..3644c642 100644
|
||||
--- a/pss-mgf1.c
|
||||
+++ b/pss-mgf1.c
|
||||
@@ -66,8 +66,11 @@ pss_mgf1(const void *seed, const struct nettle_hash *hash,
|
||||
if (length <= hash->digest_size)
|
||||
{
|
||||
hash->digest(state, length, mask);
|
||||
- return;
|
||||
+ break;
|
||||
}
|
||||
hash->digest(state, hash->digest_size, mask);
|
||||
}
|
||||
+
|
||||
+ TMP_CLEAR(h, hash->digest_size);
|
||||
+ TMP_CLEAR_ALIGN(state, hash->context_size);
|
||||
}
|
||||
diff --git a/pss.c b/pss.c
|
||||
index d28e7b13..8106ebf2 100644
|
||||
--- a/pss.c
|
||||
+++ b/pss.c
|
||||
@@ -77,6 +77,7 @@ pss_encode_mgf1(mpz_t m, size_t bits,
|
||||
if (key_size < hash->digest_size + salt_length + 2)
|
||||
{
|
||||
TMP_GMP_FREE(em);
|
||||
+ TMP_CLEAR_ALIGN(state, hash->context_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -111,6 +112,7 @@ pss_encode_mgf1(mpz_t m, size_t bits,
|
||||
|
||||
nettle_mpz_set_str_256_u(m, key_size, em);
|
||||
TMP_GMP_FREE(em);
|
||||
+ TMP_CLEAR_ALIGN(state, hash->context_size);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -194,5 +196,7 @@ pss_verify_mgf1(const mpz_t m, size_t bits,
|
||||
ret = 1;
|
||||
cleanup:
|
||||
TMP_GMP_FREE(em);
|
||||
+ TMP_CLEAR(h2, hash->digest_size);
|
||||
+ TMP_CLEAR_ALIGN(state, hash->context_size);
|
||||
return ret;
|
||||
}
|
||||
--
|
||||
2.41.0
|
||||
|
222
nettle.spec
222
nettle.spec
@ -1,222 +0,0 @@
|
||||
# Recent so-version, so we do not bump accidentally.
|
||||
%global nettle_so_ver 8
|
||||
%global hogweed_so_ver 6
|
||||
|
||||
# Set to 1 when building a bootstrap for a bumped so-name.
|
||||
%global bootstrap 0
|
||||
|
||||
%if 0%{?bootstrap}
|
||||
%global version_old 3.5.1
|
||||
%global nettle_so_ver_old 7
|
||||
%global hogweed_so_ver_old 5
|
||||
%endif
|
||||
|
||||
# * In RHEL nettle is included in the gnutls FIPS module boundary,
|
||||
# and HMAC is calculated there with its own tool.
|
||||
# * In RHEL gmp is statically linked to ensure zeroization of CSP.
|
||||
%if %{defined rhel}
|
||||
%bcond_with fipshmac
|
||||
%bcond_without bundle_gmp
|
||||
%else
|
||||
%bcond_without fipshmac
|
||||
%bcond_with bundle_gmp
|
||||
%endif
|
||||
|
||||
Name: nettle
|
||||
Version: 3.10
|
||||
Release: %{?autorelease}%{!?autorelease:1%{?dist}}
|
||||
Summary: A low-level cryptographic library
|
||||
|
||||
License: LGPL-3.0-or-later OR GPL-2.0-or-later
|
||||
URL: http://www.lysator.liu.se/~nisse/nettle/
|
||||
Source0: http://www.lysator.liu.se/~nisse/archive/%{name}-%{version}.tar.gz
|
||||
Source1: http://www.lysator.liu.se/~nisse/archive/%{name}-%{version}.tar.gz.sig
|
||||
Source2: nettle-release-keyring.gpg
|
||||
%if 0%{?bootstrap}
|
||||
Source100: %{name}-%{version_old}-hobbled.tar.xz
|
||||
Source101: nettle-3.5-remove-ecc-testsuite.patch
|
||||
%endif
|
||||
Patch: nettle-3.8-zeroize-stack.patch
|
||||
Patch: nettle-3.10-hobble-to-configure.patch
|
||||
|
||||
%if %{with bundle_gmp}
|
||||
Source200: gmp-6.2.1.tar.xz
|
||||
# Taken from the main gmp package
|
||||
Source201: gmp-6.2.1-intel-cet.patch
|
||||
Source202: gmp-6.2.1-zeroize-allocator.patch
|
||||
%endif
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: gcc
|
||||
%if !%{with bundle_gmp}
|
||||
BuildRequires: gmp-devel
|
||||
%endif
|
||||
BuildRequires: m4
|
||||
BuildRequires: libtool, automake, autoconf, gettext-devel
|
||||
%if %{with fipshmac}
|
||||
BuildRequires: fipscheck
|
||||
%endif
|
||||
BuildRequires: gnupg2
|
||||
|
||||
%package devel
|
||||
Summary: Development headers for a low-level cryptographic library
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: gmp-devel%{?_isa}
|
||||
|
||||
%description
|
||||
Nettle is a cryptographic library that is designed to fit easily in more
|
||||
or less any context: In crypto toolkits for object-oriented languages
|
||||
(C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in
|
||||
kernel space.
|
||||
|
||||
%description devel
|
||||
Nettle is a cryptographic library that is designed to fit easily in more
|
||||
or less any context: In crypto toolkits for object-oriented languages
|
||||
(C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in
|
||||
kernel space. This package contains the files needed for developing
|
||||
applications with nettle.
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -Tb 0 -p1
|
||||
|
||||
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
|
||||
|
||||
%if %{with bundle_gmp}
|
||||
mkdir -p bundled_gmp
|
||||
pushd bundled_gmp
|
||||
tar --strip-components=1 -xf %{SOURCE200}
|
||||
patch -p1 < %{SOURCE201}
|
||||
patch -p1 < %{SOURCE202}
|
||||
popd
|
||||
|
||||
# Prevent -lgmp appearing in the compiler command line in dependent components
|
||||
sed -i '/^Libs.private:/d' hogweed.pc.in
|
||||
%endif
|
||||
|
||||
%if 0%{?bootstrap}
|
||||
mkdir -p bootstrap_ver
|
||||
pushd bootstrap_ver
|
||||
tar --strip-components=1 -xf %{SOURCE100}
|
||||
patch -p1 < %{SOURCE101}
|
||||
|
||||
# Disable -ggdb3 which makes debugedit unhappy
|
||||
sed s/ggdb3/g/ -i configure
|
||||
sed 's/ecc-192.c//g' -i Makefile.in
|
||||
sed 's/ecc-224.c//g' -i Makefile.in
|
||||
popd
|
||||
%endif
|
||||
|
||||
# Disable -ggdb3 which makes debugedit unhappy
|
||||
sed s/ggdb3/g/ -i configure
|
||||
|
||||
%build
|
||||
%if %{with bundle_gmp}
|
||||
pushd bundled_gmp
|
||||
autoreconf -ifv
|
||||
%configure --disable-cxx --disable-shared --enable-fat --with-pic
|
||||
%make_build
|
||||
popd
|
||||
%endif
|
||||
|
||||
autoreconf -ifv
|
||||
# For annocheck
|
||||
export ASM_FLAGS="-Wa,--generate-missing-build-notes=yes"
|
||||
%configure --enable-shared --enable-fat \
|
||||
--disable-sm3 --disable-sm4 --disable-ecc-secp192r1 --disable-ecc-secp224r1 \
|
||||
%if %{with bundle_gmp}
|
||||
--with-include-path=$PWD/bundled_gmp --with-lib-path=$PWD/bundled_gmp/.libs \
|
||||
%endif
|
||||
%{nil}
|
||||
%make_build
|
||||
|
||||
%if 0%{?bootstrap}
|
||||
pushd bootstrap_ver
|
||||
autoconf
|
||||
%configure --with-tests
|
||||
%make_build
|
||||
popd
|
||||
%endif
|
||||
|
||||
%if %{with fipshmac}
|
||||
%define fipshmac() \
|
||||
fipshmac -d $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_libdir}/%1.* \
|
||||
file=`basename $RPM_BUILD_ROOT%{_libdir}/%1.*.hmac` && \
|
||||
mv $RPM_BUILD_ROOT%{_libdir}/$file $RPM_BUILD_ROOT%{_libdir}/.$file && \
|
||||
ln -s .$file $RPM_BUILD_ROOT%{_libdir}/.%1.hmac
|
||||
|
||||
%if 0%{?bootstrap}
|
||||
%define bootstrap_fips 1
|
||||
%endif
|
||||
|
||||
%define __spec_install_post \
|
||||
%{?__debug_package:%{__debug_install_post}} \
|
||||
%{__arch_install_post} \
|
||||
%{__os_install_post} \
|
||||
%fipshmac libnettle.so.%{nettle_so_ver} \
|
||||
%fipshmac libhogweed.so.%{hogweed_so_ver} \
|
||||
%{?bootstrap_fips:%fipshmac libnettle.so.%{nettle_so_ver_old}} \
|
||||
%{?bootstrap_fips:%fipshmac libhogweed.so.%{hogweed_so_ver_old}} \
|
||||
%{nil}
|
||||
%endif
|
||||
|
||||
|
||||
%install
|
||||
%if 0%{?bootstrap}
|
||||
make -C bootstrap_ver install-shared-nettle DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
|
||||
make -C bootstrap_ver install-shared-hogweed DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
|
||||
|
||||
chmod 0755 $RPM_BUILD_ROOT%{_libdir}/libnettle.so.%{nettle_so_ver_old}.*
|
||||
chmod 0755 $RPM_BUILD_ROOT%{_libdir}/libhogweed.so.%{hogweed_so_ver_old}.*
|
||||
%endif
|
||||
|
||||
%make_install
|
||||
make install-shared DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
|
||||
mkdir -p $RPM_BUILD_ROOT%{_infodir}
|
||||
install -p -m 644 nettle.info $RPM_BUILD_ROOT%{_infodir}/
|
||||
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
|
||||
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
||||
rm -f $RPM_BUILD_ROOT%{_bindir}/nettle-lfib-stream
|
||||
rm -f $RPM_BUILD_ROOT%{_bindir}/pkcs1-conv
|
||||
rm -f $RPM_BUILD_ROOT%{_bindir}/sexp-conv
|
||||
rm -f $RPM_BUILD_ROOT%{_bindir}/nettle-hash
|
||||
rm -f $RPM_BUILD_ROOT%{_bindir}/nettle-pbkdf2
|
||||
|
||||
chmod 0755 $RPM_BUILD_ROOT%{_libdir}/libnettle.so.%{nettle_so_ver}.*
|
||||
chmod 0755 $RPM_BUILD_ROOT%{_libdir}/libhogweed.so.%{hogweed_so_ver}.*
|
||||
|
||||
%check
|
||||
make check
|
||||
|
||||
%files
|
||||
%doc AUTHORS NEWS README
|
||||
%license COPYINGv2 COPYING.LESSERv3
|
||||
%{_infodir}/nettle.info.*
|
||||
%{_libdir}/libnettle.so.%{nettle_so_ver}
|
||||
%{_libdir}/libnettle.so.%{nettle_so_ver}.*
|
||||
%{_libdir}/libhogweed.so.%{hogweed_so_ver}
|
||||
%{_libdir}/libhogweed.so.%{hogweed_so_ver}.*
|
||||
%if 0%{?bootstrap}
|
||||
%{_libdir}/libnettle.so.%{nettle_so_ver_old}
|
||||
%{_libdir}/libnettle.so.%{nettle_so_ver_old}.*
|
||||
%{_libdir}/libhogweed.so.%{hogweed_so_ver_old}
|
||||
%{_libdir}/libhogweed.so.%{hogweed_so_ver_old}.*
|
||||
%endif
|
||||
%if %{with fipshmac}
|
||||
%{_libdir}/.libhogweed.so.*.hmac
|
||||
%{_libdir}/.libnettle.so.*.hmac
|
||||
%endif
|
||||
|
||||
%files devel
|
||||
%doc descore.README nettle.html nettle.pdf
|
||||
%{_includedir}/nettle
|
||||
%{_libdir}/libnettle.so
|
||||
%{_libdir}/libhogweed.so
|
||||
%{_libdir}/pkgconfig/hogweed.pc
|
||||
%{_libdir}/pkgconfig/nettle.pc
|
||||
|
||||
%ldconfig_scriptlets
|
||||
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
23
plans/ci.fmf
23
plans/ci.fmf
@ -1,23 +0,0 @@
|
||||
/fips-disabled-buildroot-disabled:
|
||||
plan:
|
||||
import:
|
||||
url: https://pkgs.devel.redhat.com/git/tests/nettle
|
||||
name: /plans/ci/fips-disabled-buildroot-disabled
|
||||
|
||||
/fips-disabled-buildroot-enabled:
|
||||
plan:
|
||||
import:
|
||||
url: https://pkgs.devel.redhat.com/git/tests/nettle
|
||||
name: /plans/ci/fips-disabled-buildroot-enabled
|
||||
|
||||
/fips-enabled-buildroot-disabled:
|
||||
plan:
|
||||
import:
|
||||
url: https://pkgs.devel.redhat.com/git/tests/nettle
|
||||
name: /plans/ci/fips-enabled-buildroot-disabled
|
||||
|
||||
/fips-enabled-buildroot-enabled:
|
||||
plan:
|
||||
import:
|
||||
url: https://pkgs.devel.redhat.com/git/tests/nettle
|
||||
name: /plans/ci/fips-enabled-buildroot-enabled
|
4
sources
4
sources
@ -1,4 +0,0 @@
|
||||
SHA512 (nettle-3.10.tar.gz) = 18d5b904ce60514aa81b57bff2945e5f7f4366d4775e6a5ffc227b85be2def72b3d2159b983b75ac95a56d3167a2ef1a25b5dfc2fb6193f16a012935c36a7b34
|
||||
SHA512 (nettle-3.10.tar.gz.sig) = a56d46bfd545b0dff47ee6426e019afea024ebf40698018b8a4b7a25168ce615bbfe773894dc01ab246f7010ef6a7f1c248cf1f9c693f0f0dbaf27c33c7d216f
|
||||
SHA512 (nettle-release-keyring.gpg) = 0e59447eb74017439c8b5b5b05173c0ffd710705d2a9c1f74833b7034fad1608fa1bdd2c308e6c42214553cd648606b6a07044ea39677b1b3452cb4d07bf889b
|
||||
SHA512 (gmp-6.2.1.tar.xz) = c99be0950a1d05a0297d65641dd35b75b74466f7bf03c9e8a99895a3b2f9a0856cd17887738fa51cf7499781b65c049769271cbcb77d057d2e9f1ec52e07dd84
|
@ -1,6 +0,0 @@
|
||||
summary: Check that gnutls is rebuilt as part of the same bodhi update
|
||||
execute:
|
||||
script: >
|
||||
dnf install -y gnutls-utils
|
||||
&& rpm -q gnutls nettle
|
||||
&& env GNUTLS_FORCE_FIPS_MODE=1 gnutls-cli --list
|
Loading…
Reference in New Issue
Block a user