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

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

Issue 1910903002: Remove *_openssl files for gcm_driver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment. Created 4 years, 8 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 | « components/gcm_driver/crypto/p256_key_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/crypto/p256_key_util_openssl.cc
diff --git a/components/gcm_driver/crypto/p256_key_util_openssl.cc b/components/gcm_driver/crypto/p256_key_util_openssl.cc
deleted file mode 100644
index 6a48be1689d532fe9a920f8e8b6543acb4c3e3bb..0000000000000000000000000000000000000000
--- a/components/gcm_driver/crypto/p256_key_util_openssl.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <openssl/ec.h>
-#include <openssl/ecdh.h>
-#include <openssl/evp.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#include <memory>
-
-#include "base/logging.h"
-#include "base/strings/string_util.h"
-#include "components/gcm_driver/crypto/p256_key_util.h"
-#include "crypto/ec_private_key.h"
-#include "crypto/scoped_openssl_types.h"
-
-namespace gcm {
-
-namespace {
-
-// A P-256 field element consists of 32 bytes.
-const size_t kFieldBytes = 32;
-
-} // namespace
-
-bool ComputeSharedP256Secret(const base::StringPiece& private_key,
- const base::StringPiece& public_key_x509,
- const base::StringPiece& peer_public_key,
- std::string* out_shared_secret) {
- DCHECK(out_shared_secret);
-
- std::unique_ptr<crypto::ECPrivateKey> local_key_pair(
- crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo(
- "" /* no password */,
- std::vector<uint8_t>(private_key.data(),
- private_key.data() + private_key.size()),
- std::vector<uint8_t>(
- public_key_x509.data(),
- public_key_x509.data() + public_key_x509.size())));
-
- if (!local_key_pair) {
- DLOG(ERROR) << "Unable to create the local key pair.";
- 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())) {
- DLOG(ERROR) << "The private key is invalid.";
- return false;
- }
-
- crypto::ScopedEC_POINT point(
- EC_POINT_new(EC_KEY_get0_group(ec_private_key.get())));
-
- 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)) {
- 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)) {
- DLOG(ERROR) << "Unable to compute the ECDH shared secret.";
- return false;
- }
-
- out_shared_secret->assign(reinterpret_cast<char*>(result), sizeof(result));
- return true;
-}
-
-} // namespace gcm
« no previous file with comments | « components/gcm_driver/crypto/p256_key_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698