Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Side by Side Diff: net/cert/x509_certificate_mac.cc

Issue 173853014: Make OpenSSL UpdateServerCert() OS independent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_certificate.h" 5 #include "net/cert/x509_certificate.h"
6 6
7 #include <CommonCrypto/CommonDigest.h> 7 #include <CommonCrypto/CommonDigest.h>
8 #include <CoreServices/CoreServices.h> 8 #include <CoreServices/CoreServices.h>
9 #include <Security/Security.h> 9 #include <Security/Security.h>
10 10
11 #include <cert.h>
12
13 #include <vector> 11 #include <vector>
14 12
15 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
16 #include "base/logging.h" 14 #include "base/logging.h"
17 #include "base/mac/mac_logging.h" 15 #include "base/mac/mac_logging.h"
18 #include "base/mac/scoped_cftyperef.h" 16 #include "base/mac/scoped_cftyperef.h"
19 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
20 #include "base/pickle.h" 18 #include "base/pickle.h"
21 #include "base/sha1.h" 19 #include "base/sha1.h"
22 #include "base/strings/string_piece.h" 20 #include "base/strings/string_piece.h"
23 #include "base/strings/sys_string_conversions.h" 21 #include "base/strings/sys_string_conversions.h"
24 #include "base/synchronization/lock.h" 22 #include "base/synchronization/lock.h"
25 #include "crypto/cssm_init.h" 23 #include "crypto/cssm_init.h"
26 #include "crypto/mac_security_services_lock.h" 24 #include "crypto/mac_security_services_lock.h"
27 #include "crypto/nss_util.h" 25 #include "crypto/nss_util.h"
wtc 2014/02/25 01:13:09 This header is NSS-specific and should also be rem
28 #include "net/cert/x509_util_mac.h" 26 #include "net/cert/x509_util_mac.h"
29 27
30 using base::ScopedCFTypeRef; 28 using base::ScopedCFTypeRef;
31 using base::Time; 29 using base::Time;
32 30
33 namespace net { 31 namespace net {
34 32
35 namespace { 33 namespace {
36 34
37 void GetCertDistinguishedName( 35 void GetCertDistinguishedName(
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 197 }
200 } 198 }
201 199
202 struct CSSMOIDString { 200 struct CSSMOIDString {
203 const CSSM_OID* oid_; 201 const CSSM_OID* oid_;
204 std::string string_; 202 std::string string_;
205 }; 203 };
206 204
207 typedef std::vector<CSSMOIDString> CSSMOIDStringVector; 205 typedef std::vector<CSSMOIDString> CSSMOIDStringVector;
208 206
209 class ScopedCertName {
210 public:
211 explicit ScopedCertName(CERTName* name) : name_(name) { }
212 ~ScopedCertName() {
213 if (name_) CERT_DestroyName(name_);
214 }
215 operator CERTName*() { return name_; }
216
217 private:
218 CERTName* name_;
219 };
Ryan Sleevi 2014/02/21 22:34:38 Unrelated cleanups are best left for a separate CL
220
221 class ScopedEncodedCertResults { 207 class ScopedEncodedCertResults {
222 public: 208 public:
223 explicit ScopedEncodedCertResults(CSSM_TP_RESULT_SET* results) 209 explicit ScopedEncodedCertResults(CSSM_TP_RESULT_SET* results)
224 : results_(results) { } 210 : results_(results) { }
225 ~ScopedEncodedCertResults() { 211 ~ScopedEncodedCertResults() {
226 if (results_) { 212 if (results_) {
227 CSSM_ENCODED_CERT* encCert = 213 CSSM_ENCODED_CERT* encCert =
228 reinterpret_cast<CSSM_ENCODED_CERT*>(results_->Results); 214 reinterpret_cast<CSSM_ENCODED_CERT*>(results_->Results);
229 for (uint32 i = 0; i < results_->NumberOfResults; i++) { 215 for (uint32 i = 0; i < results_->NumberOfResults; i++) {
230 crypto::CSSMFree(encCert[i].CertBlob.Data); 216 crypto::CSSMFree(encCert[i].CertBlob.Data);
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 *type = kPublicKeyTypeDH; 534 *type = kPublicKeyTypeDH;
549 break; 535 break;
550 default: 536 default:
551 *type = kPublicKeyTypeUnknown; 537 *type = kPublicKeyTypeUnknown;
552 *size_bits = 0; 538 *size_bits = 0;
553 break; 539 break;
554 } 540 }
555 } 541 }
556 542
557 } // namespace net 543 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/socket/ssl_client_socket_openssl.cc » ('j') | net/socket/ssl_client_socket_openssl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698