45#define KEY(...) { __VA_ARGS__ }
48#define IV(...) { __VA_ARGS__ }
51#define ADDITIONAL(...) { __VA_ARGS__ }
54#define PLAINTEXT(...) { __VA_ARGS__ }
57#define CIPHERTEXT(...) { __VA_ARGS__ }
60#define AUTH(...) { __VA_ARGS__ }
75#define CIPHER_TEST( name, CIPHER, KEY, IV, ADDITIONAL, PLAINTEXT, \
77 static const uint8_t name ## _key [] = KEY; \
78 static const uint8_t name ## _iv [] = IV; \
79 static const uint8_t name ## _additional [] = ADDITIONAL; \
80 static const uint8_t name ## _plaintext [] = PLAINTEXT; \
81 static const uint8_t name ## _ciphertext \
82 [ sizeof ( name ## _plaintext ) ] = CIPHERTEXT; \
83 static const uint8_t name ## _auth [] = AUTH; \
84 static struct cipher_test name = { \
86 .key = name ## _key, \
87 .key_len = sizeof ( name ## _key ), \
89 .iv_len = sizeof ( name ## _iv ), \
90 .additional = name ## _additional, \
91 .additional_len = sizeof ( name ## _additional ), \
92 .plaintext = name ## _plaintext, \
93 .ciphertext = name ## _ciphertext, \
94 .len = sizeof ( name ## _plaintext ), \
95 .auth = name ## _auth, \
96 .auth_len = sizeof ( name ## _auth ), \
115#define cipher_encrypt_ok( test ) \
116 cipher_encrypt_okx ( test, __FILE__, __LINE__ )
123#define cipher_decrypt_ok( test ) \
124 cipher_decrypt_okx ( test, __FILE__, __LINE__ )
131#define cipher_ok( test ) \
132 cipher_okx ( test, __FILE__, __LINE__ )
unsigned long cipher_cost_decrypt(struct cipher_algorithm *cipher, size_t key_len)
Calculate cipher decryption cost.
unsigned long cipher_cost_encrypt(struct cipher_algorithm *cipher, size_t key_len)
Calculate cipher encryption cost.
void cipher_decrypt_okx(struct cipher_test *test, const char *file, unsigned int line)
Report a cipher decryption test result.
void cipher_encrypt_okx(struct cipher_test *test, const char *file, unsigned int line)
Report a cipher encryption test result.
void cipher_okx(struct cipher_test *test, const char *file, unsigned int line)
Report a cipher encryption and decryption test result.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
const void * plaintext
Plaintext.
const void * ciphertext
Ciphertext.
size_t auth_len
Length of authentication tag.
struct cipher_algorithm * cipher
Cipher algorithm.
const void * iv
Initialisation vector.
size_t key_len
Length of key.
size_t len
Length of text.
size_t additional_len
Length of additional data.
const void * auth
Authentication tag.
const void * additional
Additional data.
size_t iv_len
Length of initialisation vector.
Self-test infrastructure.