staging:vt6655:rc4: Whitespace cleanups

Neatening only.
git diff -w shows no differences.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Joe Perches 2013-03-18 10:44:59 -07:00 committed by Greg Kroah-Hartman
parent 474f0f89ef
commit 7e58568f13
2 changed files with 42 additions and 42 deletions

View File

@ -34,54 +34,54 @@
void rc4_init(PRC4Ext pRC4, unsigned char *pbyKey, unsigned int cbKey_len) void rc4_init(PRC4Ext pRC4, unsigned char *pbyKey, unsigned int cbKey_len)
{ {
unsigned int ust1, ust2; unsigned int ust1, ust2;
unsigned int keyindex; unsigned int keyindex;
unsigned int stateindex; unsigned int stateindex;
unsigned char *pbyst; unsigned char *pbyst;
unsigned int idx; unsigned int idx;
pbyst = pRC4->abystate; pbyst = pRC4->abystate;
pRC4->ux = 0; pRC4->ux = 0;
pRC4->uy = 0; pRC4->uy = 0;
for (idx = 0; idx < 256; idx++) for (idx = 0; idx < 256; idx++)
pbyst[idx] = (unsigned char)idx; pbyst[idx] = (unsigned char)idx;
keyindex = 0; keyindex = 0;
stateindex = 0; stateindex = 0;
for (idx = 0; idx < 256; idx++) { for (idx = 0; idx < 256; idx++) {
ust1 = pbyst[idx]; ust1 = pbyst[idx];
stateindex = (stateindex + pbyKey[keyindex] + ust1) & 0xff; stateindex = (stateindex + pbyKey[keyindex] + ust1) & 0xff;
ust2 = pbyst[stateindex]; ust2 = pbyst[stateindex];
pbyst[stateindex] = (unsigned char)ust1; pbyst[stateindex] = (unsigned char)ust1;
pbyst[idx] = (unsigned char)ust2; pbyst[idx] = (unsigned char)ust2;
if (++keyindex >= cbKey_len) if (++keyindex >= cbKey_len)
keyindex = 0; keyindex = 0;
} }
} }
unsigned int rc4_byte(PRC4Ext pRC4) unsigned int rc4_byte(PRC4Ext pRC4)
{ {
unsigned int ux; unsigned int ux;
unsigned int uy; unsigned int uy;
unsigned int ustx, usty; unsigned int ustx, usty;
unsigned char *pbyst; unsigned char *pbyst;
pbyst = pRC4->abystate; pbyst = pRC4->abystate;
ux = (pRC4->ux + 1) & 0xff; ux = (pRC4->ux + 1) & 0xff;
ustx = pbyst[ux]; ustx = pbyst[ux];
uy = (ustx + pRC4->uy) & 0xff; uy = (ustx + pRC4->uy) & 0xff;
usty = pbyst[uy]; usty = pbyst[uy];
pRC4->ux = ux; pRC4->ux = ux;
pRC4->uy = uy; pRC4->uy = uy;
pbyst[uy] = (unsigned char)ustx; pbyst[uy] = (unsigned char)ustx;
pbyst[ux] = (unsigned char)usty; pbyst[ux] = (unsigned char)usty;
return pbyst[(ustx + usty) & 0xff]; return pbyst[(ustx + usty) & 0xff];
} }
void rc4_encrypt(PRC4Ext pRC4, unsigned char *pbyDest, void rc4_encrypt(PRC4Ext pRC4, unsigned char *pbyDest,
unsigned char *pbySrc, unsigned int cbData_len) unsigned char *pbySrc, unsigned int cbData_len)
{ {
unsigned int ii; unsigned int ii;
for (ii = 0; ii < cbData_len; ii++) for (ii = 0; ii < cbData_len; ii++)
pbyDest[ii] = (unsigned char)(pbySrc[ii] ^ rc4_byte(pRC4)); pbyDest[ii] = (unsigned char)(pbySrc[ii] ^ rc4_byte(pRC4));
} }

View File

@ -35,9 +35,9 @@
/*--------------------- Export Definitions -------------------------*/ /*--------------------- Export Definitions -------------------------*/
/*--------------------- Export Types ------------------------------*/ /*--------------------- Export Types ------------------------------*/
typedef struct { typedef struct {
unsigned int ux; unsigned int ux;
unsigned int uy; unsigned int uy;
unsigned char abystate[256]; unsigned char abystate[256];
} RC4Ext, *PRC4Ext; } RC4Ext, *PRC4Ext;
void rc4_init(PRC4Ext pRC4, unsigned char *pbyKey, unsigned int cbKey_len); void rc4_init(PRC4Ext pRC4, unsigned char *pbyKey, unsigned int cbKey_len);