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

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

Issue 2341943002: Add error details to TBSCertificate parsing function and tests. (Closed)
Patch Set: fix fuzzer compile Created 4 years, 3 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_util.h" 5 #include "net/cert/x509_util.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "crypto/ec_private_key.h" 10 #include "crypto/ec_private_key.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 std::vector<std::string>* ip_addresses) { 126 std::vector<std::string>* ip_addresses) {
127 der::Input cert_data(certificate); 127 der::Input cert_data(certificate);
128 der::Input tbs_cert, signature_alg; 128 der::Input tbs_cert, signature_alg;
129 der::BitString signature_value; 129 der::BitString signature_value;
130 if (!ParseCertificate(cert_data, &tbs_cert, &signature_alg, &signature_value, 130 if (!ParseCertificate(cert_data, &tbs_cert, &signature_alg, &signature_value,
131 nullptr)) 131 nullptr))
132 return false; 132 return false;
133 133
134 ParsedTbsCertificate parsed_tbs_cert; 134 ParsedTbsCertificate parsed_tbs_cert;
135 if (!ParseTbsCertificate(tbs_cert, ParseCertificateOptions(), 135 if (!ParseTbsCertificate(tbs_cert, ParseCertificateOptions(),
136 &parsed_tbs_cert)) 136 &parsed_tbs_cert, nullptr))
137 return false; 137 return false;
138 138
139 if (!GetCommonName(parsed_tbs_cert.subject_tlv, subject)) 139 if (!GetCommonName(parsed_tbs_cert.subject_tlv, subject))
140 return false; 140 return false;
141 141
142 if (!GetCommonName(parsed_tbs_cert.issuer_tlv, issuer)) 142 if (!GetCommonName(parsed_tbs_cert.issuer_tlv, issuer))
143 return false; 143 return false;
144 144
145 if (!DecodeTime(parsed_tbs_cert.validity_not_before, not_before)) 145 if (!DecodeTime(parsed_tbs_cert.validity_not_before, not_before))
146 return false; 146 return false;
(...skipping 19 matching lines...) Expand all
166 ip_addresses->push_back(ip.ToString()); 166 ip_addresses->push_back(ip.ToString());
167 } 167 }
168 } 168 }
169 169
170 return true; 170 return true;
171 } 171 }
172 172
173 } // namespace x509_util 173 } // namespace x509_util
174 174
175 } // namespace net 175 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/parsed_certificate.cc ('k') | net/data/parse_certificate_unittest/tbs_v3_data_after_extensions.pem » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698