4 FILE_LICENCE ( GPL2_OR_LATER );
7 #include <ipxe/crypto.h>
10 extern int cbc_test_encrypt ( struct cipher_algorithm *cipher, const void *key,
11 size_t key_len, const void *iv,
12 const void *plaintext,
13 const void *expected_ciphertext, size_t len );
14 extern int cbc_test_decrypt ( struct cipher_algorithm *cipher, const void *key,
15 size_t key_len, const void *iv,
16 const void *ciphertext,
17 const void *expected_plaintext, size_t len );
18 extern unsigned long cbc_cost_encrypt ( struct cipher_algorithm *cipher,
20 extern unsigned long cbc_cost_decrypt ( struct cipher_algorithm *cipher,
24 * Report CBC encryption test result
26 * @v cipher Cipher algorithm
28 * @v key_len Length of key
29 * @v iv Initialisation vector
30 * @v plaintext Plaintext data
31 * @v expected_ciphertext Expected ciphertext data
32 * @v len Length of data
34 #define cbc_encrypt_ok( cipher, key, key_len, iv, plaintext, \
35 expected_ciphertext, len ) do { \
36 ok ( cbc_test_encrypt ( cipher, key, key_len, iv, plaintext, \
37 expected_ciphertext, len ) ); \
41 * Report CBC decryption test result
43 * @v cipher Cipher algorithm
45 * @v key_len Length of key
46 * @v iv Initialisation vector
47 * @v ciphertext Ciphertext data
48 * @v expected_plaintext Expected plaintext data
49 * @v len Length of data
51 #define cbc_decrypt_ok( cipher, key, key_len, iv, ciphertext, \
52 expected_plaintext, len ) do { \
53 ok ( cbc_test_decrypt ( cipher, key, key_len, iv, ciphertext, \
54 expected_plaintext, len ) ); \
57 #endif /* _CBC_TEST_H */