lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <202003281643.02SGhGKO009144@sdf.org>
Date:   Wed, 27 Mar 2019 07:56:49 -0400
From:   George Spelvin <lkml@....org>
To:     linux-kernel@...r.kernel.org, lkml@....org
Cc:     James Hsiao <jhsiao@...c.com>,
        Christian Lamparter <chunkeey@...il.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        linux-crypto@...r.kernel.org
Subject: [RFC PATCH v1 24/50] crypto4xx_core: Use more appropriate seed for
 PRNG

A PRNG doesn't need the full security guarantees of
get_random_bytes() (and a 64-bit seed can be brute-forced
anyway); get_random_u32() is quite sufficient.

Signed-off-by: George Spelvin <lkml@....org>
Cc: James Hsiao <jhsiao@...c.com>
Cc: Christian Lamparter <chunkeey@...il.com>
Cc: Herbert Xu <herbert@...dor.apana.org.au>
Cc: linux-crypto@...r.kernel.org
---
 drivers/crypto/amcc/crypto4xx_core.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 7d6b695c4ab3f..0fc41ffe3ff9a 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -53,7 +53,6 @@ static void crypto4xx_hw_init(struct crypto4xx_device *dev)
 	union ce_ring_control ring_ctrl;
 	union ce_part_ring_size part_ring_size;
 	union ce_io_threshold io_threshold;
-	u32 rand_num;
 	union ce_pe_dma_cfg pe_dma_cfg;
 	u32 device_ctrl;
 
@@ -79,10 +78,8 @@ static void crypto4xx_hw_init(struct crypto4xx_device *dev)
 	writel(dev->pdr_pa, dev->ce_base + CRYPTO4XX_PDR_BASE);
 	writel(dev->pdr_pa, dev->ce_base + CRYPTO4XX_RDR_BASE);
 	writel(PPC4XX_PRNG_CTRL_AUTO_EN, dev->ce_base + CRYPTO4XX_PRNG_CTRL);
-	get_random_bytes(&rand_num, sizeof(rand_num));
-	writel(rand_num, dev->ce_base + CRYPTO4XX_PRNG_SEED_L);
-	get_random_bytes(&rand_num, sizeof(rand_num));
-	writel(rand_num, dev->ce_base + CRYPTO4XX_PRNG_SEED_H);
+	writel(get_random_u32(), dev->ce_base + CRYPTO4XX_PRNG_SEED_L);
+	writel(get_random_u32(), dev->ce_base + CRYPTO4XX_PRNG_SEED_H);
 	ring_size.w = 0;
 	ring_size.bf.ring_offset = PPC4XX_PD_SIZE;
 	ring_size.bf.ring_size   = PPC4XX_NUM_PD;
-- 
2.26.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ