summaryrefslogtreecommitdiff
path: root/datatest.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2021-03-18 22:46:58 -0400
committerJeffrey Walton <noloader@gmail.com>2021-03-18 22:46:58 -0400
commit07951c11e5d184e97fe811a76bf242d07c56b84a (patch)
treec80b20c7e2ff853340b38684db095dff27f58322 /datatest.cpp
parentdb35e1d44cf05f5d101e03f8dab69b1ff743fd6b (diff)
downloadcryptopp-git-07951c11e5d184e97fe811a76bf242d07c56b84a.tar.gz
Cut-in TestSymmetricCipherWithFileSource (GH #672, GH #1010)
Diffstat (limited to 'datatest.cpp')
-rw-r--r--datatest.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/datatest.cpp b/datatest.cpp
index 50659291..22e80988 100644
--- a/datatest.cpp
+++ b/datatest.cpp
@@ -590,8 +590,8 @@ void TestSymmetricCipher(TestData &v, const NameValuePairs &overrideParameters,
if (encrypted != ciphertext)
{
std::cout << "\nincorrectly encrypted: ";
- StringSource xx(encrypted, false, new HexEncoder(new FileSink(std::cout)));
- xx.Pump(256); xx.Flush(false);
+ StringSource ss(encrypted, false, new HexEncoder(new FileSink(std::cout)));
+ ss.Pump(256); ss.Flush(false);
std::cout << "\n";
SignalTestFailure();
}
@@ -619,8 +619,8 @@ void TestSymmetricCipher(TestData &v, const NameValuePairs &overrideParameters,
if (test != "EncryptXorDigest" ? encrypted != ciphertext : xorDigest != ciphertextXorDigest)
{
std::cout << "\nincorrectly encrypted: ";
- StringSource xx(encrypted, false, new HexEncoder(new FileSink(std::cout)));
- xx.Pump(2048); xx.Flush(false);
+ StringSource ss(encrypted, false, new HexEncoder(new FileSink(std::cout)));
+ ss.Pump(2048); ss.Flush(false);
std::cout << "\n";
SignalTestFailure();
}
@@ -636,8 +636,8 @@ void TestSymmetricCipher(TestData &v, const NameValuePairs &overrideParameters,
if (decrypted != plaintext)
{
std::cout << "\nincorrectly decrypted: ";
- StringSource xx(decrypted, false, new HexEncoder(new FileSink(std::cout)));
- xx.Pump(256); xx.Flush(false);
+ StringSource ss(decrypted, false, new HexEncoder(new FileSink(std::cout)));
+ ss.Pump(256); ss.Flush(false);
std::cout << "\n";
SignalTestFailure();
}
@@ -750,8 +750,8 @@ void TestSymmetricCipherWithFileSource(TestData &v, const NameValuePairs &overri
if (encrypted != ciphertext)
{
std::cout << "\nincorrectly encrypted: ";
- StringSource xx(encrypted, false, new HexEncoder(new FileSink(std::cout)));
- xx.Pump(2048); xx.Flush(false);
+ StringSource ss(encrypted, false, new HexEncoder(new FileSink(std::cout)));
+ ss.Pump(2048); ss.Flush(false);
std::cout << "\n";
SignalTestFailure();
}
@@ -767,8 +767,8 @@ void TestSymmetricCipherWithFileSource(TestData &v, const NameValuePairs &overri
if (decrypted != plaintext)
{
std::cout << "\nincorrectly decrypted: ";
- StringSource xx(decrypted, false, new HexEncoder(new FileSink(std::cout)));
- xx.Pump(256); xx.Flush(false);
+ StringSource ss(decrypted, false, new HexEncoder(new FileSink(std::cout)));
+ ss.Pump(256); ss.Flush(false);
std::cout << "\n";
SignalTestFailure();
}
@@ -834,16 +834,16 @@ void TestAuthenticatedSymmetricCipher(TestData &v, const NameValuePairs &overrid
if (test == "Encrypt" && encrypted != ciphertext+mac)
{
std::cout << "\nincorrectly encrypted: ";
- StringSource xx(encrypted, false, new HexEncoder(new FileSink(std::cout)));
- xx.Pump(2048); xx.Flush(false);
+ StringSource ss(encrypted, false, new HexEncoder(new FileSink(std::cout)));
+ ss.Pump(2048); ss.Flush(false);
std::cout << "\n";
SignalTestFailure();
}
if (test == "Encrypt" && decrypted != plaintext)
{
std::cout << "\nincorrectly decrypted: ";
- StringSource xx(decrypted, false, new HexEncoder(new FileSink(std::cout)));
- xx.Pump(256); xx.Flush(false);
+ StringSource ss(decrypted, false, new HexEncoder(new FileSink(std::cout)));
+ ss.Pump(256); ss.Flush(false);
std::cout << "\n";
SignalTestFailure();
}
@@ -1110,8 +1110,9 @@ void TestDataFile(std::string filename, const NameValuePairs &overrideParameters
TestSignatureScheme(v, totalTests);
else if (algType == "SymmetricCipher")
{
+ TestData vv(v); // Used with TestSymmetricCipherWithFileSource
TestSymmetricCipher(v, overrideParameters, totalTests);
- // TestSymmetricCipherWithFileSource(v, overrideParameters, totalTests);
+ TestSymmetricCipherWithFileSource(vv, overrideParameters, totalTests);
}
else if (algType == "AuthenticatedSymmetricCipher")
TestAuthenticatedSymmetricCipher(v, overrideParameters, totalTests);