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

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

Issue 2627523002: Refactor the assignment of CertVerifyResult::has_md2, etc. (Closed)
Patch Set: Created 3 years, 11 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/cert_verify_proc_openssl.h" 5 #include "net/cert/cert_verify_proc_openssl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 STACK_OF(X509)* chain = X509_STORE_CTX_get_chain(store_ctx); 97 STACK_OF(X509)* chain = X509_STORE_CTX_get_chain(store_ctx);
98 X509* verified_cert = NULL; 98 X509* verified_cert = NULL;
99 std::vector<X509*> verified_chain; 99 std::vector<X509*> verified_chain;
100 for (size_t i = 0; i < sk_X509_num(chain); ++i) { 100 for (size_t i = 0; i < sk_X509_num(chain); ++i) {
101 X509* cert = sk_X509_value(chain, i); 101 X509* cert = sk_X509_value(chain, i);
102 if (i == 0) { 102 if (i == 0) {
103 verified_cert = cert; 103 verified_cert = cert;
104 } else { 104 } else {
105 verified_chain.push_back(cert); 105 verified_chain.push_back(cert);
106 } 106 }
107
108 // Only check the algorithm status for certificates that are not in the
109 // trust store.
110 if (i < static_cast<size_t>(store_ctx->last_untrusted)) {
111 FillCertVerifyResultWeakSignature(cert, i == 0, verify_result);
112 }
113 } 107 }
114 108
115 // Set verify_result->verified_cert and 109 // Set verify_result->verified_cert and
116 // verify_result->is_issued_by_known_root. 110 // verify_result->is_issued_by_known_root.
117 if (verified_cert) { 111 if (verified_cert) {
118 verify_result->verified_cert = 112 verify_result->verified_cert =
119 X509Certificate::CreateFromHandle(verified_cert, verified_chain); 113 X509Certificate::CreateFromHandle(verified_cert, verified_chain);
120 114
121 // For OpenSSL builds, only certificates used for unit tests are treated 115 // For OpenSSL builds, only certificates used for unit tests are treated
122 // as not issued by known roots. The only way to determine whether a 116 // as not issued by known roots. The only way to determine whether a
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 219
226 GetCertChainInfo(ctx.get(), verify_result); 220 GetCertChainInfo(ctx.get(), verify_result);
227 AppendPublicKeyHashes(ctx.get(), &verify_result->public_key_hashes); 221 AppendPublicKeyHashes(ctx.get(), &verify_result->public_key_hashes);
228 if (IsCertStatusError(verify_result->cert_status)) 222 if (IsCertStatusError(verify_result->cert_status))
229 return MapCertStatusToNetError(verify_result->cert_status); 223 return MapCertStatusToNetError(verify_result->cert_status);
230 224
231 return OK; 225 return OK;
232 } 226 }
233 227
234 } // namespace net 228 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698