| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "net/ssl/ssl_config.h" | |
| 6 | |
| 7 #include "net/socket/ssl_client_socket.h" | |
| 8 | |
| 9 namespace net { | |
| 10 | |
| 11 const uint16 kDefaultSSLVersionMin = SSL_PROTOCOL_VERSION_TLS1; | |
| 12 | |
| 13 const uint16 kDefaultSSLVersionFallbackMin = SSL_PROTOCOL_VERSION_TLS1; | |
| 14 | |
| 15 SSLConfig::CertAndStatus::CertAndStatus() : cert_status(0) {} | |
| 16 | |
| 17 SSLConfig::CertAndStatus::~CertAndStatus() {} | |
| 18 | |
| 19 SSLConfig::SSLConfig() | |
| 20 : rev_checking_enabled(false), | |
| 21 rev_checking_required_local_anchors(false), | |
| 22 version_min(kDefaultSSLVersionMin), | |
| 23 version_max(SSLClientSocket::GetMaxSupportedSSLVersion()), | |
| 24 version_fallback_min(kDefaultSSLVersionFallbackMin), | |
| 25 channel_id_enabled(true), | |
| 26 false_start_enabled(true), | |
| 27 signed_cert_timestamps_enabled(true), | |
| 28 require_forward_secrecy(false), | |
| 29 send_client_cert(false), | |
| 30 verify_ev_cert(false), | |
| 31 version_fallback(false), | |
| 32 cert_io_enabled(true), | |
| 33 fastradio_padding_enabled(false), | |
| 34 fastradio_padding_eligible(false) { | |
| 35 } | |
| 36 | |
| 37 SSLConfig::~SSLConfig() {} | |
| 38 | |
| 39 bool SSLConfig::IsAllowedBadCert(X509Certificate* cert, | |
| 40 CertStatus* cert_status) const { | |
| 41 std::string der_cert; | |
| 42 if (!X509Certificate::GetDEREncoded(cert->os_cert_handle(), &der_cert)) | |
| 43 return false; | |
| 44 return IsAllowedBadCert(der_cert, cert_status); | |
| 45 } | |
| 46 | |
| 47 bool SSLConfig::IsAllowedBadCert(const base::StringPiece& der_cert, | |
| 48 CertStatus* cert_status) const { | |
| 49 for (size_t i = 0; i < allowed_bad_certs.size(); ++i) { | |
| 50 if (der_cert == allowed_bad_certs[i].der_cert) { | |
| 51 if (cert_status) | |
| 52 *cert_status = allowed_bad_certs[i].cert_status; | |
| 53 return true; | |
| 54 } | |
| 55 } | |
| 56 return false; | |
| 57 } | |
| 58 | |
| 59 } // namespace net | |
| OLD | NEW |