Commit 5f81bd7e authored by Mathieu Trudel-Lapierre's avatar Mathieu Trudel-Lapierre

Update upstream source from tag 'upstream/15+1533136590.3beb971b'

Update to upstream version '15+1533136590.3beb971b'
with Debian dir 26714b7953c3d4b1f6aa8b95e9e1e026d455a008
parents 3f6670a9 7bf7a6d0
diff --git a/Cryptlib/Include/openssl/e_os2.h b/Cryptlib/Include/openssl/e_os2.h
index 99ea347..f11cffe 100644
--- a/Cryptlib/Include/openssl/e_os2.h
+++ b/Cryptlib/Include/openssl/e_os2.h
@@ -234,6 +234,7 @@ extern "C" {
/* Standard integer types */
# if defined(OPENSSL_SYS_UEFI)
+#include <efi.h>
typedef INT8 int8_t;
typedef UINT8 uint8_t;
typedef INT16 int16_t;
diff --git a/Cryptlib/SysCall/BaseMemAllocation.c b/Cryptlib/SysCall/BaseMemAllocation.c
index 68bc25a..1abe78e 100644
index f390e0d..65e9938 100644
--- a/Cryptlib/SysCall/BaseMemAllocation.c
+++ b/Cryptlib/SysCall/BaseMemAllocation.c
@@ -32,7 +32,7 @@ void *realloc (void *ptr, size_t size)
@@ -33,7 +33,7 @@ void *realloc (void *ptr, size_t size)
// BUG: hardcode OldSize == size! We have no any knowledge about
// memory size of original pointer ptr.
//
......@@ -11,8 +23,33 @@ index 68bc25a..1abe78e 100644
}
/* De-allocates or frees a memory block */
diff --git a/Cryptlib/SysCall/CrtWrapper.c b/Cryptlib/SysCall/CrtWrapper.c
index 20c9656..7878953 100644
--- a/Cryptlib/SysCall/CrtWrapper.c
+++ b/Cryptlib/SysCall/CrtWrapper.c
@@ -371,20 +371,6 @@ size_t fwrite (const void *buffer, size_t size, size_t count, FILE *stream)
return 0;
}
-//
-// -- Dummy OpenSSL Support Routines --
-//
-
-int BIO_printf (void *bio, const char *format, ...)
-{
- return 0;
-}
-
-int BIO_snprintf(char *buf, size_t n, const char *format, ...)
-{
- return 0;
-}
-
#ifdef __GNUC__
typedef
diff --git a/Cryptlib/SysCall/TimerWrapper.c b/Cryptlib/SysCall/TimerWrapper.c
index 805e6b4..bb7bcba 100644
index 581b8fb..04fe4ef 100644
--- a/Cryptlib/SysCall/TimerWrapper.c
+++ b/Cryptlib/SysCall/TimerWrapper.c
@@ -13,9 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
......@@ -20,12 +57,12 @@ index 805e6b4..bb7bcba 100644
**/
-#include <Uefi.h>
#include <OpenSslSupport.h>
#include <CrtLibSupport.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
//
// -- Time Management Routines --
@@ -78,7 +76,7 @@ time_t time (time_t *timer)
@@ -79,7 +77,7 @@ time_t time (time_t *timer)
//
// Get the current time and date information
//
......@@ -34,24 +71,3 @@ index 805e6b4..bb7bcba 100644
//
// Years Handling
diff --git a/Cryptlib/SysCall/CrtWrapper.c b/Cryptlib/SysCall/CrtWrapper.c
index fb446b6..5a8322d 100644
--- a/Cryptlib/SysCall/CrtWrapper.c
+++ b/Cryptlib/SysCall/CrtWrapper.c
@@ -293,16 +293,6 @@ size_t fwrite (const void *buffer, size_t size, size_t count, FILE *stream)
// -- Dummy OpenSSL Support Routines --
//
-int BIO_printf (void *bio, const char *format, ...)
-{
- return 0;
-}
-
-int BIO_snprintf(char *buf, size_t n, const char *format, ...)
-{
- return 0;
-}
-
void *UI_OpenSSL(void)
{
return NULL;
/** @file
HMAC-MD5 Wrapper Implementation which does not provide real capabilities.
Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2012 - 2017, 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
......@@ -16,6 +16,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/**
Retrieves the size, in bytes, of the context buffer required for HMAC-MD5 operations.
(NOTE: This API is deprecated.
Use HmacMd5New() / HmacMd5Free() for HMAC-MD5 Context operations.)
Return zero to indicate this interface is not supported.
......@@ -32,6 +34,42 @@ HmacMd5GetContextSize (
return 0;
}
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-MD5 use.
Return NULL to indicate this interface is not supported.
@retval NULL This interface is not supported.
**/
VOID *
EFIAPI
HmacMd5New (
VOID
)
{
ASSERT (FALSE);
return NULL;
}
/**
Release the specified HMAC_CTX context.
This function will do nothing.
@param[in] HmacMd5Ctx Pointer to the HMAC_CTX context to be released.
**/
VOID
EFIAPI
HmacMd5Free (
IN VOID *HmacMd5Ctx
)
{
ASSERT (FALSE);
return;
}
/**
Initializes user-supplied memory pointed by HmacMd5Context as HMAC-MD5 context for
subsequent use.
......
/** @file
HMAC-SHA1 Wrapper Implementation which does not provide real capabilities.
Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2012 - 2017, 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
......@@ -16,6 +16,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/**
Retrieves the size, in bytes, of the context buffer required for HMAC-SHA1 operations.
(NOTE: This API is deprecated.
Use HmacSha1New() / HmacSha1Free() for HMAC-SHA1 Context operations.)
Return zero to indicate this interface is not supported.
......@@ -32,6 +34,42 @@ HmacSha1GetContextSize (
return 0;
}
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA1 use.
Return NULL to indicate this interface is not supported.
@return NULL This interface is not supported..
**/
VOID *
EFIAPI
HmacSha1New (
VOID
)
{
ASSERT (FALSE);
return NULL;
}
/**
Release the specified HMAC_CTX context.
This function will do nothing.
@param[in] HmacSha1Ctx Pointer to the HMAC_CTX context to be released.
**/
VOID
EFIAPI
HmacSha1Free (
IN VOID *HmacSha1Ctx
)
{
ASSERT (FALSE);
return;
}
/**
Initializes user-supplied memory pointed by HmacSha1Context as HMAC-SHA1 context for
subsequent use.
......
/** @file
HMAC-SHA256 Wrapper Implementation which does not provide real capabilities.
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2016 - 2017, 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
......@@ -16,6 +16,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/**
Retrieves the size, in bytes, of the context buffer required for HMAC-SHA256 operations.
(NOTE: This API is deprecated.
Use HmacSha256New() / HmacSha256Free() for HMAC-SHA256 Context operations.)
Return zero to indicate this interface is not supported.
......@@ -32,6 +34,42 @@ HmacSha256GetContextSize (
return 0;
}
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use.
Return NULL to indicate this interface is not supported.
@return NULL This interface is not supported..
**/
VOID *
EFIAPI
HmacSha256New (
VOID
)
{
ASSERT (FALSE);
return NULL;
}
/**
Release the specified HMAC_CTX context.
This function will do nothing.
@param[in] HmacSha256Ctx Pointer to the HMAC_CTX context to be released.
**/
VOID
EFIAPI
HmacSha256Free (
IN VOID *HmacSha256Ctx
)
{
ASSERT (FALSE);
return;
}
/**
Initializes user-supplied memory pointed by HmacSha256Context as HMAC-SHA256 context for
subsequent use.
......
/** @file
Root include file to support building OpenSSL Crypto Library.
Root include file of C runtime library to support building the third-party
cryptographic library.
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2017, 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
......@@ -12,8 +13,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __OPEN_SSL_SUPPORT_H__
#define __OPEN_SSL_SUPPORT_H__
#ifndef __CRT_LIB_SUPPORT_H__
#define __CRT_LIB_SUPPORT_H__
#include <efi.h>
#include <efilib.h>
......@@ -28,6 +29,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/
#include <stddef.h>
#define OPENSSLDIR ""
#define ENGINESDIR ""
#define CONST const
//
......@@ -169,27 +173,14 @@ typedef CHAR8 *VA_LIST;
#endif
//
// #defines from EFI Application Toolkit required to buiild Open SSL
// Definitions for global constants used by CRT library routines
//
#define ENOMEM 12 /* Cannot allocate memory */
#define EINVAL 22 /* Invalid argument */
#define BUFSIZ 1024 /* size of buffer used by setbuf */
#define INT_MAX 2147483647 /* max value for an int */
#define INT_MIN (-2147483647-1) /* min value for an int */
#define LONG_MAX 2147483647L /* max value for a long */
#define LONG_MIN (-2147483647-1) /* min value for a long */
#define ULONG_MAX 0xffffffff /* max value for an unsigned long */
#define LOG_DAEMON (3<<3) /* system daemons */
#define LOG_EMERG 0 /* system is unusable */
#define LOG_ALERT 1 /* action must be taken immediately */
#define LOG_CRIT 2 /* critical conditions */
#define LOG_ERR 3 /* error conditions */
#define LOG_WARNING 4 /* warning conditions */
#define LOG_NOTICE 5 /* normal but significant condition */
#define LOG_INFO 6 /* informational */
#define LOG_DEBUG 7 /* debug-level messages */
#define LOG_PID 0x01 /* log the pid with each message */
#define LOG_CONS 0x02 /* log on the console if errors in sending */
#define INT_MAX 0x7FFFFFFF /* Maximum (signed) int value */
#define LONG_MAX 0X7FFFFFFFL /* max value for a long */
#define LONG_MIN (-LONG_MAX-1) /* min value for a long */
#define ULONG_MAX 0xFFFFFFFF /* Maximum unsigned long value */
#define CHAR_BIT 8 /* Number of bits in a char */
//
// Macros from EFI Application Toolkit required to buiild Open SSL
......@@ -204,25 +195,26 @@ typedef CHAR8 *VA_LIST;
#endif
//
// Basic types from EFI Application Toolkit required to buiild Open SSL
// Basic types mapping
//
typedef UINTN size_t;
typedef INTN ssize_t;
typedef INT32 time_t;
typedef UINT8 __uint8_t;
typedef UINT8 sa_family_t;
typedef UINT32 uid_t;
typedef UINT32 gid_t;
typedef INT64 off_t;
typedef UINT16 mode_t;
typedef long time_t;
typedef unsigned long clock_t;
typedef UINT32 uid_t;
typedef UINT32 gid_t;
typedef UINT32 ino_t;
typedef UINT32 dev_t;
typedef UINT16 nlink_t;
typedef int pid_t;
typedef void *DIR;
typedef void __sighandler_t (int);
//
// Structures from EFI Application Toolkit required to buiild Open SSL
// Structures Definitions
//
struct tm {
int tm_sec; /* seconds after the minute [0-60] */
......@@ -243,6 +235,12 @@ struct timeval {
long tv_usec; /* time value, in microseconds */
};
struct sockaddr {
__uint8_t sa_len; /* total length */
sa_family_t sa_family; /* address family */
char sa_data[14]; /* actually longer; address value */
};
struct dirent {
UINT32 d_fileno; /* file number of entry */
UINT16 d_reclen; /* length of this record */
......@@ -275,38 +273,37 @@ struct stat {
};
//
// Externs from EFI Application Toolkit required to buiild Open SSL
// Global variables
//
extern int errno;
//
// Function prototypes from EFI Application Toolkit required to buiild Open SSL
// Function prototypes of CRT Library routines
//
void *malloc (size_t);
void *realloc (void *, size_t);
void free (void *);
int isdigit (int);
int isspace (int);
int tolower (int);
int isupper (int);
int isxdigit (int);
int isalnum (int);
void *memcpy (void *, const void *, size_t);
void *memset (void *, int, size_t);
void *memchr (const void *, int, size_t);
int memcmp (const void *, const void *, size_t);
void *memmove (void *, const void *, size_t);
void *memset (void *, int, size_t);
int isdigit (int);
int isspace (int);
int isxdigit (int);
int isalnum (int);
int isupper (int);
int tolower (int);
int strcmp (const char *, const char *);
int strncmp (const char *, const char *, size_t);
int strncasecmp (const char *, const char *, size_t);
int strcasecmp (const char *, const char *);
char *strcpy (char *, const char *);
char *strncpy (char *, const char *, size_t);
size_t strlen (const char *);
char *strcat (char *, const char *);
char *strchr (const char *, int);
int strcasecmp (const char *, const char *);
int strncasecmp (const char *, const char *, size_t);
char *strncpy (char *, const char *, size_t);
int strncmp (const char *, const char *, size_t);
char *strrchr (const char *, int);
unsigned long strtoul (const char *, char **, int);
long strtol (const char *, char **, int);
......@@ -348,8 +345,11 @@ gid_t getegid (void);
void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
char *getenv (const char *);
void exit (int);
#if defined(__GNUC__) && (__GNUC__ >= 2)
void abort (void) __attribute__((__noreturn__));
#else
void abort (void);
__sighandler_t *signal (int, __sighandler_t *);
#endif
//
// Global variables from EFI Application Toolkit required to buiild Open SSL
......@@ -380,6 +380,8 @@ extern FILE *stdout;