diff options
author | Daniel Neus <[email protected]> | 2016-07-25 18:06:39 +0200 |
---|---|---|
committer | Daniel Neus <[email protected]> | 2016-07-26 13:03:00 +0200 |
commit | 6815421f6bb0ba73cc8c1f59b5cd4c997b7c103d (patch) | |
tree | 119708a87f2ffa784dc0f62172aced3d012b7141 /src/tests | |
parent | 5d50db6e964a9305d7271301804a1dcb4ce22606 (diff) |
add test for BlockCipher::clear()
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test_block.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tests/test_block.cpp b/src/tests/test_block.cpp index 75a460bc7..0863cb891 100644 --- a/src/tests/test_block.cpp +++ b/src/tests/test_block.cpp @@ -45,6 +45,12 @@ class Block_Cipher_Tests : public Text_Based_Test result.test_gte(provider, cipher->block_size(), 8); result.test_gte(provider, cipher->parallel_bytes(), cipher->block_size() * cipher->parallelism()); + // Test to make sure clear() resets what we need it to + cipher->set_key(Test::rng().random_vec(cipher->key_spec().minimum_keylength())); + Botan::secure_vector<byte> garbage = Test::rng().random_vec(cipher->block_size()); + cipher->encrypt(garbage); + cipher->clear(); + cipher->set_key(key); std::vector<uint8_t> buf = input; |