diff options
author | Amy Chan <amy.chan@intel.com> | 2024-11-06 12:10:09 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-11-25 16:40:28 +0000 |
commit | 065df32de381243588855b03ae49344b6b07a061 (patch) | |
tree | 284a2ffbbf8cc00437f7e5b25830b6095b0e7b9f /CryptoPkg | |
parent | 8c8e05db24d8578cf87669e491f983fbd8357d55 (diff) | |
download | edk2-065df32de381243588855b03ae49344b6b07a061.tar.gz |
CryptoPkg: Apply gettimeofday() solution to BaseCryptLibMbedTls
BaseCryptLib turn gettimeofday() from a Macro into a function call,
apply the same change to BaseCryptLibMbedTls
Signed-off-by: Amy Chan <amy.chan@intel.com>
Diffstat (limited to 'CryptoPkg')
-rw-r--r-- | CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/ConstantTimeClock.c | 33 | ||||
-rw-r--r-- | CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/TimerWrapper.c | 33 |
2 files changed, 28 insertions, 38 deletions
diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/ConstantTimeClock.c b/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/ConstantTimeClock.c index 2ec13ef9d0..e6e0f1ec2d 100644 --- a/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/ConstantTimeClock.c +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/ConstantTimeClock.c @@ -19,25 +19,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <Base.h>
#include <Library/BaseMemoryLib.h>
-
-typedef int time_t;
-
-//
-// Structures Definitions
-//
-struct tm {
- int tm_sec; /* seconds after the minute [0-60] */
- int tm_min; /* minutes after the hour [0-59] */
- int tm_hour; /* hours since midnight [0-23] */
- int tm_mday; /* day of the month [1-31] */
- int tm_mon; /* months since January [0-11] */
- int tm_year; /* years since 1900 */
- int tm_wday; /* days since Sunday [0-6] */
- int tm_yday; /* days since January 1 [0-365] */
- int tm_isdst; /* Daylight Savings Time flag */
- long tm_gmtoff; /* offset from CUT in seconds */
- char *tm_zone; /* timezone abbreviation */
-};
+#include <CrtLibSupport.h>
//
// -- Time Management Routines --
@@ -73,3 +55,16 @@ _time64 ( {
return time (t);
}
+
+long timezone;
+
+int
+gettimeofday (
+ struct timeval *tv,
+ struct timezone *tz
+ )
+{
+ tv->tv_sec = 0;
+ tv->tv_usec = 0;
+ return 0;
+}
diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/TimerWrapper.c b/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/TimerWrapper.c index b7cd4d3181..738db4e0ce 100644 --- a/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/TimerWrapper.c +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/TimerWrapper.c @@ -11,25 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
-
-typedef int time_t;
-
-//
-// Structures Definitions
-//
-struct tm {
- int tm_sec; /* seconds after the minute [0-60] */
- int tm_min; /* minutes after the hour [0-59] */
- int tm_hour; /* hours since midnight [0-23] */
- int tm_mday; /* day of the month [1-31] */
- int tm_mon; /* months since January [0-11] */
- int tm_year; /* years since 1900 */
- int tm_wday; /* days since Sunday [0-6] */
- int tm_yday; /* days since January 1 [0-365] */
- int tm_isdst; /* Daylight Savings Time flag */
- long tm_gmtoff; /* offset from CUT in seconds */
- char *tm_zone; /* timezone abbreviation */
-};
+#include <CrtLibSupport.h>
//
// -- Time Management Routines --
@@ -196,3 +178,16 @@ _time64 ( {
return time (t);
}
+
+long timezone;
+
+int
+gettimeofday (
+ struct timeval *tv,
+ struct timezone *tz
+ )
+{
+ tv->tv_sec = (long)time (NULL);
+ tv->tv_usec = 0;
+ return 0;
+}
|