diff options
author | lloyd <[email protected]> | 2006-06-07 08:58:09 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-06-07 08:58:09 +0000 |
commit | 877bcfb5e7265f9bae084c5328a3fb61bc3d6618 (patch) | |
tree | cab19f994d13c0005f0a11031e2ed8c948c5db99 | |
parent | 580b9c13fb15c91fbc3187f0171f482f65316754 (diff) |
Revert last change to check.cpp (didn't mean to commit that)
Commit the actual squaring tests in checks/bigint.cpp
-rw-r--r-- | checks/bigint.cpp | 18 | ||||
-rw-r--r-- | checks/check.cpp | 6 |
2 files changed, 21 insertions, 3 deletions
diff --git a/checks/bigint.cpp b/checks/bigint.cpp index b4e8a574d..8ace987e0 100644 --- a/checks/bigint.cpp +++ b/checks/bigint.cpp @@ -16,6 +16,7 @@ using namespace Botan; u32bit check_add(const std::vector<std::string>&); u32bit check_sub(const std::vector<std::string>&); u32bit check_mul(const std::vector<std::string>&); +u32bit check_sqr(const std::vector<std::string>&); u32bit check_div(const std::vector<std::string>&); u32bit check_mod(const std::vector<std::string>&); u32bit check_shr(const std::vector<std::string>&); @@ -91,6 +92,8 @@ u32bit do_bigint_tests(const std::string& filename) new_errors = check_sub(substr); else if(algorithm.find("Multiplication") != std::string::npos) new_errors = check_mul(substr); + else if(algorithm.find("Square") != std::string::npos) + new_errors = check_sqr(substr); else if(algorithm.find("Division") != std::string::npos) new_errors = check_div(substr); else if(algorithm.find("Modulo") != std::string::npos) @@ -141,6 +144,7 @@ u32bit results(std::string op, std::cout << "a = " << std::hex << a << std::endl; std::cout << "b = " << std::hex << b << std::endl; + std::cout << "c = " << std::hex << c << std::endl; std::cout << "d = " << std::hex << d << std::endl; std::cout << "e = " << std::hex << e << std::endl; @@ -218,6 +222,20 @@ u32bit check_mul(const std::vector<std::string>& args) return results("*", a, b, c, d, e); } +u32bit check_sqr(const std::vector<std::string>& args) + { + BigInt a(args[0]); + BigInt b(args[1]); + + a.grow_reg(16); + b.grow_reg(16); + + BigInt c = square(a); + BigInt d = a * a; + + return results("sqr", a, a, b, c, d); + } + u32bit check_div(const std::vector<std::string>& args) { BigInt a(args[0]); diff --git a/checks/check.cpp b/checks/check.cpp index 177632d0a..81bb92220 100644 --- a/checks/check.cpp +++ b/checks/check.cpp @@ -173,10 +173,10 @@ int validate() test_types(); u32bit errors = 0; try { - //errors += do_validation_tests(VALIDATION_FILE); - // errors += do_validation_tests(EXPECTED_FAIL_FILE, false); + errors += do_validation_tests(VALIDATION_FILE); + errors += do_validation_tests(EXPECTED_FAIL_FILE, false); errors += do_bigint_tests(BIGINT_VALIDATION_FILE); - // errors += do_pk_validation_tests(PK_VALIDATION_FILE); + errors += do_pk_validation_tests(PK_VALIDATION_FILE); } catch(Botan::Exception& e) { |