From 5f8fa05fe1d642df641baa96eb4038d7eac1b6fd Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Thu, 11 Feb 2021 17:08:29 +0000 Subject: [PATCH] Merged update from upstream sources This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/nettle.git#4ef5318bc4753b255cdb423b99f2b22fb554594b --- nettle-3.7-chacha-counter-ppc64.patch | 51 +++++++++++++++++++++++++++ nettle.spec | 7 +++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 nettle-3.7-chacha-counter-ppc64.patch diff --git a/nettle-3.7-chacha-counter-ppc64.patch b/nettle-3.7-chacha-counter-ppc64.patch new file mode 100644 index 0000000..7f9f103 --- /dev/null +++ b/nettle-3.7-chacha-counter-ppc64.patch @@ -0,0 +1,51 @@ +From 64837b2e433e2b99b893683949bad3a99acab38f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Niels=20M=C3=B6ller?= +Date: Wed, 10 Feb 2021 11:22:23 +0100 +Subject: [PATCH] Fix chacha counter update for _4core variants. + +--- + ChangeLog | 4 ++++ + chacha-crypt.c | 10 +++++++--- + 2 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/chacha-crypt.c b/chacha-crypt.c +index 081ebcf4..1fdfc813 100644 +--- a/chacha-crypt.c ++++ b/chacha-crypt.c +@@ -80,13 +80,16 @@ _nettle_chacha_crypt_4core(struct chacha_ctx *ctx, + while (length > 2*CHACHA_BLOCK_SIZE) + { + _nettle_chacha_4core (x, ctx->state, CHACHA_ROUNDS); +- ctx->state[12] += 4; +- ctx->state[13] += (ctx->state[12] < 4); + if (length <= 4*CHACHA_BLOCK_SIZE) + { ++ uint32_t incr = 3 + (length > 3*CHACHA_BLOCK_SIZE); ++ ctx->state[12] += incr; ++ ctx->state[13] += (ctx->state[12] < incr); + memxor3 (dst, src, x, length); + return; + } ++ ctx->state[12] += 4; ++ ctx->state[13] += (ctx->state[12] < 4); + memxor3 (dst, src, x, 4*CHACHA_BLOCK_SIZE); + + length -= 4*CHACHA_BLOCK_SIZE; +@@ -200,12 +203,13 @@ _nettle_chacha_crypt32_4core(struct chacha_ctx *ctx, + while (length > 2*CHACHA_BLOCK_SIZE) + { + _nettle_chacha_4core32 (x, ctx->state, CHACHA_ROUNDS); +- ctx->state[12] += 4; + if (length <= 4*CHACHA_BLOCK_SIZE) + { ++ ctx->state[12] += 3 + (length > 3*CHACHA_BLOCK_SIZE); + memxor3 (dst, src, x, length); + return; + } ++ ctx->state[12] += 4; + memxor3 (dst, src, x, 4*CHACHA_BLOCK_SIZE); + + length -= 4*CHACHA_BLOCK_SIZE; +-- +2.29.2 + diff --git a/nettle.spec b/nettle.spec index d8cd29e..b82fd68 100644 --- a/nettle.spec +++ b/nettle.spec @@ -15,7 +15,7 @@ Name: nettle Version: 3.7 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A low-level cryptographic library License: LGPLv3+ or GPLv2+ @@ -28,6 +28,8 @@ Source2: nettle-3.5-remove-ecc-testsuite.patch %endif Patch0: nettle-3.6-remove-ecc-testsuite.patch Patch1: nettle-3.4-annocheck.patch +# https://lists.lysator.liu.se/pipermail/nettle-bugs/2021/009423.html +Patch2: nettle-3.7-chacha-counter-ppc64.patch BuildRequires: make BuildRequires: gcc @@ -171,6 +173,9 @@ make check %changelog +* Wed Feb 10 2021 Daiki Ueno - 3.7-3 +- Port a fix for chacha counter issue on ppc64le + * Tue Jan 26 2021 Fedora Release Engineering - 3.7-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild