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

Unified Diff: net/ssl/test_ssl_private_key.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_private_key.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/test_ssl_private_key.cc
diff --git a/net/ssl/test_ssl_private_key.cc b/net/ssl/test_ssl_private_key.cc
index ddcce8865bbe9811a3d7a74e56b32cff403656dc..59dea2f77369f2a33ffb186c65f9766efea176a8 100644
--- a/net/ssl/test_ssl_private_key.cc
+++ b/net/ssl/test_ssl_private_key.cc
@@ -5,6 +5,7 @@
#include "net/ssl/test_ssl_private_key.h"
#include <openssl/digest.h>
+#include <openssl/ec.h>
#include <openssl/evp.h>
#include <openssl/rsa.h>
@@ -14,7 +15,7 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "net/base/net_errors.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"
@@ -115,9 +116,25 @@ scoped_refptr<SSLPrivateKey> WrapOpenSSLPrivateKey(
case EVP_PKEY_RSA:
type = SSLPrivateKey::Type::RSA;
break;
- case EVP_PKEY_EC:
- type = SSLPrivateKey::Type::ECDSA;
+ case EVP_PKEY_EC: {
+ EC_KEY* ec_key = EVP_PKEY_get0_EC_KEY(key.get());
+ int curve = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec_key));
+ switch (curve) {
+ case NID_X9_62_prime256v1:
+ type = SSLPrivateKey::Type::ECDSA_P256;
+ break;
+ case NID_secp384r1:
+ type = SSLPrivateKey::Type::ECDSA_P384;
+ break;
+ case NID_secp521r1:
+ type = SSLPrivateKey::Type::ECDSA_P384;
+ break;
+ default:
+ LOG(ERROR) << "Unknown curve: " << curve;
+ return nullptr;
+ }
break;
+ }
default:
LOG(ERROR) << "Unknown key type: " << EVP_PKEY_id(key.get());
return nullptr;
« no previous file with comments | « net/ssl/ssl_private_key.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698