|
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(...) |
| Define inline key. | |
| #define | IV(...) |
| Define inline initialisation vector. | |
| #define | ADDITIONAL(...) |
| Define inline additional data. | |
| #define | PLAINTEXT(...) |
| Define inline plaintext data. | |
| #define | CIPHERTEXT(...) |
| Define inline ciphertext data. | |
| #define | AUTH(...) |
| Define inline authentication tag. | |
| #define | CIPHER_TEST(name, CIPHER, KEY, IV, ADDITIONAL, PLAINTEXT, CIPHERTEXT, AUTH) |
| Define a cipher test. | |
| #define | cipher_encrypt_ok(test) |
| Report a cipher encryption test result. | |
| #define | cipher_decrypt_ok(test) |
| Report a cipher decryption test result. | |
| #define | cipher_ok(test) |
| Report a cipher encryption and decryption test result. | |
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. | |
| void | cipher_decrypt_okx (struct cipher_test *test, const char *file, unsigned int line) |
| Report a cipher decryption test result. | |
| void | cipher_okx (struct cipher_test *test, const char *file, unsigned int line) |
| Report a cipher encryption and decryption test result. | |
| unsigned long | cipher_cost_encrypt (struct cipher_algorithm *cipher, size_t key_len) |
| Calculate cipher encryption cost. | |
| unsigned long | cipher_cost_decrypt (struct cipher_algorithm *cipher, size_t key_len) |
| Calculate cipher decryption cost. | |
Cipher self-tests.
Definition in file cipher_test.h.
| #define KEY | ( | ... | ) |
Define inline key.
Definition at line 45 of file cipher_test.h.
Referenced by CIPHER_TEST(), CIPHER_TEST(), HMAC_TEST(), HMAC_TEST(), HMAC_TEST(), HMAC_TEST(), and HMAC_TEST().
| #define IV | ( | ... | ) |
Define inline initialisation vector.
Definition at line 48 of file cipher_test.h.
Referenced by CIPHER_TEST().
| #define ADDITIONAL | ( | ... | ) |
| #define PLAINTEXT | ( | ... | ) |
Define inline plaintext data.
Definition at line 54 of file cipher_test.h.
Referenced by CIPHER_TEST(), CIPHER_TEST(), PUBKEY_SIGN_TEST(), PUBKEY_SIGN_TEST(), PUBKEY_SIGN_TEST(), PUBKEY_SIGN_TEST(), PUBKEY_SIGN_TEST(), PUBKEY_SIGN_TEST(), PUBKEY_SIGN_TEST(), PUBKEY_TEST(), and PUBKEY_TEST().
| #define CIPHERTEXT | ( | ... | ) |
Define inline ciphertext data.
Definition at line 57 of file cipher_test.h.
Referenced by CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), PUBKEY_TEST(), and PUBKEY_TEST().
| #define AUTH | ( | ... | ) |
Define inline authentication tag.
Definition at line 60 of file cipher_test.h.
Referenced by CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), CIPHER_TEST(), and CIPHER_TEST().
| #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 | ) |
Report a cipher encryption test result.
| test | Cipher test |
Definition at line 115 of file cipher_test.h.
| #define cipher_decrypt_ok | ( | test | ) |
Report a cipher decryption test result.
| test | Cipher test |
Definition at line 123 of file cipher_test.h.
| #define cipher_ok | ( | test | ) |
Report a cipher encryption and decryption test result.
| test | Cipher test |
Definition at line 131 of file cipher_test.h.
Referenced by aes_test_exec(), des_test_exec(), and gcm_test_exec().
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
extern |
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().
|
extern |
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().
|
extern |
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.
|
extern |
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().
|
extern |
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().