mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-10-15 23:20:10 +02:00
Do not use legacy BSD u_* types
Some systems do not have these types available, and they are simply convenience aliases. Instead use the expanded versions which are more portable. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=101192
This commit is contained in:
@@ -59,7 +59,7 @@ static struct _rs {
|
||||
/* Maybe be preserved in fork children, if _rs_allocate() decides. */
|
||||
static struct _rsx {
|
||||
chacha_ctx rs_chacha; /* chacha context for random keystream */
|
||||
u_char rs_buf[RSBUFSZ]; /* keystream blocks */
|
||||
unsigned char rs_buf[RSBUFSZ]; /* keystream blocks */
|
||||
} *rsx;
|
||||
|
||||
static inline int _rs_allocate(struct _rs **, struct _rsx **);
|
||||
@@ -67,7 +67,7 @@ static inline void _rs_forkdetect(void);
|
||||
#include "arc4random.h"
|
||||
|
||||
static inline void
|
||||
_rs_init(u_char *buf, size_t n)
|
||||
_rs_init(unsigned char *buf, size_t n)
|
||||
{
|
||||
if (n < KEYSZ + IVSZ)
|
||||
return;
|
||||
@@ -82,7 +82,7 @@ _rs_init(u_char *buf, size_t n)
|
||||
}
|
||||
|
||||
static inline void
|
||||
_rs_rekey(u_char *dat, size_t datlen)
|
||||
_rs_rekey(unsigned char *dat, size_t datlen)
|
||||
{
|
||||
#ifndef KEYSTREAM_ONLY
|
||||
memset(rsx->rs_buf, 0, sizeof(rsx->rs_buf));
|
||||
@@ -107,7 +107,7 @@ _rs_rekey(u_char *dat, size_t datlen)
|
||||
static void
|
||||
_rs_stir(void)
|
||||
{
|
||||
u_char rnd[KEYSZ + IVSZ];
|
||||
unsigned char rnd[KEYSZ + IVSZ];
|
||||
|
||||
if (getentropy(rnd, sizeof rnd) == -1)
|
||||
_getentropy_fail();
|
||||
@@ -140,8 +140,8 @@ _rs_stir_if_needed(size_t len)
|
||||
static inline void
|
||||
_rs_random_buf(void *_buf, size_t n)
|
||||
{
|
||||
u_char *buf = (u_char *)_buf;
|
||||
u_char *keystream;
|
||||
unsigned char *buf = (unsigned char *)_buf;
|
||||
unsigned char *keystream;
|
||||
size_t m;
|
||||
|
||||
_rs_stir_if_needed(n);
|
||||
@@ -164,7 +164,7 @@ _rs_random_buf(void *_buf, size_t n)
|
||||
static inline void
|
||||
_rs_random_u32(uint32_t *val)
|
||||
{
|
||||
u_char *keystream;
|
||||
unsigned char *keystream;
|
||||
|
||||
_rs_stir_if_needed(sizeof(*val));
|
||||
if (rs->rs_have < sizeof(*val))
|
||||
@@ -184,7 +184,7 @@ arc4random_stir(void)
|
||||
}
|
||||
|
||||
void
|
||||
arc4random_addrandom(u_char *dat, int datlen)
|
||||
arc4random_addrandom(unsigned char *dat, int datlen)
|
||||
{
|
||||
_ARC4_LOCK();
|
||||
_rs_stir_if_needed(datlen);
|
||||
|
Reference in New Issue
Block a user