iPXE
|
Go to the source code of this file.
Macros | |
#define | SWAP(ary, i, j) ({ u8 temp = ary[i]; ary[i] = ary[j]; ary[j] = temp; }) |
Functions | |
FILE_LICENCE (GPL2_OR_LATER) | |
static int | arc4_setkey (void *ctxv, const void *keyv, size_t keylen) |
Set ARC4 key. More... | |
static void | arc4_xor (void *ctxv, const void *srcv, void *dstv, size_t len) |
Perform ARC4 encryption or decryption. More... | |
void | arc4_skip (const void *key, size_t keylen, size_t skip, const void *src, void *dst, size_t msglen) |
Perform ARC4 encryption or decryption, skipping initial keystream bytes. More... | |
Variables | |
struct cipher_algorithm | arc4_algorithm |
#define SWAP | ( | ary, | |
i, | |||
j | |||
) | ({ u8 temp = ary[i]; ary[i] = ary[j]; ary[j] = temp; }) |
FILE_LICENCE | ( | GPL2_OR_LATER | ) |
|
static |
Set ARC4 key.
ctxv | ARC4 encryption context |
keyv | Key to set |
keylen | Length of key |
If an initialisation vector is to be used, it should be prepended to the key; ARC4 does not implement the setiv
function because there is no standard length for an initialisation vector in the cipher.
Definition at line 42 of file arc4.c.
References ctx, arc4_ctx::i, arc4_ctx::j, key, S(), and SWAP.
Referenced by arc4_skip().
|
static |
Perform ARC4 encryption or decryption.
ctxv | ARC4 encryption context |
srcv | Data to encrypt or decrypt |
dstv | Location to store encrypted or decrypted data |
len | Length of data to operate on |
ARC4 is a stream cipher that works by generating a stream of PRNG data based on the key, and XOR'ing it with the data to be encrypted. Since XOR is symmetric, encryption and decryption in ARC4 are the same operation.
If you pass a NULL
source or destination pointer, len keystream bytes will be consumed without encrypting any data.
Definition at line 78 of file arc4.c.
References ctx, arc4_ctx::i, arc4_ctx::j, len, S(), src, and SWAP.
Referenced by arc4_skip().
void arc4_skip | ( | const void * | key, |
size_t | keylen, | ||
size_t | skip, | ||
const void * | src, | ||
void * | dst, | ||
size_t | msglen | ||
) |
Perform ARC4 encryption or decryption, skipping initial keystream bytes.
key | ARC4 encryption key |
keylen | Key length |
skip | Number of bytes of keystream to skip |
src | Message to encrypt or decrypt |
msglen | Length of message |
dst | Encrypted or decrypted message |
Definition at line 109 of file arc4.c.
References arc4_setkey(), arc4_xor(), ctx, key, NULL, and src.
Referenced by tkip_kie_decrypt().
struct cipher_algorithm arc4_algorithm |
Definition at line 118 of file arc4.c.
Referenced by tkip_decrypt(), tkip_encrypt(), wep_decrypt(), and wep_encrypt().