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/cert_verifier.h" | 5 #include "net/cert/cert_verifier.h" |
6 | 6 |
7 #include <openssl/sha.h> | 7 #include <openssl/sha.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 25 matching lines...) Expand all Loading... |
36 additional_trust_anchors_(std::move(additional_trust_anchors)) { | 36 additional_trust_anchors_(std::move(additional_trust_anchors)) { |
37 // For efficiency sake, rather than compare all of the fields for each | 37 // For efficiency sake, rather than compare all of the fields for each |
38 // comparison, compute a hash of their values. This is done directly in | 38 // comparison, compute a hash of their values. This is done directly in |
39 // this class, rather than as an overloaded hash operator, for efficiency's | 39 // this class, rather than as an overloaded hash operator, for efficiency's |
40 // sake. | 40 // sake. |
41 SHA256_CTX ctx; | 41 SHA256_CTX ctx; |
42 SHA256_Init(&ctx); | 42 SHA256_Init(&ctx); |
43 std::string cert_der; | 43 std::string cert_der; |
44 X509Certificate::GetDEREncoded(certificate_->os_cert_handle(), &cert_der); | 44 X509Certificate::GetDEREncoded(certificate_->os_cert_handle(), &cert_der); |
45 SHA256_Update(&ctx, cert_der.data(), cert_der.size()); | 45 SHA256_Update(&ctx, cert_der.data(), cert_der.size()); |
46 for (const auto& cert_handle : certificate_->GetIntermediateCertificates()) { | 46 for (auto* cert_handle : certificate_->GetIntermediateCertificates()) { |
47 X509Certificate::GetDEREncoded(cert_handle, &cert_der); | 47 X509Certificate::GetDEREncoded(cert_handle, &cert_der); |
48 SHA256_Update(&ctx, cert_der.data(), cert_der.size()); | 48 SHA256_Update(&ctx, cert_der.data(), cert_der.size()); |
49 } | 49 } |
50 SHA256_Update(&ctx, hostname_.data(), hostname.size()); | 50 SHA256_Update(&ctx, hostname_.data(), hostname.size()); |
51 SHA256_Update(&ctx, &flags, sizeof(flags)); | 51 SHA256_Update(&ctx, &flags, sizeof(flags)); |
52 SHA256_Update(&ctx, ocsp_response.data(), ocsp_response.size()); | 52 SHA256_Update(&ctx, ocsp_response.data(), ocsp_response.size()); |
53 for (const auto& trust_anchor : additional_trust_anchors_) { | 53 for (const auto& trust_anchor : additional_trust_anchors_) { |
54 X509Certificate::GetDEREncoded(trust_anchor->os_cert_handle(), &cert_der); | 54 X509Certificate::GetDEREncoded(trust_anchor->os_cert_handle(), &cert_der); |
55 SHA256_Update(&ctx, cert_der.data(), cert_der.size()); | 55 SHA256_Update(&ctx, cert_der.data(), cert_der.size()); |
56 } | 56 } |
(...skipping 25 matching lines...) Expand all Loading... |
82 NOTIMPLEMENTED(); | 82 NOTIMPLEMENTED(); |
83 return std::unique_ptr<CertVerifier>(); | 83 return std::unique_ptr<CertVerifier>(); |
84 #else | 84 #else |
85 return base::MakeUnique<CachingCertVerifier>( | 85 return base::MakeUnique<CachingCertVerifier>( |
86 base::MakeUnique<MultiThreadedCertVerifier>( | 86 base::MakeUnique<MultiThreadedCertVerifier>( |
87 CertVerifyProc::CreateDefault())); | 87 CertVerifyProc::CreateDefault())); |
88 #endif | 88 #endif |
89 } | 89 } |
90 | 90 |
91 } // namespace net | 91 } // namespace net |
OLD | NEW |