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

Unified Diff: crypto/encryptor.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 | « crypto/ec_signature_creator_impl.cc ('k') | crypto/hmac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/encryptor.cc
diff --git a/crypto/encryptor.cc b/crypto/encryptor.cc
index a9f9a9d5dcea15fe2e9341e14138da45f8467ba3..06bf00cce94bc608bf2a79aa14f4565177bd942d 100644
--- a/crypto/encryptor.cc
+++ b/crypto/encryptor.cc
@@ -23,7 +23,8 @@ const EVP_CIPHER* GetCipherForKey(SymmetricKey* key) {
switch (key->key().length()) {
case 16: return EVP_aes_128_cbc();
case 32: return EVP_aes_256_cbc();
- default: return NULL;
+ default:
+ return nullptr;
}
}
@@ -84,10 +85,7 @@ size_t Encryptor::Counter::GetLengthInBytes() const {
/////////////////////////////////////////////////////////////////////////////
// Encryptor Implementation.
-Encryptor::Encryptor()
- : key_(NULL),
- mode_(CBC) {
-}
+Encryptor::Encryptor() : key_(nullptr), mode_(CBC) {}
Encryptor::~Encryptor() {
}
@@ -102,7 +100,7 @@ bool Encryptor::Init(SymmetricKey* key,
if (mode == CBC && iv.size() != AES_BLOCK_SIZE)
return false;
- if (GetCipherForKey(key) == NULL)
+ if (GetCipherForKey(key) == nullptr)
return false;
key_ = key;
@@ -191,9 +189,10 @@ bool Encryptor::Crypt(bool do_encrypt,
DCHECK_EQ(EVP_CIPHER_key_length(cipher), key.length());
ScopedCipherCTX ctx;
- if (!EVP_CipherInit_ex(
- ctx.get(), cipher, NULL, reinterpret_cast<const uint8_t*>(key.data()),
- reinterpret_cast<const uint8_t*>(iv_.data()), do_encrypt))
+ if (!EVP_CipherInit_ex(ctx.get(), cipher, nullptr,
+ reinterpret_cast<const uint8_t*>(key.data()),
+ reinterpret_cast<const uint8_t*>(iv_.data()),
+ do_encrypt))
return false;
// When encrypting, add another block size of space to allow for any padding.
« no previous file with comments | « crypto/ec_signature_creator_impl.cc ('k') | crypto/hmac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698