From 0ec54d8d0c8fb3069ca290c4e7b265f5ddff8583 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 11 Jun 2024 12:02:11 +0200 Subject: CrtLibSupport: add mktime() Will be needed by openssl-3.2.x Signed-off-by: Gerd Hoffmann --- .../Library/BaseCryptLib/SysCall/ConstantTimeClock.c | 8 ++++++++ CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 18 ++++++++++++++++++ CryptoPkg/Library/Include/CrtLibSupport.h | 5 +++++ 3 files changed, 31 insertions(+) (limited to 'CryptoPkg') diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c b/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c index b625246bda..224e3c3642 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c @@ -43,6 +43,14 @@ gmtime ( return NULL; } +time_t +mktime ( + struct tm *t + ) +{ + return 0; +} + unsigned int sleep ( unsigned int seconds diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c index 2e83041cf8..21b79acccd 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c @@ -141,6 +141,24 @@ time ( return CalTime; } +time_t +mktime ( + struct tm *t + ) +{ + EFI_TIME Time = { + .Year = (UINT16)t->tm_year, + .Month = (UINT8)t->tm_mon, + .Day = (UINT8)t->tm_mday, + .Hour = (UINT8)t->tm_hour, + .Minute = (UINT8)t->tm_min, + .Second = (UINT8)t->tm_sec, + .TimeZone = EFI_UNSPECIFIED_TIMEZONE, + }; + + return CalculateTimeT (&Time); +} + // // Convert a time value from type time_t to struct tm. // diff --git a/CryptoPkg/Library/Include/CrtLibSupport.h b/CryptoPkg/Library/Include/CrtLibSupport.h index f81f490734..e3e8781d16 100644 --- a/CryptoPkg/Library/Include/CrtLibSupport.h +++ b/CryptoPkg/Library/Include/CrtLibSupport.h @@ -348,6 +348,11 @@ gettimeofday ( struct timezone *tz ); +time_t +mktime ( + struct tm *t + ); + uid_t getuid ( void -- cgit