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

Unified Diff: components/webcrypto/algorithms/asymmetric_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 | « components/webcrypto/algorithms/asymmetric_key_util.h ('k') | components/webcrypto/algorithms/ec.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webcrypto/algorithms/asymmetric_key_util.cc
diff --git a/components/webcrypto/algorithms/asymmetric_key_util.cc b/components/webcrypto/algorithms/asymmetric_key_util.cc
index 57a3a4a84638e467b1f415d4ff99cba77d985c40..7a960f03faa5bf6fbac5c51b0ed360ebe5e47842 100644
--- a/components/webcrypto/algorithms/asymmetric_key_util.cc
+++ b/components/webcrypto/algorithms/asymmetric_key_util.cc
@@ -6,6 +6,7 @@
#include <openssl/bytestring.h>
#include <openssl/evp.h>
+#include <openssl/mem.h>
#include <stdint.h>
#include <utility>
@@ -14,9 +15,7 @@
#include "components/webcrypto/crypto_data.h"
#include "components/webcrypto/generate_key_result.h"
#include "components/webcrypto/status.h"
-#include "crypto/auto_cbb.h"
#include "crypto/openssl_util.h"
-#include "crypto/scoped_openssl_types.h"
namespace webcrypto {
@@ -28,7 +27,7 @@ Status ExportPKeySpki(EVP_PKEY* key, std::vector<uint8_t>* buffer) {
uint8_t* der;
size_t der_len;
- crypto::AutoCBB cbb;
+ bssl::ScopedCBB cbb;
if (!CBB_init(cbb.get(), 0) || !EVP_marshal_public_key(cbb.get(), key) ||
!CBB_finish(cbb.get(), &der, &der_len)) {
return Status::ErrorUnexpected();
@@ -46,7 +45,7 @@ Status ExportPKeyPkcs8(EVP_PKEY* key, std::vector<uint8_t>* buffer) {
// http://crbug.com/373545
uint8_t* der;
size_t der_len;
- crypto::AutoCBB cbb;
+ bssl::ScopedCBB cbb;
if (!CBB_init(cbb.get(), 0) || !EVP_marshal_private_key(cbb.get(), key) ||
!CBB_finish(cbb.get(), &der, &der_len)) {
return Status::ErrorUnexpected();
@@ -58,7 +57,7 @@ Status ExportPKeyPkcs8(EVP_PKEY* key, std::vector<uint8_t>* buffer) {
} // namespace
-Status CreateWebCryptoPublicKey(crypto::ScopedEVP_PKEY public_key,
+Status CreateWebCryptoPublicKey(bssl::UniquePtr<EVP_PKEY> public_key,
const blink::WebCryptoKeyAlgorithm& algorithm,
bool extractable,
blink::WebCryptoKeyUsageMask usages,
@@ -76,7 +75,7 @@ Status CreateWebCryptoPublicKey(crypto::ScopedEVP_PKEY public_key,
return Status::Success();
}
-Status CreateWebCryptoPrivateKey(crypto::ScopedEVP_PKEY private_key,
+Status CreateWebCryptoPrivateKey(bssl::UniquePtr<EVP_PKEY> private_key,
const blink::WebCryptoKeyAlgorithm& algorithm,
bool extractable,
blink::WebCryptoKeyUsageMask usages,
@@ -96,12 +95,12 @@ Status CreateWebCryptoPrivateKey(crypto::ScopedEVP_PKEY private_key,
Status ImportUnverifiedPkeyFromSpki(const CryptoData& key_data,
int expected_pkey_id,
- crypto::ScopedEVP_PKEY* out_pkey) {
+ bssl::UniquePtr<EVP_PKEY>* out_pkey) {
crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
CBS cbs;
CBS_init(&cbs, key_data.bytes(), key_data.byte_length());
- crypto::ScopedEVP_PKEY pkey(EVP_parse_public_key(&cbs));
+ bssl::UniquePtr<EVP_PKEY> pkey(EVP_parse_public_key(&cbs));
if (!pkey || CBS_len(&cbs) != 0)
return Status::DataError();
@@ -114,12 +113,12 @@ Status ImportUnverifiedPkeyFromSpki(const CryptoData& key_data,
Status ImportUnverifiedPkeyFromPkcs8(const CryptoData& key_data,
int expected_pkey_id,
- crypto::ScopedEVP_PKEY* out_pkey) {
+ bssl::UniquePtr<EVP_PKEY>* out_pkey) {
crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
CBS cbs;
CBS_init(&cbs, key_data.bytes(), key_data.byte_length());
- crypto::ScopedEVP_PKEY pkey(EVP_parse_private_key(&cbs));
+ bssl::UniquePtr<EVP_PKEY> pkey(EVP_parse_private_key(&cbs));
if (!pkey || CBS_len(&cbs) != 0)
return Status::DataError();
« no previous file with comments | « components/webcrypto/algorithms/asymmetric_key_util.h ('k') | components/webcrypto/algorithms/ec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698