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 FILE_SECBOOT ( PERMITTED );
12 
13 #include <ipxe/crypto.h>
14 
15 /** AES blocksize */
16 #define AES_BLOCKSIZE 16
17 
18 /** Maximum number of AES rounds */
19 #define AES_MAX_ROUNDS 15
20 
21 /** AES matrix */
22 union aes_matrix {
23  /** Viewed as an array of bytes */
24  uint8_t byte[16];
25  /** Viewed as an array of four-byte columns */
27 } __attribute__ (( packed ));
28 
29 /** AES round keys */
31  /** Round keys */
33 };
34 
35 /** AES context */
36 struct aes_context {
37  /** Encryption keys */
39  /** Decryption keys */
41  /** Number of rounds */
42  unsigned int rounds;
43 };
44 
45 /** AES context size */
46 #define AES_CTX_SIZE sizeof ( struct aes_context )
47 
48 extern struct cipher_algorithm aes_algorithm;
52 
53 int aes_wrap ( const void *kek, const void *src, void *dest, int nblk );
54 int aes_unwrap ( const void *kek, const void *src, void *dest, int nblk );
55 
56 #endif /* _IPXE_AES_H */
#define __attribute__(x)
Definition: compiler.h:10
unsigned int rounds
Number of rounds.
Definition: aes.h:42
struct cipher_algorithm aes_gcm_algorithm
#define AES_MAX_ROUNDS
Maximum number of AES rounds.
Definition: aes.h:19
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
Cryptographic API.
AES context.
Definition: aes.h:36
struct aes_round_keys encrypt
Encryption keys.
Definition: aes.h:38
AES round keys.
Definition: aes.h:30
struct aes_round_keys decrypt
Decryption keys.
Definition: aes.h:40
static const void * src
Definition: string.h:48
struct cipher_algorithm aes_algorithm
Basic AES algorithm.
Definition: aes.c:784
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:22
union aes_matrix key[AES_MAX_ROUNDS]
Round keys.
Definition: aes.h:32
unsigned int uint32_t
Definition: stdint.h:12
struct cipher_algorithm aes_cbc_algorithm
FILE_SECBOOT(PERMITTED)
uint32_t column[4]
Viewed as an array of four-byte columns.
Definition: aes.h:26
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
Definition: string.h:151
A cipher algorithm.
Definition: crypto.h:51
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