iPXE
aes.h
Go to the documentation of this file.
1 #ifndef _IPXE_AES_H
2 #define _IPXE_AES_H
3 
4 /** @file
5  *
6  * AES algorithm
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <ipxe/crypto.h>
13 
14 /** AES blocksize */
15 #define AES_BLOCKSIZE 16
16 
17 /** Maximum number of AES rounds */
18 #define AES_MAX_ROUNDS 15
19 
20 /** AES matrix */
21 union aes_matrix {
22  /** Viewed as an array of bytes */
23  uint8_t byte[16];
24  /** Viewed as an array of four-byte columns */
26 } __attribute__ (( packed ));
27 
28 /** AES round keys */
30  /** Round keys */
32 };
33 
34 /** AES context */
35 struct aes_context {
36  /** Encryption keys */
38  /** Decryption keys */
40  /** Number of rounds */
41  unsigned int rounds;
42 };
43 
44 /** AES context size */
45 #define AES_CTX_SIZE sizeof ( struct aes_context )
46 
47 extern struct cipher_algorithm aes_algorithm;
50 
51 int aes_wrap ( const void *kek, const void *src, void *dest, int nblk );
52 int aes_unwrap ( const void *kek, const void *src, void *dest, int nblk );
53 
54 #endif /* _IPXE_AES_H */
unsigned int rounds
Number of rounds.
Definition: aes.h:41
struct aes_round_keys __attribute__
#define AES_MAX_ROUNDS
Maximum number of AES rounds.
Definition: aes.h:18
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
Cryptographic API.
AES context.
Definition: aes.h:35
struct aes_round_keys encrypt
Encryption keys.
Definition: aes.h:37
AES round keys.
Definition: aes.h:29
struct aes_round_keys decrypt
Decryption keys.
Definition: aes.h:39
struct cipher_algorithm aes_algorithm
Basic AES algorithm.
Definition: aes.c:792
static void * dest
Definition: strings.h:176
static __always_inline void off_t userptr_t src
Definition: efi_uaccess.h:66
u8 kek[WPA_KEK_LEN]
EAPOL-Key Key Encryption Key (KEK)
Definition: wpa.h:31
int aes_unwrap(const void *kek, const void *src, void *dest, int nblk)
Unwrap a key or other data using AES Key Wrap (RFC 3394)
Definition: aes_wrap.c:85
unsigned char uint8_t
Definition: stdint.h:10
AES matrix.
Definition: aes.h:21
union aes_matrix key[AES_MAX_ROUNDS]
Round keys.
Definition: aes.h:31
unsigned int uint32_t
Definition: stdint.h:12
struct cipher_algorithm aes_cbc_algorithm
uint32_t column[4]
Viewed as an array of four-byte columns.
Definition: aes.h:25
A cipher algorithm.
Definition: crypto.h:48
struct cipher_algorithm aes_ecb_algorithm
int aes_wrap(const void *kek, const void *src, void *dest, int nblk)
Wrap a key or other data using AES Key Wrap (RFC 3394)
Definition: aes_wrap.c:38