aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEneas U de Queiroz <cotequeiroz@gmail.com>2023-03-10 17:53:25 -0300
committerEneas U de Queiroz <cotequeiroz@gmail.com>2023-04-05 08:24:49 -0300
commit0dc5fc8fa53be55c3adc59055e7f6f150a5ab1ad (patch)
treec6f2dceb75f2ad7abe237a2b27692cc6335fe765 /include
parent0b70d55a64c39da4144cc15aa7d6de70a3957ccb (diff)
downloadupstream-0dc5fc8fa53be55c3adc59055e7f6f150a5ab1ad.tar.gz
upstream-0dc5fc8fa53be55c3adc59055e7f6f150a5ab1ad.tar.bz2
upstream-0dc5fc8fa53be55c3adc59055e7f6f150a5ab1ad.zip
openssl: add legacy provider
This adapts the engine build infrastructure to allow building providers, and packages the legacy provider. Providers are the successors of engines, which have been deprecated. The legacy provider supplies OpenSSL implementations of algorithms that have been deemed legacy, including DES, IDEA, MDC2, SEED, and Whirlpool. Even though these algorithms are implemented in a separate package, their removal makes the regular library smaller by 3%, so the build options will remain to allow lean custom builds. Their defaults will change to 'y' if not bulding for a small flash, so that the regular legacy package will contain a complete set of algorithms. The engine build and configuration structure was changed to accomodate providers, and adapt to the new style of openssl.cnf in version 3.0. There is not a clean upgrade path for the /etc/ssl/openssl.cnf file, installed by the openssl-conf package. It is recommended to rename or remove the old config file when flashing an image with the updated openssl-conf package, then apply the changes manually. An old openssl.cnf file will silently work, but new engine or provider packages will not be enabled. Any remaining engine config files under /etc/ssl/engines.cnf.d can be removed. On the build side, the include file used by engine packages was renamed to openssl-module.mk, so the engine packages in other feeds need to adapt. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/openssl-engine.mk50
-rw-r--r--include/openssl-module.mk79
2 files changed, 79 insertions, 50 deletions
diff --git a/include/openssl-engine.mk b/include/openssl-engine.mk
deleted file mode 100644
index 891d284f12..0000000000
--- a/include/openssl-engine.mk
+++ /dev/null
@@ -1,50 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Copyright (C) 2022-2023 Enéas Ulir de Queiroz
-
-ENGINES_DIR=engines-3
-
-define Package/openssl/engine/Default
- SECTION:=libs
- CATEGORY:=Libraries
- SUBMENU:=SSL
- DEPENDS:=libopenssl @OPENSSL_ENGINE +libopenssl-conf
-endef
-
-# 1 = engine name
-# 2 - package name, defaults to libopenssl-$(1)
-define Package/openssl/add-engine
- OSSL_ENG_PKG:=$(if $(2),$(2),libopenssl-$(1))
- Package/$$(OSSL_ENG_PKG)/conffiles:=/etc/ssl/engines.cnf.d/$(1).cnf
-
- define Package/$$(OSSL_ENG_PKG)/install
- $$(INSTALL_DIR) $$(1)/usr/lib/$(ENGINES_DIR)
- $$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/lib/$(ENGINES_DIR)/$(1).so \
- $$(1)/usr/lib/$(ENGINES_DIR)
- $$(INSTALL_DIR) $$(1)/etc/ssl/engines.cnf.d
- $$(INSTALL_DATA) ./files/$(1).cnf $$(1)/etc/ssl/engines.cnf.d/
- endef
-
- define Package/$$(OSSL_ENG_PKG)/postinst :=
-#!/bin/sh
-OPENSSL_UCI="$$$${IPKG_INSTROOT}/etc/config/openssl"
-
-[ -z "$$$${IPKG_INSTROOT}" ] && uci -q get openssl.$(1) >/dev/null && exit 0
-
-cat << EOF >> "$$$${OPENSSL_UCI}"
-
-config engine '$(1)'
- option enabled '1'
-EOF
-
-[ -n "$$$${IPKG_INSTROOT}" ] || /etc/init.d/openssl reload
- endef
-
- define Package/$$(OSSL_ENG_PKG)/postrm :=
-#!/bin/sh
-[ -n "$$$${IPKG_INSTROOT}" ] && exit 0
-uci delete openssl.$(1)
-uci commit openssl
-/etc/init.d/openssl reload
- endef
-endef
diff --git a/include/openssl-module.mk b/include/openssl-module.mk
new file mode 100644
index 0000000000..7348a10dbc
--- /dev/null
+++ b/include/openssl-module.mk
@@ -0,0 +1,79 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2022-2023 Enéas Ulir de Queiroz
+
+ENGINES_DIR=engines-3
+
+define Package/openssl/module/Default
+ SECTION:=libs
+ CATEGORY:=Libraries
+ SUBMENU:=SSL
+ DEPENDS:=libopenssl +libopenssl-conf
+endef
+
+define Package/openssl/engine/Default
+ $(Package/openssl/module/Default)
+ DEPENDS+=@OPENSSL_ENGINE
+endef
+
+
+# 1 = moudule type (engine|provider)
+# 2 = module name
+# 3 = directory to save .so file
+# 4 = [ package name, defaults to libopenssl-$(2) ]
+define Package/openssl/add-module
+ $(eval MOD_TYPE:=$(1))
+ $(eval MOD_NAME:=$(2))
+ $(eval MOD_DIR:=$(3))
+ $(eval OSSL_PKG:=$(if $(4),$(4),libopenssl-$(MOD_NAME)))
+ $(info Package/openssl/add-module 1='$(1)'; 2='$(2)'; 3='$(3)' 4='$(4)')
+ $(info MOD_TYPE='$(MOD_TYPE)'; MOD_NAME='$(MOD_NAME)'; MOD_DIR='$(MOD_DIR)' OSSL_PKG='$(OSSL_PKG)')
+ Package/$(OSSL_PKG)/conffiles:=/etc/ssl/modules.cnf.d/$(MOD_NAME).cnf
+
+ define Package/$(OSSL_PKG)/install
+ $$(INSTALL_DIR) $$(1)/$(MOD_DIR)
+ $$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/$(MOD_DIR)/$(MOD_NAME).so \
+ $$(1)/$(MOD_DIR)
+ $$(INSTALL_DIR) $$(1)/etc/ssl/modules.cnf.d
+ $$(INSTALL_DATA) ./files/$(MOD_NAME).cnf $$(1)/etc/ssl/modules.cnf.d/
+ endef
+
+ define Package/$(OSSL_PKG)/postinst
+#!/bin/sh
+OPENSSL_UCI="$$$${IPKG_INSTROOT}/etc/config/openssl"
+
+[ -z "$$$${IPKG_INSTROOT}" ] \
+ && uci -q get openssl.$(MOD_NAME) >/dev/null \
+ && exit 0
+
+cat << EOF >> "$$$${OPENSSL_UCI}"
+
+config $(MOD_TYPE) '$(MOD_NAME)'
+ option enabled '1'
+EOF
+
+[ -n "$$$${IPKG_INSTROOT}" ] || /etc/init.d/openssl reload
+exit 0
+ endef
+
+ define Package/$(OSSL_PKG)/postrm
+#!/bin/sh
+[ -n "$$$${IPKG_INSTROOT}" ] && exit 0
+uci -q delete openssl.$(MOD_NAME) && uci commit openssl
+/etc/init.d/openssl reload
+exit 0
+ endef
+endef
+
+# 1 = engine name
+# 2 - package name, defaults to libopenssl-$(1)
+define Package/openssl/add-engine
+ $(call Package/openssl/add-module,engine,$(1),/usr/lib/$(ENGINES_DIR),$(2))
+endef
+
+# 1 = provider name
+# 2 = [ package name, defaults to libopenssl-$(1) ]
+define Package/openssl/add-provider
+ $(call Package/openssl/add-module,provider,$(1),/usr/lib/ossl-modules,$(2))
+endef
+