| 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/cert_verify_proc.h" | 5 #include "net/cert/cert_verify_proc.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 if (exploded_expiry.year - exploded_start.year > 10) | 686 if (exploded_expiry.year - exploded_start.year > 10) |
| 687 return true; | 687 return true; |
| 688 | 688 |
| 689 int month_diff = (exploded_expiry.year - exploded_start.year) * 12 + | 689 int month_diff = (exploded_expiry.year - exploded_start.year) * 12 + |
| 690 (exploded_expiry.month - exploded_start.month); | 690 (exploded_expiry.month - exploded_start.month); |
| 691 | 691 |
| 692 // Add any remainder as a full month. | 692 // Add any remainder as a full month. |
| 693 if (exploded_expiry.day_of_month > exploded_start.day_of_month) | 693 if (exploded_expiry.day_of_month > exploded_start.day_of_month) |
| 694 ++month_diff; | 694 ++month_diff; |
| 695 | 695 |
| 696 static const base::Time time_2012_07_01 = | 696 const base::Time time_2012_07_01 = |
| 697 base::Time::FromUTCExploded({2012, 7, 0, 1, 0, 0, 0, 0}); | 697 base::Time::FromInternalValue(12985574400000000); |
| 698 static const base::Time time_2015_04_01 = | 698 const base::Time time_2015_04_01 = |
| 699 base::Time::FromUTCExploded({2015, 4, 0, 1, 0, 0, 0, 0}); | 699 base::Time::FromInternalValue(13072320000000000); |
| 700 static const base::Time time_2019_07_01 = | 700 const base::Time time_2019_07_01 = |
| 701 base::Time::FromUTCExploded({2019, 7, 0, 1, 0, 0, 0, 0}); | 701 base::Time::FromInternalValue(13206412800000000); |
| 702 | 702 |
| 703 // For certificates issued before the BRs took effect. | 703 // For certificates issued before the BRs took effect. |
| 704 if (start < time_2012_07_01 && (month_diff > 120 || expiry > time_2019_07_01)) | 704 if (start < time_2012_07_01 && (month_diff > 120 || expiry > time_2019_07_01)) |
| 705 return true; | 705 return true; |
| 706 | 706 |
| 707 // For certificates issued after 1 July 2012: 60 months. | 707 // For certificates issued after 1 July 2012: 60 months. |
| 708 if (start >= time_2012_07_01 && month_diff > 60) | 708 if (start >= time_2012_07_01 && month_diff > 60) |
| 709 return true; | 709 return true; |
| 710 | 710 |
| 711 // For certificates issued after 1 April 2015: 39 months. | 711 // For certificates issued after 1 April 2015: 39 months. |
| 712 if (start >= time_2015_04_01 && month_diff > 39) | 712 if (start >= time_2015_04_01 && month_diff > 39) |
| 713 return true; | 713 return true; |
| 714 | 714 |
| 715 return false; | 715 return false; |
| 716 } | 716 } |
| 717 | 717 |
| 718 } // namespace net | 718 } // namespace net |
| OLD | NEW |