Home Home > GIT Browse > SLE15
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2019-07-16 21:58:33 +0200
committerMichal Suchanek <msuchanek@suse.de>2019-07-16 22:13:58 +0200
commit930a2cfd00bcb4269b95f8f907d3d712e2e9b34b (patch)
tree30b595c2cddb0a374907e699b72a2d49da9fc3a9
parente2767111bf08d428ecd363b3ffe65b852b9ada74 (diff)
powerpc/crypto: Use cheaper random numbers for crc-vpmsum
self-test (FATE#327696).
-rw-r--r--patches.arch/powerpc-crypto-Use-cheaper-random-numbers-for-crc-vp.patch54
-rw-r--r--series.conf1
2 files changed, 55 insertions, 0 deletions
diff --git a/patches.arch/powerpc-crypto-Use-cheaper-random-numbers-for-crc-vp.patch b/patches.arch/powerpc-crypto-Use-cheaper-random-numbers-for-crc-vp.patch
new file mode 100644
index 0000000000..717ed1daf8
--- /dev/null
+++ b/patches.arch/powerpc-crypto-Use-cheaper-random-numbers-for-crc-vp.patch
@@ -0,0 +1,54 @@
+From 80d04b7fabe161a23d143b3bfcfca1b002c23da1 Mon Sep 17 00:00:00 2001
+From: George Spelvin <lkml@sdf.org>
+Date: Thu, 21 Mar 2019 10:42:22 +0000
+Subject: [PATCH] powerpc/crypto: Use cheaper random numbers for crc-vpmsum
+ self-test
+
+References: FATE#327696
+Patch-mainline: v5.2-rc1
+Git-commit: 80d04b7fabe161a23d143b3bfcfca1b002c23da1
+
+This code was filling a 64K buffer from /dev/urandom in order to
+compute a CRC over (on average half of) it by two different methods,
+comparing the CRCs, and repeating.
+
+This is not a remotely security-critical application, so use the far
+faster and cheaper prandom_u32() generator.
+
+And, while we're at it, only fill as much of the buffer as we plan to use.
+
+Signed-off-by: George Spelvin <lkml@sdf.org>
+Acked-by: Daniel Axtens <dja@axtens.net>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ arch/powerpc/crypto/crc-vpmsum_test.c | 10 +++-------
+ 1 file changed, 3 insertions(+), 7 deletions(-)
+
+diff --git a/arch/powerpc/crypto/crc-vpmsum_test.c b/arch/powerpc/crypto/crc-vpmsum_test.c
+index 0153a9c6f4af..98ea4f4d3dde 100644
+--- a/arch/powerpc/crypto/crc-vpmsum_test.c
++++ b/arch/powerpc/crypto/crc-vpmsum_test.c
+@@ -78,16 +78,12 @@ static int __init crc_test_init(void)
+
+ pr_info("crc-vpmsum_test begins, %lu iterations\n", iterations);
+ for (i=0; i<iterations; i++) {
+- size_t len, offset;
++ size_t offset = prandom_u32_max(16);
++ size_t len = prandom_u32_max(MAX_CRC_LENGTH);
+
+- get_random_bytes(data, MAX_CRC_LENGTH);
+- get_random_bytes(&len, sizeof(len));
+- get_random_bytes(&offset, sizeof(offset));
+-
+- len %= MAX_CRC_LENGTH;
+- offset &= 15;
+ if (len <= offset)
+ continue;
++ prandom_bytes(data, len);
+ len -= offset;
+
+ crypto_shash_update(crct10dif_shash, data+offset, len);
+--
+2.22.0
+
diff --git a/series.conf b/series.conf
index 4515006cf0..0c79c4485e 100644
--- a/series.conf
+++ b/series.conf
@@ -22481,6 +22481,7 @@
patches.suse/tipc-fix-hanging-clients-using-poll-with-EPOLLOUT-fl.patch
patches.fixes/vlan-disable-SIOCSHWTSTAMP-in-container.patch
patches.suse/packet-Fix-error-path-in-packet_init.patch
+ patches.arch/powerpc-crypto-Use-cheaper-random-numbers-for-crc-vp.patch
patches.arch/powerpc-numa-improve-control-of-topology-updates.patch
patches.arch/powerpc-numa-document-topology_updates_enabled-disab.patch
patches.arch/powerpc-powernv-idle-Restore-IAMR-after-idle.patch