diff options
Diffstat (limited to 'src/tests/cipher_test.h')
-rw-r--r-- | src/tests/cipher_test.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/tests/cipher_test.h b/src/tests/cipher_test.h index 4139a77..519d12e 100644 --- a/src/tests/cipher_test.h +++ b/src/tests/cipher_test.h @@ -35,6 +35,10 @@ struct cipher_test { const void *ciphertext; /** Length of text */ size_t len; + /** Authentication tag */ + const void *auth; + /** Length of authentication tag */ + size_t auth_len; }; /** Define inline key */ @@ -52,6 +56,9 @@ struct cipher_test { /** Define inline ciphertext data */ #define CIPHERTEXT(...) { __VA_ARGS__ } +/** Define inline authentication tag */ +#define AUTH(...) { __VA_ARGS__ } + /** * Define a cipher test * @@ -62,16 +69,18 @@ struct cipher_test { * @v ADDITIONAL Additional data * @v PLAINTEXT Plaintext * @v CIPHERTEXT Ciphertext + * @v AUTH Authentication tag * @ret test Cipher test */ #define CIPHER_TEST( name, CIPHER, KEY, IV, ADDITIONAL, PLAINTEXT, \ - CIPHERTEXT ) \ + CIPHERTEXT, AUTH ) \ static const uint8_t name ## _key [] = KEY; \ static const uint8_t name ## _iv [] = IV; \ static const uint8_t name ## _additional [] = ADDITIONAL; \ static const uint8_t name ## _plaintext [] = PLAINTEXT; \ static const uint8_t name ## _ciphertext \ [ sizeof ( name ## _plaintext ) ] = CIPHERTEXT; \ + static const uint8_t name ## _auth [] = AUTH; \ static struct cipher_test name = { \ .cipher = CIPHER, \ .key = name ## _key, \ @@ -83,6 +92,8 @@ struct cipher_test { .plaintext = name ## _plaintext, \ .ciphertext = name ## _ciphertext, \ .len = sizeof ( name ## _plaintext ), \ + .auth = name ## _auth, \ + .auth_len = sizeof ( name ## _auth ), \ } extern void cipher_encrypt_okx ( struct cipher_test *test, const char *file, |