mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-06-14 16:33:54 +00:00
Add a mechanism to print openssl errors
Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
aaf8049c39
commit
96b347c200
@ -88,6 +88,9 @@ extern UINT8 verbose;
|
|||||||
__dprinta_ret; \
|
__dprinta_ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
extern EFI_STATUS print_crypto_errors(EFI_STATUS rc, char *file, const char *func, int line);
|
||||||
|
#define crypterr(rc) print_crypto_errors((rc), __FILE__, __func__, __LINE__)
|
||||||
|
|
||||||
extern VOID msleep(unsigned long msecs);
|
extern VOID msleep(unsigned long msecs);
|
||||||
|
|
||||||
#endif /* _SHIM_LIB_CONSOLE_H */
|
#endif /* _SHIM_LIB_CONSOLE_H */
|
||||||
|
@ -2,7 +2,8 @@ TARGET = lib.a
|
|||||||
|
|
||||||
LIBFILES = simple_file.o guid.o console.o execute.o configtable.o shell.o variables.o security_policy.o
|
LIBFILES = simple_file.o guid.o console.o execute.o configtable.o shell.o variables.o security_policy.o
|
||||||
|
|
||||||
EFI_INCLUDES = -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol -I$(TOPDIR)/../include
|
EFI_INCLUDES = -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol -I$(TOPDIR)/../include \
|
||||||
|
-I$(TOPDIR)/CryptLib/Include/openssl/
|
||||||
|
|
||||||
lib.a: $(LIBFILES)
|
lib.a: $(LIBFILES)
|
||||||
$(AR) rcs lib.a $(LIBFILES)
|
$(AR) rcs lib.a $(LIBFILES)
|
||||||
|
@ -6,10 +6,14 @@
|
|||||||
*/
|
*/
|
||||||
#include <efi.h>
|
#include <efi.h>
|
||||||
#include <efilib.h>
|
#include <efilib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <console.h>
|
#include <console.h>
|
||||||
#include <variables.h>
|
#include <variables.h>
|
||||||
#include <errors.h>
|
#include <errors.h>
|
||||||
|
#include <Library/BaseCryptLib.h>
|
||||||
|
#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 EFI_GUID SHIM_LOCK_GUID = { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} };
|
||||||
|
|
||||||
@ -384,7 +388,6 @@ err_string (
|
|||||||
return L"";
|
return L"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
console_error(CHAR16 *err, EFI_STATUS status)
|
console_error(CHAR16 *err, EFI_STATUS status)
|
||||||
{
|
{
|
||||||
@ -396,7 +399,8 @@ console_error(CHAR16 *err, EFI_STATUS status)
|
|||||||
};
|
};
|
||||||
CHAR16 str[512];
|
CHAR16 str[512];
|
||||||
|
|
||||||
SPrint(str, sizeof(str), L"%s: (%d) %s", err, status, err_string(status));
|
SPrint(str, sizeof(str), L"%s: (0x%x) %s", err, status, err_string(status));
|
||||||
|
|
||||||
|
|
||||||
err_arr[2] = str;
|
err_arr[2] = str;
|
||||||
|
|
||||||
@ -460,6 +464,26 @@ VOID setup_console (int text)
|
|||||||
uefi_call_wrapper(concon->SetMode, 2, concon, new_mode);
|
uefi_call_wrapper(concon->SetMode, 2, concon, new_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
print_errors_cb(const char *str, size_t len, void *u)
|
||||||
|
{
|
||||||
|
Print(L"%a", str);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
print_crypto_errors(EFI_STATUS rc, char *file, const char *func, int line)
|
||||||
|
{
|
||||||
|
if (!(verbose && EFI_ERROR(rc)))
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
Print(L"SSL Error: %a:%d %a(): %r\n", file, line, func, rc);
|
||||||
|
ERR_print_errors_cb(print_errors_cb, NULL);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
msleep(unsigned long msecs)
|
msleep(unsigned long msecs)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user