From 19a147061c45e7beeb3c533ef59857cac859ab15 Mon Sep 17 00:00:00 2001 From: Gary Lin Date: Fri, 22 Nov 2019 17:22:15 +0800 Subject: lib: move print_crypto_errors() out of console.c print_crypto_errors() will pull in the whole openssl library which bloats the size of fallback.efi. Move the function to an independent file (lib/print_crypto.c) to reduce the file size of fallback.efi from 1.3MB to 93KB. Signed-off-by: Gary Lin --- lib/print_crypto.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lib/print_crypto.c (limited to 'lib/print_crypto.c') diff --git a/lib/print_crypto.c b/lib/print_crypto.c new file mode 100644 index 00000000..1bab0a6c --- /dev/null +++ b/lib/print_crypto.c @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: BSD-2-Clause-Patent +/* + * Copyright 2019 SUSE LLC + */ + +#include +#include +#include + +#include "shim.h" + +#include +#include +#include +#include + +static int +print_errors_cb(const char *str, size_t len, void *u) +{ + console_print(L"%a", str); + + return len; +} + +EFI_STATUS +print_crypto_errors(EFI_STATUS efi_status, + char *file, const char *func, int line) +{ + if (!(verbose && EFI_ERROR(efi_status))) + return efi_status; + + console_print(L"SSL Error: %a:%d %a(): %r\n", file, line, func, + efi_status); + ERR_print_errors_cb(print_errors_cb, NULL); + + return efi_status; +} -- cgit v1.2.3