diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-13 07:00:19 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-13 07:00:19 +0000 |
commit | 78df46aceb47bbb91eb1c4fed658c87a366129dc (patch) | |
tree | f157058a51d424447a3e6ed39ab2ab14456d1b46 /crypto/p224_spake_unittest.cc | |
parent | 291d774464e6532e32d95e5d7b58fd4fe9c0ab40 (diff) | |
download | chromium_src-78df46aceb47bbb91eb1c4fed658c87a366129dc.zip chromium_src-78df46aceb47bbb91eb1c4fed658c87a366129dc.tar.gz chromium_src-78df46aceb47bbb91eb1c4fed658c87a366129dc.tar.bz2 |
Simplify SPAKE2 implementation.
Currently P224EncryptedKeyExchange uses two pieces of secret: password
and session-specific key. They are combined and used together as one
password. It is not really needed and the calling code can do
it when neccessary.
BUG=105214
Review URL: http://codereview.chromium.org/8903001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114189 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/p224_spake_unittest.cc')
-rw-r--r-- | crypto/p224_spake_unittest.cc | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/crypto/p224_spake_unittest.cc b/crypto/p224_spake_unittest.cc index e45ec82..bcd448c 100644 --- a/crypto/p224_spake_unittest.cc +++ b/crypto/p224_spake_unittest.cc @@ -43,37 +43,24 @@ bool RunExchange(P224EncryptedKeyExchange* client, } static const char kPassword[] = "foo"; -static const char kSession[] = "bar"; TEST(MutualAuth, CorrectAuth) { P224EncryptedKeyExchange client( - P224EncryptedKeyExchange::kPeerTypeClient, - kPassword, kSession); + P224EncryptedKeyExchange::kPeerTypeClient, kPassword); P224EncryptedKeyExchange server( - P224EncryptedKeyExchange::kPeerTypeServer, - kPassword, kSession); + P224EncryptedKeyExchange::kPeerTypeServer, kPassword); EXPECT_TRUE(RunExchange(&client, &server)); + EXPECT_EQ(client.GetKey(), server.GetKey()); } TEST(MutualAuth, IncorrectPassword) { P224EncryptedKeyExchange client( P224EncryptedKeyExchange::kPeerTypeClient, - kPassword, kSession); - P224EncryptedKeyExchange server( - P224EncryptedKeyExchange::kPeerTypeServer, - "wrongpassword", kSession); - - EXPECT_FALSE(RunExchange(&client, &server)); -} - -TEST(MutualAuth, IncorrectSession) { - P224EncryptedKeyExchange client( - P224EncryptedKeyExchange::kPeerTypeClient, - kPassword, kSession); + kPassword); P224EncryptedKeyExchange server( P224EncryptedKeyExchange::kPeerTypeServer, - kPassword, "wrongsession"); + "wrongpassword"); EXPECT_FALSE(RunExchange(&client, &server)); } @@ -83,11 +70,9 @@ TEST(MutualAuth, Fuzz) { for (unsigned i = 0; i < kIterations; i++) { P224EncryptedKeyExchange client( - P224EncryptedKeyExchange::kPeerTypeClient, - kPassword, kSession); + P224EncryptedKeyExchange::kPeerTypeClient, kPassword); P224EncryptedKeyExchange server( - P224EncryptedKeyExchange::kPeerTypeServer, - kPassword, kSession); + P224EncryptedKeyExchange::kPeerTypeServer, kPassword); // We'll only be testing small values of i, but we don't want that to bias // the test coverage. So we disperse the value of i by multiplying by the |