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

Unified Diff: components/gcm_driver/crypto/p256_key_util.cc

Issue 2407633002: Use new BoringSSL scopers in //components. (Closed)
Patch Set: Created 4 years, 2 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 | components/webcrypto/algorithms/aes_cbc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/crypto/p256_key_util.cc
diff --git a/components/gcm_driver/crypto/p256_key_util.cc b/components/gcm_driver/crypto/p256_key_util.cc
index 86b543de45d3916b5d42519eefcd42b0cd01c270..15c96b9f8b504de99365bf66b751b921fe343d43 100644
--- a/components/gcm_driver/crypto/p256_key_util.cc
+++ b/components/gcm_driver/crypto/p256_key_util.cc
@@ -16,7 +16,6 @@
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "crypto/ec_private_key.h"
-#include "crypto/scoped_openssl_types.h"
namespace gcm {
@@ -113,29 +112,27 @@ bool ComputeSharedP256Secret(const base::StringPiece& private_key,
return false;
}
- crypto::ScopedEC_KEY ec_private_key(
- EVP_PKEY_get1_EC_KEY(local_key_pair->key()));
-
- if (!ec_private_key || !EC_KEY_check_key(ec_private_key.get())) {
+ EC_KEY* ec_private_key = EVP_PKEY_get0_EC_KEY(local_key_pair->key());
+ if (!ec_private_key || !EC_KEY_check_key(ec_private_key)) {
DLOG(ERROR) << "The private key is invalid.";
return false;
}
- crypto::ScopedEC_POINT point(
- EC_POINT_new(EC_KEY_get0_group(ec_private_key.get())));
+ bssl::UniquePtr<EC_POINT> point(
+ EC_POINT_new(EC_KEY_get0_group(ec_private_key)));
if (!point ||
- !EC_POINT_oct2point(EC_KEY_get0_group(ec_private_key.get()), point.get(),
- reinterpret_cast<const uint8_t*>(
- peer_public_key.data()),
- peer_public_key.size(), nullptr)) {
+ !EC_POINT_oct2point(
+ EC_KEY_get0_group(ec_private_key), point.get(),
+ reinterpret_cast<const uint8_t*>(peer_public_key.data()),
+ peer_public_key.size(), nullptr)) {
DLOG(ERROR) << "Can't convert peer public value to curve point.";
return false;
}
uint8_t result[kFieldBytes];
- if (ECDH_compute_key(result, sizeof(result), point.get(),
- ec_private_key.get(), nullptr) != sizeof(result)) {
+ if (ECDH_compute_key(result, sizeof(result), point.get(), ec_private_key,
+ nullptr) != sizeof(result)) {
DLOG(ERROR) << "Unable to compute the ECDH shared secret.";
return false;
}
« no previous file with comments | « no previous file | components/webcrypto/algorithms/aes_cbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698