summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2011-03-18 16:03:12 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-06-15 14:00:26 +0200
commit85a5d70b5f76c1565816494908288b59fc0b7501 (patch)
tree47789244edc7af37308a0b0723ff609272276474 /libc
parentb386c1a798710570b59d137fa0f38dff885bd657 (diff)
arc4random.c: move arc4_getbyte up
no need for forward declarations Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc')
-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)
{