diff options
author | Jack Lloyd <[email protected]> | 2017-06-16 15:35:51 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-06-16 17:07:36 -0400 |
commit | 46e34bf0513129b76481477c4d07452cb48b3cd9 (patch) | |
tree | d233736ee6cf901d70ba2e377279654695c1fa32 /src/tests/test_block.cpp | |
parent | 37dac0dc7e1f28e30d25c544cc16dcf49575a0b4 (diff) |
Add SM4 block cipher
This work was sponsored by Ribose Inc
Diffstat (limited to 'src/tests/test_block.cpp')
-rw-r--r-- | src/tests/test_block.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/tests/test_block.cpp b/src/tests/test_block.cpp index 7f4856374..16f83a1cb 100644 --- a/src/tests/test_block.cpp +++ b/src/tests/test_block.cpp @@ -12,7 +12,7 @@ namespace Botan_Tests { class Block_Cipher_Tests : public Text_Based_Test { public: - Block_Cipher_Tests() : Text_Based_Test("block", "Key,In,Out") {} + Block_Cipher_Tests() : Text_Based_Test("block", "Key,In,Out", "Iterations") {} std::vector<std::string> possible_providers(const std::string& algo) override { @@ -24,6 +24,7 @@ class Block_Cipher_Tests : public Text_Based_Test const std::vector<uint8_t> key = get_req_bin(vars, "Key"); const std::vector<uint8_t> input = get_req_bin(vars, "In"); const std::vector<uint8_t> expected = get_req_bin(vars, "Out"); + const size_t iterations = get_opt_sz(vars, "Iterations", 1); Test::Result result(algo); @@ -69,13 +70,20 @@ class Block_Cipher_Tests : public Text_Based_Test // have called set_key on clone: process input values std::vector<uint8_t> buf = input; - cipher->encrypt(buf); + for(size_t i = 0; i != iterations; ++i) + { + cipher->encrypt(buf); + } result.test_eq(provider, "encrypt", buf, expected); // always decrypt expected ciphertext vs what we produced above buf = expected; - cipher->decrypt(buf); + + for(size_t i = 0; i != iterations; ++i) + { + cipher->decrypt(buf); + } cipher->clear(); |