summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-12-07 14:25:10 -0500
committerJeffrey Walton <noloader@gmail.com>2018-12-07 14:25:10 -0500
commit5b0df2592ae8b843a35ff2809589bd469d0013f0 (patch)
tree2bc681bcdb323d09ce5391135232758d8472d7cb
parent1c88fd6f59564f4933fd3d897503a5492feb726c (diff)
downloadcryptopp-git-5b0df2592ae8b843a35ff2809589bd469d0013f0.tar.gz
Handle test vectors with extensions
-rw-r--r--test.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/test.cpp b/test.cpp
index 8879c2c3..f4e70746 100644
--- a/test.cpp
+++ b/test.cpp
@@ -314,7 +314,9 @@ int scoped_main(int argc, char *argv[])
// TestDataFile() adds CRYPTOPP_DATA_DIR as required
std::string fname = (argv[2] ? argv[2] : "all");
if (fname.find(".txt") == std::string::npos)
- fname = "TestVectors/" + fname + ".txt";
+ fname += ".txt";
+ if (fname.find("TestVectors") == std::string::npos)
+ fname = "TestVectors/" + fname;
PrintSeedAndThreads();
return !RunTestDataFile(fname.c_str());
@@ -328,7 +330,7 @@ int scoped_main(int argc, char *argv[])
std::cin.getline(passPhrase, MAX_PHRASE_LENGTH);
std::cout << "\nPlaintext: ";
- std::cin.getline(plaintext, 1024);
+ std::cin.getline(plaintext, sizeof(plaintext));
std::string ciphertext = EncryptString(plaintext, passPhrase);
std::cout << "\nCiphertext: " << ciphertext << std::endl;
@@ -361,7 +363,7 @@ int scoped_main(int argc, char *argv[])
char thisSeed[1024];
std::cout << "\nRandom Seed: ";
std::ws(std::cin);
- std::cin.getline(thisSeed, 1024);
+ std::cin.getline(thisSeed, sizeof(thisSeed));
SecretShareFile(StringToValue<int, true>(argv[2]), StringToValue<int, true>(argv[3]), argv[4], thisSeed);
}
else if (command == "sr")