diff options
author | Jeffrey Walton <noloader@gmail.com> | 2018-12-07 14:25:10 -0500 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2018-12-07 14:25:10 -0500 |
commit | 5b0df2592ae8b843a35ff2809589bd469d0013f0 (patch) | |
tree | 2bc681bcdb323d09ce5391135232758d8472d7cb | |
parent | 1c88fd6f59564f4933fd3d897503a5492feb726c (diff) | |
download | cryptopp-git-5b0df2592ae8b843a35ff2809589bd469d0013f0.tar.gz |
Handle test vectors with extensions
-rw-r--r-- | test.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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")
|