Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1318)

Unified Diff: remoting/protocol/jingle_session.cc

Issue 7522014: Add WARN_UNUSED_RESULT to crypto/hmac.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/jingle_session.cc
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 3e08dca2eb8a759a91d8ebc9e1565a88a3fc3451..0a9b6c429a0e288fb8bda5b00cd8678720e4d461 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -71,12 +71,15 @@ bool GetChannelKey(const std::string& channel_name,
const std::string& master_key,
std::string* channel_key) {
crypto::HMAC hmac(crypto::HMAC::SHA256);
- hmac.Init(channel_name);
+ if (!hmac.Init(channel_name)) {
+ channel_key->clear();
+ return false;
+ }
channel_key->resize(kChannelKeyLength);
if (!hmac.Sign(master_key,
reinterpret_cast<unsigned char*>(&(*channel_key)[0]),
channel_key->size())) {
- *channel_key = "";
+ channel_key->clear();
return false;
}
return true;

Powered by Google App Engine
This is Rietveld 408576698