aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/cipher_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/cipher_test.c')
-rw-r--r--src/tests/cipher_test.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tests/cipher_test.c b/src/tests/cipher_test.c
index cc732c2e0..2ead3c827 100644
--- a/src/tests/cipher_test.c
+++ b/src/tests/cipher_test.c
@@ -131,8 +131,18 @@ void cipher_decrypt_okx ( struct cipher_test *test, const char *file,
*/
void cipher_okx ( struct cipher_test *test, const char *file,
unsigned int line ) {
+ struct cipher_algorithm *cipher = test->cipher;
+ size_t len = test->len;
+ /* Sanity checks */
+ okx ( cipher->blocksize != 0, file, line );
+ okx ( ( len % cipher->blocksize ) == 0, file, line );
+ okx ( ( cipher->alignsize % cipher->blocksize ) == 0, file, line );
+
+ /* Report encryption test result */
cipher_encrypt_okx ( test, file, line );
+
+ /* Report decryption test result */
cipher_decrypt_okx ( test, file, line );
}