| 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 "crypto/nss_util.h" | 5 #include "crypto/nss_util.h" |
| 6 #include "crypto/nss_util_internal.h" | 6 #include "crypto/nss_util_internal.h" |
| 7 | 7 |
| 8 #include <nss.h> | 8 #include <nss.h> |
| 9 #include <plarena.h> | 9 #include <plarena.h> |
| 10 #include <prerror.h> | 10 #include <prerror.h> |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 | 762 |
| 763 bool EnsureTPMTokenReady() { | 763 bool EnsureTPMTokenReady() { |
| 764 return g_nss_singleton.Get().EnsureTPMTokenReady(); | 764 return g_nss_singleton.Get().EnsureTPMTokenReady(); |
| 765 } | 765 } |
| 766 | 766 |
| 767 SymmetricKey* GetSupplementalUserKey() { | 767 SymmetricKey* GetSupplementalUserKey() { |
| 768 return g_nss_singleton.Get().GetSupplementalUserKey(); | 768 return g_nss_singleton.Get().GetSupplementalUserKey(); |
| 769 } | 769 } |
| 770 #endif // defined(OS_CHROMEOS) | 770 #endif // defined(OS_CHROMEOS) |
| 771 | 771 |
| 772 // TODO(port): Implement this more simply. We can convert by subtracting an | |
| 773 // offset (the difference between NSPR's and base::Time's epochs). | |
| 774 base::Time PRTimeToBaseTime(PRTime prtime) { | 772 base::Time PRTimeToBaseTime(PRTime prtime) { |
| 775 PRExplodedTime prxtime; | 773 return base::Time::FromInternalValue( |
| 776 PR_ExplodeTime(prtime, PR_GMTParameters, &prxtime); | 774 prtime + base::Time::UnixEpoch().ToInternalValue()); |
| 775 } |
| 777 | 776 |
| 778 base::Time::Exploded exploded; | 777 PRTime BaseTimeToPRTime(base::Time time) { |
| 779 exploded.year = prxtime.tm_year; | 778 return time.ToInternalValue() - base::Time::UnixEpoch().ToInternalValue(); |
| 780 exploded.month = prxtime.tm_month + 1; | |
| 781 exploded.day_of_week = prxtime.tm_wday; | |
| 782 exploded.day_of_month = prxtime.tm_mday; | |
| 783 exploded.hour = prxtime.tm_hour; | |
| 784 exploded.minute = prxtime.tm_min; | |
| 785 exploded.second = prxtime.tm_sec; | |
| 786 exploded.millisecond = prxtime.tm_usec / 1000; | |
| 787 | |
| 788 return base::Time::FromUTCExploded(exploded); | |
| 789 } | 779 } |
| 790 | 780 |
| 791 PK11SlotInfo* GetPublicNSSKeySlot() { | 781 PK11SlotInfo* GetPublicNSSKeySlot() { |
| 792 return g_nss_singleton.Get().GetPublicNSSKeySlot(); | 782 return g_nss_singleton.Get().GetPublicNSSKeySlot(); |
| 793 } | 783 } |
| 794 | 784 |
| 795 PK11SlotInfo* GetPrivateNSSKeySlot() { | 785 PK11SlotInfo* GetPrivateNSSKeySlot() { |
| 796 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); | 786 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); |
| 797 } | 787 } |
| 798 | 788 |
| 799 } // namespace crypto | 789 } // namespace crypto |
| OLD | NEW |