summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/stdlib/arc4random.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/libc/stdlib/arc4random.c b/libc/stdlib/arc4random.c
index c7aed66b6..e074a22b9 100644
--- a/libc/stdlib/arc4random.c
+++ b/libc/stdlib/arc4random.c
@@ -47,12 +47,6 @@ struct arc4_stream {
static int rs_initialized;
static struct arc4_stream rs;
-static __inline__ void arc4_init(struct arc4_stream *);
-static __inline__ void arc4_addrandom(struct arc4_stream *, u_char *, int);
-static void arc4_stir(struct arc4_stream *);
-static __inline__ uint8_t arc4_getbyte(struct arc4_stream *);
-static __inline__ uint32_t arc4_getword(struct arc4_stream *);
-
static __inline__ void
arc4_init(struct arc4_stream *as)
{
@@ -64,6 +58,20 @@ arc4_init(struct arc4_stream *as)
as->j = 0;
}
+static __inline__ uint8_t
+arc4_getbyte(struct arc4_stream *as)
+{
+ uint8_t si, sj;
+
+ as->i = (as->i + 1);
+ si = as->s[as->i];
+ as->j = (as->j + si);
+ sj = as->s[as->j];
+ as->s[as->i] = sj;
+ as->s[as->j] = si;
+ return (as->s[(si + sj) & 0xff]);
+}
+
static __inline__ void
arc4_addrandom(struct arc4_stream *as, u_char *dat, int datlen)
{
@@ -131,20 +139,6 @@ arc4_stir(struct arc4_stream *as)
arc4_getbyte(as);
}
-static __inline__ uint8_t
-arc4_getbyte(struct arc4_stream *as)
-{
- uint8_t si, sj;
-
- as->i = (as->i + 1);
- si = as->s[as->i];
- as->j = (as->j + si);
- sj = as->s[as->j];
- as->s[as->i] = sj;
- as->s[as->j] = si;
- return (as->s[(si + sj) & 0xff]);
-}
-
static __inline__ uint32_t
arc4_getword(struct arc4_stream *as)
{