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

AES (Rijndael) cipher - encrypt. More...

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

Macros

#define ROUND(i, d, s)
 

Functions

void * aes_encrypt_init (const u8 *key, size_t len)
 Initialize AES for encryption. More...
 
void aes_encrypt (void *ctx, const u8 *plain, u8 *crypt)
 Encrypt one AES block. More...
 
void aes_encrypt_deinit (void *ctx)
 Deinitialize AES encryption. More...
 

Detailed Description

AES (Rijndael) cipher - encrypt.

Modifications to public domain implementation:

Macro Definition Documentation

#define ROUND (   i,
  d,
 
)
Value:
d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \
d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \
d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \
d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3]

Function Documentation

void aes_encrypt ( void *  ctx,
const u8 *  plain,
u8 *  crypt 
)

Encrypt one AES block.

Parameters
ctxContext pointer from aes_encrypt_init()
plainPlaintext data to be encrypted (16 bytes)
cryptBuffer for the encrypted data (16 bytes)
void aes_encrypt_deinit ( void *  ctx)

Deinitialize AES encryption.

Parameters
ctxContext pointer from aes_encrypt_init()
void* aes_encrypt_init ( const u8 *  key,
size_t  len 
)

Initialize AES for encryption.

Parameters
keyEncryption key
lenKey length in bytes (usually 16, i.e., 128 bits)
Returns
Pointer to context data or NULL on failure