dropbear: add ed25519 and chacha20-poly1305
[openwrt/openwrt.git] / package / network / services / dropbear / Makefile
index b30229300c6deaee5cae2bffe2b4ec13632bd74e..8de0739d56c242931442dcf868739df587a6d675 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dropbear
 PKG_VERSION:=2019.78
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
@@ -29,6 +29,7 @@ PKG_FIXUP:=autoreconf
 PKG_CONFIG_DEPENDS:= \
        CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_ECC_FULL \
        CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
+       CONFIG_DROPBEAR_ED25519 CONFIG_DROPBEAR_CHACHA20POLY1305 \
        CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE \
        CONFIG_DROPBEAR_DBCLIENT
 
@@ -63,6 +64,7 @@ define Package/dropbear/description
 endef
 
 define Package/dropbear/conffiles
+$(if $(CONFIG_DROPBEAR_ED25519),/etc/dropbear/dropbear_ed25519_host_key)
 $(if $(CONFIG_DROPBEAR_ECC),/etc/dropbear/dropbear_ecdsa_host_key)
 /etc/dropbear/dropbear_rsa_host_key
 /etc/config/dropbear
@@ -110,6 +112,12 @@ define Build/Configure
                        $(PKG_BUILD_DIR)/localoptions.h; \
        done
 
+       echo '#define DROPBEAR_ED25519 $(if $(CONFIG_DROPBEAR_ED25519),1,0)' >> \
+               $(PKG_BUILD_DIR)/localoptions.h
+
+       echo '#define DROPBEAR_CHACHA20POLY1305 $(if $(CONFIG_DROPBEAR_CHACHA20POLY1305),1,0)' >> \
+               $(PKG_BUILD_DIR)/localoptions.h
+
        # remove protocol idented software version number
        $(ESED) 's,^(#define LOCAL_IDENT) .*$$$$,\1 "SSH-2.0-dropbear",g' \
                $(PKG_BUILD_DIR)/sysoptions.h
@@ -160,6 +168,7 @@ define Package/dropbear/install
        $(INSTALL_DIR) $(1)/etc/dropbear
        $(INSTALL_DIR) $(1)/lib/preinit
        $(INSTALL_DATA) ./files/dropbear.failsafe $(1)/lib/preinit/99_10_failsafe_dropbear
+       $(if $(CONFIG_DROPBEAR_ED25519),touch $(1)/etc/dropbear/dropbear_ed25519_host_key)
        $(if $(CONFIG_DROPBEAR_ECC),touch $(1)/etc/dropbear/dropbear_ecdsa_host_key)
        touch $(1)/etc/dropbear/dropbear_rsa_host_key
 endef