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

Unified Diff: net/cert/internal/verify_signed_data.cc

Issue 1742873002: Switch //net to the new SPKI and PKCS#8 APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@spki-crypto
Patch Set: tweak keygen_handler_openssl.cc Created 4 years, 10 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 | « net/cert/ct_log_verifier_openssl.cc ('k') | net/cert/internal/verify_signed_data_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/verify_signed_data.cc
diff --git a/net/cert/internal/verify_signed_data.cc b/net/cert/internal/verify_signed_data.cc
index 9b0ebd458171e111f6fd6be3fa2182c860422830..eb0fd3ff2b6380e04d5eac1d5b3cd990425e768d 100644
--- a/net/cert/internal/verify_signed_data.cc
+++ b/net/cert/internal/verify_signed_data.cc
@@ -29,12 +29,12 @@ bool VerifySignedData(const SignatureAlgorithm& signature_algorithm,
#else
+#include <openssl/bytestring.h>
#include <openssl/digest.h>
#include <openssl/ec.h>
#include <openssl/ec_key.h>
#include <openssl/evp.h>
#include <openssl/rsa.h>
-#include <openssl/x509.h>
#include "base/compiler_specific.h"
#include "crypto/openssl_util.h"
@@ -97,9 +97,10 @@ WARN_UNUSED_RESULT bool ImportPkeyFromSpki(const der::Input& spki,
crypto::ScopedEVP_PKEY* pkey) {
crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
- const uint8_t* ptr = spki.UnsafeData();
- pkey->reset(d2i_PUBKEY(nullptr, &ptr, spki.Length()));
- if (!pkey->get() || ptr != spki.UnsafeData() + spki.Length() ||
+ CBS cbs;
+ CBS_init(&cbs, spki.UnsafeData(), spki.Length());
+ pkey->reset(EVP_parse_public_key(&cbs));
+ if (!*pkey || CBS_len(&cbs) != 0 ||
EVP_PKEY_id(pkey->get()) != expected_pkey_id) {
pkey->reset();
return false;
« no previous file with comments | « net/cert/ct_log_verifier_openssl.cc ('k') | net/cert/internal/verify_signed_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698