| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cert/x509_util_mac.h" | 5 #include "net/cert/x509_util_mac.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/apple_apsl/cssmapplePriv.h" | 8 #include "third_party/apple_apsl/cssmapplePriv.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 memset(&tp_ssl_options, 0, sizeof(tp_ssl_options)); | 55 memset(&tp_ssl_options, 0, sizeof(tp_ssl_options)); |
| 56 tp_ssl_options.Version = CSSM_APPLE_TP_SSL_OPTS_VERSION; | 56 tp_ssl_options.Version = CSSM_APPLE_TP_SSL_OPTS_VERSION; |
| 57 tp_ssl_options.Flags |= CSSM_APPLE_TP_SSL_CLIENT; | 57 tp_ssl_options.Flags |= CSSM_APPLE_TP_SSL_CLIENT; |
| 58 | 58 |
| 59 return CreatePolicy(&CSSMOID_APPLE_TP_SSL, &tp_ssl_options, | 59 return CreatePolicy(&CSSMOID_APPLE_TP_SSL, &tp_ssl_options, |
| 60 sizeof(tp_ssl_options), policy); | 60 sizeof(tp_ssl_options), policy); |
| 61 } | 61 } |
| 62 | 62 |
| 63 OSStatus CreateSSLServerPolicy(const std::string& hostname, | 63 OSStatus CreateSSLServerPolicy(const std::string& hostname, |
| 64 SecPolicyRef* policy) { | 64 SecPolicyRef* policy) { |
| 65 CSSM_APPLE_TP_SSL_OPTIONS tp_ssl_options; | |
| 66 memset(&tp_ssl_options, 0, sizeof(tp_ssl_options)); | |
| 67 tp_ssl_options.Version = CSSM_APPLE_TP_SSL_OPTS_VERSION; | |
| 68 if (!hostname.empty()) { | 65 if (!hostname.empty()) { |
| 66 CSSM_APPLE_TP_SSL_OPTIONS tp_ssl_options; |
| 67 memset(&tp_ssl_options, 0, sizeof(tp_ssl_options)); |
| 68 tp_ssl_options.Version = CSSM_APPLE_TP_SSL_OPTS_VERSION; |
| 69 tp_ssl_options.ServerName = hostname.data(); | 69 tp_ssl_options.ServerName = hostname.data(); |
| 70 tp_ssl_options.ServerNameLen = hostname.size(); | 70 tp_ssl_options.ServerNameLen = hostname.size(); |
| 71 |
| 72 return CreatePolicy(&CSSMOID_APPLE_TP_SSL, &tp_ssl_options, |
| 73 sizeof(tp_ssl_options), policy); |
| 71 } | 74 } |
| 72 | 75 |
| 73 return CreatePolicy(&CSSMOID_APPLE_TP_SSL, &tp_ssl_options, | 76 return CreatePolicy(&CSSMOID_APPLE_TP_SSL, nullptr, 0U, policy); |
| 74 sizeof(tp_ssl_options), policy); | |
| 75 } | 77 } |
| 76 | 78 |
| 77 OSStatus CreateBasicX509Policy(SecPolicyRef* policy) { | 79 OSStatus CreateBasicX509Policy(SecPolicyRef* policy) { |
| 78 return CreatePolicy(&CSSMOID_APPLE_X509_BASIC, NULL, 0, policy); | 80 return CreatePolicy(&CSSMOID_APPLE_X509_BASIC, NULL, 0, policy); |
| 79 } | 81 } |
| 80 | 82 |
| 81 OSStatus CreateRevocationPolicies(bool enable_revocation_checking, | 83 OSStatus CreateRevocationPolicies(bool enable_revocation_checking, |
| 82 bool enable_ev_checking, | 84 bool enable_ev_checking, |
| 83 CFMutableArrayRef policies) { | 85 CFMutableArrayRef policies) { |
| 84 OSStatus status = noErr; | 86 OSStatus status = noErr; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 CSSM_CL_CertAbortQuery(cl_handle_, results_handle); | 231 CSSM_CL_CertAbortQuery(cl_handle_, results_handle); |
| 230 field->Reset(cl_handle_, oid, field_ptr); | 232 field->Reset(cl_handle_, oid, field_ptr); |
| 231 return CSSM_OK; | 233 return CSSM_OK; |
| 232 } | 234 } |
| 233 | 235 |
| 234 } // namespace x509_util | 236 } // namespace x509_util |
| 235 | 237 |
| 236 #pragma clang diagnostic pop // "-Wdeprecated-declarations" | 238 #pragma clang diagnostic pop // "-Wdeprecated-declarations" |
| 237 | 239 |
| 238 } // namespace net | 240 } // namespace net |
| OLD | NEW |