Chromium Code Reviews| 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 #ifndef NET_SSL_SSL_CIPHER_SUITE_NAMES_H_ | 5 #ifndef NET_SSL_SSL_CIPHER_SUITE_NAMES_H_ |
| 6 #define NET_SSL_SSL_CIPHER_SUITE_NAMES_H_ | 6 #define NET_SSL_SSL_CIPHER_SUITE_NAMES_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 // suites in this form will not return an error. | 40 // suites in this form will not return an error. |
| 41 // | 41 // |
| 42 // Returns true if the cipher suite was successfully parsed, storing the | 42 // Returns true if the cipher suite was successfully parsed, storing the |
| 43 // result in |cipher_suite|. | 43 // result in |cipher_suite|. |
| 44 // | 44 // |
| 45 // TODO(rsleevi): Support the full strings defined in the IANA TLS parameters | 45 // TODO(rsleevi): Support the full strings defined in the IANA TLS parameters |
| 46 // list. | 46 // list. |
| 47 NET_EXPORT bool ParseSSLCipherString(const std::string& cipher_string, | 47 NET_EXPORT bool ParseSSLCipherString(const std::string& cipher_string, |
| 48 uint16_t* cipher_suite); | 48 uint16_t* cipher_suite); |
| 49 | 49 |
| 50 // |cipher_suite| is the IANA id for the cipher suite. What a "secure" | 50 // Mask definitions for an integer that holds obsolete SSL settingdetails. |
| 51 // cipher suite is arbitrarily determined here. The intent is to indicate what | 51 enum NET_EXPORT ObsoleteSSLMask { |
| 52 // cipher suites meet modern security standards when backwards compatibility can | 52 // Modern SSL |
| 53 // be ignored. | 53 OBSOLETE_SSL_NONE = 0, |
| 54 OBSOLETE_SSL_MASK_PROTOCOL = 1 << 0, | |
| 55 OBSOLETE_SSL_MASK_KEY_EXCHANGE = 1 << 1, | |
| 56 // |OBSOLETE_SSL_CIPHER_SUITE| indicates to an obsolete cipher, possibly with | |
| 57 // a MAC. Note that it does NOT indicate anything about the key exchange. | |
| 58 OBSOLETE_SSL_MASK_CIPHER_SUITE = 1 << 2, | |
| 59 }; | |
| 60 | |
| 61 // Takes the given |connection_status| and returns a bitmask indicating which of | |
| 62 // the protocol, key exchange, and cipher suite do not meet modern best-practice | |
| 63 // security standards (when backwards compatibility can be ignored) - that is, | |
| 64 // which ones are "obsolete". | |
| 54 // | 65 // |
| 55 // Currently, this function follows these criteria: | 66 // Currently, this function follows these criteria to determine what is |
| 56 // 1) Only uses ECDHE-based key exchanges authenticated by a certificate | 67 // obsolete: |
| 57 // 2) Only uses AEADs | 68 // |
| 58 NET_EXPORT bool IsSecureTLSCipherSuite(uint16_t cipher_suite); | 69 // - Protocol: less than TLS 1.2 |
|
davidben
2016/04/11 16:47:01
This function has a ton of callers you need to upd
lgarron
2016/04/12 02:25:09
Yeah, I left them out for this patch because most
| |
| 70 // - Key exchange: Does not use ECDHE-based key exchanges authenticated by a | |
| 71 // certificate | |
| 72 // - Cipher suite: not an AEAD cipher | |
| 73 NET_EXPORT int ObsoleteSSLStatus(int connection_status); | |
| 59 | 74 |
| 60 // Returns true if |cipher_suite| is suitable for use with HTTP/2. See | 75 // Returns true if |cipher_suite| is suitable for use with HTTP/2. See |
| 61 // https://http2.github.io/http2-spec/#rfc.section.9.2.2. | 76 // https://http2.github.io/http2-spec/#rfc.section.9.2.2. |
| 62 NET_EXPORT bool IsTLSCipherSuiteAllowedByHTTP2(uint16_t cipher_suite); | 77 NET_EXPORT bool IsTLSCipherSuiteAllowedByHTTP2(uint16_t cipher_suite); |
| 63 | 78 |
| 64 // Returns the static curve name of |key_exchange_info| if the |cipher_suite| | 79 // Returns the static curve name of |key_exchange_info| if the |cipher_suite| |
| 65 // is an elliptic curve, and a name is known. Returns nullptr otherwise. | 80 // is an elliptic curve, and a name is known. Returns nullptr otherwise. |
| 66 // Only defined for OpenSSL, returns nullptr otherwise. | 81 // Only defined for OpenSSL, returns nullptr otherwise. |
| 67 NET_EXPORT const char* ECCurveName(uint16_t cipher_suite, | 82 NET_EXPORT const char* ECCurveName(uint16_t cipher_suite, |
| 68 int key_exchange_info); | 83 int key_exchange_info); |
| 69 | 84 |
| 70 } // namespace net | 85 } // namespace net |
| 71 | 86 |
| 72 #endif // NET_SSL_SSL_CIPHER_SUITE_NAMES_H_ | 87 #endif // NET_SSL_SSL_CIPHER_SUITE_NAMES_H_ |
| OLD | NEW |