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

Unified Diff: content/child/webcrypto/openssl/pbkdf2_openssl.cc

Issue 877783005: Fix a style issue: Add braces around a multi-line if statement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address David's feedback Created 5 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/openssl/pbkdf2_openssl.cc
diff --git a/content/child/webcrypto/openssl/pbkdf2_openssl.cc b/content/child/webcrypto/openssl/pbkdf2_openssl.cc
index e25d96cb4d2a54be7e16802f10dbb93d46244537..9f3017b52323ad57aa188b70d0628fada278483b 100644
--- a/content/child/webcrypto/openssl/pbkdf2_openssl.cc
+++ b/content/child/webcrypto/openssl/pbkdf2_openssl.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/numerics/safe_math.h"
#include "content/child/webcrypto/algorithm_implementation.h"
#include "content/child/webcrypto/crypto_data.h"
#include "content/child/webcrypto/openssl/key_openssl.h"
@@ -84,23 +83,18 @@ class Pbkdf2Implementation : public AlgorithmImplementation {
if (password.empty())
return Status::ErrorPbkdf2EmptyPassword();
- // Prevent underflowing password.size() - BoringSSL expects the size as an
- // signed int, and will interpret the data as a C-String if it is -1.
- base::CheckedNumeric<int> password_size = password.size();
- if (!password_size.IsValid())
- return Status::ErrorDataTooLarge();
-
if (keylen_bytes == 0)
return Status::Success();
const char* password_ptr =
password.empty() ? NULL : reinterpret_cast<const char*>(&password[0]);
- if (!PKCS5_PBKDF2_HMAC(password_ptr, password_size.ValueOrDie(),
- params->salt().data(), params->salt().size(),
- params->iterations(), digest_algorithm, keylen_bytes,
- &derived_bytes->front()))
+ if (!PKCS5_PBKDF2_HMAC(password_ptr, password.size(), params->salt().data(),
+ params->salt().size(), params->iterations(),
+ digest_algorithm, keylen_bytes,
+ &derived_bytes->front())) {
return Status::OperationError();
+ }
return Status::Success();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698