diff options
Diffstat (limited to 'src/tests/cipher_test.c')
-rw-r--r-- | src/tests/cipher_test.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/tests/cipher_test.c b/src/tests/cipher_test.c index 5361502ff..c49b4b69b 100644 --- a/src/tests/cipher_test.c +++ b/src/tests/cipher_test.c @@ -63,6 +63,12 @@ void cipher_encrypt_okx ( struct cipher_test *test, const char *file, file, line ); cipher_setiv ( cipher, ctx, test->iv, test->iv_len ); + /* Process additional data, if applicable */ + if ( test->additional_len ) { + cipher_encrypt ( cipher, ctx, test->additional, NULL, + test->additional_len ); + } + /* Perform encryption */ cipher_encrypt ( cipher, ctx, test->plaintext, ciphertext, len ); @@ -89,7 +95,13 @@ void cipher_decrypt_okx ( struct cipher_test *test, const char *file, file, line ); cipher_setiv ( cipher, ctx, test->iv, test->iv_len ); - /* Perform encryption */ + /* Process additional data, if applicable */ + if ( test->additional_len ) { + cipher_decrypt ( cipher, ctx, test->additional, NULL, + test->additional_len ); + } + + /* Perform decryption */ cipher_decrypt ( cipher, ctx, test->ciphertext, plaintext, len ); /* Compare against expected plaintext */ |