| 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();
|
| }
|
|
|
|
|