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 int key_exchange, cipher, mac; | |
427 if (!GetCipherProperties(cipher_suite, &key_exchange, &cipher, &mac)) | |
Ryan Sleevi
2015/09/02 01:37:07
Why do this lookup for non-OpenSSL cases?
sigbjorn
2015/09/02 13:42:14
Done.
| |
428 return NULL; | |
Ryan Sleevi
2015/09/02 01:37:07
nullptr throughout.
sigbjorn
2015/09/02 13:42:14
Done.
| |
429 switch (key_exchange) { | |
430 case 14: // ECDHE_ECDSA | |
431 case 16: // ECDHE_RSA | |
Ryan Sleevi
2015/09/02 01:37:07
This seems very brittle; I guess it's contingent u
sigbjorn
2015/09/02 13:42:14
I don't know if the methods above are generated, t
| |
432 break; | |
433 default: | |
434 return NULL; | |
435 } | |
436 #if defined(USE_OPENSSL) | |
Ryan Sleevi
2015/09/02 01:37:07
newline between 435/436 for legibility.
sigbjorn
2015/09/02 13:42:14
Code changed.
| |
437 return SSL_get_curve_name(key_exchange_info); | |
438 #endif | |
439 return NULL; | |
440 } | |
441 | |
422 } // namespace net | 442 } // namespace net |
OLD | NEW |