]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Fix build without OpenSSL (#533)
authorTomas Paukrt <44699103+tpaukrt@users.noreply.github.com>
Thu, 21 Nov 2024 02:53:28 +0000 (03:53 +0100)
committerGitHub <noreply@github.com>
Thu, 21 Nov 2024 02:53:28 +0000 (13:53 +1100)
The symbol OPENSSL_VERSION_NUMBER is not defined when pppd is
compiled without OpenSSL support, so it evaluates to zero.
This results in the following linker error:

crypto.c:241: undefined reference to `ERR_free_strings'

Signed-off-by: Tomas Paukrt <tomaspaukrt@email.cz>
pppd/crypto.c

index 3576afd5ac7239556806ff8e1b48c0fa4b146acf..8e98261919f9b13ae5b866ea3758685df50c7e0a 100644 (file)
@@ -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>
@@ -53,6 +52,7 @@ struct crypto_ctx {
     OSSL_PROVIDER *provider;
 } g_crypto_ctx;
 #endif
+#endif
 
 PPP_MD_CTX *PPP_MD_CTX_new()
 {
@@ -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)
@@ -214,6 +215,7 @@ int PPP_crypto_init()
         PPP_crypto_error("Could not load default provider");
         goto done;
     }
+#endif
 #endif
 
     retval = 1;
@@ -225,6 +227,7 @@ done:
 
 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);
@@ -239,6 +242,7 @@ int PPP_crypto_deinit()
 
 #if OPENSSL_VERSION_NUMBER < 0x10100000L
     ERR_free_strings();
+#endif
 #endif
     return 1;
 }