5872fb18b4
- Rebase to edk2-stable202405 - Bumo openssl to 8e5beb77088b - Resolves: RHEL-32486 (rebase to edk2-stable202405 [rhel-9]) - Resolves: RHEL-36446 (edk2: enable MOR [rhel-9]) - Resolves: RHEL-21653 (CVE-2023-6237 edk2: openssl: Excessive time spent checking invalid RSA public keys [rhel-9]) - Resolves: RHEL-21150 (CVE-2023-6129 edk2: mysql: openssl: POLY1305 MAC implementation corrupts vector registers on PowerPC) - Resolves: RHEL-22490 (CVE-2024-0727 edk2: openssl: denial of service via null dereference [rhel-9])
140 lines
2.7 KiB
Diff
140 lines
2.7 KiB
Diff
From 168cfe83b250d3166817549c1e96e6b1f02bcab4 Mon Sep 17 00:00:00 2001
|
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
Date: Mon, 28 Aug 2023 13:27:09 +0200
|
|
Subject: [PATCH] CryptoPkg/CrtLib: add access/open/read/write/close syscalls
|
|
|
|
Needed by rhel downstream openssl patches, they use unix syscalls
|
|
for file access (instead of fopen + friends like the rest of the
|
|
code base). No actual file access is needed for edk2, so just
|
|
add stubs to make linking work.
|
|
|
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
---
|
|
.../Library/BaseCryptLib/SysCall/CrtWrapper.c | 46 +++++++++++++++++++
|
|
CryptoPkg/Library/Include/CrtLibSupport.h | 41 +++++++++++++++++
|
|
2 files changed, 87 insertions(+)
|
|
|
|
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
|
|
index 37cdecc9bd..dfdb635536 100644
|
|
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
|
|
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
|
|
@@ -550,6 +550,52 @@ fread (
|
|
return 0;
|
|
}
|
|
|
|
+int
|
|
+access(
|
|
+ const char*,
|
|
+ int
|
|
+ )
|
|
+{
|
|
+ return -1;
|
|
+}
|
|
+
|
|
+int
|
|
+open (
|
|
+ const char *,
|
|
+ int
|
|
+ )
|
|
+{
|
|
+ return -1;
|
|
+}
|
|
+
|
|
+ssize_t
|
|
+read (
|
|
+ int,
|
|
+ void*,
|
|
+ size_t
|
|
+ )
|
|
+{
|
|
+ return -1;
|
|
+}
|
|
+
|
|
+ssize_t
|
|
+write (
|
|
+ int,
|
|
+ const void*,
|
|
+ size_t
|
|
+ )
|
|
+{
|
|
+ return -1;
|
|
+}
|
|
+
|
|
+int
|
|
+close (
|
|
+ int
|
|
+ )
|
|
+{
|
|
+ return -1;
|
|
+}
|
|
+
|
|
uid_t
|
|
getuid (
|
|
void
|
|
diff --git a/CryptoPkg/Library/Include/CrtLibSupport.h b/CryptoPkg/Library/Include/CrtLibSupport.h
|
|
index f36fe08f0c..7d98496af8 100644
|
|
--- a/CryptoPkg/Library/Include/CrtLibSupport.h
|
|
+++ b/CryptoPkg/Library/Include/CrtLibSupport.h
|
|
@@ -78,6 +78,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
//
|
|
// Definitions for global constants used by CRT library routines
|
|
//
|
|
+#define EINTR 4
|
|
#define EINVAL 22 /* Invalid argument */
|
|
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
|
|
#define INT_MAX 0x7FFFFFFF /* Maximum (signed) int value */
|
|
@@ -102,6 +103,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
#define NS_INADDRSZ 4 /*%< IPv4 T_A */
|
|
#define NS_IN6ADDRSZ 16 /*%< IPv6 T_AAAA */
|
|
|
|
+#define O_RDONLY 00000000
|
|
+#define O_WRONLY 00000001
|
|
+#define O_RDWR 00000002
|
|
+
|
|
+#define R_OK 4
|
|
+#define W_OK 2
|
|
+#define X_OK 1
|
|
+#define F_OK 0
|
|
+
|
|
//
|
|
// Basic types mapping
|
|
//
|
|
@@ -324,6 +334,37 @@ fprintf (
|
|
...
|
|
);
|
|
|
|
+int
|
|
+access(
|
|
+ const char*,
|
|
+ int
|
|
+ );
|
|
+
|
|
+int
|
|
+open (
|
|
+ const char *,
|
|
+ int
|
|
+ );
|
|
+
|
|
+ssize_t
|
|
+read (
|
|
+ int,
|
|
+ void*,
|
|
+ size_t
|
|
+ );
|
|
+
|
|
+ssize_t
|
|
+write (
|
|
+ int,
|
|
+ const void*,
|
|
+ size_t
|
|
+ );
|
|
+
|
|
+int
|
|
+close (
|
|
+ int
|
|
+ );
|
|
+
|
|
time_t
|
|
time (
|
|
time_t *
|