iPXE
|
Cipher self-tests. More...
Go to the source code of this file.
Data Structures | |
struct | cipher_test |
A cipher test. More... | |
Macros | |
#define | KEY(...) { __VA_ARGS__ } |
Define inline key. More... | |
#define | IV(...) { __VA_ARGS__ } |
Define inline initialisation vector. More... | |
#define | ADDITIONAL(...) { __VA_ARGS__ } |
Define inline additional data. More... | |
#define | PLAINTEXT(...) { __VA_ARGS__ } |
Define inline plaintext data. More... | |
#define | CIPHERTEXT(...) { __VA_ARGS__ } |
Define inline ciphertext data. More... | |
#define | AUTH(...) { __VA_ARGS__ } |
Define inline authentication tag. More... | |
#define | CIPHER_TEST(name, CIPHER, KEY, IV, ADDITIONAL, PLAINTEXT, CIPHERTEXT, AUTH) |
Define a cipher test. More... | |
#define | cipher_encrypt_ok(test) cipher_encrypt_okx ( test, __FILE__, __LINE__ ) |
Report a cipher encryption test result. More... | |
#define | cipher_decrypt_ok(test) cipher_decrypt_okx ( test, __FILE__, __LINE__ ) |
Report a cipher decryption test result. More... | |
#define | cipher_ok(test) cipher_okx ( test, __FILE__, __LINE__ ) |
Report a cipher encryption and decryption test result. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
void | cipher_encrypt_okx (struct cipher_test *test, const char *file, unsigned int line) |
Report a cipher encryption test result. More... | |
void | cipher_decrypt_okx (struct cipher_test *test, const char *file, unsigned int line) |
Report a cipher decryption test result. More... | |
void | cipher_okx (struct cipher_test *test, const char *file, unsigned int line) |
Report a cipher encryption and decryption test result. More... | |
unsigned long | cipher_cost_encrypt (struct cipher_algorithm *cipher, size_t key_len) |
Calculate cipher encryption cost. More... | |
unsigned long | cipher_cost_decrypt (struct cipher_algorithm *cipher, size_t key_len) |
Calculate cipher decryption cost. More... | |
Cipher self-tests.
Definition in file cipher_test.h.
#define KEY | ( | ... | ) | { __VA_ARGS__ } |
Define inline key.
Definition at line 45 of file cipher_test.h.
#define IV | ( | ... | ) | { __VA_ARGS__ } |
Define inline initialisation vector.
Definition at line 48 of file cipher_test.h.
#define ADDITIONAL | ( | ... | ) | { __VA_ARGS__ } |
Define inline additional data.
Definition at line 51 of file cipher_test.h.
#define PLAINTEXT | ( | ... | ) | { __VA_ARGS__ } |
Define inline plaintext data.
Definition at line 54 of file cipher_test.h.
#define CIPHERTEXT | ( | ... | ) | { __VA_ARGS__ } |
Define inline ciphertext data.
Definition at line 57 of file cipher_test.h.
#define AUTH | ( | ... | ) | { __VA_ARGS__ } |
Define inline authentication tag.
Definition at line 60 of file cipher_test.h.
#define CIPHER_TEST | ( | name, | |
CIPHER, | |||
KEY, | |||
IV, | |||
ADDITIONAL, | |||
PLAINTEXT, | |||
CIPHERTEXT, | |||
AUTH | |||
) |
Define a cipher test.
name | Test name |
CIPHER | Cipher algorithm |
KEY | Key |
IV | Initialisation vector |
ADDITIONAL | Additional data |
PLAINTEXT | Plaintext |
CIPHERTEXT | Ciphertext |
AUTH | Authentication tag |
test | Cipher test |
Definition at line 75 of file cipher_test.h.
#define cipher_encrypt_ok | ( | test | ) | cipher_encrypt_okx ( test, __FILE__, __LINE__ ) |
Report a cipher encryption test result.
test | Cipher test |
Definition at line 115 of file cipher_test.h.
#define cipher_decrypt_ok | ( | test | ) | cipher_decrypt_okx ( test, __FILE__, __LINE__ ) |
Report a cipher decryption test result.
test | Cipher test |
Definition at line 123 of file cipher_test.h.
#define cipher_ok | ( | test | ) | cipher_okx ( test, __FILE__, __LINE__ ) |
Report a cipher encryption and decryption test result.
test | Cipher test |
Definition at line 131 of file cipher_test.h.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
void cipher_encrypt_okx | ( | struct cipher_test * | test, |
const char * | file, | ||
unsigned int | line | ||
) |
Report a cipher encryption test result.
test | Cipher test |
file | Test code file |
line | Test code line |
Definition at line 54 of file cipher_test.c.
References cipher_algorithm::auth, cipher_algorithm::authsize, cipher_auth(), cipher_encrypt, cipher_setiv(), cipher_setkey(), ctx, cipher_algorithm::ctxsize, is_auth_cipher(), len, memcmp(), memcpy(), NULL, okx, and test.
Referenced by cipher_okx().
void cipher_decrypt_okx | ( | struct cipher_test * | test, |
const char * | file, | ||
unsigned int | line | ||
) |
Report a cipher decryption test result.
test | Cipher test |
file | Test code file |
line | Test code line |
Definition at line 113 of file cipher_test.c.
References cipher_algorithm::auth, cipher_algorithm::authsize, cipher_auth(), cipher_decrypt, cipher_setiv(), cipher_setkey(), ctx, cipher_algorithm::ctxsize, is_auth_cipher(), len, memcmp(), memcpy(), NULL, okx, and test.
Referenced by cipher_okx().
void cipher_okx | ( | struct cipher_test * | test, |
const char * | file, | ||
unsigned int | line | ||
) |
Report a cipher encryption and decryption test result.
test | Cipher test |
file | Test code file |
line | Test code line |
Definition at line 172 of file cipher_test.c.
References cipher_algorithm::alignsize, cipher_algorithm::blocksize, cipher_decrypt_okx(), cipher_encrypt_okx(), len, okx, and test.
unsigned long cipher_cost_encrypt | ( | struct cipher_algorithm * | cipher, |
size_t | key_len | ||
) |
Calculate cipher encryption cost.
cipher | Cipher algorithm |
key_len | Length of key |
cost | Cost (in cycles per byte) |
Definition at line 246 of file cipher_test.c.
References cipher_cost(), and cipher_encrypt.
Referenced by aes_test_exec(), des_test_exec(), and gcm_test_exec().
unsigned long cipher_cost_decrypt | ( | struct cipher_algorithm * | cipher, |
size_t | key_len | ||
) |
Calculate cipher decryption cost.
cipher | Cipher algorithm |
key_len | Length of key |
cost | Cost (in cycles per byte) |
Definition at line 258 of file cipher_test.c.
References cipher_cost(), and cipher_decrypt.
Referenced by aes_test_exec(), des_test_exec(), and gcm_test_exec().