From 489da75e65fb2fc4fc67cc95570433140329fc52 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Fri, 14 Jan 2022 15:21:38 -0600 Subject: [PATCH] tommath: Fix warning in s_read_getrandom() See https://github.com/libtom/libtommath/pull/512 (Note: this has not shipped. Only OS X would be affected, specifically RSA key gen would be affected on OS X.) --- lib/hcrypto/libtommath/bn_s_mp_rand_platform.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/hcrypto/libtommath/bn_s_mp_rand_platform.c b/lib/hcrypto/libtommath/bn_s_mp_rand_platform.c index 55c69390e..831606b84 100644 --- a/lib/hcrypto/libtommath/bn_s_mp_rand_platform.c +++ b/lib/hcrypto/libtommath/bn_s_mp_rand_platform.c @@ -56,16 +56,16 @@ static mp_err s_read_wincsp(void *p, size_t n) static mp_err s_read_getrandom(void *p, size_t n) { - char *q = (char *)p; + char *r = (char *)p; while (n > 0u) { - ssize_t ret = getrandom(q, n, 0); + ssize_t ret = getrandom(r, n, 0); if (ret < 0) { if (errno == EINTR) { continue; } return MP_ERR; } - q += ret; + r += ret; n -= (size_t)ret; } return MP_OKAY; @@ -88,7 +88,7 @@ static mp_err s_read_getrandom(void *p, size_t n) static mp_err s_read_urandom(void *p, size_t n) { int fd; - char *q = (char *)p; + char *r = (char *)p; do { fd = open(MP_DEV_URANDOM, O_RDONLY); @@ -96,7 +96,7 @@ static mp_err s_read_urandom(void *p, size_t n) if (fd == -1) return MP_ERR; while (n > 0u) { - ssize_t ret = read(fd, p, n); + ssize_t ret = read(fd, r, n); if (ret < 0) { if (errno == EINTR) { continue; @@ -104,7 +104,7 @@ static mp_err s_read_urandom(void *p, size_t n) close(fd); return MP_ERR; } - q += ret; + r += ret; n -= (size_t)ret; }