aboutsummaryrefslogtreecommitdiffstats
path: root/checks
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-10-01 14:06:58 +0000
committerlloyd <[email protected]>2008-10-01 14:06:58 +0000
commit9b3a3590dc780cd22390ddece4635d1c919fc733 (patch)
tree1f2d96e07ab8a0c972956e4ab907a49f37487ed4 /checks
parent988ed628fb68deb32e8ff54cc1e4eb8d06f53f34 (diff)
During the public key test suite, print . if the test passed, ? if the
algorithm could not be found, or X if the test fails. Before, one could disable (say) NR, and the NR tests would all look to pass, because they are being silently skipped. This gives some feedback that the test is not actually being run.
Diffstat (limited to 'checks')
-rw-r--r--checks/pk.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/checks/pk.cpp b/checks/pk.cpp
index 618ba8f25..69221a1c5 100644
--- a/checks/pk.cpp
+++ b/checks/pk.cpp
@@ -459,9 +459,9 @@ u32bit validate_nr_sig(const std::string& algo,
if(str.size() != 8)
throw Exception("Invalid input from pk_valid.dat");
- bool failure = false;
#if defined(BOTAN_HAS_NR)
+
DL_Group domain(to_bigint(str[0]), to_bigint(str[1]), to_bigint(str[2]));
NR_PrivateKey privkey(rng, domain, to_bigint(str[4]));
NR_PublicKey pubkey = privkey;
@@ -471,10 +471,12 @@ u32bit validate_nr_sig(const std::string& algo,
PK_Verifier* v = get_pk_verifier(pubkey, emsa);
PK_Signer* s = get_pk_signer(privkey, emsa);
+ bool failure = false;
validate_signature(v, s, algo, str[5], str[6], str[7], failure);
+ return (failure ? 1 : 0);
#endif
- return (failure ? 1 : 0);
+ return 2;
}
u32bit validate_dh(const std::string& algo,
@@ -672,9 +674,6 @@ u32bit do_pk_validation_tests(const std::string& filename,
continue;
}
- std::cout << '.';
- std::cout.flush();
-
std::vector<std::string> substr = parse(line);
#if DEBUG
@@ -718,15 +717,25 @@ u32bit do_pk_validation_tests(const std::string& filename,
std::cout << "WARNING: Unknown PK algorithm "
<< algorithm << std::endl;
+ if(new_errors == 0) // OK
+ std::cout << '.';
+ else if(new_errors == 1) // test failed
+ std::cout << 'X';
+ else if(new_errors == 2) // unknown algo
+ std::cout << '?';
+
+ std::cout.flush();
+
alg_count++;
- errors += new_errors;
+ if(new_errors == 1)
+ errors += new_errors;
}
catch(std::exception& e)
{
std::cout << "Exception: " << e.what() << "\n";
}
- if(new_errors)
+ if(new_errors == 1)
std::cout << "ERROR: \"" << algorithm << "\" failed test #"
<< std::dec << alg_count << std::endl;
}