summaryrefslogtreecommitdiff
path: root/random
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2020-01-21 12:05:23 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2020-01-21 12:05:23 +0900
commit4997139b3e83761c9af0246cec829305c3d7d13b (patch)
treebd342e45cd30ec109ce28f693556e5a21b530b9e /random
parent5ebb2f0671c902863eee91cbcfc85a72be506410 (diff)
downloadlibgcrypt-4997139b3e83761c9af0246cec829305c3d7d13b.tar.gz
Avoid use of ulong in internal code.
* configure.ac (HAVE_ULONG_TYPEDEF): Remove. * mpi/mpi-div.c (_gcry_mpi_fdiv_r_ui): Use unsigned long. (_gcry_mpi_divisible_ui): Likewise. * random/rndunix.c (_gcry_rndunix_gather_random): Likewise. * random/rndw32.c (_gcry_rndw32_gather_random_fast): Likewise. (ADDINT): Likewise. * random/rndw32ce.c (_gcry_rndw32ce_gather_random_fast): Likewise. * src/mpi.h: Follow the change. * src/types.h (HAVE_ULONG_TYPEDEF): Remove. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'random')
-rw-r--r--random/rndunix.c4
-rw-r--r--random/rndw32.c4
-rw-r--r--random/rndw32ce.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/random/rndunix.c b/random/rndunix.c
index fcb45b78..aff2f85d 100644
--- a/random/rndunix.c
+++ b/random/rndunix.c
@@ -894,7 +894,7 @@ _gcry_rndunix_gather_random (void (*add)(const void*, size_t,
/* now read from the gatherer */
while( length ) {
int goodness;
- ulong subtract;
+ unsigned long subtract;
if( read_a_msg( pipedes[0], &msg ) ) {
log_error("reading from gatherer pipe failed: %s\n",
@@ -928,7 +928,7 @@ _gcry_rndunix_gather_random (void (*add)(const void*, size_t,
(*add)( msg.data, n, origin );
/* this is the trick how we cope with the goodness */
- subtract = (ulong)n * goodness / 100;
+ subtract = (unsigned long)n * goodness / 100;
/* subtract at least 1 byte to avoid infinite loops */
length -= subtract ? subtract : 1;
}
diff --git a/random/rndw32.c b/random/rndw32.c
index 08a8867d..b3f63d20 100644
--- a/random/rndw32.c
+++ b/random/rndw32.c
@@ -845,10 +845,10 @@ _gcry_rndw32_gather_random_fast (void (*add)(const void*, size_t,
We discard the upper 32-bit of those values. */
{
- byte buffer[20*sizeof(ulong)], *bufptr;
+ byte buffer[20*sizeof(unsigned long)], *bufptr;
bufptr = buffer;
-#define ADDINT(f) do { ulong along = (ulong)(f); \
+#define ADDINT(f) do { unsigned long along = (unsigned long)(f); \
memcpy (bufptr, &along, sizeof (along) ); \
bufptr += sizeof (along); \
} while (0)
diff --git a/random/rndw32ce.c b/random/rndw32ce.c
index b485eef2..873e8460 100644
--- a/random/rndw32ce.c
+++ b/random/rndw32ce.c
@@ -115,7 +115,7 @@ _gcry_rndw32ce_gather_random_fast (void (*add)(const void*, size_t,
memcpy (bufptr, &along, sizeof (along)); \
bufptr += sizeof (along); \
} while (0)
- unsigned char buffer[20*sizeof(ulong)], *bufptr;
+ unsigned char buffer[20*sizeof(unsigned long)], *bufptr;
bufptr = buffer;
ADD (HWND, GetActiveWindow ());