summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 11:55:10 +0000
committerricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 11:55:10 +0000
commit0553072d237ad2b977e948591de3f87eee536a9c (patch)
tree58b462d22b2342db07c041ac8abaf061e671d1e5 /remoting
parent9377d2ad77c6d7ee0190c90544eaed0ff0c7fc9c (diff)
downloadchromium_src-0553072d237ad2b977e948591de3f87eee536a9c.zip
chromium_src-0553072d237ad2b977e948591de3f87eee536a9c.tar.gz
chromium_src-0553072d237ad2b977e948591de3f87eee536a9c.tar.bz2
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 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239759 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/base/rsa_key_pair.cc4
-rw-r--r--remoting/host/pin_hash.cc4
-rw-r--r--remoting/host/token_validator_factory_impl.cc3
-rw-r--r--remoting/protocol/auth_util.cc4
-rw-r--r--remoting/protocol/authenticator_test_base.cc2
-rw-r--r--remoting/protocol/pairing_registry.cc6
-rw-r--r--remoting/protocol/v2_authenticator.cc9
7 files changed, 9 insertions, 23 deletions
diff --git a/remoting/base/rsa_key_pair.cc b/remoting/base/rsa_key_pair.cc
index 1cea077..28dd2ef 100644
--- a/remoting/base/rsa_key_pair.cc
+++ b/remoting/base/rsa_key_pair.cc
@@ -63,9 +63,7 @@ std::string RsaKeyPair::ToString() const {
CHECK(key_->ExportPrivateKey(&key_buf));
std::string key_str(key_buf.begin(), key_buf.end());
std::string key_base64;
- if (!base::Base64Encode(key_str, &key_base64)) {
- LOG(FATAL) << "Base64Encode failed";
- }
+ base::Base64Encode(key_str, &key_base64);
return key_base64;
}
diff --git a/remoting/host/pin_hash.cc b/remoting/host/pin_hash.cc
index fe17f38..c9b1ca3c 100644
--- a/remoting/host/pin_hash.cc
+++ b/remoting/host/pin_hash.cc
@@ -16,9 +16,7 @@ std::string MakeHostPinHash(const std::string& host_id,
std::string hash = protocol::AuthenticationMethod::ApplyHashFunction(
protocol::AuthenticationMethod::HMAC_SHA256, host_id, pin);
std::string hash_base64;
- if (!base::Base64Encode(hash, &hash_base64)) {
- LOG(FATAL) << "Base64Encode failed";
- }
+ base::Base64Encode(hash, &hash_base64);
return "hmac:" + hash_base64;
}
diff --git a/remoting/host/token_validator_factory_impl.cc b/remoting/host/token_validator_factory_impl.cc
index 3dd9245..d93df62 100644
--- a/remoting/host/token_validator_factory_impl.cc
+++ b/remoting/host/token_validator_factory_impl.cc
@@ -107,8 +107,7 @@ class TokenValidatorImpl
std::string nonce_bytes;
crypto::RandBytes(WriteInto(&nonce_bytes, kNonceLength + 1), kNonceLength);
std::string nonce;
- bool success = base::Base64Encode(nonce_bytes, &nonce);
- DCHECK(success);
+ base::Base64Encode(nonce_bytes, &nonce);
return "client:" + remote_jid + " host:" + local_jid + " nonce:" + nonce;
}
diff --git a/remoting/protocol/auth_util.cc b/remoting/protocol/auth_util.cc
index 4559636..17263bf 100644
--- a/remoting/protocol/auth_util.cc
+++ b/remoting/protocol/auth_util.cc
@@ -26,9 +26,7 @@ std::string GenerateSupportAuthToken(const std::string& jid,
const std::string& access_code) {
std::string sha256 = crypto::SHA256HashString(jid + " " + access_code);
std::string sha256_base64;
- if (!base::Base64Encode(sha256, &sha256_base64)) {
- LOG(FATAL) << "Failed to encode auth token";
- }
+ base::Base64Encode(sha256, &sha256_base64);
return sha256_base64;
}
diff --git a/remoting/protocol/authenticator_test_base.cc b/remoting/protocol/authenticator_test_base.cc
index 8311476..25b0efe 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;
- ASSERT_TRUE(base::Base64Encode(key_string, &key_base64));
+ 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 c159ce6..f1ce333 100644
--- a/remoting/protocol/pairing_registry.cc
+++ b/remoting/protocol/pairing_registry.cc
@@ -49,10 +49,8 @@ PairingRegistry::Pairing PairingRegistry::Pairing::Create(
std::string shared_secret;
char buffer[kKeySize];
crypto::RandBytes(buffer, arraysize(buffer));
- if (!base::Base64Encode(base::StringPiece(buffer, arraysize(buffer)),
- &shared_secret)) {
- LOG(FATAL) << "Base64Encode failed.";
- }
+ base::Base64Encode(base::StringPiece(buffer, arraysize(buffer)),
+ &shared_secret);
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 80f7af3..ee5c9d1 100644
--- a/remoting/protocol/v2_authenticator.cc
+++ b/remoting/protocol/v2_authenticator.cc
@@ -156,10 +156,7 @@ scoped_ptr<buzz::XmlElement> V2Authenticator::GetNextMessage() {
while (!pending_messages_.empty()) {
const std::string& spake_message = pending_messages_.front();
std::string base64_message;
- if (!base::Base64Encode(spake_message, &base64_message)) {
- LOG(DFATAL) << "Cannot perform base64 encode on certificate";
- continue;
- }
+ base::Base64Encode(spake_message, &base64_message);
buzz::XmlElement* eke_tag = new buzz::XmlElement(kEkeTag);
eke_tag->SetBodyText(base64_message);
@@ -171,9 +168,7 @@ scoped_ptr<buzz::XmlElement> V2Authenticator::GetNextMessage() {
if (!local_cert_.empty() && !certificate_sent_) {
buzz::XmlElement* certificate_tag = new buzz::XmlElement(kCertificateTag);
std::string base64_cert;
- if (!base::Base64Encode(local_cert_, &base64_cert)) {
- LOG(DFATAL) << "Cannot perform base64 encode on certificate";
- }
+ base::Base64Encode(local_cert_, &base64_cert);
certificate_tag->SetBodyText(base64_cert);
message->AddElement(certificate_tag);
certificate_sent_ = true;