bn_s_mp_rand_platform.c: s_read_urandom: correctly handle split read
commit4891d713fb1949fe5c869974b94018380d110363
authorLuke Howard <lukeh@padl.com>
Sat, 15 Jan 2022 02:38:18 +0000 (15 13:38 +1100)
committerLuke Howard <lukeh@padl.com>
Sat, 15 Jan 2022 02:38:18 +0000 (15 13:38 +1100)
treeb7ac85661a19c9a9bba3b73acbcaf41997b4d3da
parent046675ce0ec45da5fe9cf5080f664c0a42d22dd0
bn_s_mp_rand_platform.c: s_read_urandom: correctly handle split read

s_read_urandom has a while loop to handle read() that returns less
than the full buffer (either due to EINTR or because more than the
atomic guarantee from urandom was requested). However, the target
of the read was always the base pointer p instead of the updated
pointer q, so in the end less than the requested randomness is returned.

Use q instead of p in the read() call.

Upstream pull request:
https://github.com/libtom/libtommath/pull/512

Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
lib/hcrypto/libtommath/bn_s_mp_rand_platform.c