Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/base/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
| 6 | 6 |
| 7 #include <CommonCrypto/CommonDigest.h> | 7 #include <CommonCrypto/CommonDigest.h> |
| 8 #include <Security/Security.h> | 8 #include <Security/Security.h> |
| 9 #include <time.h> | 9 #include <time.h> |
| 10 | 10 |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 // chain building. | 440 // chain building. |
| 441 CFMutableArrayRef cert_array = CFArrayCreateMutable(kCFAllocatorDefault, 0, | 441 CFMutableArrayRef cert_array = CFArrayCreateMutable(kCFAllocatorDefault, 0, |
| 442 &kCFTypeArrayCallBacks); | 442 &kCFTypeArrayCallBacks); |
| 443 if (!cert_array) | 443 if (!cert_array) |
| 444 return ERR_OUT_OF_MEMORY; | 444 return ERR_OUT_OF_MEMORY; |
| 445 scoped_cftyperef<CFArrayRef> scoped_cert_array(cert_array); | 445 scoped_cftyperef<CFArrayRef> scoped_cert_array(cert_array); |
| 446 CFArrayAppendValue(cert_array, cert_handle_); | 446 CFArrayAppendValue(cert_array, cert_handle_); |
| 447 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) | 447 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) |
| 448 CFArrayAppendValue(cert_array, intermediate_ca_certs_[i]); | 448 CFArrayAppendValue(cert_array, intermediate_ca_certs_[i]); |
| 449 | 449 |
| 450 // From here on, only one thread can be active at a time. | |
|
wtc
2010/04/27 00:06:43
It would be nice to explain why you break the Veri
| |
| 451 AutoLock lock(lock_); | |
| 452 | |
| 450 SecTrustRef trust_ref = NULL; | 453 SecTrustRef trust_ref = NULL; |
| 451 status = SecTrustCreateWithCertificates(cert_array, ssl_policy, &trust_ref); | 454 status = SecTrustCreateWithCertificates(cert_array, ssl_policy, &trust_ref); |
| 452 if (status) | 455 if (status) |
| 453 return NetErrorFromOSStatus(status); | 456 return NetErrorFromOSStatus(status); |
| 454 scoped_cftyperef<SecTrustRef> scoped_trust_ref(trust_ref); | 457 scoped_cftyperef<SecTrustRef> scoped_trust_ref(trust_ref); |
| 455 | 458 |
| 456 // Set the trusted anchor certificates for the SecTrustRef by merging the | 459 // Set the trusted anchor certificates for the SecTrustRef by merging the |
| 457 // system trust anchors and the test root certificate. | 460 // system trust anchors and the test root certificate. |
| 458 CFArrayRef anchor_array = | 461 CFArrayRef anchor_array = |
| 459 Singleton<MacTrustedCertificates>::get()->CopyTrustedCertificateArray(); | 462 Singleton<MacTrustedCertificates>::get()->CopyTrustedCertificateArray(); |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 861 } | 864 } |
| 862 CFRelease(cert_chain); | 865 CFRelease(cert_chain); |
| 863 } | 866 } |
| 864 exit: | 867 exit: |
| 865 if (result) | 868 if (result) |
| 866 LOG(ERROR) << "CreateIdentityCertificateChain error " << result; | 869 LOG(ERROR) << "CreateIdentityCertificateChain error " << result; |
| 867 return chain.release(); | 870 return chain.release(); |
| 868 } | 871 } |
| 869 | 872 |
| 870 } // namespace net | 873 } // namespace net |
| OLD | NEW |