diff --git a/errlog.c b/errlog.c index b67c23d..de0e735 100644 --- a/errlog.c +++ b/errlog.c @@ -7,10 +7,6 @@ #include "shim.h" -#ifdef LogError -#undef LogError -#endif - static CHAR16 **errs = NULL; static UINTN nerrs = 0; @@ -51,7 +47,7 @@ VLogError(const char *file, int line, const char *func, CHAR16 *fmt, va_list arg } EFI_STATUS -LogError(const char *file, int line, const char *func, CHAR16 *fmt, ...) +LogError_(const char *file, int line, const char *func, CHAR16 *fmt, ...) { va_list args; EFI_STATUS efi_status; diff --git a/httpboot.c b/httpboot.c index 0fd4ae7..4cfa3aa 100644 --- a/httpboot.c +++ b/httpboot.c @@ -36,13 +36,6 @@ #include "shim.h" -#define perror(fmt, ...) ({ \ - UINTN __perror_ret = 0; \ - if (!in_protocol) \ - __perror_ret = Print((fmt), ##__VA_ARGS__); \ - __perror_ret; \ - }) - static UINTN ascii_to_int (CONST CHAR8 *str) { diff --git a/shim.c b/shim.c index e8401f8..2b263c2 100644 --- a/shim.c +++ b/shim.c @@ -65,14 +65,6 @@ static CHAR16 *second_stage; static void *load_options; static UINT32 load_options_size; -#define perror(fmt, ...) ({ \ - UINTN __perror_ret = 0; \ - if (!in_protocol) \ - __perror_ret = Print((fmt), ##__VA_ARGS__); \ - LogError(fmt, ##__VA_ARGS__); \ - __perror_ret; \ - }) - /* * The vendor certificate used for validating the second stage loader */ diff --git a/shim.h b/shim.h index 6cbc9e1..ddc8d7f 100644 --- a/shim.h +++ b/shim.h @@ -156,11 +156,25 @@ typedef struct _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 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__) +extern UINT32 vendor_cert_size; +extern UINT32 vendor_dbx_size; +extern UINT8 *vendor_cert; +extern UINT8 *vendor_dbx; + +extern UINT8 in_protocol; +#define perror_(file, line, func, fmt, ...) ({ \ + UINTN __perror_ret = 0; \ + if (!in_protocol) \ + __perror_ret = Print((fmt), ##__VA_ARGS__); \ + LogError_(file, line, func, fmt, ##__VA_ARGS__); \ + __perror_ret; \ + }) +#define perror(fmt, ...) perror_(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__) +#define LogError(fmt, ...) LogError_(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__) #endif /* SHIM_H_ */ diff --git a/tpm.c b/tpm.c index cacfde7..26050dd 100644 --- a/tpm.c +++ b/tpm.c @@ -5,14 +5,6 @@ #include "shim.h" -#define perror(fmt, ...) ({ \ - UINTN __perror_ret = 0; \ - if (!in_protocol) \ - __perror_ret = Print((fmt), ##__VA_ARGS__); \ - __perror_ret; \ - }) - - typedef struct { CHAR16 *VariableName; EFI_GUID *VendorGuid;