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

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

Issue 2090713003: Make callers of FromUTC(Local)Exploded in net/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert Created 4 years, 2 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/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
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 static base::Time time_2012_07_01;
697 base::Time::FromUTCExploded({2012, 7, 0, 1, 0, 0, 0, 0}); 697 if (!base::Time::FromUTCExploded({2012, 7, 0, 1, 0, 0, 0, 0},
eroman 2016/10/20 18:05:21 This translation is not the same -- before FromUTC
698 static const base::Time time_2015_04_01 = 698 &time_2012_07_01)) {
699 base::Time::FromUTCExploded({2015, 4, 0, 1, 0, 0, 0, 0}); 699 return false;
700 static const base::Time time_2019_07_01 = 700 }
701 base::Time::FromUTCExploded({2019, 7, 0, 1, 0, 0, 0, 0}); 701
702 static base::Time time_2015_04_01;
703 if (!base::Time::FromUTCExploded({2015, 4, 0, 1, 0, 0, 0, 0},
704 &time_2015_04_01)) {
705 return false;
706 }
707
708 static base::Time time_2019_07_01;
709 if (!base::Time::FromUTCExploded({2019, 7, 0, 1, 0, 0, 0, 0},
710 &time_2019_07_01)) {
711 return false;
712 }
702 713
703 // For certificates issued before the BRs took effect. 714 // For certificates issued before the BRs took effect.
704 if (start < time_2012_07_01 && (month_diff > 120 || expiry > time_2019_07_01)) 715 if (start < time_2012_07_01 && (month_diff > 120 || expiry > time_2019_07_01))
705 return true; 716 return true;
706 717
707 // For certificates issued after 1 July 2012: 60 months. 718 // For certificates issued after 1 July 2012: 60 months.
708 if (start >= time_2012_07_01 && month_diff > 60) 719 if (start >= time_2012_07_01 && month_diff > 60)
709 return true; 720 return true;
710 721
711 // For certificates issued after 1 April 2015: 39 months. 722 // For certificates issued after 1 April 2015: 39 months.
712 if (start >= time_2015_04_01 && month_diff > 39) 723 if (start >= time_2015_04_01 && month_diff > 39)
713 return true; 724 return true;
714 725
715 return false; 726 return false;
716 } 727 }
717 728
718 } // namespace net 729 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/cert/ct_policy_enforcer_unittest.cc » ('j') | net/cert/ct_policy_enforcer_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698