Commit d120360c authored by vitalybuka's avatar vitalybuka Committed by Commit bot

Renamed GetMessage into GetNextMessage.

Windows defines GetMessage as GetMessageW.
This makes linking fail if p224_spake included after windows headers.

NOPRESUBMIT=true

Review URL: https://codereview.chromium.org/889663003

Cr-Commit-Position: refs/heads/master@{#313782}
parent 9c30a7e9
...@@ -131,7 +131,7 @@ void P224EncryptedKeyExchange::Init() { ...@@ -131,7 +131,7 @@ void P224EncryptedKeyExchange::Init() {
next_message_ = Xstar.ToString(); next_message_ = Xstar.ToString();
} }
const std::string& P224EncryptedKeyExchange::GetMessage() { const std::string& P224EncryptedKeyExchange::GetNextMessage() {
if (state_ == kStateInitial) { if (state_ == kStateInitial) {
state_ = kStateRecvDH; state_ = kStateRecvDH;
return next_message_; return next_message_;
...@@ -140,7 +140,7 @@ const std::string& P224EncryptedKeyExchange::GetMessage() { ...@@ -140,7 +140,7 @@ const std::string& P224EncryptedKeyExchange::GetMessage() {
return next_message_; return next_message_;
} }
LOG(FATAL) << "P224EncryptedKeyExchange::GetMessage called in" LOG(FATAL) << "P224EncryptedKeyExchange::GetNextMessage called in"
" bad state " << state_; " bad state " << state_;
next_message_ = ""; next_message_ = "";
return next_message_; return next_message_;
......
...@@ -23,10 +23,10 @@ namespace crypto { ...@@ -23,10 +23,10 @@ namespace crypto {
// permitted authentication attempts otherwise they get many one-shot oracles.) // permitted authentication attempts otherwise they get many one-shot oracles.)
// //
// The protocol requires several RTTs (actually two, but you shouldn't assume // The protocol requires several RTTs (actually two, but you shouldn't assume
// that.) To use the object, call GetMessage() and pass that message to the // that.) To use the object, call GetNextMessage() and pass that message to the
// peer. Get a message from the peer and feed it into ProcessMessage. Then // peer. Get a message from the peer and feed it into ProcessMessage. Then
// examine the return value of ProcessMessage: // examine the return value of ProcessMessage:
// kResultPending: Another round is required. Call GetMessage and repeat. // kResultPending: Another round is required. Call GetNextMessage and repeat.
// kResultFailed: The authentication has failed. You can get a human readable // kResultFailed: The authentication has failed. You can get a human readable
// error message by calling error(). // error message by calling error().
// kResultSuccess: The authentication was successful. // kResultSuccess: The authentication was successful.
...@@ -55,12 +55,12 @@ class CRYPTO_EXPORT P224EncryptedKeyExchange { ...@@ -55,12 +55,12 @@ class CRYPTO_EXPORT P224EncryptedKeyExchange {
P224EncryptedKeyExchange(PeerType peer_type, P224EncryptedKeyExchange(PeerType peer_type,
const base::StringPiece& password); const base::StringPiece& password);
// GetMessage returns a byte string which must be passed to the other party // GetNextMessage returns a byte string which must be passed to the other
// in the authentication. // party in the authentication.
const std::string& GetMessage(); const std::string& GetNextMessage();
// ProcessMessage processes a message which must have been generated by a // ProcessMessage processes a message which must have been generated by a
// call to GetMessage() by the other party. // call to GetNextMessage() by the other party.
Result ProcessMessage(const base::StringPiece& message); Result ProcessMessage(const base::StringPiece& message);
// In the event that ProcessMessage() returns kResultFailed, error will // In the event that ProcessMessage() returns kResultFailed, error will
...@@ -95,7 +95,7 @@ class CRYPTO_EXPORT P224EncryptedKeyExchange { ...@@ -95,7 +95,7 @@ class CRYPTO_EXPORT P224EncryptedKeyExchange {
State state_; State state_;
const bool is_server_; const bool is_server_;
// next_message_ contains a value for GetMessage() to return. // next_message_ contains a value for GetNextMessage() to return.
std::string next_message_; std::string next_message_;
std::string error_; std::string error_;
......
...@@ -23,8 +23,8 @@ bool RunExchange(P224EncryptedKeyExchange* client, ...@@ -23,8 +23,8 @@ bool RunExchange(P224EncryptedKeyExchange* client,
bool is_password_same) { bool is_password_same) {
for (;;) { for (;;) {
std::string client_message, server_message; std::string client_message, server_message;
client_message = client->GetMessage(); client_message = client->GetNextMessage();
server_message = server->GetMessage(); server_message = server->GetNextMessage();
P224EncryptedKeyExchange::Result client_result, server_result; P224EncryptedKeyExchange::Result client_result, server_result;
client_result = client->ProcessMessage(server_message); client_result = client->ProcessMessage(server_message);
...@@ -85,13 +85,13 @@ TEST(MutualAuth, ExpectedValues) { ...@@ -85,13 +85,13 @@ TEST(MutualAuth, ExpectedValues) {
kPassword); kPassword);
server.SetXForTesting("Server x"); server.SetXForTesting("Server x");
std::string client_message = client.GetMessage(); std::string client_message = client.GetNextMessage();
EXPECT_EQ( EXPECT_EQ(
"3508EF7DECC8AB9F9C439FBB0154288BBECC0A82E8448F4CF29554EB" "3508EF7DECC8AB9F9C439FBB0154288BBECC0A82E8448F4CF29554EB"
"BE9D486686226255EAD1D077C635B1A41F46AC91D7F7F32CED9EC3E0", "BE9D486686226255EAD1D077C635B1A41F46AC91D7F7F32CED9EC3E0",
HexEncodeString(client_message)); HexEncodeString(client_message));
std::string server_message = server.GetMessage(); std::string server_message = server.GetNextMessage();
EXPECT_EQ( EXPECT_EQ(
"A3088C18B75D2C2B107105661AEC85424777475EB29F1DDFB8C14AFB" "A3088C18B75D2C2B107105661AEC85424777475EB29F1DDFB8C14AFB"
"F1603D0DF38413A00F420ACF2059E7997C935F5A957A193D09A2B584", "F1603D0DF38413A00F420ACF2059E7997C935F5A957A193D09A2B584",
...@@ -129,8 +129,8 @@ TEST(MutualAuth, Fuzz) { ...@@ -129,8 +129,8 @@ TEST(MutualAuth, Fuzz) {
for (unsigned round = 0;; round++) { for (unsigned round = 0;; round++) {
std::string client_message, server_message; std::string client_message, server_message;
client_message = client.GetMessage(); client_message = client.GetNextMessage();
server_message = server.GetMessage(); server_message = server.GetNextMessage();
if ((rand & 1) == round) { if ((rand & 1) == round) {
const bool server_or_client = rand & 2; const bool server_or_client = rand & 2;
......
...@@ -64,7 +64,7 @@ V2Authenticator::V2Authenticator( ...@@ -64,7 +64,7 @@ V2Authenticator::V2Authenticator(
state_(initial_state), state_(initial_state),
started_(false), started_(false),
rejection_reason_(INVALID_CREDENTIALS) { rejection_reason_(INVALID_CREDENTIALS) {
pending_messages_.push(key_exchange_impl_.GetMessage()); pending_messages_.push(key_exchange_impl_.GetNextMessage());
} }
V2Authenticator::~V2Authenticator() { V2Authenticator::~V2Authenticator() {
...@@ -135,7 +135,7 @@ void V2Authenticator::ProcessMessageInternal(const buzz::XmlElement* message) { ...@@ -135,7 +135,7 @@ void V2Authenticator::ProcessMessageInternal(const buzz::XmlElement* message) {
started_ = true; started_ = true;
switch (result) { switch (result) {
case P224EncryptedKeyExchange::kResultPending: case P224EncryptedKeyExchange::kResultPending:
pending_messages_.push(key_exchange_impl_.GetMessage()); pending_messages_.push(key_exchange_impl_.GetNextMessage());
break; break;
case P224EncryptedKeyExchange::kResultFailed: case P224EncryptedKeyExchange::kResultFailed:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment