iPXE
|
#include <string.h>
#include <ipxe/crypto.h>
#include <ipxe/sha1.h>
#include <ipxe/hmac.h>
#include <stdint.h>
#include <byteswap.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER) | |
void | prf_sha1 (const void *key, size_t key_len, const char *label, const void *data, size_t data_len, void *prf, size_t prf_len) |
SHA1 pseudorandom function for creating derived keys. More... | |
static void | pbkdf2_sha1_f (const void *passphrase, size_t pass_len, const void *salt, size_t salt_len, int iterations, u32 blocknr, u8 *block) |
PBKDF2 key derivation function inner block operation. More... | |
void | pbkdf2_sha1 (const void *passphrase, size_t pass_len, const void *salt, size_t salt_len, int iterations, void *key, size_t key_len) |
PBKDF2 key derivation function using SHA1. More... | |
FILE_LICENCE | ( | GPL2_OR_LATER | ) |
void prf_sha1 | ( | const void * | key, |
size_t | key_len, | ||
const char * | label, | ||
const void * | data, | ||
size_t | data_len, | ||
void * | prf, | ||
size_t | prf_len | ||
) |
SHA1 pseudorandom function for creating derived keys.
key | Master key with which this call is associated |
key_len | Length of key |
label | NUL-terminated ASCII string describing purpose of PRF data |
data | Further data that should be included in the PRF |
data_len | Length of further PRF data |
prf_len | Bytes of PRF to generate |
prf | Pseudorandom function bytes |
This is the PRF variant used by 802.11, defined in IEEE 802.11-2007 8.5.5.1. EAP-FAST uses a different SHA1-based PRF, and TLS uses an MD5-based PRF.
Definition at line 44 of file sha1extra.c.
References ctx, data, data_len, hmac_final(), hmac_init(), hmac_update(), in, key, memcpy(), out, sha1_algorithm, SHA1_BLOCK_SIZE, SHA1_CTX_SIZE, SHA1_DIGEST_SIZE, and strlen().
Referenced by wpa_derive_ptk().
|
static |
PBKDF2 key derivation function inner block operation.
passphrase | Passphrase from which to derive key |
pass_len | Length of passphrase |
salt | Salt to include in key |
salt_len | Length of salt |
iterations | Number of iterations of SHA1 to perform |
blocknr | Index of this block, starting at 1 |
block | SHA1_SIZE bytes of PBKDF2 data |
The operation of this function is described in RFC 2898.
Definition at line 96 of file sha1extra.c.
References block, ctx, hmac_final(), hmac_init(), hmac_update(), htonl, in, memcpy(), memset(), sha1_algorithm, SHA1_BLOCK_SIZE, SHA1_CTX_SIZE, and SHA1_DIGEST_SIZE.
Referenced by pbkdf2_sha1().
void pbkdf2_sha1 | ( | const void * | passphrase, |
size_t | pass_len, | ||
const void * | salt, | ||
size_t | salt_len, | ||
int | iterations, | ||
void * | key, | ||
size_t | key_len | ||
) |
PBKDF2 key derivation function using SHA1.
passphrase | Passphrase from which to derive key |
pass_len | Length of passphrase |
salt | Salt to include in key |
salt_len | Length of salt |
iterations | Number of iterations of SHA1 to perform |
key_len | Length of key to generate |
key | Generated key bytes |
This is used most notably in 802.11 WPA passphrase hashing, in which case the salt is the SSID, 4096 iterations are used, and a 32-byte key is generated that serves as the Pairwise Master Key for EAPOL authentication.
The operation of this function is further described in RFC 2898.
Definition at line 148 of file sha1extra.c.
References key, memcpy(), pbkdf2_sha1_f(), and SHA1_DIGEST_SIZE.
Referenced by wpa_psk_start().