git: 79d4d7133f07 - main - dumpon: update OpenSSL initialization call

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 02 Jun 2023 01:24:03 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=79d4d7133f07b399155a4d2eb20a8ee1ca705569

commit 79d4d7133f07b399155a4d2eb20a8ee1ca705569
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-05-31 16:25:58 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-06-02 01:21:23 +0000

    dumpon: update OpenSSL initialization call
    
    ERR_load_crypto_strings() was deprecated in OpenSSL 1.1.0, and explicit
    initialization is generally not reqiured.  In the case of dumpon however
    we initialize prior to entering capability mode, so replace with an
    OPENSSL_init_crypto call.
    
    Reviewed by:    def, Pierre Pronchery
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D40353
---
 sbin/dumpon/dumpon.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sbin/dumpon/dumpon.c b/sbin/dumpon/dumpon.c
index c530c9ad59ed..5bcfe2b8f1e7 100644
--- a/sbin/dumpon/dumpon.c
+++ b/sbin/dumpon/dumpon.c
@@ -566,7 +566,12 @@ main(int argc, char *argv[])
 	if (cipher != KERNELDUMP_ENC_NONE && pubkeyfile == NULL) {
 		errx(EX_USAGE, "-C option requires a public key file.");
 	} else if (pubkeyfile != NULL) {
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
 		ERR_load_crypto_strings();
+#else
+		if (!OPENSSL_init_crypto(0, NULL))
+			errx(EX_UNAVAILABLE, "Unable to initialize OpenSSL");
+#endif
 	}
 #else
 	if (pubkeyfile != NULL)