mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 00:11:13 +00:00
0134f845da
This uses uci to configure engines, by generating a list of enabled engines in /var/etc/ssl/engines.cnf from engines configured in /etc/config/openssl: config engine 'devcrypto' option enabled '1' Currently the only options implemented are 'enabled', which defaults to true and enables the named engine, and the 'force' option, that enables the engine even if the init script thinks the engine does not exist. The existence test is to check for either a configuration file /etc/ssl/engines.cnf.d/%ENGINE%.cnf, or a shared object file /usr/lib/engines-1.1/%ENGINE%.so. The engine list is generated by an init script which is set to run after 'log' because it informs the engines being enabled or skipped. It should run before any service using OpenSSL as the crypto library, otherwise the service will not use any engine. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
47 lines
1.2 KiB
Makefile
47 lines
1.2 KiB
Makefile
ENGINES_DIR=engines-1.1
|
|
|
|
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
|