fix bug in EncryptionPairwiseConsistencyTest
parent
b3d19ce83c
commit
94f405b94b
21
fipstest.cpp
21
fipstest.cpp
|
|
@ -165,9 +165,7 @@ void EncryptionPairwiseConsistencyTest(const PK_Encryptor &encryptor, const PK_D
|
||||||
RandomNumberGenerator &rng = NullRNG();
|
RandomNumberGenerator &rng = NullRNG();
|
||||||
#endif
|
#endif
|
||||||
const char *testMessage ="test message";
|
const char *testMessage ="test message";
|
||||||
|
std::string ciphertext, decrypted;
|
||||||
EqualityComparisonFilter comparison;
|
|
||||||
comparison.ChannelPutMessageEnd("0", (const byte *)testMessage, strlen(testMessage));
|
|
||||||
|
|
||||||
StringSource(
|
StringSource(
|
||||||
testMessage,
|
testMessage,
|
||||||
|
|
@ -175,10 +173,21 @@ void EncryptionPairwiseConsistencyTest(const PK_Encryptor &encryptor, const PK_D
|
||||||
new PK_EncryptorFilter(
|
new PK_EncryptorFilter(
|
||||||
rng,
|
rng,
|
||||||
encryptor,
|
encryptor,
|
||||||
new PK_DecryptorFilter(rng, decryptor, new ChannelSwitch(comparison, "1"))));
|
new StringSink(ciphertext)));
|
||||||
|
|
||||||
comparison.ChannelMessageSeriesEnd("0");
|
if (ciphertext == testMessage)
|
||||||
comparison.ChannelMessageSeriesEnd("1");
|
throw 0;
|
||||||
|
|
||||||
|
StringSource(
|
||||||
|
ciphertext,
|
||||||
|
true,
|
||||||
|
new PK_DecryptorFilter(
|
||||||
|
rng,
|
||||||
|
decryptor,
|
||||||
|
new StringSink(decrypted)));
|
||||||
|
|
||||||
|
if (decrypted != testMessage)
|
||||||
|
throw 0;
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue