diff options
Diffstat (limited to 'test.cpp')
-rw-r--r-- | test.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -42,6 +42,10 @@ #include <console.h> #endif +#ifdef _OPENMP +# include <omp.h> +#endif + #ifdef __BORLANDC__ #pragma comment(lib, "cryptlib_bds.lib") #pragma comment(lib, "ws2_32.lib") @@ -113,6 +117,8 @@ int CRYPTOPP_API main(int argc, char *argv[]) #if defined(__MWERKS__) && defined(macintosh) argc = ccommand(&argv); #endif + + CRYPTOPP_UNUSED(argc), CRYPTOPP_UNUSED(argv); try { @@ -249,7 +255,7 @@ int CRYPTOPP_API main(int argc, char *argv[]) DigestFile(argv[2]); else if (command == "tv") { - std::string fname = argv[2]; + std::string fname = (argc >= 3 ? argv[2] : "all"); if (fname.find(".txt") == std::string::npos) fname = "TestVectors/" + fname + ".txt"; return !RunTestDataFile(fname.c_str()); @@ -767,9 +773,21 @@ bool Validate(int alg, bool thorough, const char *seedInput) std::string seed = seedInput ? std::string(seedInput) : IntToString(time(NULL)); seed.resize(16); - cout << "Using seed: " << seed << endl << endl; + cout << "Using seed: " << seed << endl; s_globalRNG.SetKeyWithIV((byte *)seed.data(), 16, (byte *)seed.data()); +#ifdef _OPENMP + int tc = 0; + #pragma omp parallel + { + tc = omp_get_num_threads(); + } + + cout << "Using " << tc << " OMP " << (tc == 1 ? "thread" : "threads") << endl; +#endif + + cout << endl; + switch (alg) { case 0: result = ValidateAll(thorough); break; |