kernel: 5.4: import wireguard backport
[openwrt/openwrt.git] / target / linux / generic / backport-5.4 / 080-wireguard-0060-crypto-x86-curve25519-Remove-unused-carry-variables.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Herbert Xu <herbert@gondor.apana.org.au>
3 Date: Thu, 23 Jul 2020 17:50:48 +1000
4 Subject: [PATCH] crypto: x86/curve25519 - Remove unused carry variables
5
6 commit 054a5540fb8f7268e2c79e9deab4242db15c8cba upstream.
7
8 The carry variables are assigned but never used, which upsets
9 the compiler. This patch removes them.
10
11 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
12 Reviewed-by: Karthikeyan Bhargavan <karthik.bhargavan@gmail.com>
13 Acked-by: Jason A. Donenfeld <Jason@zx2c4.com>
14 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
15 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 ---
17 arch/x86/crypto/curve25519-x86_64.c | 6 ++----
18 1 file changed, 2 insertions(+), 4 deletions(-)
19
20 --- a/arch/x86/crypto/curve25519-x86_64.c
21 +++ b/arch/x86/crypto/curve25519-x86_64.c
22 @@ -948,10 +948,8 @@ static void store_felem(u64 *b, u64 *f)
23 {
24 u64 f30 = f[3U];
25 u64 top_bit0 = f30 >> (u32)63U;
26 - u64 carry0;
27 u64 f31;
28 u64 top_bit;
29 - u64 carry;
30 u64 f0;
31 u64 f1;
32 u64 f2;
33 @@ -970,11 +968,11 @@ static void store_felem(u64 *b, u64 *f)
34 u64 o2;
35 u64 o3;
36 f[3U] = f30 & (u64)0x7fffffffffffffffU;
37 - carry0 = add_scalar(f, f, (u64)19U * top_bit0);
38 + add_scalar(f, f, (u64)19U * top_bit0);
39 f31 = f[3U];
40 top_bit = f31 >> (u32)63U;
41 f[3U] = f31 & (u64)0x7fffffffffffffffU;
42 - carry = add_scalar(f, f, (u64)19U * top_bit);
43 + add_scalar(f, f, (u64)19U * top_bit);
44 f0 = f[0U];
45 f1 = f[1U];
46 f2 = f[2U];