From 0deac093474ebd1dd5138b25ca7dd65b845f55c5 Mon Sep 17 00:00:00 2001 From: weidai Date: Thu, 5 Feb 2004 03:32:59 +0000 Subject: fix bug in EncryptionPairwiseConsistencyTest git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@145 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- fipstest.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'fipstest.cpp') diff --git a/fipstest.cpp b/fipstest.cpp index f4fb694..7a3f1a5 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 (...) { -- cgit v1.2.1