crypto.h File Reference

WPA Supplicant / wrapper functions for crypto libraries. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void md4_vector (size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
 MD4 hash for data vector.
void md5_vector (size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
 MD5 hash for data vector.
void sha1_vector (size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
 SHA-1 hash for data vector.
void sha1_transform (u8 *state, const u8 data[64])
 Perform one SHA-1 transform step.
void des_encrypt (const u8 *clear, const u8 *key, u8 *cypher)
 Encrypt one block with DES.
void * aes_encrypt_init (const u8 *key, size_t len)
 Initialize AES for encryption.
void aes_encrypt (void *ctx, const u8 *plain, u8 *crypt)
 Encrypt one AES block.
void aes_encrypt_deinit (void *ctx)
 Deinitialize AES encryption.
void * aes_decrypt_init (const u8 *key, size_t len)
 Initialize AES for decryption.
void aes_decrypt (void *ctx, const u8 *crypt, u8 *plain)
 Decrypt one AES block.
void aes_decrypt_deinit (void *ctx)
 Deinitialize AES decryption.


Detailed Description

WPA Supplicant / wrapper functions for crypto libraries.

Copyright
Copyright (c) 2004-2005, Jouni Malinen <[email protected]>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

Alternatively, this software may be distributed under the terms of BSD license.

See README and COPYING for more details.

This file defines the cryptographic functions that need to be implemented for wpa_supplicant and hostapd. When TLS is not used, internal implementation of MD5, SHA1, and AES is used and no external libraries are required. When TLS is enabled (e.g., by enabling EAP-TLS or EAP-PEAP), the crypto library used by the TLS implementation is expected to be used for non-TLS needs, too, in order to save space by not implementing these functions twice.

Wrapper code for using each crypto library is in its own file (crypto*.c) and one of these files is build and linked in to provide the functions defined here.

Definition in file crypto.h.


Function Documentation

void aes_decrypt void *  ctx,
const u8 *  crypt,
u8 *  plain
 

Decrypt one AES block.

Parameters:
ctx Context pointer from aes_encrypt_init()
crypt Encrypted data (16 bytes)
plain Buffer for the decrypted data (16 bytes)

Definition at line 1097 of file aes.c.

void aes_decrypt_deinit void *  ctx  ) 
 

Deinitialize AES decryption.

Parameters:
ctx Context pointer from aes_encrypt_init()

Definition at line 1103 of file aes.c.

void* aes_decrypt_init const u8 *  key,
size_t  len
 

Initialize AES for decryption.

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

Definition at line 1084 of file aes.c.

Here is the call graph for this function:

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

Encrypt one AES block.

Parameters:
ctx Context pointer from aes_encrypt_init()
plain Plaintext data to be encrypted (16 bytes)
crypt Buffer for the encrypted data (16 bytes)

Definition at line 1072 of file aes.c.

void aes_encrypt_deinit void *  ctx  ) 
 

Deinitialize AES encryption.

Parameters:
ctx Context pointer from aes_encrypt_init()

Definition at line 1078 of file aes.c.

void* aes_encrypt_init const u8 *  key,
size_t  len
 

Initialize AES for encryption.

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

Definition at line 1059 of file aes.c.

Here is the call graph for this function:

void des_encrypt const u8 *  clear,
const u8 *  key,
u8 *  cypher
 

Encrypt one block with DES.

Parameters:
clear 8 octets (in)
key 7 octets (in) (no parity bits included)
cypher 8 octets (out)

Definition at line 52 of file crypto.c.

void md4_vector size_t  num_elem,
const u8 *  addr[],
const size_t *  len,
u8 *  mac
 

MD4 hash for data vector.

Parameters:
num_elem Number of elements in the data vector
addr Pointers to the data areas
len Lengths of the data blocks
mac Buffer for the hash

Definition at line 40 of file crypto.c.

void md5_vector size_t  num_elem,
const u8 *  addr[],
const size_t *  len,
u8 *  mac
 

MD5 hash for data vector.

Parameters:
num_elem Number of elements in the data vector
addr Pointers to the data areas
len Lengths of the data blocks
mac Buffer for the hash

Definition at line 141 of file md5.c.

void sha1_transform u8 *  state,
const u8  data[64]
 

Perform one SHA-1 transform step.

Parameters:
state SHA-1 state
data Input data for the SHA-1 transform
This function is used to implement random number generation specified in NIST FIPS Publication 186-2 for EAP-SIM. This PRF uses a function that is similar to SHA-1, but has different message padding and as such, access to just part of the SHA-1 is needed.

Definition at line 424 of file sha1.c.

void sha1_vector size_t  num_elem,
const u8 *  addr[],
const size_t *  len,
u8 *  mac
 

SHA-1 hash for data vector.

Parameters:
num_elem Number of elements in the data vector
addr Pointers to the data areas
len Lengths of the data blocks
mac Buffer for the hash

Definition at line 400 of file sha1.c.


Generated on Sat May 6 21:14:40 2006 for wpa_supplicant by  doxygen 1.4.2