summaryrefslogtreecommitdiff
path: root/fipstest.cpp
diff options
context:
space:
mode:
authorweidai <weidai11@users.noreply.github.com>2004-02-05 03:32:59 +0000
committerweidai <weidai11@users.noreply.github.com>2004-02-05 03:32:59 +0000
commit94f405b94b3bd1b6723117a16af72b7d06dee251 (patch)
treebde2d750290eb7928e39118cf8da991e18151642 /fipstest.cpp
parentb3d19ce83cbce76e832c43e7de09c679e2cb5cbd (diff)
downloadcryptopp-git-94f405b94b3bd1b6723117a16af72b7d06dee251.tar.gz
fix bug in EncryptionPairwiseConsistencyTest
Diffstat (limited to 'fipstest.cpp')
-rw-r--r--fipstest.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/fipstest.cpp b/fipstest.cpp
index f4fb694b..7a3f1a59 100644
--- a/fipstest.cpp
+++ b/fipstest.cpp
@@ -165,9 +165,7 @@ void EncryptionPairwiseConsistencyTest(const PK_Encryptor &encryptor, const PK_D
RandomNumberGenerator &rng = NullRNG();
#endif
const char *testMessage ="test message";
-
- EqualityComparisonFilter comparison;
- comparison.ChannelPutMessageEnd("0", (const byte *)testMessage, strlen(testMessage));
+ std::string ciphertext, decrypted;
StringSource(
testMessage,
@@ -175,10 +173,21 @@ void EncryptionPairwiseConsistencyTest(const PK_Encryptor &encryptor, const PK_D
new PK_EncryptorFilter(
rng,
encryptor,
- new PK_DecryptorFilter(rng, decryptor, new ChannelSwitch(comparison, "1"))));
+ new StringSink(ciphertext)));
+
+ if (ciphertext == testMessage)
+ throw 0;
+
+ StringSource(
+ ciphertext,
+ true,
+ new PK_DecryptorFilter(
+ rng,
+ decryptor,
+ new StringSink(decrypted)));
- comparison.ChannelMessageSeriesEnd("0");
- comparison.ChannelMessageSeriesEnd("1");
+ if (decrypted != testMessage)
+ throw 0;
}
catch (...)
{