diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2024-05-22 12:14:31 +0200 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-09-25 16:08:35 +0000 |
commit | ebf7daa583f742129765c62cbd99de58e3300dd8 (patch) | |
tree | a199c6abf04b38aafc488f67defd78be9f5616b3 /CryptoPkg | |
parent | 609c7e86794158f847023679841b17bb3f7b8325 (diff) | |
download | edk2-ebf7daa583f742129765c62cbd99de58e3300dd8.tar.gz edk2-ebf7daa583f742129765c62cbd99de58e3300dd8.tar.bz2 edk2-ebf7daa583f742129765c62cbd99de58e3300dd8.zip |
CrtLibSupport: fix gettimeofday()
Turn gettimeofday() into a proper function with return value.
Will be needed by openssl-3.2.x
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'CryptoPkg')
4 files changed, 41 insertions, 1 deletions
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
|