| OLD | NEW |
| 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 "chrome/browser/ssl/chrome_security_state_model_client.h" | 5 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| 6 | 6 |
| 7 #include <openssl/ssl.h> | 7 #include <openssl/ssl.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 | 76 |
| 77 int ssl_version = | 77 int ssl_version = |
| 78 net::SSLConnectionStatusToVersion(security_info.connection_status); | 78 net::SSLConnectionStatusToVersion(security_info.connection_status); |
| 79 const char* protocol; | 79 const char* protocol; |
| 80 net::SSLVersionToString(&protocol, ssl_version); | 80 net::SSLVersionToString(&protocol, ssl_version); |
| 81 const char* key_exchange; | 81 const char* key_exchange; |
| 82 const char* cipher; | 82 const char* cipher; |
| 83 const char* mac; | 83 const char* mac; |
| 84 bool is_aead; | 84 bool is_aead; |
| 85 bool is_tls13; |
| 85 uint16_t cipher_suite = | 86 uint16_t cipher_suite = |
| 86 net::SSLConnectionStatusToCipherSuite(security_info.connection_status); | 87 net::SSLConnectionStatusToCipherSuite(security_info.connection_status); |
| 87 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, | 88 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, |
| 88 cipher_suite); | 89 &is_tls13, cipher_suite); |
| 89 base::string16 protocol_name = base::ASCIIToUTF16(protocol); | 90 base::string16 protocol_name = base::ASCIIToUTF16(protocol); |
| 90 base::string16 key_exchange_name = base::ASCIIToUTF16(key_exchange); | |
| 91 const base::string16 cipher_name = | 91 const base::string16 cipher_name = |
| 92 (mac == NULL) ? base::ASCIIToUTF16(cipher) | 92 (mac == NULL) ? base::ASCIIToUTF16(cipher) |
| 93 : l10n_util::GetStringFUTF16(IDS_CIPHER_WITH_MAC, | 93 : l10n_util::GetStringFUTF16(IDS_CIPHER_WITH_MAC, |
| 94 base::ASCIIToUTF16(cipher), | 94 base::ASCIIToUTF16(cipher), |
| 95 base::ASCIIToUTF16(mac)); | 95 base::ASCIIToUTF16(mac)); |
| 96 | 96 |
| 97 // Include the key exchange group (previously known as curve) if specified. | 97 // Include the key exchange group (previously known as curve) if specified. |
| 98 // | 98 base::string16 key_exchange_name; |
| 99 // TODO(davidben): When TLS 1.3's new negotiation is implemented, omit the | 99 if (is_tls13) { |
| 100 // "key exchange" if empty and only display the group, which is the true key | 100 key_exchange_name = base::ASCIIToUTF16( |
| 101 // exchange. See https://crbug.com/639495. | 101 SSL_get_curve_name(security_info.key_exchange_group)); |
| 102 if (security_info.key_exchange_group != 0) { | 102 } else if (security_info.key_exchange_group != 0) { |
| 103 key_exchange_name = l10n_util::GetStringFUTF16( | 103 key_exchange_name = l10n_util::GetStringFUTF16( |
| 104 IDS_SSL_KEY_EXCHANGE_WITH_GROUP, key_exchange_name, | 104 IDS_SSL_KEY_EXCHANGE_WITH_GROUP, base::ASCIIToUTF16(key_exchange), |
| 105 base::ASCIIToUTF16( | 105 base::ASCIIToUTF16( |
| 106 SSL_get_curve_name(security_info.key_exchange_group))); | 106 SSL_get_curve_name(security_info.key_exchange_group))); |
| 107 } else { |
| 108 key_exchange_name = base::ASCIIToUTF16(key_exchange); |
| 107 } | 109 } |
| 108 | 110 |
| 109 if (security_info.obsolete_ssl_status == net::OBSOLETE_SSL_NONE) { | 111 if (security_info.obsolete_ssl_status == net::OBSOLETE_SSL_NONE) { |
| 110 security_style_explanations->secure_explanations.push_back( | 112 security_style_explanations->secure_explanations.push_back( |
| 111 content::SecurityStyleExplanation( | 113 content::SecurityStyleExplanation( |
| 112 l10n_util::GetStringUTF8(IDS_STRONG_SSL_SUMMARY), | 114 l10n_util::GetStringUTF8(IDS_STRONG_SSL_SUMMARY), |
| 113 l10n_util::GetStringFUTF8(IDS_STRONG_SSL_DESCRIPTION, protocol_name, | 115 l10n_util::GetStringFUTF8(IDS_STRONG_SSL_DESCRIPTION, protocol_name, |
| 114 key_exchange_name, cipher_name))); | 116 key_exchange_name, cipher_name))); |
| 115 return; | 117 return; |
| 116 } | 118 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 !!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS); | 357 !!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS); |
| 356 state->displayed_password_field_on_http = | 358 state->displayed_password_field_on_http = |
| 357 !!(ssl.content_status & | 359 !!(ssl.content_status & |
| 358 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); | 360 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); |
| 359 state->displayed_credit_card_field_on_http = | 361 state->displayed_credit_card_field_on_http = |
| 360 !!(ssl.content_status & | 362 !!(ssl.content_status & |
| 361 content::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP); | 363 content::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP); |
| 362 | 364 |
| 363 CheckSafeBrowsingStatus(entry, web_contents_, state); | 365 CheckSafeBrowsingStatus(entry, web_contents_, state); |
| 364 } | 366 } |
| OLD | NEW |