| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |