aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2023-05-27 01:02:34 +0000
committerEnji Cooper <ngie@FreeBSD.org>2023-05-27 01:05:04 +0000
commit52b63df9b6dfc157fb0b9f61a770b64e3663dee9 (patch)
tree543b071ef3e9505514561d97895f124ed088dfc1
parentda8c3d21490fe791f8e4405216d5490dbea4dbe5 (diff)
dumpon: provide diag info when `PEM_read_RSA_PUBKEY` fails
This change modifies dumpon to print out the last error from OpenSSL when `PEM_read_RSA_PUBKEY` fails. This allows end-users to diagnose why reading in RSA pubkey files fails so they can adjust the usage to meet the needs of the command. MFC after: 1 week
-rw-r--r--sbin/dumpon/dumpon.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/dumpon/dumpon.c b/sbin/dumpon/dumpon.c
index 626350427595..c530c9ad59ed 100644
--- a/sbin/dumpon/dumpon.c
+++ b/sbin/dumpon/dumpon.c
@@ -270,7 +270,8 @@ _genkey(const char *pubkeyfile, struct diocskerneldump_arg *kdap)
fclose(fp);
fp = NULL;
if (pubkey == NULL)
- errx(1, "Unable to read data from %s.", pubkeyfile);
+ errx(1, "Unable to read data from %s: %s", pubkeyfile,
+ ERR_error_string(ERR_get_error(), NULL));
/*
* RSA keys under ~1024 bits are trivially factorable (2018). OpenSSL