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

Side by Side Diff: net/cert/internal/parsed_certificate.cc

Issue 2341943002: Add error details to TBSCertificate parsing function and tests. (Closed)
Patch Set: update comment 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/internal/parsed_certificate.h" 5 #include "net/cert/internal/parsed_certificate.h"
6 6
7 #include "net/cert/internal/name_constraints.h" 7 #include "net/cert/internal/name_constraints.h"
8 #include "net/cert/internal/signature_algorithm.h" 8 #include "net/cert/internal/signature_algorithm.h"
9 #include "net/cert/internal/verify_name_match.h" 9 #include "net/cert/internal/verify_name_match.h"
10 #include "net/der/parser.h" 10 #include "net/der/parser.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 result->cert_ = der::Input(data, length); 91 result->cert_ = der::Input(data, length);
92 break; 92 break;
93 } 93 }
94 94
95 if (!ParseCertificate(result->cert_, &result->tbs_certificate_tlv_, 95 if (!ParseCertificate(result->cert_, &result->tbs_certificate_tlv_,
96 &result->signature_algorithm_tlv_, 96 &result->signature_algorithm_tlv_,
97 &result->signature_value_, errors)) { 97 &result->signature_value_, errors)) {
98 return nullptr; 98 return nullptr;
99 } 99 }
100 100
101 if (!ParseTbsCertificate(result->tbs_certificate_tlv_, options, 101 if (!ParseTbsCertificate(result->tbs_certificate_tlv_, options, &result->tbs_,
102 &result->tbs_)) { 102 errors)) {
103 return nullptr; 103 return nullptr;
104 } 104 }
105 105
106 // Attempt to parse the signature algorithm contained in the Certificate. 106 // Attempt to parse the signature algorithm contained in the Certificate.
107 // Do not give up on failure here, since SignatureAlgorithm::CreateFromDer 107 // Do not give up on failure here, since SignatureAlgorithm::CreateFromDer
108 // will fail on valid but unsupported signature algorithms. 108 // will fail on valid but unsupported signature algorithms.
109 // TODO(mattm): should distinguish between unsupported algorithms and parsing 109 // TODO(mattm): should distinguish between unsupported algorithms and parsing
110 // errors. 110 // errors.
111 result->signature_algorithm_ = 111 result->signature_algorithm_ =
112 SignatureAlgorithm::CreateFromDer(result->signature_algorithm_tlv_); 112 SignatureAlgorithm::CreateFromDer(result->signature_algorithm_tlv_);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // NOTE: if additional extensions are consumed here, the verification code 193 // NOTE: if additional extensions are consumed here, the verification code
194 // must be updated to process those extensions, since the 194 // must be updated to process those extensions, since the
195 // VerifyNoUnconsumedCriticalExtensions uses the unparsed_extensions_ 195 // VerifyNoUnconsumedCriticalExtensions uses the unparsed_extensions_
196 // variable to tell which extensions were processed. 196 // variable to tell which extensions were processed.
197 } 197 }
198 198
199 return result; 199 return result;
200 } 200 }
201 201
202 } // namespace net 202 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698