wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions
rc4.c File Reference

RC4 stream cipher. More...

#include "includes.h"
#include "common.h"
#include "crypto.h"

Macros

#define S_SWAP(a, b)   do { u8 t = S[a]; S[a] = S[b]; S[b] = t; } while(0)
 

Functions

int rc4_skip (const u8 *key, size_t keylen, size_t skip, u8 *data, size_t data_len)
 XOR RC4 stream to given data with skip-stream-start. More...
 

Detailed Description

RC4 stream cipher.

Function Documentation

int rc4_skip ( const u8 *  key,
size_t  keylen,
size_t  skip,
u8 *  data,
size_t  data_len 
)

XOR RC4 stream to given data with skip-stream-start.

Parameters
keyRC4 key
keylenRC4 key length
skipnumber of bytes to skip from the beginning of the RC4 stream
datadata to be XOR'ed with RC4 stream
data_lenbuf length
Returns
0 on success, -1 on failure

Generate RC4 pseudo random stream for the given key, skip beginning of the stream, and XOR the end result with the data buffer to perform RC4 encryption/decryption.