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

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

Issue 1158923005: Use the exact-width integer types defined in <stdint.h> rather than (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comments. Exclude mime_sniffer*. Rebase. Created 5 years, 6 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/asn1_util.h" 5 #include "net/cert/asn1_util.h"
6 6
7 namespace net { 7 namespace net {
8 8
9 namespace asn1 { 9 namespace asn1 {
10 10
11 bool ParseElement(base::StringPiece* in, 11 bool ParseElement(base::StringPiece* in,
12 unsigned tag_value, 12 unsigned tag_value,
13 base::StringPiece* out, 13 base::StringPiece* out,
14 unsigned *out_header_len) { 14 unsigned *out_header_len) {
15 const uint8* data = reinterpret_cast<const uint8*>(in->data()); 15 const uint8_t* data = reinterpret_cast<const uint8_t*>(in->data());
16 16
17 // We don't support kAny and kOptional at the same time. 17 // We don't support kAny and kOptional at the same time.
18 if ((tag_value & kAny) && (tag_value & kOptional)) 18 if ((tag_value & kAny) && (tag_value & kOptional))
19 return false; 19 return false;
20 20
21 if (in->empty() && (tag_value & kOptional)) { 21 if (in->empty() && (tag_value & kOptional)) {
22 if (out_header_len) 22 if (out_header_len)
23 *out_header_len = 0; 23 *out_header_len = 0;
24 if (out) 24 if (out)
25 *out = base::StringPiece(); 25 *out = base::StringPiece();
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 base::StringPiece extension; 236 base::StringPiece extension;
237 if (!GetElement(&extensions, kSEQUENCE, &extension)) 237 if (!GetElement(&extensions, kSEQUENCE, &extension))
238 return false; 238 return false;
239 239
240 base::StringPiece oid; 240 base::StringPiece oid;
241 if (!GetElement(&extension, kOID, &oid)) 241 if (!GetElement(&extension, kOID, &oid))
242 return false; 242 return false;
243 243
244 // kCRLDistributionPointsOID is the DER encoding of the OID for the X.509 244 // kCRLDistributionPointsOID is the DER encoding of the OID for the X.509
245 // CRL Distribution Points extension. 245 // CRL Distribution Points extension.
246 static const uint8 kCRLDistributionPointsOID[] = {0x55, 0x1d, 0x1f}; 246 static const uint8_t kCRLDistributionPointsOID[] = {0x55, 0x1d, 0x1f};
247 247
248 if (oid.size() != sizeof(kCRLDistributionPointsOID) || 248 if (oid.size() != sizeof(kCRLDistributionPointsOID) ||
249 memcmp(oid.data(), kCRLDistributionPointsOID, oid.size()) != 0) { 249 memcmp(oid.data(), kCRLDistributionPointsOID, oid.size()) != 0) {
250 continue; 250 continue;
251 } 251 }
252 252
253 // critical 253 // critical
254 GetElement(&extension, kBOOLEAN, NULL); 254 GetElement(&extension, kBOOLEAN, NULL);
255 255
256 // extnValue 256 // extnValue
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 322 }
323 } 323 }
324 324
325 urls_out->swap(tmp_urls_out); 325 urls_out->swap(tmp_urls_out);
326 return true; 326 return true;
327 } 327 }
328 328
329 } // namespace asn1 329 } // namespace asn1
330 330
331 } // namespace net 331 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698