Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95bdcc4b02 |
7 changed files with 1 additions and 1534 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,3 +0,0 @@
|
|||
/nettle-*.tar.gz
|
||||
/nettle-*.tar.gz.sig
|
||||
/nettle-release-keyring.gpg
|
||||
1
dead.package
Normal file
1
dead.package
Normal file
|
|
@ -0,0 +1 @@
|
|||
All mingw packages have been retired in EPEL 7, see https://pagure.io/fesco/issue/2333
|
||||
339
hobble-nettle
339
hobble-nettle
|
|
@ -1,339 +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
|
||||
|
||||
patch -p1 << __EOF__
|
||||
From b519b23a141752043c9cc9182048c26d80d22af2 Mon Sep 17 00:00:00 2001
|
||||
From: Daiki Ueno <dueno@redhat.com>
|
||||
Date: Sun, 21 Mar 2021 11:09:51 +0100
|
||||
Subject: [PATCH] Remove secp192r1 and secp224r1 support
|
||||
|
||||
---
|
||||
eccdata.c | 67 +----------------------------------
|
||||
examples/ecc-benchmark.c | 2 --
|
||||
examples/hogweed-benchmark.c | 17 ---------
|
||||
testsuite/ecdh-test.c | 40 ---------------------
|
||||
testsuite/ecdsa-sign-test.c | 47 ------------------------
|
||||
testsuite/ecdsa-verify-test.c | 28 ---------------
|
||||
testsuite/testutils.c | 20 -----------
|
||||
7 files changed, 1 insertion(+), 220 deletions(-)
|
||||
|
||||
diff --git a/eccdata.c b/eccdata.c
|
||||
index 1b4cb0b5..dc2be5f9 100644
|
||||
--- a/eccdata.c
|
||||
+++ b/eccdata.c
|
||||
@@ -434,72 +434,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 3ab269c7..402744a0 100644
|
||||
--- a/examples/ecc-benchmark.c
|
||||
+++ b/examples/ecc-benchmark.c
|
||||
@@ -307,8 +307,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 3d008021..b8cf902c 100644
|
||||
--- a/examples/hogweed-benchmark.c
|
||||
+++ b/examples/hogweed-benchmark.c
|
||||
@@ -412,23 +412,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 08a10a1d..0acd4e5c 100644
|
||||
--- a/testsuite/ecdsa-sign-test.c
|
||||
+++ b/testsuite/ecdsa-sign-test.c
|
||||
@@ -58,53 +58,6 @@ test_ecdsa (const struct ecc_curve *ecc,
|
||||
void
|
||||
test_main (void)
|
||||
{
|
||||
- /* 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 */
|
||||
-
|
||||
- /* 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 8110c64d..71c0b5c0 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 */
|
||||
-
|
||||
/* From RFC 4754 */
|
||||
test_ecdsa (&_nettle_secp_256r1,
|
||||
"2442A5CC 0ECD015F A3CA31DC 8E2BBC70"
|
||||
diff --git a/testsuite/testutils.c b/testsuite/testutils.c
|
||||
index 2c6cac40..fbf4974c 100644
|
||||
--- a/testsuite/testutils.c
|
||||
+++ b/testsuite/testutils.c
|
||||
@@ -1656,8 +1656,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,
|
||||
@@ -1714,24 +1712,6 @@ 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" },
|
||||
- },
|
||||
{ { "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",
|
||||
"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5" },
|
||||
{ "7cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc47669978",
|
||||
--
|
||||
2.30.2
|
||||
|
||||
__EOF__
|
||||
|
|
@ -1,246 +0,0 @@
|
|||
%{?mingw_package_header}
|
||||
|
||||
Name: mingw-nettle
|
||||
Version: 3.10.2
|
||||
Release: 1%{?dist}
|
||||
|
||||
Summary: MinGW package for nettle cryptographic library
|
||||
# Automatically converted from old format: LGPLv3+ or GPLv2+ - review is highly recommended.
|
||||
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/nettle-%{version}.tar.gz
|
||||
Source1: http://www.lysator.liu.se/~nisse/archive/nettle-%{version}.tar.gz.sig
|
||||
Source2: nettle-release-keyring.gpg
|
||||
# MinGW does not support explicit_bzero()
|
||||
#Patch0: nettle-3.8-zeroize-stack.patch
|
||||
Patch1: nettle-3.10-hobble-to-configure.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: mingw32-filesystem >= 95
|
||||
BuildRequires: mingw64-filesystem >= 95
|
||||
BuildRequires: mingw32-gcc
|
||||
BuildRequires: mingw64-gcc
|
||||
BuildRequires: mingw32-binutils
|
||||
BuildRequires: mingw64-binutils
|
||||
BuildRequires: mingw32-gmp
|
||||
BuildRequires: mingw64-gmp
|
||||
BuildRequires: mingw32-openssl
|
||||
BuildRequires: mingw64-openssl
|
||||
|
||||
BuildRequires: autoconf, automake
|
||||
BuildRequires: gcc
|
||||
BuildRequires: m4
|
||||
|
||||
|
||||
%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.
|
||||
|
||||
|
||||
# Mingw32
|
||||
%package -n mingw32-nettle
|
||||
Summary: MinGW package for nettle cryptographic library
|
||||
|
||||
|
||||
%description -n mingw32-nettle
|
||||
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.
|
||||
|
||||
|
||||
# Mingw64
|
||||
%package -n mingw64-nettle
|
||||
Summary: MinGW package for nettle cryptographic library
|
||||
|
||||
|
||||
%description -n mingw64-nettle
|
||||
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.
|
||||
|
||||
|
||||
%?mingw_debug_package
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -Tb 0 -p1 -n nettle-%{version}
|
||||
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
|
||||
|
||||
|
||||
%build
|
||||
autoreconf -ifv
|
||||
%mingw_configure --enable-shared --enable-fat \
|
||||
--disable-sm3 --disable-sm4 --disable-ecc-secp192r1 --disable-ecc-secp224r1
|
||||
%mingw_make %{?_smp_mflags}
|
||||
|
||||
|
||||
%install
|
||||
%mingw_make install DESTDIR=$RPM_BUILD_ROOT
|
||||
|
||||
# Clean out files that should not be part of the rpm.
|
||||
rm -f $RPM_BUILD_ROOT%{mingw32_libdir}/libnettle.a
|
||||
rm -f $RPM_BUILD_ROOT%{mingw64_libdir}/libnettle.a
|
||||
rm -f $RPM_BUILD_ROOT%{mingw32_libdir}/libhogweed.a
|
||||
rm -f $RPM_BUILD_ROOT%{mingw64_libdir}/libhogweed.a
|
||||
rm -rf $RPM_BUILD_ROOT%{mingw32_infodir}/
|
||||
rm -rf $RPM_BUILD_ROOT%{mingw64_infodir}/
|
||||
|
||||
|
||||
# Win32
|
||||
%files -n mingw32-nettle
|
||||
%doc README
|
||||
%license COPYINGv2 COPYING.LESSERv3
|
||||
%{mingw32_bindir}/nettle-hash.exe
|
||||
%{mingw32_bindir}/nettle-lfib-stream.exe
|
||||
%{mingw32_bindir}/nettle-pbkdf2.exe
|
||||
%{mingw32_bindir}/pkcs1-conv.exe
|
||||
%{mingw32_bindir}/sexp-conv.exe
|
||||
%{mingw32_bindir}/libnettle-8.dll
|
||||
%{mingw32_bindir}/libhogweed-6.dll
|
||||
%{mingw32_libdir}/libnettle.dll.a
|
||||
%{mingw32_libdir}/libhogweed.dll.a
|
||||
%{mingw32_libdir}/pkgconfig/nettle.pc
|
||||
%{mingw32_libdir}/pkgconfig/hogweed.pc
|
||||
%dir %{mingw32_includedir}/nettle
|
||||
%{mingw32_includedir}/nettle/*.h
|
||||
|
||||
|
||||
# Win64
|
||||
%files -n mingw64-nettle
|
||||
%doc README
|
||||
%license COPYINGv2 COPYING.LESSERv3
|
||||
%{mingw64_bindir}/nettle-hash.exe
|
||||
%{mingw64_bindir}/nettle-lfib-stream.exe
|
||||
%{mingw64_bindir}/nettle-pbkdf2.exe
|
||||
%{mingw64_bindir}/pkcs1-conv.exe
|
||||
%{mingw64_bindir}/sexp-conv.exe
|
||||
%{mingw64_bindir}/libnettle-8.dll
|
||||
%{mingw64_bindir}/libhogweed-6.dll
|
||||
%{mingw64_libdir}/libnettle.dll.a
|
||||
%{mingw64_libdir}/libhogweed.dll.a
|
||||
%{mingw64_libdir}/pkgconfig/nettle.pc
|
||||
%{mingw64_libdir}/pkgconfig/hogweed.pc
|
||||
%dir %{mingw64_includedir}/nettle
|
||||
%{mingw64_includedir}/nettle/*.h
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-13
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||
|
||||
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||
|
||||
* Wed Aug 07 2024 Miroslav Suchý <msuchy@redhat.com> - 3.7.2-11
|
||||
- convert license to SPDX
|
||||
|
||||
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||
|
||||
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Fri Mar 25 2022 Sandro Mani <manisandro@gmail.com> - 3.7.2-4
|
||||
- Rebuild with mingw-gcc-12
|
||||
|
||||
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Tue Apr 13 2021 Michael Cronenworth <mike@cchtml.com> - 3.7.2-1
|
||||
- New upstream release.
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.1-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.1-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.1-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Tue Oct 08 2019 Sandro Mani <manisandro@gmail.com> - 3.5.1-2
|
||||
- Rebuild (Changes/Mingw32GccDwarf2)
|
||||
|
||||
* Wed Aug 14 2019 Fabiano Fidêncio <fidencio@redhat.com> - 3.5.1-1
|
||||
- Update the sources accordingly to its native counter part, rhbz#1740768
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.1-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Thu Jan 03 2019 Michael Cronenworth <mike@cchtml.com> - 3.4.1-1
|
||||
- New upstream release
|
||||
|
||||
* Fri Aug 24 2018 Richard W.M. Jones <rjones@redhat.com> - 3.4-3
|
||||
- Rebuild for new mingw-openssl.
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.4-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Tue Jun 26 2018 Michael Cronenworth <mike@cchtml.com> - 3.4-1
|
||||
- New upstream release
|
||||
|
||||
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_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
|
||||
|
||||
* Thu Nov 03 2016 Michael Cronenworth <mike@cchtml.com> - 3.3-1
|
||||
- New upstream release
|
||||
- Fixed CVE-2016-6489 (#1362018)
|
||||
|
||||
* Wed Feb 03 2016 Michael Cronenworth <mike@cchtml.com> - 3.2-1
|
||||
- New upstream release
|
||||
- Fixed CVE-2015-8803 secp256r1 calculation bug (#1304305)
|
||||
|
||||
* 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
|
||||
|
||||
* Wed May 13 2015 Michael Cronenworth <mike@cchtml.com> - 3.1.1-1
|
||||
- New upstream release
|
||||
|
||||
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||
|
||||
* Sun Jan 26 2014 Michael Cronenworth <mike@cchtml.com> - 2.7.1-1
|
||||
- New upstream release
|
||||
|
||||
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||
|
||||
* Wed Feb 06 2013 Michael Cronenworth <mike@cchtml.com> - 2.6-1
|
||||
- New upstream release
|
||||
|
||||
* Wed Aug 29 2012 Michael Cronenworth <mike@cchtml.com> - 2.4-2
|
||||
- Missing BR m4
|
||||
|
||||
* Tue Jul 10 2012 Michael Cronenworth <mike@cchtml.com> - 2.4-1
|
||||
- Initial RPM package
|
||||
|
|
@ -1,609 +0,0 @@
|
|||
From 9d31f90e71a4a3eadc3224db8800a8fa7fbdbb03 Mon Sep 17 00:00:00 2001
|
||||
From: rpm-build <rpm-build>
|
||||
Date: Mon, 10 Feb 2025 11:55:37 +0900
|
||||
Subject: [PATCH] nettle-3.10-hobble-to-configure.patch
|
||||
|
||||
Signed-off-by: rpm-build <rpm-build>
|
||||
---
|
||||
Makefile.in | 16 +++++----
|
||||
configure.ac | 64 ++++++++++++++++++++++++++++++++++-
|
||||
examples/ecc-benchmark.c | 4 +++
|
||||
examples/hogweed-benchmark.c | 6 ++++
|
||||
examples/nettle-benchmark.c | 16 +++++++--
|
||||
nettle-meta-aeads.c | 2 ++
|
||||
nettle-meta-ciphers.c | 2 ++
|
||||
nettle-meta-hashes.c | 2 ++
|
||||
nettle-meta-macs.c | 2 ++
|
||||
testsuite/Makefile.in | 5 ++-
|
||||
testsuite/ecdh-test.c | 4 +++
|
||||
testsuite/ecdsa-sign-test.c | 6 ++++
|
||||
testsuite/ecdsa-verify-test.c | 4 +++
|
||||
testsuite/gcm-test.c | 2 ++
|
||||
testsuite/hmac-test.c | 2 ++
|
||||
testsuite/meta-aead-test.c | 2 ++
|
||||
testsuite/meta-cipher-test.c | 4 ++-
|
||||
testsuite/meta-hash-test.c | 2 ++
|
||||
testsuite/meta-mac-test.c | 2 ++
|
||||
testsuite/testutils.c | 10 +++++-
|
||||
20 files changed, 145 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 71ad761..1e9ed61 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -117,17 +117,16 @@ 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 \
|
||||
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-gosthash94-meta.c \
|
||||
- hmac-streebog-meta.c hmac-sm3-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 \
|
||||
@@ -153,12 +152,10 @@ 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 \
|
||||
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 \
|
||||
@@ -205,7 +202,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 +225,13 @@ 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
|
||||
+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 7c003bb..105640e 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -124,6 +124,22 @@ 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_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
|
||||
@@ -616,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=""
|
||||
@@ -1157,6 +1179,42 @@ 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
|
||||
+
|
||||
+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
|
||||
+
|
||||
+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)
|
||||
@@ -1165,6 +1223,10 @@ AC_SUBST(IF_DLOPEN_TEST)
|
||||
AC_SUBST(IF_DOCUMENTATION)
|
||||
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 7e857f8..ebcced6 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 3f85883..df608ff 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/examples/nettle-benchmark.c b/examples/nettle-benchmark.c
|
||||
index 2a11a69..66f92f6 100644
|
||||
--- a/examples/nettle-benchmark.c
|
||||
+++ b/examples/nettle-benchmark.c
|
||||
@@ -901,6 +901,18 @@ bench_ghash_update(void)
|
||||
# define OPENSSL(x)
|
||||
#endif
|
||||
|
||||
+#if WITH_SM3
|
||||
+# define SM3(x) x,
|
||||
+#else
|
||||
+# define SM3(x)
|
||||
+#endif
|
||||
+
|
||||
+#if WITH_SM4
|
||||
+# define SM4(x) x,
|
||||
+#else
|
||||
+# define SM4(x)
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -920,7 +932,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
|
||||
};
|
||||
|
||||
@@ -937,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 78f38a3..c94fecd 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 f8d691c..6a84a43 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/nettle-meta-hashes.c b/nettle-meta-hashes.c
|
||||
index 2245dfb..6d4563d 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 48b2176..866f076 100644
|
||||
--- a/nettle-meta-macs.c
|
||||
+++ b/nettle-meta-macs.c
|
||||
@@ -52,7 +52,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 0699fa0..3483f40 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 \
|
||||
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,9 @@ 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_NETTLE_SOURCES += @IF_SM4@ sm4-test.c
|
||||
+
|
||||
TS_SOURCES = $(TS_NETTLE_SOURCES) $(TS_HOGWEED_SOURCES)
|
||||
CXX_SOURCES = cxx-test.cxx
|
||||
|
||||
diff --git a/testsuite/ecdh-test.c b/testsuite/ecdh-test.c
|
||||
index ff4f723..f852d81 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 46fc273..aa44adb 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 8d52700..1fa69f0 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/gcm-test.c b/testsuite/gcm-test.c
|
||||
index e8228ed..fad9184 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/hmac-test.c b/testsuite/hmac-test.c
|
||||
index d7af247..d34127b 100644
|
||||
--- a/testsuite/hmac-test.c
|
||||
+++ b/testsuite/hmac-test.c
|
||||
@@ -949,9 +949,11 @@ test_main (void)
|
||||
SHEX("a1aa5f7de402d7b3d323f2991c8d4534"
|
||||
"013137010a83754fd0af6d7cd4922ed9"));
|
||||
|
||||
+#if WITH_SM3
|
||||
test_mac (&nettle_hmac_sm3, (nettle_hash_update_func*) hmac_sm3_set_key,
|
||||
SDATA("monkey monkey monkey monkey"),
|
||||
SDATA("abc"),
|
||||
SHEX("7a9388e2ca5343b5d76e7c2c3d84f239"
|
||||
"f306c0b60d5e0dc4d2771e42860a6a2b"));
|
||||
+#endif
|
||||
}
|
||||
diff --git a/testsuite/meta-aead-test.c b/testsuite/meta-aead-test.c
|
||||
index ceeca22..d1a3193 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 912fac5..b57fcbe 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
|
||||
diff --git a/testsuite/meta-hash-test.c b/testsuite/meta-hash-test.c
|
||||
index ec4e0d1..8427e0a 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 6c848a8..c00efd3 100644
|
||||
--- a/testsuite/meta-mac-test.c
|
||||
+++ b/testsuite/meta-mac-test.c
|
||||
@@ -16,7 +16,9 @@ const char* macs[] = {
|
||||
"hmac_sha512",
|
||||
"hmac_streebog256",
|
||||
"hmac_streebog512",
|
||||
+#if WITH_SM3
|
||||
"hmac_sm3",
|
||||
+#endif
|
||||
};
|
||||
|
||||
void
|
||||
diff --git a/testsuite/testutils.c b/testsuite/testutils.c
|
||||
index 76aa556..5b7c7de 100644
|
||||
--- a/testsuite/testutils.c
|
||||
+++ b/testsuite/testutils.c
|
||||
@@ -2230,8 +2230,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,
|
||||
@@ -2355,7 +2359,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",
|
||||
@@ -2365,6 +2370,8 @@ static const struct ecc_ref_point ecc_ref[9][4] = {
|
||||
{ "35433907297cc378b0015703374729d7a4fe46647084e4ba",
|
||||
"a2649984f2135c301ea3acb0776cd4f125389b311db3be32" }
|
||||
},
|
||||
+#endif
|
||||
+#if WITH_ECC_SECP224R1
|
||||
{ { "b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21",
|
||||
"bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34" },
|
||||
{ "706a46dc76dcb76798e60e6d89474788d16dc18032d268fd1a704fa6",
|
||||
@@ -2374,6 +2381,7 @@ static const struct ecc_ref_point ecc_ref[9][4] = {
|
||||
{ "ae99feebb5d26945b54892092a8aee02912930fa41cd114e40447301",
|
||||
"482580a0ec5bc47e88bc8c378632cd196cb3fa058a7114eb03054c9" },
|
||||
},
|
||||
+#endif
|
||||
{ { "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",
|
||||
"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5" },
|
||||
{ "7cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc47669978",
|
||||
--
|
||||
2.48.1
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
3
sources
3
sources
|
|
@ -1,3 +0,0 @@
|
|||
SHA512 (nettle-3.10.2.tar.gz) = bf37ddd7dca8e78488da2a5286dcf16761d527d620572b42f2ad27bb8ee8c12999d92b0272e06f53766e7155a3f4a1ab7ad9c4b1c3caec47c031878b6b1772fb
|
||||
SHA512 (nettle-3.10.2.tar.gz.sig) = 82d82ba83b65b191d0ad9af24603df8dbc1b4172118618be66c267e51bad470d902e7194de1948e3570f144e0021afb7ddfb81badbe71fd57999d3d3227f0d39
|
||||
SHA512 (nettle-release-keyring.gpg) = 0e59447eb74017439c8b5b5b05173c0ffd710705d2a9c1f74833b7034fad1608fa1bdd2c308e6c42214553cd648606b6a07044ea39677b1b3452cb4d07bf889b
|
||||
Loading…
Add table
Add a link
Reference in a new issue