diff options
Diffstat (limited to 'libarchive/archive_random.c')
-rw-r--r-- | libarchive/archive_random.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/libarchive/archive_random.c b/libarchive/archive_random.c index 57c49d5..a20b9b1 100644 --- a/libarchive/archive_random.c +++ b/libarchive/archive_random.c @@ -62,6 +62,10 @@ static void arc4random_buf(void *, size_t); #include <wincrypt.h> #endif +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#endif + /* * Random number generator function. * This simply calls arc4random_buf function if the platform provides it. @@ -133,16 +137,15 @@ archive_random(void *buf, size_t nbytes) #endif /* !__GNUC__ */ struct arc4_stream { - u_int8_t i; - u_int8_t j; - u_int8_t s[256]; + uint8_t i; + uint8_t j; + uint8_t s[256]; }; -static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; - #define RANDOMDEV "/dev/urandom" #define KEYSIZE 128 #ifdef HAVE_PTHREAD_H +static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; #define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx); #define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx); #else @@ -155,7 +158,7 @@ static struct arc4_stream rs; static pid_t arc4_stir_pid; static int arc4_count; -static inline u_int8_t arc4_getbyte(void); +static inline uint8_t arc4_getbyte(void); static void arc4_stir(void); static inline void @@ -173,7 +176,7 @@ static inline void arc4_addrandom(u_char *dat, int datlen) { int n; - u_int8_t si; + uint8_t si; rs.i--; for (n = 0; n < 256; n++) { @@ -235,10 +238,10 @@ arc4_stir_if_needed(void) } } -static inline u_int8_t +static inline uint8_t arc4_getbyte(void) { - u_int8_t si, sj; + uint8_t si, sj; rs.i = (rs.i + 1); si = rs.s[rs.i]; |