2 # Copyright (C) 2006-2016 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 http://matt.ucc.asn.au/dropbear/releases/ \
17 https://dropbear.nl/mirror/releases/
18 PKG_HASH:=d91f78ebe633be1d071fd1b7e5535b9693794048b019e9f4bea257e1992b458d
21 PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
22 PKG_CPE_ID:=cpe:/a:matt_johnston:dropbear_ssh_server
28 PKG_CONFIG_DEPENDS:= \
29 CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC \
30 CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
31 CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE
33 include $(INCLUDE_DIR)/package.mk
36 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5)
39 define Package/dropbear/Default
40 URL:=http://matt.ucc.asn.au/dropbear/
43 define Package/dropbear/config
44 source "$(SOURCE)/Config.in"
47 define Package/dropbear
48 $(call Package/dropbear/Default)
51 TITLE:=Small SSH2 client/server
52 DEPENDS:= +DROPBEAR_ZLIB:zlib
54 100:/usr/bin/ssh:/usr/sbin/dropbear \
55 100:/usr/bin/scp:/usr/sbin/dropbear \
59 define Package/dropbear/description
60 A small SSH2 server/client designed for small memory environments.
63 define Package/dropbear/conffiles
64 $(if $(CONFIG_DROPBEAR_ECC),/etc/dropbear/dropbear_ecdsa_host_key)
65 /etc/dropbear/dropbear_rsa_host_key
69 define Package/dropbearconvert
70 $(call Package/dropbear/Default)
73 TITLE:=Utility for converting SSH keys
82 $(if $(CONFIG_DROPBEAR_UTMP),,--disable-utmp) \
86 $(if $(CONFIG_DROPBEAR_PUTUTLINE),,--disable-pututline) \
87 --disable-pututxline \
88 $(if $(CONFIG_DROPBEAR_ZLIB),,--disable-zlib) \
89 --enable-bundled-libtom
91 TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections -flto
92 TARGET_LDFLAGS += -Wl,--gc-sections -flto=jobserver
94 define Build/Configure
95 : > $(PKG_BUILD_DIR)/localoptions.h
97 $(Build/Configure/Default)
99 echo '#define DEFAULT_PATH "$(TARGET_INIT_PATH)"' >> \
100 $(PKG_BUILD_DIR)/localoptions.h
102 echo '#define DROPBEAR_CURVE25519 $(if $(CONFIG_DROPBEAR_CURVE25519),1,0)' >> \
103 $(PKG_BUILD_DIR)/localoptions.h
105 for OPTION in DROPBEAR_ECDSA DROPBEAR_ECDH; do \
106 echo "#define $$$$OPTION $(if $(CONFIG_DROPBEAR_ECC),1,0)" >> \
107 $(PKG_BUILD_DIR)/localoptions.h; \
110 # remove protocol idented software version number
111 $(ESED) 's,^(#define LOCAL_IDENT) .*$$$$,\1 "SSH-2.0-dropbear",g' \
112 $(PKG_BUILD_DIR)/sysoptions.h
114 # disable legacy/unsafe methods and unused functionality
115 for OPTION in INETD_MODE DROPBEAR_CLI_NETCAT \
116 DROPBEAR_3DES DROPBEAR_DSS DROPBEAR_ENABLE_CBC_MODE \
117 DROPBEAR_SHA1_96_HMAC DROPBEAR_USE_PASSWORD_ENV; do \
118 echo "#define $$$$OPTION 0" >> \
119 $(PKG_BUILD_DIR)/localoptions.h; \
122 # Enforce rebuild of svr-chansession.c
123 rm -f $(PKG_BUILD_DIR)/svr-chansession.o
127 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
128 $(TARGET_CONFIGURE_OPTS) \
129 PROGRAMS="dropbear dbclient dropbearkey scp" \
130 MULTI=1 SCPPROGRESS=1
131 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
132 $(TARGET_CONFIGURE_OPTS) \
133 PROGRAMS="dropbearconvert"
136 define Package/dropbear/install
137 $(INSTALL_DIR) $(1)/usr/sbin
138 $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
139 $(INSTALL_DIR) $(1)/usr/bin
140 $(LN) ../sbin/dropbear $(1)/usr/bin/dbclient
141 $(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey
142 $(INSTALL_DIR) $(1)/etc/config
143 $(INSTALL_CONF) ./files/dropbear.config $(1)/etc/config/dropbear
144 $(INSTALL_DIR) $(1)/etc/init.d
145 $(INSTALL_BIN) ./files/dropbear.init $(1)/etc/init.d/dropbear
146 $(INSTALL_DIR) $(1)/usr/lib/opkg/info
147 $(INSTALL_DIR) $(1)/etc/dropbear
148 $(if $(CONFIG_DROPBEAR_ECC),touch $(1)/etc/dropbear/dropbear_ecdsa_host_key)
149 touch $(1)/etc/dropbear/dropbear_rsa_host_key
152 define Package/dropbearconvert/install
153 $(INSTALL_DIR) $(1)/usr/bin
154 $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearconvert $(1)/usr/bin/dropbearconvert
157 $(eval $(call BuildPackage,dropbear))
158 $(eval $(call BuildPackage,dropbearconvert))