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.02SGhN8L003837@sdf.org>
Date:   Wed, 21 Aug 2019 20:15:22 -0400
From:   George Spelvin <lkml@....org>
To:     linux-kernel@...r.kernel.org, lkml@....org
Cc:     Karsten Keil <isdn@...ux-pingi.de>,
        isdn4linux@...tserv.isdn4linux.de, netdev@...r.kernel.org
Subject: [RFC PATCH v1 43/50] drivers/isdn: Use get_random_u32()

There's no need to get_random_bytes() into a temporary buffer.

This is not a no-brainer change; get_random_u32() has slightly weaker
security guarantees, but they're fine for applications like these where
the random value is stored in the kernel for as long as it's
valuable.

Signed-off-by: George Spelvin <lkml@....org>
Cc: Karsten Keil <isdn@...ux-pingi.de>
Cc: isdn4linux@...tserv.isdn4linux.de
Cc: netdev@...r.kernel.org
---
 drivers/isdn/mISDN/tei.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/isdn/mISDN/tei.c b/drivers/isdn/mISDN/tei.c
index 59d28cb19738e..8135e20a667cc 100644
--- a/drivers/isdn/mISDN/tei.c
+++ b/drivers/isdn/mISDN/tei.c
@@ -404,10 +404,7 @@ dl_unit_data(struct manager *mgr, struct sk_buff *skb)
 static unsigned int
 random_ri(void)
 {
-	u16 x;
-
-	get_random_bytes(&x, sizeof(x));
-	return x;
+	return get_random_u32() & 0xffff;
 }
 
 static struct layer2 *
-- 
2.26.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ