Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/base64.h" | 5 #include "base/base64.h" |
| 6 #include "base/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "crypto/sha2.h" | 10 #include "crypto/sha2.h" |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 | 403 |
| 404 *out_crl_set = crl_set; | 404 *out_crl_set = crl_set; |
| 405 return true; | 405 return true; |
| 406 } | 406 } |
| 407 | 407 |
| 408 CRLSet::Result CRLSet::CheckCertificate( | 408 CRLSet::Result CRLSet::CheckCertificate( |
| 409 const base::StringPiece& serial_number, | 409 const base::StringPiece& serial_number, |
| 410 const base::StringPiece& parent_spki) const { | 410 const base::StringPiece& parent_spki) const { |
| 411 base::StringPiece serial(serial_number); | 411 base::StringPiece serial(serial_number); |
| 412 | 412 |
| 413 if (!serial.empty() && serial[0] >= 0x80) { | 413 if (!serial.empty() && static_cast<unsigned char>(serial[0]) >= 0x80) { |
|
wtc
2011/11/01 04:02:51
It may be better to use bit testing:
(serial[0]
Hironori Bono
2011/11/01 07:57:52
Done. Thanks for your suggestion. It also fixes th
| |
| 414 // This serial number is negative but the process which generates CRL sets | 414 // This serial number is negative but the process which generates CRL sets |
| 415 // will reject any certificates with negative serial numbers as invalid. | 415 // will reject any certificates with negative serial numbers as invalid. |
| 416 return UNKNOWN; | 416 return UNKNOWN; |
| 417 } | 417 } |
| 418 | 418 |
| 419 // Remove any leading zero bytes. | 419 // Remove any leading zero bytes. |
| 420 while (serial.size() > 1 && serial[0] == 0x00) | 420 while (serial.size() > 1 && serial[0] == 0x00) |
| 421 serial.remove_prefix(1); | 421 serial.remove_prefix(1); |
| 422 | 422 |
| 423 std::map<std::string, size_t>::const_iterator i = | 423 std::map<std::string, size_t>::const_iterator i = |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 445 | 445 |
| 446 uint32 CRLSet::sequence() const { | 446 uint32 CRLSet::sequence() const { |
| 447 return sequence_; | 447 return sequence_; |
| 448 } | 448 } |
| 449 | 449 |
| 450 const CRLSet::CRLList& CRLSet::crls() const { | 450 const CRLSet::CRLList& CRLSet::crls() const { |
| 451 return crls_; | 451 return crls_; |
| 452 } | 452 } |
| 453 | 453 |
| 454 } // namespace net | 454 } // namespace net |
| OLD | NEW |