aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-11-26 06:00:56 -0500
committerJack Lloyd <[email protected]>2016-11-26 06:00:56 -0500
commitf397471782357aa57b55cf8d3ec5c3018e9b0aaf (patch)
tree34688bb2c326e40b4ac704ac42662f758e237aae /src/tests
parentc06d8a066b2c89b877350102fcf605caf247bb88 (diff)
When fuzzing verify/decrypt, choose a new value each time through loop
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test_pubkey.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp
index 122fb5784..654021805 100644
--- a/src/tests/test_pubkey.cpp
+++ b/src/tests/test_pubkey.cpp
@@ -36,12 +36,9 @@ void check_invalid_signatures(Test::Result& result,
const std::vector<uint8_t> zero_sig(signature.size());
result.test_eq("all zero signature invalid", verifier.verify_message(message, zero_sig), false);
- std::vector<uint8_t> bad_sig = signature;
-
for(size_t i = 0; i < Test::soak_level(); ++i)
{
- while(bad_sig == signature)
- bad_sig = Test::mutate_vec(bad_sig, true);
+ const std::vector<uint8_t> bad_sig = Test::mutate_vec(signature);
if(!result.test_eq("incorrect signature invalid",
verifier.verify_message(message, bad_sig), false))
@@ -56,14 +53,11 @@ void check_invalid_ciphertexts(Test::Result& result,
const std::vector<uint8_t>& plaintext,
const std::vector<uint8_t>& ciphertext)
{
- std::vector<uint8_t> bad_ctext = ciphertext;
-
size_t ciphertext_accepted = 0, ciphertext_rejected = 0;
for(size_t i = 0; i < Test::soak_level(); ++i)
{
- while(bad_ctext == ciphertext)
- bad_ctext = Test::mutate_vec(bad_ctext, true);
+ const std::vector<uint8_t> bad_ctext = Test::mutate_vec(ciphertext);
try
{