git: 8e7a31b65f9a - main - decryptcore: update for OpenSSL 1.1 API
Date: Wed, 31 May 2023 16:20:43 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=8e7a31b65f9ab0210b9648211a4f5268e2680058
commit 8e7a31b65f9ab0210b9648211a4f5268e2680058
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-05-31 14:17:52 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-05-31 16:20:34 +0000
decryptcore: update for OpenSSL 1.1 API
ERR_load_crypto_strings is deprecated in OpenSSL 1.1, and OpenSSL 1.1
generally does not require explicit initialization. However, we do need
to ensure that initialization is done before entering capability mode so
call OPENSSL_init_crypto instead. Also include header needed for
ERR_error_string.
Reviewed by: vangyzen
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40343
---
sbin/decryptcore/decryptcore.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sbin/decryptcore/decryptcore.c b/sbin/decryptcore/decryptcore.c
index fc6599fb0ecc..8f80c948b341 100644
--- a/sbin/decryptcore/decryptcore.c
+++ b/sbin/decryptcore/decryptcore.c
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
+#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
@@ -179,8 +180,10 @@ decrypt(int ofd, const char *privkeyfile, const char *keyfile,
unsigned char c[1];
RAND_bytes(c, 1);
}
-#endif
ERR_load_crypto_strings();
+#else
+ OPENSSL_init_crypto(0, NULL);
+#endif
caph_cache_catpages();
if (caph_enter() < 0) {