summaryrefslogtreecommitdiff
path: root/Cryptlib/SysCall
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2017-08-31 13:57:30 -0400
committerPeter Jones <pjones@redhat.com>2017-08-31 15:13:58 -0400
commit1d39ada8cb336d9e7c156be7526b674851fbdd40 (patch)
treedc497e33b1d4830bf58d79dedc3026087f31f044 /Cryptlib/SysCall
parenteae64276ffe0361d2b4087c48390d12f157f65f0 (diff)
downloadefi-boot-shim-1d39ada8cb336d9e7c156be7526b674851fbdd40.tar.gz
efi-boot-shim-1d39ada8cb336d9e7c156be7526b674851fbdd40.zip
Revert lots of Cryptlib updates.
OpenSSL changes quite a bit of the key validation, and most of the keys I can find in the wild aren't marked as trusted by the new checker. Intel noticed this too: https://github.com/vathpela/edk2/commit/f536d7c3ed but instead of fixing the compatibility error, they switched their test data to match the bug. So that's pretty broken. For now, I'm reverting OpenSSL 1.1.0e, because we need those certs in the wild to work. This reverts commit 513cbe2aea689bf968f171f894f3d4cdb43524d5. This reverts commit e9cc33d6f2b7f35c6f5e349fd83fb9ae0bc66226. This reverts commit 80d49f758ead0180bfe6161931838e0578248303. This reverts commit 9bc647e2b23bcfd69a0077c0717fbc454c919a57. This reverts commit ae75df6232ad30f3e8736e9449692d58a7439260. This reverts commit e883479f35644d17db7efed710657c8543cfcb68. This reverts commit 97469449fda5ba933a64280917e776487301a127. This reverts commit e39692647f78e13d757ddbfdd36f440d5f526050. This reverts commit 0f3dfc01e2d5e7df882c963dd8dc4a0dfbfc96ad. This reverts commit 4da6ac819510c7cc4ba21d7a735d69b45daa5873. This reverts commit d064bd7eef201f26cb926450a76260b5187ac689. This reverts commit 9bc86cfd6f9387f0da9d5c0102b6aa5627e91c91. This reverts commit ab9a05a10f16b33f7ee1e9da360c7801eebdb9d2. Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'Cryptlib/SysCall')
-rw-r--r--Cryptlib/SysCall/BaseMemAllocation.c5
-rw-r--r--Cryptlib/SysCall/BaseStrings.c70
-rw-r--r--Cryptlib/SysCall/CrtWrapper.c189
-rw-r--r--Cryptlib/SysCall/TimerWrapper.c4
4 files changed, 106 insertions, 162 deletions
diff --git a/Cryptlib/SysCall/BaseMemAllocation.c b/Cryptlib/SysCall/BaseMemAllocation.c
index 65e9938e..792b29e8 100644
--- a/Cryptlib/SysCall/BaseMemAllocation.c
+++ b/Cryptlib/SysCall/BaseMemAllocation.c
@@ -2,7 +2,7 @@
Base Memory Allocation Routines Wrapper for Crypto library over OpenSSL
during PEI & DXE phases.
-Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -13,8 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#include <CrtLibSupport.h>
-#include <Library/MemoryAllocationLib.h>
+#include <OpenSslSupport.h>
//
// -- Memory-Allocation Routines --
diff --git a/Cryptlib/SysCall/BaseStrings.c b/Cryptlib/SysCall/BaseStrings.c
index 2267d862..43875712 100644
--- a/Cryptlib/SysCall/BaseStrings.c
+++ b/Cryptlib/SysCall/BaseStrings.c
@@ -1,9 +1,9 @@
-#include <CrtLibSupport.h>
+#include <OpenSslSupport.h>
-char *
-AsciiStrCat(char *Destination, char *Source)
+CHAR8 *
+AsciiStrCat(CHAR8 *Destination, CHAR8 *Source)
{
- UINTN dest_len = strlena((CHAR8 *)Destination);
+ UINTN dest_len = strlena(Destination);
UINTN i;
for (i = 0; Source[i] != '\0'; i++)
@@ -25,8 +25,8 @@ AsciiStrCpy(CHAR8 *Destination, CHAR8 *Source)
return Destination;
}
-char *
-AsciiStrnCpy(char *Destination, char *Source, UINTN count)
+CHAR8 *
+AsciiStrnCpy(CHAR8 *Destination, CHAR8 *Source, UINTN count)
{
UINTN i;
@@ -64,62 +64,4 @@ AsciiStrSize(CHAR8 *string)
return strlena(string) + 1;
}
-/* Based on AsciiStrDecimalToUintnS() in edk2
- * MdePkg/Library/BaseLib/SafeString.c */
-UINTN
-AsciiStrDecimalToUintn(const char *String)
-{
- UINTN Result;
-
- if (String == NULL)
- return 0;
-
- /* Ignore the pad spaces (space or tab) */
- while ((*String == ' ') || (*String == '\t')) {
- String++;
- }
-
- /* Ignore leading Zeros after the spaces */
- while (*String == '0') {
- String++;
- }
-
- Result = 0;
-
- while (*String >= '0' && *String <= '9') {
- Result = Result * 10 + (*String - '0');
- String++;
- }
-
- return Result;
-}
-
-int
-strcmp (const char *str1, const char *str2)
-{
- return strcmpa((CHAR8 *)str1,(CHAR8 *)str2);
-}
-
-inline static char
-toupper (char c)
-{
- return ((c >= 'a' && c <= 'z') ? c - ('a' - 'A') : c);
-}
-
-/* Based on AsciiStriCmp() in edk2 MdePkg/Library/BaseLib/String.c */
-int
-strcasecmp (const char *str1, const char *str2)
-{
- char c1, c2;
-
- c1 = toupper (*str1);
- c2 = toupper (*str2);
- while ((*str1 != '\0') && (c1 == c2)) {
- str1++;
- str2++;
- c1 = toupper (*str1);
- c2 = toupper (*str2);
- }
- return c1 - c2;
-}
diff --git a/Cryptlib/SysCall/CrtWrapper.c b/Cryptlib/SysCall/CrtWrapper.c
index 78789538..1afe319f 100644
--- a/Cryptlib/SysCall/CrtWrapper.c
+++ b/Cryptlib/SysCall/CrtWrapper.c
@@ -2,7 +2,7 @@
C Run-Time Libraries (CRT) Wrapper Implementation for OpenSSL-based
Cryptographic Library.
-Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#include <CrtLibSupport.h>
+#include <OpenSslSupport.h>
int errno = 0;
@@ -136,30 +136,6 @@ char *strrchr (const char *str, int c)
}
}
-/* Compare first n bytes of string s1 with string s2, ignoring case */
-int strncasecmp (const char *s1, const char *s2, size_t n)
-{
- int Val;
-
- ASSERT(s1 != NULL);
- ASSERT(s2 != NULL);
-
- if (n != 0) {
- do {
- Val = tolower(*s1) - tolower(*s2);
- if (Val != 0) {
- return Val;
- }
- ++s1;
- ++s2;
- if (*s1 == '\0') {
- break;
- }
- } while (--n != 0);
- }
- return 0;
-}
-
/* Read formatted data from a string */
int sscanf (const char *buffer, const char *format, ...)
{
@@ -170,70 +146,6 @@ int sscanf (const char *buffer, const char *format, ...)
return 0;
}
-/* Maps errnum to an error-message string */
-char * strerror (int errnum)
-{
- return NULL;
-}
-
-/* Computes the length of the maximum initial segment of the string pointed to by s1
- which consists entirely of characters from the string pointed to by s2. */
-size_t strspn (const char *s1 , const char *s2)
-{
- UINT8 Map[32];
- UINT32 Index;
- size_t Count;
-
- for (Index = 0; Index < 32; Index++) {
- Map[Index] = 0;
- }
-
- while (*s2) {
- Map[*s2 >> 3] |= (1 << (*s2 & 7));
- s2++;
- }
-
- if (*s1) {
- Count = 0;
- while (Map[*s1 >> 3] & (1 << (*s1 & 7))) {
- Count++;
- s1++;
- }
-
- return Count;
- }
-
- return 0;
-}
-
-/* Computes the length of the maximum initial segment of the string pointed to by s1
- which consists entirely of characters not from the string pointed to by s2. */
-size_t strcspn (const char *s1, const char *s2)
-{
- UINT8 Map[32];
- UINT32 Index;
- size_t Count;
-
- for (Index = 0; Index < 32; Index++) {
- Map[Index] = 0;
- }
-
- while (*s2) {
- Map[*s2 >> 3] |= (1 << (*s2 & 7));
- s2++;
- }
-
- Map[0] |= 1;
-
- Count = 0;
- while (!(Map[*s1 >> 3] & (1 << (*s1 & 7)))) {
- Count ++;
- s1++;
- }
-
- return Count;
-}
-
//
// -- Character Classification Routines --
//
@@ -365,12 +277,52 @@ char *getenv (const char *varname)
// -- Stream I/O Routines --
//
+/* Write formatted output using a pointer to a list of arguments */
+int vfprintf (FILE *stream, const char *format, VA_LIST arg)
+{
+ return 0;
+}
+
/* Write data to a stream */
size_t fwrite (const void *buffer, size_t size, size_t count, FILE *stream)
{
return 0;
}
+//
+// -- Dummy OpenSSL Support Routines --
+//
+
+void *UI_OpenSSL(void)
+{
+ return NULL;
+}
+
+int X509_load_cert_file (VOID *ctx, const char *file, int type)
+{
+ return 0;
+}
+
+int X509_load_crl_file (VOID *ctx, const char *file, int type)
+{
+ return 0;
+}
+
+int chmod (const char *c, mode_t m)
+{
+ return -1;
+}
+
+int close (int f)
+{
+ return -1;
+}
+
+void closelog (void)
+{
+
+}
+
#ifdef __GNUC__
typedef
@@ -379,6 +331,7 @@ VOID
VOID
) __attribute__((__noreturn__));
+
STATIC
VOID
EFIAPI
@@ -388,7 +341,8 @@ NopFunction (
{
}
-void abort (void)
+
+void exit (int e)
{
NoReturnFuncPtr NoReturnFunc;
@@ -399,9 +353,8 @@ void abort (void)
#else
-void abort (void)
+void exit (int e)
{
- // Do nothing
}
#endif
@@ -421,6 +374,16 @@ size_t fread (void *b, size_t c, size_t i, FILE *f)
return 0;
}
+int fputs (const char *s, FILE *f)
+{
+ return 0;
+}
+
+int fprintf (FILE *f, const char *s, ...)
+{
+ return 0;
+}
+
uid_t getuid (void)
{
return 0;
@@ -441,6 +404,46 @@ gid_t getegid (void)
return 0;
}
+off_t lseek (int a, off_t o, int d)
+{
+ return 0;
+}
+
+void openlog (const char *c, int a, int b)
+{
+
+}
+
+ssize_t read (int f, void *b, size_t c)
+{
+ return 0;
+}
+
+int stat (const char *c, struct stat *s)
+{
+ return -1;
+}
+
+int strcasecmp (const char *c, const char *s)
+{
+ return 0;
+}
+
+int strncasecmp (const char *c, const char *s, size_t l)
+{
+ return 0;
+}
+
+void syslog (int a, const char *c, ...)
+{
+
+}
+
+ssize_t write (int f, const void *b, size_t l)
+{
+ return 0;
+}
+
int printf (char const *fmt, ...)
{
return 0;
diff --git a/Cryptlib/SysCall/TimerWrapper.c b/Cryptlib/SysCall/TimerWrapper.c
index 04fe4ef9..27ac44a3 100644
--- a/Cryptlib/SysCall/TimerWrapper.c
+++ b/Cryptlib/SysCall/TimerWrapper.c
@@ -2,7 +2,7 @@
C Run-Time Libraries (CRT) Time Management Routines Wrapper Implementation
for OpenSSL-based Cryptographic Library (used in DXE & RUNTIME).
-Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#include <CrtLibSupport.h>
+#include <OpenSslSupport.h>
//
// -- Time Management Routines --