| 1 |
// SPDX-License-Identifier: BSD-2-Clause-Patent |
| 2 |
/* |
| 3 |
* Copyright 2019 SUSE LLC <[email protected]> |
| 4 |
*/ |
| 5 |
#include "shim.h" |
| 6 |
|
| 7 |
#include <Library/BaseCryptLib.h> |
| 8 |
#include <openssl/err.h> |
| 9 |
#include <openssl/crypto.h> |
| 10 |
#include <console.h> |
| 11 |
|
| 12 |
static int |
| 13 |
print_errors_cb(const char *str, size_t len, void *u UNUSED) |
| 14 |
{ |
| 15 |
console_print(L"%a", str); |
| 16 |
|
| 17 |
return len; |
| 18 |
} |
| 19 |
|
| 20 |
EFI_STATUS |
| 21 |
print_crypto_errors(EFI_STATUS efi_status, |
| 22 |
char *file, const char *func, int line) |
| 23 |
{ |
| 24 |
if (!(verbose && EFI_ERROR(efi_status))) |
| 25 |
return efi_status; |
| 26 |
|
| 27 |
console_print(L"SSL Error: %a:%d %a(): %r\n", file, line, func, |
| 28 |
efi_status); |
| 29 |
ERR_print_errors_cb(print_errors_cb, NULL); |
| 30 |
|
| 31 |
return efi_status; |
| 32 |
} |