diff options
author | Steve McIntyre <steve@einval.com> | 2021-03-23 23:49:46 +0000 |
---|---|---|
committer | Steve McIntyre <steve@einval.com> | 2021-03-23 23:49:46 +0000 |
commit | 031e5cce385d3f96b1caa1d53495332a7eb03749 (patch) | |
tree | b4988dfbd191b2242b9294e24075b39a608b1155 /lib/print_crypto.c | |
parent | 7bf7a6d0852382bb645119b18df3ff461aaba247 (diff) | |
download | efi-boot-shim-upstream/15.3.tar.gz efi-boot-shim-upstream/15.3.zip |
New upstream version 15.3upstream/15.3
Diffstat (limited to 'lib/print_crypto.c')
-rw-r--r-- | lib/print_crypto.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/print_crypto.c b/lib/print_crypto.c new file mode 100644 index 00000000..ccdb65b1 --- /dev/null +++ b/lib/print_crypto.c @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: BSD-2-Clause-Patent +/* + * Copyright 2019 SUSE LLC <glin@suse.com> + */ +#include "shim.h" + +#include <Library/BaseCryptLib.h> +#include <openssl/err.h> +#include <openssl/crypto.h> +#include <console.h> + +static int +print_errors_cb(const char *str, size_t len, void *u UNUSED) +{ + 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; +} |