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

Unified Diff: crypto/signature_verifier.cc

Issue 2332473002: Use new BoringSSL scopers in //crypto (Closed)
Patch Set: rebase Created 4 years, 3 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 | « crypto/signature_verifier.h ('k') | extensions/browser/api/cast_channel/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/signature_verifier.cc
diff --git a/crypto/signature_verifier.cc b/crypto/signature_verifier.cc
index 236b64c594d14de25342cfbb41d36866f1da2298..b4e04add3593ed0682175351a2bf29e4d9460395 100644
--- a/crypto/signature_verifier.cc
+++ b/crypto/signature_verifier.cc
@@ -7,6 +7,7 @@
#include <openssl/bytestring.h>
#include <openssl/digest.h>
#include <openssl/evp.h>
+#include <openssl/rsa.h>
#include <stdint.h>
#include <memory>
@@ -14,7 +15,6 @@
#include "base/logging.h"
#include "crypto/openssl_util.h"
-#include "crypto/scoped_openssl_types.h"
namespace crypto {
@@ -33,14 +33,12 @@ const EVP_MD* ToOpenSSLDigest(SignatureVerifier::HashAlgorithm hash_alg) {
} // namespace
struct SignatureVerifier::VerifyContext {
- ScopedEVP_MD_CTX ctx;
+ bssl::ScopedEVP_MD_CTX ctx;
};
-SignatureVerifier::SignatureVerifier() : verify_context_(nullptr) {}
+SignatureVerifier::SignatureVerifier() {}
-SignatureVerifier::~SignatureVerifier() {
- Reset();
-}
+SignatureVerifier::~SignatureVerifier() {}
bool SignatureVerifier::VerifyInit(SignatureAlgorithm signature_algorithm,
const uint8_t* signature,
@@ -131,27 +129,25 @@ bool SignatureVerifier::CommonInit(int pkey_type,
if (verify_context_)
return false;
- verify_context_ = new VerifyContext;
+ verify_context_.reset(new VerifyContext);
signature_.assign(signature, signature + signature_len);
CBS cbs;
CBS_init(&cbs, public_key_info, public_key_info_len);
- ScopedEVP_PKEY public_key(EVP_parse_public_key(&cbs));
+ bssl::UniquePtr<EVP_PKEY> public_key(EVP_parse_public_key(&cbs));
if (!public_key || CBS_len(&cbs) != 0 ||
EVP_PKEY_id(public_key.get()) != pkey_type) {
return false;
}
- verify_context_->ctx.reset(EVP_MD_CTX_create());
int rv = EVP_DigestVerifyInit(verify_context_->ctx.get(), pkey_ctx,
digest, nullptr, public_key.get());
return rv == 1;
}
void SignatureVerifier::Reset() {
- delete verify_context_;
- verify_context_ = nullptr;
+ verify_context_.reset();
signature_.clear();
}
« no previous file with comments | « crypto/signature_verifier.h ('k') | extensions/browser/api/cast_channel/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698