Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pppd: Fix build without OpenSSL #533

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pppd/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#ifdef PPP_WITH_OPENSSL
#include <openssl/opensslv.h>
#include <openssl/err.h>
#endif

#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/provider.h>
Expand All @@ -53,6 +52,7 @@ struct crypto_ctx {
OSSL_PROVIDER *provider;
} g_crypto_ctx;
#endif
#endif

PPP_MD_CTX *PPP_MD_CTX_new()
{
Expand Down Expand Up @@ -200,6 +200,7 @@ int PPP_crypto_init()
{
int retval = 0;

#ifdef PPP_WITH_OPENSSL
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
g_crypto_ctx.legacy = OSSL_PROVIDER_load(NULL, "legacy");
if (g_crypto_ctx.legacy == NULL)
Expand All @@ -214,6 +215,7 @@ int PPP_crypto_init()
PPP_crypto_error("Could not load default provider");
goto done;
}
#endif
#endif

retval = 1;
Expand All @@ -225,6 +227,7 @@ int PPP_crypto_init()

int PPP_crypto_deinit()
{
#ifdef PPP_WITH_OPENSSL
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
if (g_crypto_ctx.legacy) {
OSSL_PROVIDER_unload(g_crypto_ctx.legacy);
Expand All @@ -239,6 +242,7 @@ int PPP_crypto_deinit()

#if OPENSSL_VERSION_NUMBER < 0x10100000L
ERR_free_strings();
#endif
#endif
return 1;
}
Expand Down