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

Unified Diff: net/ssl/ssl_platform_key_win.cc

Issue 2391213002: Report curve types in ECDSA SSLPrivateKeys. (Closed)
Patch Set: rebase 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 | « net/ssl/ssl_platform_key_util_unittest.cc ('k') | net/ssl/ssl_private_key.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/ssl_platform_key_win.cc
diff --git a/net/ssl/ssl_platform_key_win.cc b/net/ssl/ssl_platform_key_win.cc
index e1dbd576b58ea01bbdd6353f4281f7a9d7d5ab8c..40913aa087e3a29a7ab306c6769910067e89402e 100644
--- a/net/ssl/ssl_platform_key_win.cc
+++ b/net/ssl/ssl_platform_key_win.cc
@@ -25,7 +25,7 @@
#include "crypto/wincrypt_shim.h"
#include "net/base/net_errors.h"
#include "net/cert/x509_certificate.h"
-#include "net/ssl/ssl_platform_key_task_runner.h"
+#include "net/ssl/ssl_platform_key_util.h"
#include "net/ssl/ssl_private_key.h"
#include "net/ssl/threaded_ssl_private_key.h"
@@ -211,7 +211,7 @@ class SSLPlatformKeyCNG : public ThreadedSSLPrivateKey::Delegate {
// CNG emits raw ECDSA signatures, but BoringSSL expects a DER-encoded
// ECDSA-Sig-Value.
- if (type_ == SSLPrivateKey::Type::ECDSA) {
+ if (SSLPrivateKey::IsECDSAType(type_)) {
if (signature->size() % 2 != 0) {
LOG(ERROR) << "Bad signature length";
return ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED;
@@ -247,38 +247,6 @@ class SSLPlatformKeyCNG : public ThreadedSSLPrivateKey::Delegate {
DISALLOW_COPY_AND_ASSIGN(SSLPlatformKeyCNG);
};
-// Determines the key type and maximum signature length of |certificate|'s
-// public key.
-bool GetKeyInfo(const X509Certificate* certificate,
- SSLPrivateKey::Type* out_type,
- size_t* out_max_length) {
- crypto::OpenSSLErrStackTracer tracker(FROM_HERE);
-
- std::string der_encoded;
- if (!X509Certificate::GetDEREncoded(certificate->os_cert_handle(),
- &der_encoded))
- return false;
- const uint8_t* bytes = reinterpret_cast<const uint8_t*>(der_encoded.data());
- bssl::UniquePtr<X509> x509(d2i_X509(nullptr, &bytes, der_encoded.size()));
- if (!x509)
- return false;
- bssl::UniquePtr<EVP_PKEY> key(X509_get_pubkey(x509.get()));
- if (!key)
- return false;
- switch (EVP_PKEY_id(key.get())) {
- case EVP_PKEY_RSA:
- *out_type = SSLPrivateKey::Type::RSA;
- break;
- case EVP_PKEY_EC:
- *out_type = SSLPrivateKey::Type::ECDSA;
- break;
- default:
- return false;
- }
- *out_max_length = EVP_PKEY_size(key.get());
- return true;
-}
-
} // namespace
scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey(
@@ -288,7 +256,7 @@ scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey(
// consistently work depending on the system. See https://crbug.com/468345.
SSLPrivateKey::Type key_type;
size_t max_length;
- if (!GetKeyInfo(certificate, &key_type, &max_length))
+ if (!GetClientCertInfo(certificate, &key_type, &max_length))
return nullptr;
PCCERT_CONTEXT cert_context = certificate->os_cert_handle();
« no previous file with comments | « net/ssl/ssl_platform_key_util_unittest.cc ('k') | net/ssl/ssl_private_key.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698