git: c15ed41118c9 - stable/13 - dumpon: provide diag info when `PEM_read_RSA_PUBKEY` fails
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 26 Mar 2025 21:37:17 UTC
The branch stable/13 has been updated by ngie:
URL: https://cgit.FreeBSD.org/src/commit/?id=c15ed41118c9174160a1a854355320558b48928d
commit c15ed41118c9174160a1a854355320558b48928d
Author: Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2023-05-27 01:02:34 +0000
Commit: Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2025-03-26 21:36:43 +0000
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
(cherry picked from commit 52b63df9b6dfc157fb0b9f61a770b64e3663dee9)
---
sbin/dumpon/dumpon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sbin/dumpon/dumpon.c b/sbin/dumpon/dumpon.c
index d12df7bf0c4d..ca25d38c09e8 100644
--- a/sbin/dumpon/dumpon.c
+++ b/sbin/dumpon/dumpon.c
@@ -267,7 +267,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