diff options
author | Jack Lloyd <[email protected]> | 2015-08-28 20:21:12 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-08-28 20:21:12 -0400 |
commit | f10c51de2e50746b9689332860563aa4f2ce8aa6 (patch) | |
tree | b1488bc7b89213648d042a7bae32b63bc56afd2e /src/tests/test_pubkey.cpp | |
parent | f7f94b4a22f569098fd4a741ced382346c040530 (diff) |
Fix pk signature test framework bug.
Was attempting to test that the all-zero signature is invalid, then
tested some mutated signatures. Unfortunately it zeroed out the
signature before doing the mutation tests, so the mutated signatures
were all very-low Hamming weight strings instead of being close to
the original valid signature.
Diffstat (limited to 'src/tests/test_pubkey.cpp')
-rw-r--r-- | src/tests/test_pubkey.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp index c3f2017f6..f5528af12 100644 --- a/src/tests/test_pubkey.cpp +++ b/src/tests/test_pubkey.cpp @@ -253,11 +253,7 @@ size_t validate_signature(PK_Verifier& v, PK_Signer& s, const std::string& algo, PK_TEST(v.verify_message(message, sig), "Correct signature is valid"); - zero_mem(sig.data(), sig.size()); - - PK_TEST(!v.verify_message(message, sig), "All-zero signature is invalid"); - - for(size_t i = 0; i != 3; ++i) + for(size_t i = 0; i != 5; ++i) { auto bad_sig = sig; @@ -267,6 +263,10 @@ size_t validate_signature(PK_Verifier& v, PK_Signer& s, const std::string& algo, PK_TEST(!v.verify_message(message, bad_sig), "Incorrect signature is invalid"); } + zero_mem(sig.data(), sig.size()); + + PK_TEST(!v.verify_message(message, sig), "All-zero signature is invalid"); + return fails; } |