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 | |
Ryan Sleevi
2014/03/21 20:03:02
IWYU?
#if defined(USE_OPENSSL)
#include <openssl/
Sergey Ulanov
2014/03/21 20:06:22
Done.
| |
7 namespace net { | |
8 | |
9 const uint16 kDefaultSSLVersionMin = SSL_PROTOCOL_VERSION_SSL3; | |
10 | |
11 const uint16 kDefaultSSLVersionMax = | |
12 #if defined(USE_OPENSSL) | |
13 #if defined(SSL_OP_NO_TLSv1_2) | |
14 SSL_PROTOCOL_VERSION_TLS1_2; | |
15 #elif defined(SSL_OP_NO_TLSv1_1) | |
16 SSL_PROTOCOL_VERSION_TLS1_1; | |
17 #else | |
18 SSL_PROTOCOL_VERSION_TLS1; | |
19 #endif | |
20 #else | |
21 SSL_PROTOCOL_VERSION_TLS1_2; | |
22 #endif | |
23 | |
24 SSLConfig::CertAndStatus::CertAndStatus() : cert_status(0) {} | |
25 | |
26 SSLConfig::CertAndStatus::~CertAndStatus() {} | |
27 | |
28 SSLConfig::SSLConfig() | |
29 : rev_checking_enabled(false), | |
30 rev_checking_required_local_anchors(false), | |
31 version_min(kDefaultSSLVersionMin), | |
32 version_max(kDefaultSSLVersionMax), | |
33 channel_id_enabled(true), | |
34 false_start_enabled(true), | |
35 signed_cert_timestamps_enabled(true), | |
36 require_forward_secrecy(false), | |
37 unrestricted_ssl3_fallback_enabled(false), | |
38 send_client_cert(false), | |
39 verify_ev_cert(false), | |
40 version_fallback(false), | |
41 cert_io_enabled(true) { | |
42 } | |
43 | |
44 SSLConfig::~SSLConfig() {} | |
45 | |
46 bool SSLConfig::IsAllowedBadCert(X509Certificate* cert, | |
47 CertStatus* cert_status) const { | |
48 std::string der_cert; | |
49 if (!X509Certificate::GetDEREncoded(cert->os_cert_handle(), &der_cert)) | |
50 return false; | |
51 return IsAllowedBadCert(der_cert, cert_status); | |
52 } | |
53 | |
54 bool SSLConfig::IsAllowedBadCert(const base::StringPiece& der_cert, | |
55 CertStatus* cert_status) const { | |
56 for (size_t i = 0; i < allowed_bad_certs.size(); ++i) { | |
57 if (der_cert == allowed_bad_certs[i].der_cert) { | |
58 if (cert_status) | |
59 *cert_status = allowed_bad_certs[i].cert_status; | |
60 return true; | |
61 } | |
62 } | |
63 return false; | |
64 } | |
65 | |
66 } // namespace net | |
OLD | NEW |