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

Unified Diff: sync/util/nigori.cc

Issue 2095523002: Make //crypto factories return std::unique_ptr<>s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: I'm blind Created 4 years, 6 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
« no previous file with comments | « net/ssl/default_channel_id_store_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/util/nigori.cc
diff --git a/sync/util/nigori.cc b/sync/util/nigori.cc
index 2bd5b702dfbc5043163326568bf5c68468c2f8f6..78ed2876e6537b0d08c8ae797fd2a497d7d370e8 100644
--- a/sync/util/nigori.cc
+++ b/sync/util/nigori.cc
@@ -77,45 +77,46 @@ bool Nigori::InitByDerivation(const std::string& hostname,
std::unique_ptr<SymmetricKey> user_salt(SymmetricKey::DeriveKeyFromPassword(
SymmetricKey::HMAC_SHA1, salt_password.str(), kSaltSalt, kSaltIterations,
kSaltKeySizeInBits));
- DCHECK(user_salt.get());
+ DCHECK(user_salt);
std::string raw_user_salt;
if (!user_salt->GetRawKey(&raw_user_salt))
return false;
// Kuser = PBKDF2(P, Suser, Nuser, 16)
- user_key_.reset(SymmetricKey::DeriveKeyFromPassword(SymmetricKey::AES,
- password, raw_user_salt, kUserIterations, kDerivedKeySizeInBits));
- DCHECK(user_key_.get());
+ user_key_ = SymmetricKey::DeriveKeyFromPassword(
+ SymmetricKey::AES, password, raw_user_salt, kUserIterations,
+ kDerivedKeySizeInBits);
+ DCHECK(user_key_);
// Kenc = PBKDF2(P, Suser, Nenc, 16)
- encryption_key_.reset(SymmetricKey::DeriveKeyFromPassword(SymmetricKey::AES,
- password, raw_user_salt, kEncryptionIterations, kDerivedKeySizeInBits));
- DCHECK(encryption_key_.get());
+ encryption_key_ = SymmetricKey::DeriveKeyFromPassword(
+ SymmetricKey::AES, password, raw_user_salt, kEncryptionIterations,
+ kDerivedKeySizeInBits);
+ DCHECK(encryption_key_);
// Kmac = PBKDF2(P, Suser, Nmac, 16)
- mac_key_.reset(SymmetricKey::DeriveKeyFromPassword(
+ mac_key_ = SymmetricKey::DeriveKeyFromPassword(
SymmetricKey::HMAC_SHA1, password, raw_user_salt, kSigningIterations,
- kDerivedKeySizeInBits));
- DCHECK(mac_key_.get());
+ kDerivedKeySizeInBits);
+ DCHECK(mac_key_);
- return user_key_.get() && encryption_key_.get() && mac_key_.get();
+ return user_key_ && encryption_key_ && mac_key_;
}
bool Nigori::InitByImport(const std::string& user_key,
const std::string& encryption_key,
const std::string& mac_key) {
- user_key_.reset(SymmetricKey::Import(SymmetricKey::AES, user_key));
- DCHECK(user_key_.get());
+ user_key_ = SymmetricKey::Import(SymmetricKey::AES, user_key);
+ DCHECK(user_key_);
- encryption_key_.reset(SymmetricKey::Import(SymmetricKey::AES,
- encryption_key));
- DCHECK(encryption_key_.get());
+ encryption_key_ = SymmetricKey::Import(SymmetricKey::AES, encryption_key);
+ DCHECK(encryption_key_);
- mac_key_.reset(SymmetricKey::Import(SymmetricKey::HMAC_SHA1, mac_key));
- DCHECK(mac_key_.get());
+ mac_key_ = SymmetricKey::Import(SymmetricKey::HMAC_SHA1, mac_key);
+ DCHECK(mac_key_);
- return user_key_.get() && encryption_key_.get() && mac_key_.get();
+ return user_key_ && encryption_key_ && mac_key_;
}
// Permute[Kenc,Kmac](type || name)
« no previous file with comments | « net/ssl/default_channel_id_store_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698