Browse Source

ansification; checked by pval

OPENBSD_3_4
deraadt 21 years ago
parent
commit
98afedd6e6
1 changed files with 9 additions and 18 deletions
  1. +9
    -18
      src/lib/libc/crypt/arc4random.c

+ 9
- 18
src/lib/libc/crypt/arc4random.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: arc4random.c,v 1.7 2003/02/14 17:12:54 deraadt Exp $ */
/* $OpenBSD: arc4random.c,v 1.8 2003/06/11 21:03:10 deraadt Exp $ */
/*
* Arc4 random number generator for OpenBSD.
@ -49,8 +49,7 @@ static struct arc4_stream rs;
static pid_t arc4_stir_pid;
static inline void
arc4_init(as)
struct arc4_stream *as;
arc4_init(struct arc4_stream *as)
{
int n;
@ -61,10 +60,7 @@ arc4_init(as)
}
static inline void
arc4_addrandom(as, dat, datlen)
struct arc4_stream *as;
u_char *dat;
int datlen;
arc4_addrandom(struct arc4_stream *as, u_char *dat, int datlen)
{
int n;
u_int8_t si;
@ -81,8 +77,7 @@ arc4_addrandom(as, dat, datlen)
}
static void
arc4_stir(as)
struct arc4_stream *as;
arc4_stir(struct arc4_stream *as)
{
int fd;
struct {
@ -119,8 +114,7 @@ arc4_stir(as)
}
static inline u_int8_t
arc4_getbyte(as)
struct arc4_stream *as;
arc4_getbyte(struct arc4_stream *as)
{
u_int8_t si, sj;
@ -134,8 +128,7 @@ arc4_getbyte(as)
}
static inline u_int32_t
arc4_getword(as)
struct arc4_stream *as;
arc4_getword(struct arc4_stream *as)
{
u_int32_t val;
val = arc4_getbyte(as) << 24;
@ -146,7 +139,7 @@ arc4_getword(as)
}
void
arc4random_stir()
arc4random_stir(void)
{
if (!rs_initialized) {
arc4_init(&rs);
@ -156,9 +149,7 @@ arc4random_stir()
}
void
arc4random_addrandom(dat, datlen)
u_char *dat;
int datlen;
arc4random_addrandom(u_char *dat, int datlen)
{
if (!rs_initialized)
arc4random_stir();
@ -166,7 +157,7 @@ arc4random_addrandom(dat, datlen)
}
u_int32_t
arc4random()
arc4random(void)
{
if (!rs_initialized || arc4_stir_pid != getpid())
arc4random_stir();


Loading…
Cancel
Save