From 46e34bf0513129b76481477c4d07452cb48b3cd9 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Fri, 16 Jun 2017 15:35:51 -0400 Subject: Add SM4 block cipher This work was sponsored by Ribose Inc --- src/tests/test_block.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/tests/test_block.cpp') 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 possible_providers(const std::string& algo) override { @@ -24,6 +24,7 @@ class Block_Cipher_Tests : public Text_Based_Test const std::vector key = get_req_bin(vars, "Key"); const std::vector input = get_req_bin(vars, "In"); const std::vector 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 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(); -- cgit v1.2.3