Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/sha1.h" | 7 #include "base/sha1.h" |
| 8 #include "crypto/sha2.h" | 8 #include "crypto/sha2.h" |
| 9 #include "net/cert/internal/parse_ocsp.h" | 9 #include "net/cert/internal/parse_ocsp.h" |
| 10 | 10 |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 522 } | 522 } |
| 523 } | 523 } |
| 524 } | 524 } |
| 525 | 525 |
| 526 if (!found) | 526 if (!found) |
| 527 out->status = OCSPCertStatus::Status::UNKNOWN; | 527 out->status = OCSPCertStatus::Status::UNKNOWN; |
| 528 | 528 |
| 529 return found; | 529 return found; |
| 530 } | 530 } |
| 531 | 531 |
| 532 bool CheckOCSPDateValid(const OCSPSingleResponse& response, | |
| 533 const base::Time& verify_time, | |
| 534 const base::TimeDelta& max_age) { | |
| 535 der::GeneralizedTime verify_time_der = der::ConvertBaseUTCTime(verify_time); | |
| 536 | |
| 537 // Enforce thisUpdate <= |verify_time|. | |
|
Ryan Sleevi
2016/06/28 17:33:30
Unnecessary comment
dadrian
2016/06/29 22:54:02
Done.
| |
| 538 if (response.this_update > verify_time_der) | |
|
Ryan Sleevi
2016/06/28 17:33:29
Why use > when the comment describes it as <=?
dadrian
2016/06/28 19:15:27
In addressing previous comments from svaldez, I ch
| |
| 539 return false; | |
| 540 | |
| 541 // Enforce |verify_time| < thisUpdate + |max_age|. | |
|
Ryan Sleevi
2016/06/28 17:33:29
Unnecessary comment
dadrian
2016/06/29 22:54:02
Done.
| |
| 542 der::GeneralizedTime lower_bound = | |
| 543 der::ConvertBaseUTCTime(verify_time - max_age); | |
| 544 if (response.this_update <= lower_bound) | |
|
Ryan Sleevi
2016/06/28 17:33:30
DESIGN: This code is quite confusing with the comm
dadrian
2016/06/28 19:15:27
It's written this way because addition is not defi
Ryan Sleevi
2016/06/28 19:26:44
If I understand your response, you're arguing that
dadrian
2016/06/29 22:54:02
Done.
| |
| 545 return false; | |
| 546 | |
| 547 // Enforce |verify_time| < nextUpdate, if present. | |
| 548 if (response.has_next_update && | |
| 549 (response.next_update <= response.this_update)) { | |
| 550 return false; | |
| 551 } | |
| 552 if (response.has_next_update && (response.next_update <= verify_time_der)) | |
| 553 return false; | |
|
Ryan Sleevi
2016/06/28 17:33:29
DESIGN: Why structure the conditionals like this?
dadrian
2016/06/28 19:15:27
I was trying to avoid the possible future bug, whe
Ryan Sleevi
2016/06/28 19:26:44
I don't think the readability sacrifice is worth t
dadrian
2016/06/29 22:54:02
Done.
| |
| 554 | |
| 555 return true; | |
| 556 } | |
| 557 | |
| 532 } // namespace net | 558 } // namespace net |
| OLD | NEW |