diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c b/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c index 4f23de2830..b625246bda 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c @@ -50,3 +50,14 @@ sleep ( { return 0; } + +int +gettimeofday ( + struct timeval *tv, + struct timezone *tz + ) +{ + tv->tv_sec = 0; + tv->tv_usec = 0; + return 0; +} diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c index 30c93a45ea..ff3278caea 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c @@ -205,3 +205,14 @@ sleep ( gBS->Stall (seconds * 1000 * 1000); return 0; } + +int +gettimeofday ( + struct timeval *tv, + struct timezone *tz + ) +{ + tv->tv_sec = (long)time (NULL); + tv->tv_usec = 0; + return 0; +} diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c b/CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c index 1ec7fa37cd..dab9e01a24 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c @@ -112,4 +112,15 @@ sleep ( return 0; } +int +gettimeofday ( + struct timeval *tv, + struct timezone *tz + ) +{ + tv->tv_sec = 0; + tv->tv_usec = 0; + return 0; +} + int errno = 0; diff --git a/CryptoPkg/Library/Include/CrtLibSupport.h b/CryptoPkg/Library/Include/CrtLibSupport.h index a9171fba36..f81f490734 100644 --- a/CryptoPkg/Library/Include/CrtLibSupport.h +++ b/CryptoPkg/Library/Include/CrtLibSupport.h @@ -147,6 +147,8 @@ struct timeval { long tv_usec; /* time value, in microseconds */ }; +struct timezone; + struct sockaddr { __uint8_t sa_len; /* total length */ sa_family_t sa_family; /* address family */ @@ -340,6 +342,12 @@ sleep ( unsigned int seconds ); +int +gettimeofday ( + struct timeval *tv, + struct timezone *tz + ); + uid_t getuid ( void @@ -439,6 +447,5 @@ strcat ( #define assert(expression) #define offsetof(type, member) OFFSET_OF(type,member) #define atoi(nptr) AsciiStrDecimalToUintn(nptr) -#define gettimeofday(tvp, tz) do { (tvp)->tv_sec = time(NULL); (tvp)->tv_usec = 0; } while (0) #endif