OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_cipher_suite_names.h" | 5 #include "net/ssl/ssl_cipher_suite_names.h" |
6 | 6 |
| 7 #if defined(USE_OPENSSL) |
| 8 #include <openssl/ssl.h> |
| 9 #endif |
7 #include <stdlib.h> | 10 #include <stdlib.h> |
8 | 11 |
9 #include "base/logging.h" | 12 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
12 #include "net/ssl/ssl_connection_status_flags.h" | 15 #include "net/ssl/ssl_connection_status_flags.h" |
13 | 16 |
14 // Rather than storing the names of all the ciphersuites we eliminate the | 17 // Rather than storing the names of all the ciphersuites we eliminate the |
15 // redundancy and break each cipher suite into a key exchange method, cipher | 18 // redundancy and break each cipher suite into a key exchange method, cipher |
16 // and mac. For all the ciphersuites in the IANA registry, we extract each of | 19 // and mac. For all the ciphersuites in the IANA registry, we extract each of |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 return false; | 415 return false; |
413 } | 416 } |
414 | 417 |
415 // Only AEADs allowed. | 418 // Only AEADs allowed. |
416 if (mac != kAEADMACValue) | 419 if (mac != kAEADMACValue) |
417 return false; | 420 return false; |
418 | 421 |
419 return true; | 422 return true; |
420 } | 423 } |
421 | 424 |
| 425 const char* ECCurveName(uint16 cipher_suite, int key_exchange_info) { |
| 426 #if defined(USE_OPENSSL) |
| 427 int key_exchange, cipher, mac; |
| 428 if (!GetCipherProperties(cipher_suite, &key_exchange, &cipher, &mac)) |
| 429 return nullptr; |
| 430 switch (key_exchange) { |
| 431 case 14: // ECDHE_ECDSA |
| 432 case 16: // ECDHE_RSA |
| 433 break; |
| 434 default: |
| 435 return nullptr; |
| 436 } |
| 437 return SSL_get_curve_name(key_exchange_info); |
| 438 #else |
| 439 return nullptr; |
| 440 #endif |
| 441 } |
| 442 |
422 } // namespace net | 443 } // namespace net |
OLD | NEW |