|
@@ -47,12 +47,6 @@ struct arc4_stream {
|
|
static int rs_initialized;
|
|
static int rs_initialized;
|
|
static struct arc4_stream rs;
|
|
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
|
|
static __inline__ void
|
|
arc4_init(struct arc4_stream *as)
|
|
arc4_init(struct arc4_stream *as)
|
|
{
|
|
{
|
|
@@ -64,6 +58,20 @@ arc4_init(struct arc4_stream *as)
|
|
as->j = 0;
|
|
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
|
|
static __inline__ void
|
|
arc4_addrandom(struct arc4_stream *as, u_char *dat, int datlen)
|
|
arc4_addrandom(struct arc4_stream *as, u_char *dat, int datlen)
|
|
{
|
|
{
|
|
@@ -131,20 +139,6 @@ arc4_stir(struct arc4_stream *as)
|
|
arc4_getbyte(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
|
|
static __inline__ uint32_t
|
|
arc4_getword(struct arc4_stream *as)
|
|
arc4_getword(struct arc4_stream *as)
|
|
{
|
|
{
|