diff options
author | vadimt@chromium.org <vadimt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-11 00:03:33 +0000 |
---|---|---|
committer | vadimt@chromium.org <vadimt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-11 00:03:33 +0000 |
commit | 1d4b7c7ca38a12faaf5b8878428f57b4896c1496 (patch) | |
tree | 0292489017b8ce80fab92daf4dafe2f4a54fbd3e /remoting/protocol | |
parent | 9a07c2959da5398a6dd9176e1bbf31f6ab6dc89a (diff) | |
download | chromium_src-1d4b7c7ca38a12faaf5b8878428f57b4896c1496.zip chromium_src-1d4b7c7ca38a12faaf5b8878428f57b4896c1496.tar.gz chromium_src-1d4b7c7ca38a12faaf5b8878428f57b4896c1496.tar.bz2 |
Revert 239759 "The comment in base64.h implies that base::Base64..."
> The comment in base64.h implies that base::Base64Encode() can return false, but
> this cannot happen in practice. Fix the comment.
>
> The implementation of Base64Encode() attempts to check for the return value
> MODP_B64_ERROR as a failure, but modp_b64_encode() cannot return this
> value. Remove the check.
>
> Remove unneeded integer cast.
>
> Change the return type to void.
>
> BUG=323357
> TEST=base_unittests, compile all
> TBR=jochen@chromium.org,miket@chromium.org,joi@chromium.org,akalin@chromium.org,sergeyu@chromium.org
>
> Review URL: https://codereview.chromium.org/86913002
TBR=ricea@chromium.org
Review URL: https://codereview.chromium.org/101113004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239921 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol')
-rw-r--r-- | remoting/protocol/auth_util.cc | 4 | ||||
-rw-r--r-- | remoting/protocol/authenticator_test_base.cc | 2 | ||||
-rw-r--r-- | remoting/protocol/pairing_registry.cc | 6 | ||||
-rw-r--r-- | remoting/protocol/v2_authenticator.cc | 9 |
4 files changed, 15 insertions, 6 deletions
diff --git a/remoting/protocol/auth_util.cc b/remoting/protocol/auth_util.cc index 17263bf..4559636 100644 --- a/remoting/protocol/auth_util.cc +++ b/remoting/protocol/auth_util.cc @@ -26,7 +26,9 @@ std::string GenerateSupportAuthToken(const std::string& jid, const std::string& access_code) { std::string sha256 = crypto::SHA256HashString(jid + " " + access_code); std::string sha256_base64; - base::Base64Encode(sha256, &sha256_base64); + if (!base::Base64Encode(sha256, &sha256_base64)) { + LOG(FATAL) << "Failed to encode auth token"; + } return sha256_base64; } diff --git a/remoting/protocol/authenticator_test_base.cc b/remoting/protocol/authenticator_test_base.cc index 25b0efe..8311476 100644 --- a/remoting/protocol/authenticator_test_base.cc +++ b/remoting/protocol/authenticator_test_base.cc @@ -53,7 +53,7 @@ void AuthenticatorTestBase::SetUp() { std::string key_string; ASSERT_TRUE(base::ReadFileToString(key_path, &key_string)); std::string key_base64; - base::Base64Encode(key_string, &key_base64); + ASSERT_TRUE(base::Base64Encode(key_string, &key_base64)); key_pair_ = RsaKeyPair::FromString(key_base64); ASSERT_TRUE(key_pair_.get()); host_public_key_ = key_pair_->GetPublicKey(); diff --git a/remoting/protocol/pairing_registry.cc b/remoting/protocol/pairing_registry.cc index f1ce333..c159ce6 100644 --- a/remoting/protocol/pairing_registry.cc +++ b/remoting/protocol/pairing_registry.cc @@ -49,8 +49,10 @@ PairingRegistry::Pairing PairingRegistry::Pairing::Create( std::string shared_secret; char buffer[kKeySize]; crypto::RandBytes(buffer, arraysize(buffer)); - base::Base64Encode(base::StringPiece(buffer, arraysize(buffer)), - &shared_secret); + if (!base::Base64Encode(base::StringPiece(buffer, arraysize(buffer)), + &shared_secret)) { + LOG(FATAL) << "Base64Encode failed."; + } return Pairing(created_time, client_name, client_id, shared_secret); } diff --git a/remoting/protocol/v2_authenticator.cc b/remoting/protocol/v2_authenticator.cc index ee5c9d1..80f7af3 100644 --- a/remoting/protocol/v2_authenticator.cc +++ b/remoting/protocol/v2_authenticator.cc @@ -156,7 +156,10 @@ scoped_ptr<buzz::XmlElement> V2Authenticator::GetNextMessage() { while (!pending_messages_.empty()) { const std::string& spake_message = pending_messages_.front(); std::string base64_message; - base::Base64Encode(spake_message, &base64_message); + if (!base::Base64Encode(spake_message, &base64_message)) { + LOG(DFATAL) << "Cannot perform base64 encode on certificate"; + continue; + } buzz::XmlElement* eke_tag = new buzz::XmlElement(kEkeTag); eke_tag->SetBodyText(base64_message); @@ -168,7 +171,9 @@ scoped_ptr<buzz::XmlElement> V2Authenticator::GetNextMessage() { if (!local_cert_.empty() && !certificate_sent_) { buzz::XmlElement* certificate_tag = new buzz::XmlElement(kCertificateTag); std::string base64_cert; - base::Base64Encode(local_cert_, &base64_cert); + if (!base::Base64Encode(local_cert_, &base64_cert)) { + LOG(DFATAL) << "Cannot perform base64 encode on certificate"; + } certificate_tag->SetBodyText(base64_cert); message->AddElement(certificate_tag); certificate_sent_ = true; |