Move includes around to clean the source tree up a bit.

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2017-10-19 15:44:12 -04:00 committed by Peter Jones
parent 1a44dbb8be
commit dc62a3c4dc
27 changed files with 108 additions and 139 deletions

View File

@ -1,16 +1,3 @@
-I/home/pjones/devel/github.com/shim/master/Cryptlib/OpenSSL
-I/home/pjones/devel/github.com/shim/master/Cryptlib/OpenSSL/..
-I/home/pjones/devel/github.com/shim/master/Cryptlib/OpenSSL/../Include/
-I/home/pjones/devel/github.com/shim/master/Cryptlib/OpenSSL/crypto
-I/usr/lib/gcc/x86_64-redhat-linux/7/include
-I/home/pjones/devel/github.com/shim/master/Cryptlib/OpenSSL/../Include
-I/usr/include/efi
-I/usr/include/efi/x86_64
-I/usr/include/efi/protocol
-I/home/pjones/devel/github.com/shim/master/Cryptlib/OpenSSL/crypto/asn1
-I/home/pjones/devel/github.com/shim/master/Cryptlib/OpenSSL/crypto/evp
-I/home/pjones/devel/github.com/shim/master/Cryptlib/OpenSSL/crypto/modes
-I/home/pjones/devel/github.com/shim/master/Cryptlib/OpenSSL/crypto/include
-DL_ENDIAN
-D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE
@ -29,18 +16,21 @@
-Werror=sign-compare
-ffreestanding
-std=gnu89
-I/usr/lib/gcc/x86_64-redhat-linux/7/include
-nostdinc
-I/home/pjones/devel/github.com/shim/master/Cryptlib
-I/home/pjones/devel/github.com/shim/master/Cryptlib/Include
-I/usr/include/efi
-I/usr/include/efi/x86_64
-I/usr/include/efi/protocol
-I/home/pjones/devel/github.com/shim/master/include
-I/usr/lib/gcc/x86_64-redhat-linux/7/include
-ICryptlib/
-ICryptlib/Include/
-ICryptlib/OpenSSL/
-ICryptlib/OpenSSL/crypto/
-I/usr/include/efi/
-I/usr/include/efi/x86_64/
-I/usr/include/efi/protocol/
-ICryptlib/OpenSSL/crypto/asn1/
-ICryptlib/OpenSSL/crypto/evp/
-ICryptlib/OpenSSL/crypto/modes/
-ICryptlib/OpenSSL/crypto/include/
-iquote
/home/pjones/devel/github.com/shim/master
-iquote
/home/pjones/devel/github.com/shim/master
.
-mno-mmx
-mno-sse
-mno-red-zone

View File

@ -17,11 +17,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <efi.h>
#include <efilib.h>
#include <Base.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include "Base.h"
#include "Library/BaseLib.h"
#include "Library/BaseMemoryLib.h"
#include "Library/MemoryAllocationLib.h"
#include "Library/DebugLib.h"
/*
* Include stddef.h to avoid redefining "offsetof"

View File

@ -15,11 +15,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __INTERNAL_CRYPT_LIB_H__
#define __INTERNAL_CRYPT_LIB_H__
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseCryptLib.h>
#include "Library/BaseLib.h"
#include "Library/BaseMemoryLib.h"
#include "Library/MemoryAllocationLib.h"
#include "Library/DebugLib.h"
#include "Library/BaseCryptLib.h"
#include "OpenSslSupport.h"

View File

@ -35,15 +35,15 @@ TARGETS += $(MMNAME) $(FBNAME)
endif
OBJS = shim.o netboot.o cert.o replacements.o tpm.o version.o errlog.o
KEYS = shim_cert.h ocsp.* ca.* shim.crt shim.csr shim.p12 shim.pem shim.key shim.cer
ORIG_SOURCES = shim.c shim.h netboot.c include/PeImage.h include/wincert.h include/console.h replacements.c replacements.h tpm.c tpm.h version.h errlog.c
ORIG_SOURCES = shim.c netboot.c replacements.c tpm.c errlog.c shim.h version.h $(wildcard include/*.h)
MOK_OBJS = MokManager.o PasswordCrypt.o crypt_blowfish.o
ORIG_MOK_SOURCES = MokManager.c shim.h include/console.h PasswordCrypt.c PasswordCrypt.h crypt_blowfish.c crypt_blowfish.h
ORIG_MOK_SOURCES = MokManager.c PasswordCrypt.c crypt_blowfish.c shim.h $(wildcard include/*.h)
FALLBACK_OBJS = fallback.o tpm.o
ORIG_FALLBACK_SRCS = fallback.c
ifneq ($(origin ENABLE_HTTPBOOT), undefined)
OBJS += httpboot.o
SOURCES += httpboot.c httpboot.h
SOURCES += httpboot.c include/httpboot.h
endif
SOURCES = $(foreach source,$(ORIG_SOURCES),$(TOPDIR)/$(source)) version.c

View File

@ -6,15 +6,8 @@
#include <openssl/x509v3.h>
#include <openssl/asn1.h>
#include <openssl/bn.h>
#include "shim.h"
#include "PeImage.h"
#include "PasswordCrypt.h"
#include "guid.h"
#include "console.h"
#include "variables.h"
#include "simple_file.h"
#include "efiauthenticated.h"
#include "shim.h"
#define PASSWORD_MAX 256
#define PASSWORD_MIN 1

View File

@ -3,8 +3,8 @@
#include <Library/BaseCryptLib.h>
#include <openssl/sha.h>
#include <openssl/md5.h>
#include "PasswordCrypt.h"
#include "crypt_blowfish.h"
#include "shim.h"
#define TRAD_DES_HASH_SIZE 13 /* (64/6+1) + (12/6) */
#define BSDI_DES_HASH_SIZE 20 /* (64/6+1) + (24/6) + 4 + 1 */

View File

@ -47,7 +47,7 @@
#include <efilib.h>
/* Just to make sure the prototypes match the actual definitions */
#include "crypt_blowfish.h"
#include "shim.h"
typedef unsigned int BF_word;
typedef signed int BF_word_signed;

View File

@ -33,11 +33,8 @@
#include <efi.h>
#include <efilib.h>
#include "str.h"
#include "console.h"
#include "Http.h"
#include "Ip4Config2.h"
#include "Ip6Config.h"
#include "shim.h"
#define perror(fmt, ...) ({ \
UINTN __perror_ret = 0; \

View File

@ -8,8 +8,7 @@
#include <efi.h>
#include <efilib.h>
#include <guid.h>
#include <configtable.h>
#include "shim.h"
void *
configtable_get_table(EFI_GUID *guid)

View File

@ -15,14 +15,7 @@
#include <openssl/err.h>
#include <openssl/crypto.h>
static EFI_GUID SHIM_LOCK_GUID = { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} };
static int min(int a, int b)
{
if (a < b)
return a;
return b;
}
#include "shim.h"
static int
count_lines(CHAR16 *str_arr[])

View File

@ -41,8 +41,7 @@
#include <efi.h>
#include <efilib.h>
#include <guid.h>
#include <execute.h>
#include "shim.h"
EFI_STATUS
generate_path(CHAR16* name, EFI_LOADED_IMAGE *li, EFI_DEVICE_PATH **path, CHAR16 **PathName)

View File

@ -9,7 +9,7 @@
#include <efi.h>
#include <efilib.h>
#include <guid.h>
#include "shim.h"
#include <variables.h>
#include <simple_file.h>
#include <errors.h>

View File

@ -8,7 +8,7 @@
#include <efi.h>
#include <efilib.h>
#include <shell.h>
#include "shim.h"
EFI_STATUS
argsplit(EFI_HANDLE image, int *argc, CHAR16*** ARGV)

View File

@ -7,13 +7,8 @@
#include <efi.h>
#include <efilib.h>
#include <console.h>
#include <simple_file.h>
#include <efiauthenticated.h>
#include <execute.h> /* for generate_path() */
#include "shim.h"
static EFI_GUID IMAGE_PROTOCOL = LOADED_IMAGE_PROTOCOL;
static EFI_GUID SIMPLE_FS_PROTOCOL = SIMPLE_FILE_SYSTEM_PROTOCOL;
static EFI_GUID FILE_INFO = EFI_FILE_INFO_ID;
static EFI_GUID FS_INFO = EFI_FILE_SYSTEM_INFO_ID;

View File

@ -22,12 +22,7 @@
#include <efi.h>
#include <efilib.h>
#include <efiauthenticated.h>
#include <variables.h>
#include <guid.h>
#include <console.h>
#include <errors.h>
#include "shim.h"
EFI_STATUS
variable_create_esl(void *cert, int cert_len, EFI_GUID *type, EFI_GUID *owner,

View File

@ -34,9 +34,8 @@
*/
#include "shim.h"
#include <string.h>
#include "netboot.h"
#include "str.h"
#define ntohs(x) __builtin_bswap16(x) /* supported both by GCC and clang */
#define htons(x) ntohs(x)

View File

@ -50,10 +50,8 @@
#include <efi.h>
#include <efiapi.h>
#include <efilib.h>
#include "shim.h"
#include "replacements.h"
#include "console.h"
#include "errors.h"
static EFI_SYSTEM_TABLE *systab;

120
shim.h
View File

@ -4,49 +4,7 @@
#include <efi.h>
#include <efilib.h>
#include "PeImage.h"
extern EFI_GUID SHIM_LOCK_GUID;
INTERFACE_DECL(_SHIM_LOCK);
typedef
EFI_STATUS
(*EFI_SHIM_LOCK_VERIFY) (
IN VOID *buffer,
IN UINT32 size
);
typedef
EFI_STATUS
(*EFI_SHIM_LOCK_HASH) (
IN char *data,
IN int datasize,
PE_COFF_LOADER_IMAGE_CONTEXT *context,
UINT8 *sha256hash,
UINT8 *sha1hash
);
typedef
EFI_STATUS
(*EFI_SHIM_LOCK_CONTEXT) (
IN VOID *data,
IN unsigned int datasize,
PE_COFF_LOADER_IMAGE_CONTEXT *context
);
typedef struct _SHIM_LOCK {
EFI_SHIM_LOCK_VERIFY Verify;
EFI_SHIM_LOCK_HASH Hash;
EFI_SHIM_LOCK_CONTEXT Context;
} SHIM_LOCK;
extern EFI_STATUS shim_init(void);
extern void shim_fini(void);
extern EFI_STATUS LogError(const char *file, int line, const char *func, CHAR16 *fmt, ...);
extern EFI_STATUS VLogError(const char *file, int line, const char *func, CHAR16 *fmt, va_list args);
extern VOID PrintErrors(VOID);
extern VOID ClearErrors(VOID);
#define min(a, b) ({(a) < (b) ? (a) : (b);})
#ifdef __x86_64__
#ifndef DEFAULT_LOADER
@ -108,23 +66,77 @@ extern VOID ClearErrors(VOID);
#endif
#endif
#include "netboot.h"
#include "httpboot.h"
#include "replacements.h"
#include "tpm.h"
#include "ucs2.h"
#include "include/configtable.h"
#include "include/console.h"
#include "include/crypt_blowfish.h"
#include "include/efiauthenticated.h"
#include "include/errors.h"
#include "include/execute.h"
#include "include/guid.h"
#include "include/Http.h"
#include "include/httpboot.h"
#include "include/Ip4Config2.h"
#include "include/Ip6Config.h"
#include "include/netboot.h"
#include "include/PasswordCrypt.h"
#include "include/PeImage.h"
#include "include/replacements.h"
#if defined(OVERRIDE_SECURITY_POLICY)
#include "include/security_policy.h"
#endif
#include "include/simple_file.h"
#include "include/str.h"
#include "include/tpm.h"
#include "include/ucs2.h"
#include "include/variables.h"
#include "guid.h"
#include "variables.h"
#include "efiauthenticated.h"
#include "security_policy.h"
#include "console.h"
#include "version.h"
#ifdef ENABLE_SHIM_CERT
#include "shim_cert.h"
#endif
extern EFI_GUID SHIM_LOCK_GUID;
INTERFACE_DECL(_SHIM_LOCK);
typedef
EFI_STATUS
(*EFI_SHIM_LOCK_VERIFY) (
IN VOID *buffer,
IN UINT32 size
);
typedef
EFI_STATUS
(*EFI_SHIM_LOCK_HASH) (
IN char *data,
IN int datasize,
PE_COFF_LOADER_IMAGE_CONTEXT *context,
UINT8 *sha256hash,
UINT8 *sha1hash
);
typedef
EFI_STATUS
(*EFI_SHIM_LOCK_CONTEXT) (
IN VOID *data,
IN unsigned int datasize,
PE_COFF_LOADER_IMAGE_CONTEXT *context
);
typedef struct _SHIM_LOCK {
EFI_SHIM_LOCK_VERIFY Verify;
EFI_SHIM_LOCK_HASH Hash;
EFI_SHIM_LOCK_CONTEXT Context;
} SHIM_LOCK;
extern EFI_STATUS shim_init(void);
extern void shim_fini(void);
extern EFI_STATUS LogError(const char *file, int line, const char *func, CHAR16 *fmt, ...);
extern EFI_STATUS VLogError(const char *file, int line, const char *func, CHAR16 *fmt, va_list args);
extern VOID PrintErrors(VOID);
extern VOID ClearErrors(VOID);
#define LogError(fmt, ...) LogError(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
#endif /* SHIM_H_ */

3
tpm.c
View File

@ -3,8 +3,7 @@
#include <string.h>
#include <stdint.h>
#include "tpm.h"
#include "console.h"
#include "shim.h"
#define perror(fmt, ...) ({ \
UINTN __perror_ret = 0; \