The OpenSSL libraries are used by libopkg directly, as an optional
method of verifying package feed signatures against a locally stored CA
certificate. They are enabled only when the --enable-openssl argument is
passed to AutoConf.
Assert that --enable-openssl is not widely used by opkg integrators and
that GPG feed signing (--enable-gpg) is preferred in all cases.
Remove:
* OpenSSL signature verification
* the --enable-openssl AutoConf option
* the `signature_ca_file` opkg conf setting
* the `signature_ca_path` opkg conf setting
configure.ac | 14 ---
libopkg/Makefile.am | 4 -
libopkg/opkg_conf.c | 4 -
libopkg/opkg_conf.h | 3 -
libopkg/opkg_download_curl.c | 6 --
libopkg/opkg_openssl.c | 162 -----------------------------------
libopkg/opkg_openssl.h | 35 --------
libopkg/opkg_verify.c | 16 ----
man/
opkg.conf.5.in | 9 --
9 files changed, 253 deletions(-)
delete mode 100644 libopkg/opkg_openssl.c
delete mode 100644 libopkg/opkg_openssl.h
diff --git a/
configure.ac b/
configure.ac
index 0e9bd567302659a30c8f50907cb37f5bbf61dfbf..c21b6576f2ae140f39b44ee9d20187c5a4928da9 100644
--- a/
configure.ac
+++ b/
configure.ac
@@ -111,20 +111,6 @@ if test "x$want_sha256" = "xyes"; then
fi
AM_CONDITIONAL(HAVE_SHA256, test "x$want_sha256" = "xyes")
-# check for openssl
-AC_ARG_ENABLE(openssl,
- AC_HELP_STRING([--enable-openssl], [Enable signature checking with OpenSSL
- [[default=no]] ]),
- [want_openssl="$enableval"], [want_openssl="no"])
-
-if test "x$want_openssl" = "xyes"; then
- AC_MSG_WARN(OpenSSL signature-checking support is depracted and will be \
-removed in future releases. Consider using GPGME (--enable-gpg) instead.)
- AC_DEFINE(HAVE_OPENSSL, 1, [Define if you want OpenSSL support])
- NEED_SSL_LIBS="yes"
-fi
-AM_CONDITIONAL(HAVE_OPENSSL, test "x$want_openssl" = "xyes")
-
# check for libssl-curl
AC_ARG_ENABLE(ssl-curl,
AC_HELP_STRING([--enable-ssl-curl], [Enable certificate authentication with curl
diff --git a/libopkg/Makefile.am b/libopkg/Makefile.am
index ca4a2eeb5f1e0c94b671eca7ce11dbe801231d9f..887cbc302db83b53044ed3aab8089704cc6e934e 100644
--- a/libopkg/Makefile.am
+++ b/libopkg/Makefile.am
@@ -36,10 +36,6 @@ if HAVE_SHA256
opkg_sources += sha256.c
opkg_headers += sha256.h
endif
-if HAVE_OPENSSL
-opkg_sources += opkg_openssl.c
-opkg_headers += opkg_openssl.h
-endif
if HAVE_GPGME
opkg_sources += opkg_gpg.c
opkg_headers += opkg_gpg.h
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index c0d448e900b6a4fccc9d7a4e9b086b329e864371..3cb27eff15015de3e330aec2087d2e985ea448a2 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -94,10 +94,6 @@ static opkg_option_t options[] = {
{"gpg_dir", OPKG_OPT_TYPE_STRING, &_conf.gpg_dir},
{"gpg_trust_level", OPKG_OPT_TYPE_STRING, &_conf.gpg_trust_level},
#endif
-#if defined(HAVE_OPENSSL)
- {"signature_ca_file", OPKG_OPT_TYPE_STRING, &_conf.signature_ca_file},
- {"signature_ca_path", OPKG_OPT_TYPE_STRING, &_conf.signature_ca_path},
-#endif
#if defined(HAVE_CURL)
{"connect_timeout_ms", OPKG_OPT_TYPE_INT, &_conf.connect_timeout_ms},
{"transfer_timeout_ms", OPKG_OPT_TYPE_INT, &_conf.transfer_timeout_ms},
diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h
index 293d239b00f230c497b8258cc219247653df1a8a..b7caa74a86d5d8ddc0c64863a7a4e448aea8c65d 100644
--- a/libopkg/opkg_conf.h
+++ b/libopkg/opkg_conf.h
@@ -163,9 +163,6 @@ typedef struct opkg_conf {
char *proxy_user;
char *proxy_passwd;
- char *signature_ca_file;
- char *signature_ca_path;
-
hash_table_t pkg_hash;
hash_table_t file_hash;
hash_table_t obs_file_hash;
diff --git a/libopkg/opkg_download_curl.c b/libopkg/opkg_download_curl.c
index a28293ecd0b4721a2db8050067f7792720bd0184..8fb4764a8c314a6c373e410a3d5bf673b4631640 100644
--- a/libopkg/opkg_download_curl.c
+++ b/libopkg/opkg_download_curl.c
@@ -35,9 +35,6 @@
#include "file_util.h"
#include "xfuncs.h"
-#ifdef HAVE_OPENSSL
-#include "opkg_openssl.h"
-#endif
/*
* Make curl an instance variable so we don't have to instanciate it
@@ -372,9 +369,6 @@ static CURL *opkg_curl_init(curl_progress_func cb, void *data)
curl = curl_easy_init();
#ifdef HAVE_SSLCURL
-#ifdef HAVE_OPENSSL
- openssl_init();
-#endif /* HAVE_OPENSSL */
if (opkg_config->ssl_engine) {
/* use crypto engine */
diff --git a/libopkg/opkg_openssl.c b/libopkg/opkg_openssl.c
deleted file mode 100644
index 19015c9799892e970861485f81a0ce1ee716b55a..0000000000000000000000000000000000000000
--- a/libopkg/opkg_openssl.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* vi: set expandtab sw=4 sts=4: */
-/* opkg_openssl.c - the opkg package management system
-
- Copyright (C) 2001 University of Southern California
- Copyright (C) 2008 OpenMoko Inc
- Copyright (C) 2009 Camille Moncelier <
monc...@devlife.org>
- Copyright (C) 2014 Paul Barker
-
- SPDX-License-Identifier: GPL-2.0-or-later
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-*/
-
-#include "config.h"
-
-#include <openssl/conf.h>
-#include <openssl/evp.h>
-#include <openssl/err.h>
-#include <openssl/ssl.h>
-#include <openssl/bio.h>
-#include <openssl/objects.h>
-#include <openssl/x509.h>
-#include <openssl/pem.h>
-#include <openssl/hmac.h>
-
-#include "config.h"
-#include "opkg_conf.h"
-#include "opkg_message.h"
-#include "opkg_openssl.h"
-
-
-static X509_STORE *setup_verify(char *CAfile, char *CApath)
-{
- int r;
- X509_STORE *store = NULL;
- X509_LOOKUP *lookup = NULL;
-
- store = X509_STORE_new();
- if (!store) {
- // Something bad is happening...
- goto end;
- }
- // adds the X509 file lookup method
- lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
- if (!lookup) {
- goto end;
- }
- // Autenticating against one CA file
- if (CAfile) {
- r = X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM);
- if (!r) {
- // Invalid CA => Bye bye
- opkg_msg(ERROR, "Error loading file %s.\n", CAfile);
- goto end;
- }
- } else {
- X509_LOOKUP_load_file(lookup, NULL, X509_FILETYPE_DEFAULT);
- }
-
- // Now look into CApath directory if supplied
- lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
- if (lookup == NULL) {
- goto end;
- }
-
- if (CApath) {
- r = X509_LOOKUP_add_dir(lookup, CApath, X509_FILETYPE_PEM);
- if (!r) {
- opkg_msg(ERROR, "Error loading directory %s.\n", CApath);
- goto end;
- }
- } else {
- X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT);
- }
-
- // All right !
- ERR_clear_error();
- return store;
-
- end:
-
- X509_STORE_free(store);
- return NULL;
-
-}
-
-void openssl_init(void)
-{
- static int init = 0;
-
- if (!init) {
- OPENSSL_config(NULL);
- OpenSSL_add_all_algorithms();
- ERR_load_crypto_strings();
- init = 1;
- }
-}
-
-int opkg_verify_openssl_signature(const char *file, const char *sigfile)
-{
- X509_STORE *store = NULL;
- PKCS7 *p7 = NULL;
- BIO *in = NULL, *indata = NULL;
- int r;
-
- // Sig check failed by default !
- int status = -1;
-
- openssl_init();
-
- // Set-up the key store
- store = setup_verify(opkg_config->signature_ca_file,
- opkg_config->signature_ca_path);
- if (!store) {
- opkg_msg(ERROR, "Can't open CA certificates.\n");
- goto verify_file_end;
- }
- // Open a BIO to read the sig file
- in = BIO_new_file(sigfile, "rb");
- if (!in) {
- opkg_msg(ERROR, "Can't open signature file %s.\n", sigfile);
- goto verify_file_end;
- }
- // Read the PKCS7 block contained in the sig file
- p7 = PEM_read_bio_PKCS7(in, NULL, NULL, NULL);
- if (!p7) {
- opkg_msg(ERROR, "Can't read signature file %s (Corrupted ?).\n",
- sigfile);
- goto verify_file_end;
- }
- // Open the Package file to authenticate
- indata = BIO_new_file(file, "rb");
- if (!indata) {
- opkg_msg(ERROR, "Can't open file %s.\n", file);
- goto verify_file_end;
- }
- // Let's verify the autenticity !
- r = PKCS7_verify(p7, NULL, store, indata, NULL, PKCS7_BINARY);
- if (r != 1) {
- // Get Off My Lawn!
- opkg_msg(ERROR, "Verification failure.\n");
- } else {
- // Victory !
- status = 0;
- }
-
- verify_file_end:
- BIO_free(in);
- BIO_free(indata);
- PKCS7_free(p7);
- X509_STORE_free(store);
-
- return status;
-}
diff --git a/libopkg/opkg_openssl.h b/libopkg/opkg_openssl.h
deleted file mode 100644
index 418067804a6d55cad884abc9350afdc72330a0a2..0000000000000000000000000000000000000000
--- a/libopkg/opkg_openssl.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* vi: set expandtab sw=4 sts=4: */
-/* opkg_openssl.h - the opkg package management system
-
- Copyright (C) 2001 University of Southern California
- Copyright (C) 2014 Paul Barker
-
- SPDX-License-Identifier: GPL-2.0-or-later
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-*/
-
-#ifndef OPKG_OPENSSL_H
-#define OPKG_OPENSSL_H
-
-#include <openssl/ssl.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void openssl_init(void);
-int opkg_verify_openssl_signature(const char *file, const char *sigfile);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/libopkg/opkg_verify.c b/libopkg/opkg_verify.c
index 2c36841db75c998206ebc5c5810879c976b82f3d..d80ffc9ddea68670dbbed3d27c6238464e28bb31 100644
--- a/libopkg/opkg_verify.c
+++ b/libopkg/opkg_verify.c
@@ -41,20 +41,6 @@ int opkg_verify_gpg_signature(const char *file, const char *sigfile)
}
#endif
-#ifdef HAVE_OPENSSL
-#include "opkg_openssl.h"
-#else
-/* Dummy openssl signature verification. */
-int opkg_verify_openssl_signature(const char *file, const char *sigfile)
-{
- (void)file;
- (void)sigfile;
-
- opkg_msg(ERROR, "OpenSSL signature checking not supported\n");
- return -1;
-}
-#endif
-
int opkg_verify_md5sum(const char *file, const char *md5sum)
{
int r;
@@ -104,8 +90,6 @@ int opkg_verify_signature(const char *file, const char *sigfile)
|| (strcmp(opkg_config->signature_type, "gpg-asc") == 0);
if (use_gpg)
return opkg_verify_gpg_signature(file, sigfile);
- else if (strcmp(opkg_config->signature_type, "openssl") == 0)
- return opkg_verify_openssl_signature(file, sigfile);
opkg_msg(ERROR, "signature_type option '%s' not understood.\n",
opkg_config->signature_type);
diff --git a/man/
opkg.conf.5.in b/man/
opkg.conf.5.in
index cf2f1b2b965b4a86d251d2a5635bddae4db99c24..94296e77269205eab6d13fcb701aa3a2052dee76 100644
--- a/man/
opkg.conf.5.in
+++ b/man/
opkg.conf.5.in
@@ -74,9 +74,6 @@ Performs a signature check against a package. The signature file should be next
\fBcheck_signature\fP
Performs a signature check against the package index. The signature file should be next to the package index (default is 0)
.TP
-\fBcheck_x509_path\fP
-Validates the x509 certificate all the way back to the Certificate Authority (default is 0)
-.TP
\fBcombine\fP
Combines upgrade and install operations, this may be needed to resolve dependency issues. Only available for the internal solver backend (default is 0).
.TP
@@ -199,12 +196,6 @@ User name to use for proxy authentication.
\fBquery-all\fP
Executes a query against all packages from all repositories, not just install packages (default is 0).
.TP
-\fBsignature_ca_file\fP
-Path to the CA certificate file.
-.TP
-\fBsignature_ca_path\fP
-Path to certificates directory.
-.TP
\fBsignature_type\fP
The type of signatures to check against.
.fi
--
2.30.0