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

Unified Diff: components/webcrypto/algorithms/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/sha.cc ('k') | components/webcrypto/blink_key_handle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webcrypto/algorithms/util.cc
diff --git a/components/webcrypto/algorithms/util.cc b/components/webcrypto/algorithms/util.cc
index de4c1bf7994a90f60f36dea1eaaf3813d4243cc2..8195de8984f9231029b0cca7b0bf56bd47542ee4 100644
--- a/components/webcrypto/algorithms/util.cc
+++ b/components/webcrypto/algorithms/util.cc
@@ -12,7 +12,6 @@
#include "components/webcrypto/crypto_data.h"
#include "components/webcrypto/status.h"
#include "crypto/openssl_util.h"
-#include "crypto/scoped_openssl_types.h"
namespace webcrypto {
@@ -75,18 +74,16 @@ Status AeadEncryptDecrypt(EncryptOrDecrypt mode,
const EVP_AEAD* aead_alg,
std::vector<uint8_t>* buffer) {
crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
- EVP_AEAD_CTX ctx;
+ bssl::ScopedEVP_AEAD_CTX ctx;
if (!aead_alg)
return Status::ErrorUnexpected();
- if (!EVP_AEAD_CTX_init(&ctx, aead_alg, raw_key.data(), raw_key.size(),
+ if (!EVP_AEAD_CTX_init(ctx.get(), aead_alg, raw_key.data(), raw_key.size(),
tag_length_bytes, NULL)) {
return Status::OperationError();
}
- crypto::ScopedOpenSSL<EVP_AEAD_CTX, EVP_AEAD_CTX_cleanup> ctx_cleanup(&ctx);
-
size_t len;
int ok;
@@ -96,7 +93,7 @@ Status AeadEncryptDecrypt(EncryptOrDecrypt mode,
buffer->resize(data.byte_length() - tag_length_bytes);
- ok = EVP_AEAD_CTX_open(&ctx, buffer->data(), &len, buffer->size(),
+ ok = EVP_AEAD_CTX_open(ctx.get(), buffer->data(), &len, buffer->size(),
iv.bytes(), iv.byte_length(), data.bytes(),
data.byte_length(), additional_data.bytes(),
additional_data.byte_length());
@@ -105,7 +102,7 @@ Status AeadEncryptDecrypt(EncryptOrDecrypt mode,
// the output buffer is too small).
buffer->resize(data.byte_length() + EVP_AEAD_max_overhead(aead_alg));
- ok = EVP_AEAD_CTX_seal(&ctx, buffer->data(), &len, buffer->size(),
+ ok = EVP_AEAD_CTX_seal(ctx.get(), buffer->data(), &len, buffer->size(),
iv.bytes(), iv.byte_length(), data.bytes(),
data.byte_length(), additional_data.bytes(),
additional_data.byte_length());
« no previous file with comments | « components/webcrypto/algorithms/sha.cc ('k') | components/webcrypto/blink_key_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698