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

Side by Side Diff: net/ssl/ssl_platform_key_util.cc

Issue 2567523003: Fix P-521 client cert mapping and test all curves. (Closed)
Patch Set: reupload with hack to depot_tools Created 4 years 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 unified diff | Download patch
« no previous file with comments | « net/ssl/ssl_platform_key_android_unittest.cc ('k') | net/ssl/ssl_platform_key_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/ssl/ssl_platform_key_util.h" 5 #include "net/ssl/ssl_platform_key_util.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 EC_KEY* ec_key = EVP_PKEY_get0_EC_KEY(key.get()); 81 EC_KEY* ec_key = EVP_PKEY_get0_EC_KEY(key.get());
82 int curve = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec_key)); 82 int curve = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec_key));
83 switch (curve) { 83 switch (curve) {
84 case NID_X9_62_prime256v1: 84 case NID_X9_62_prime256v1:
85 *out_type = SSLPrivateKey::Type::ECDSA_P256; 85 *out_type = SSLPrivateKey::Type::ECDSA_P256;
86 break; 86 break;
87 case NID_secp384r1: 87 case NID_secp384r1:
88 *out_type = SSLPrivateKey::Type::ECDSA_P384; 88 *out_type = SSLPrivateKey::Type::ECDSA_P384;
89 break; 89 break;
90 case NID_secp521r1: 90 case NID_secp521r1:
91 *out_type = SSLPrivateKey::Type::ECDSA_P384; 91 *out_type = SSLPrivateKey::Type::ECDSA_P521;
92 break; 92 break;
93 default: 93 default:
94 LOG(ERROR) << "Unsupported curve type " << curve; 94 LOG(ERROR) << "Unsupported curve type " << curve;
95 return false; 95 return false;
96 } 96 }
97 break; 97 break;
98 } 98 }
99 99
100 default: 100 default:
101 LOG(ERROR) << "Unsupported key type " << key_type; 101 LOG(ERROR) << "Unsupported key type " << key_type;
102 return false; 102 return false;
103 } 103 }
104 104
105 *out_max_length = EVP_PKEY_size(key.get()); 105 *out_max_length = EVP_PKEY_size(key.get());
106 return true; 106 return true;
107 } 107 }
108 108
109 } // namespace net 109 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/ssl_platform_key_android_unittest.cc ('k') | net/ssl/ssl_platform_key_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698