summaryrefslogtreecommitdiff
path: root/dh.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2008-11-21 05:30:16 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2008-11-21 05:30:16 +0000
commit514af6e3bd7ec2e16bc2524c7e77652983b13cb7 (patch)
tree52da2e56044c49342728f37f86f20ad3d07c8507 /dh.h
parent260b002fc017c4bf24ec72c4739d11babe9e1a99 (diff)
downloadcryptopp-514af6e3bd7ec2e16bc2524c7e77652983b13cb7.tar.gz
improve pairwise consistency test (Brian Pence)
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@424 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'dh.h')
-rw-r--r--dh.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/dh.h b/dh.h
index 933d94e..10e8d14 100644
--- a/dh.h
+++ b/dh.h
@@ -68,10 +68,10 @@ public:
Base::GeneratePublicKey(rng, privateKey2, publicKey2);
SecByteBlock agreedValue(this->AgreedValueLength()), agreedValue2(this->AgreedValueLength());
- this->Agree(agreedValue, privateKey, publicKey2);
- this->Agree(agreedValue2, privateKey2, publicKey);
+ bool agreed1 = this->Agree(agreedValue, privateKey, publicKey2);
+ bool agreed2 = this->Agree(agreedValue2, privateKey2, publicKey);
- if (agreedValue != agreedValue2)
+ if (!agreed1 || !agreed2 || agreedValue != agreedValue2)
throw SelfTestFailure(this->AlgorithmName() + ": pairwise consistency test failed");
}
}