wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
aes_wrap.h File Reference

AES-based functions. More...

Go to the source code of this file.

Functions

int __must_check aes_wrap (const u8 *kek, size_t kek_len, int n, const u8 *plain, u8 *cipher)
 Wrap keys with AES Key Wrap Algorithm (RFC3394) More...
 
int __must_check aes_unwrap (const u8 *kek, size_t kek_len, int n, const u8 *cipher, u8 *plain)
 Unwrap key with AES Key Wrap Algorithm (RFC3394) More...
 
int __must_check omac1_aes_vector (const u8 *key, size_t key_len, size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
 One-Key CBC MAC (OMAC1) hash with AES. More...
 
int __must_check omac1_aes_128_vector (const u8 *key, size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
 One-Key CBC MAC (OMAC1) hash with AES-128. More...
 
int __must_check omac1_aes_128 (const u8 *key, const u8 *data, size_t data_len, u8 *mac)
 One-Key CBC MAC (OMAC1) hash with AES-128 (aka AES-CMAC) More...
 
int __must_check omac1_aes_256 (const u8 *key, const u8 *data, size_t data_len, u8 *mac)
 One-Key CBC MAC (OMAC1) hash with AES-256 (aka AES-CMAC) More...
 
int __must_check aes_128_encrypt_block (const u8 *key, const u8 *in, u8 *out)
 Perform one AES 128-bit block operation. More...
 
int __must_check aes_128_ctr_encrypt (const u8 *key, const u8 *nonce, u8 *data, size_t data_len)
 AES-128 CTR mode encryption. More...
 
int __must_check aes_128_eax_encrypt (const u8 *key, const u8 *nonce, size_t nonce_len, const u8 *hdr, size_t hdr_len, u8 *data, size_t data_len, u8 *tag)
 AES-128 EAX mode encryption. More...
 
int __must_check aes_128_eax_decrypt (const u8 *key, const u8 *nonce, size_t nonce_len, const u8 *hdr, size_t hdr_len, u8 *data, size_t data_len, const u8 *tag)
 AES-128 EAX mode decryption. More...
 
int __must_check aes_128_cbc_encrypt (const u8 *key, const u8 *iv, u8 *data, size_t data_len)
 AES-128 CBC encryption. More...
 
int __must_check aes_128_cbc_decrypt (const u8 *key, const u8 *iv, u8 *data, size_t data_len)
 AES-128 CBC decryption. More...
 
int __must_check aes_gcm_ae (const u8 *key, size_t key_len, const u8 *iv, size_t iv_len, const u8 *plain, size_t plain_len, const u8 *aad, size_t aad_len, u8 *crypt, u8 *tag)
 GCM-AE_K(IV, P, A)
 
int __must_check aes_gcm_ad (const u8 *key, size_t key_len, const u8 *iv, size_t iv_len, const u8 *crypt, size_t crypt_len, const u8 *aad, size_t aad_len, const u8 *tag, u8 *plain)
 GCM-AD_K(IV, C, A, T)
 
int __must_check aes_gmac (const u8 *key, size_t key_len, const u8 *iv, size_t iv_len, const u8 *aad, size_t aad_len, u8 *tag)
 
int __must_check aes_ccm_ae (const u8 *key, size_t key_len, const u8 *nonce, size_t M, const u8 *plain, size_t plain_len, const u8 *aad, size_t aad_len, u8 *crypt, u8 *auth)
 
int __must_check aes_ccm_ad (const u8 *key, size_t key_len, const u8 *nonce, size_t M, const u8 *crypt, size_t crypt_len, const u8 *aad, size_t aad_len, const u8 *auth, u8 *plain)
 

Detailed Description

AES-based functions.

Function Documentation

int __must_check aes_128_cbc_decrypt ( const u8 *  key,
const u8 *  iv,
u8 *  data,
size_t  data_len 
)

AES-128 CBC decryption.

Parameters
keyDecryption key
ivDecryption IV for CBC mode (16 bytes)
dataData to decrypt in-place
data_lenLength of data in bytes (must be divisible by 16)
Returns
0 on success, -1 on failure
int __must_check aes_128_cbc_encrypt ( const u8 *  key,
const u8 *  iv,
u8 *  data,
size_t  data_len 
)

AES-128 CBC encryption.

Parameters
keyEncryption key
ivEncryption IV for CBC mode (16 bytes)
dataData to encrypt in-place
data_lenLength of data in bytes (must be divisible by 16)
Returns
0 on success, -1 on failure
int __must_check aes_128_ctr_encrypt ( const u8 *  key,
const u8 *  nonce,
u8 *  data,
size_t  data_len 
)

AES-128 CTR mode encryption.

Parameters
keyKey for encryption (16 bytes)
nonceNonce for counter mode (16 bytes)
dataData to encrypt in-place
data_lenLength of data in bytes
Returns
0 on success, -1 on failure
int __must_check aes_128_eax_decrypt ( const u8 *  key,
const u8 *  nonce,
size_t  nonce_len,
const u8 *  hdr,
size_t  hdr_len,
u8 *  data,
size_t  data_len,
const u8 *  tag 
)

AES-128 EAX mode decryption.

Parameters
keyKey for decryption (16 bytes)
nonceNonce for counter mode
nonce_lenNonce length in bytes
hdrHeader data to be authenticity protected
hdr_lenLength of the header data bytes
dataData to encrypt in-place
data_lenLength of data in bytes
tag16-byte tag value
Returns
0 on success, -1 on failure, -2 if tag does not match
int __must_check aes_128_eax_encrypt ( const u8 *  key,
const u8 *  nonce,
size_t  nonce_len,
const u8 *  hdr,
size_t  hdr_len,
u8 *  data,
size_t  data_len,
u8 *  tag 
)

AES-128 EAX mode encryption.

Parameters
keyKey for encryption (16 bytes)
nonceNonce for counter mode
nonce_lenNonce length in bytes
hdrHeader data to be authenticity protected
hdr_lenLength of the header data bytes
dataData to encrypt in-place
data_lenLength of data in bytes
tag16-byte tag value
Returns
0 on success, -1 on failure
int __must_check aes_128_encrypt_block ( const u8 *  key,
const u8 *  in,
u8 *  out 
)

Perform one AES 128-bit block operation.

Parameters
keyKey for AES
inInput data (16 bytes)
outOutput of the AES block operation (16 bytes)
Returns
0 on success, -1 on failure
int __must_check aes_unwrap ( const u8 *  kek,
size_t  kek_len,
int  n,
const u8 *  cipher,
u8 *  plain 
)

Unwrap key with AES Key Wrap Algorithm (RFC3394)

Parameters
kekKey encryption key (KEK)
kek_lenLength of KEK in octets
nLength of the plaintext key in 64-bit units; e.g., 2 = 128-bit = 16 bytes
cipherWrapped key to be unwrapped, (n + 1) * 64 bits
plainPlaintext key, n * 64 bits
Returns
0 on success, -1 on failure (e.g., integrity verification failed)
int __must_check aes_wrap ( const u8 *  kek,
size_t  kek_len,
int  n,
const u8 *  plain,
u8 *  cipher 
)

Wrap keys with AES Key Wrap Algorithm (RFC3394)

Parameters
kekKey encryption key (KEK)
kek_lenLength of KEK in octets
nLength of the plaintext key in 64-bit units; e.g., 2 = 128-bit = 16 bytes
plainPlaintext key to be wrapped, n * 64 bits
cipherWrapped key, (n + 1) * 64 bits
Returns
0 on success, -1 on failure
int __must_check omac1_aes_128 ( const u8 *  key,
const u8 *  data,
size_t  data_len,
u8 *  mac 
)

One-Key CBC MAC (OMAC1) hash with AES-128 (aka AES-CMAC)

Parameters
key128-bit key for the hash operation
dataData buffer for which a MAC is determined
data_lenLength of data buffer in bytes
macBuffer for MAC (128 bits, i.e., 16 bytes)
Returns
0 on success, -1 on failure

This is a mode for using block cipher (AES in this case) for authentication. OMAC1 was standardized with the name CMAC by NIST in a Special Publication (SP) 800-38B.

int __must_check omac1_aes_128_vector ( const u8 *  key,
size_t  num_elem,
const u8 *  addr[],
const size_t *  len,
u8 *  mac 
)

One-Key CBC MAC (OMAC1) hash with AES-128.

Parameters
key128-bit key for the hash operation
num_elemNumber of elements in the data vector
addrPointers to the data areas
lenLengths of the data blocks
macBuffer for MAC (128 bits, i.e., 16 bytes)
Returns
0 on success, -1 on failure

This is a mode for using block cipher (AES in this case) for authentication. OMAC1 was standardized with the name CMAC by NIST in a Special Publication (SP) 800-38B.

int __must_check omac1_aes_256 ( const u8 *  key,
const u8 *  data,
size_t  data_len,
u8 *  mac 
)

One-Key CBC MAC (OMAC1) hash with AES-256 (aka AES-CMAC)

Parameters
key256-bit key for the hash operation
dataData buffer for which a MAC is determined
data_lenLength of data buffer in bytes
macBuffer for MAC (128 bits, i.e., 16 bytes)
Returns
0 on success, -1 on failure

This is a mode for using block cipher (AES in this case) for authentication. OMAC1 was standardized with the name CMAC by NIST in a Special Publication (SP) 800-38B.

int __must_check omac1_aes_vector ( const u8 *  key,
size_t  key_len,
size_t  num_elem,
const u8 *  addr[],
const size_t *  len,
u8 *  mac 
)

One-Key CBC MAC (OMAC1) hash with AES.

Parameters
keyKey for the hash operation
key_lenKey length in octets
num_elemNumber of elements in the data vector
addrPointers to the data areas
lenLengths of the data blocks
macBuffer for MAC (128 bits, i.e., 16 bytes)
Returns
0 on success, -1 on failure

This is a mode for using block cipher (AES in this case) for authentication. OMAC1 was standardized with the name CMAC by NIST in a Special Publication (SP) 800-38B.