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
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_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 */
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 */
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
52
53int aes_wrap ( const void *kek, const void *src, void *dest, int nblk );
54int aes_unwrap ( const void *kek, const void *src, void *dest, int nblk );
55
56#endif /* _IPXE_AES_H */
struct cipher_algorithm aes_algorithm
Basic AES algorithm.
Definition aes.c:784
#define AES_MAX_ROUNDS
Maximum number of AES rounds.
Definition aes.h:19
struct cipher_algorithm aes_ecb_algorithm
struct cipher_algorithm aes_cbc_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
struct cipher_algorithm aes_gcm_algorithm
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 int uint32_t
Definition stdint.h:12
unsigned char uint8_t
Definition stdint.h:10
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" retur dest)
Definition string.h:151
static const void * src
Definition string.h:48
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define __attribute__(x)
Definition compiler.h:10
Cryptographic API.
AES context.
Definition aes.h:36
struct aes_round_keys decrypt
Decryption keys.
Definition aes.h:40
unsigned int rounds
Number of rounds.
Definition aes.h:42
struct aes_round_keys encrypt
Encryption keys.
Definition aes.h:38
AES round keys.
Definition aes.h:30
union aes_matrix key[AES_MAX_ROUNDS]
Round keys.
Definition aes.h:32
A cipher algorithm.
Definition crypto.h:51
AES matrix.
Definition aes.h:22
uint32_t column[4]
Viewed as an array of four-byte columns.
Definition aes.h:26
u8 kek[WPA_KEK_LEN]
EAPOL-Key Key Encryption Key (KEK)
Definition wpa.h:4