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