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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <947aa0ab-1f0c-44d6-943a-cf83a56ac5b8@rwthex-s2-a.rwth-ad.de>
Date:   Mon, 1 Feb 2021 16:14:59 +0100
From:   Jan Henrik Weinstock <jan.weinstock@...h-aachen.de>
To:     <mpm@...enic.com>, <herbert@...dor.apana.org.au>,
        <linux-crypto@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        "Jan Henrik Weinstock" <jan.weinstock@...h-aachen.de>
Subject: [PATCH] hw_random/timeriomem-rng: Fix cooldown period calculation

Ensure cooldown period tolerance of 1% is actually accounted for.

Signed-off-by: Jan Henrik Weinstock <jan.weinstock@...h-aachen.de>
---

Before patch, if period_us was less than 100us, no extra sleep time was 
added. If it was more than 100us, only 1us extra time (and not 1%) is slept.

  drivers/char/hw_random/timeriomem-rng.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/timeriomem-rng.c 
b/drivers/char/hw_random/timeriomem-rng.c
index e262445fe..f35f0f31f 100644
--- a/drivers/char/hw_random/timeriomem-rng.c
+++ b/drivers/char/hw_random/timeriomem-rng.c
@@ -69,7 +69,7 @@ static int timeriomem_rng_read(struct hwrng *hwrng, 
void *data,
  		 */
  		if (retval > 0)
  			usleep_range(period_us,
-					period_us + min(1, period_us / 100));
+					period_us + max(1, period_us / 100));

  		*(u32 *)data = readl(priv->io_base);
  		retval += sizeof(u32);
-- 
2.17.1


Download attachment "smime.p7s" of type "application/pkcs7-signature" (5316 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ