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
:=525965971272270995364a0eb01f35180d793182e63dd0b0c3eb0292291644a4
21 PKG_LICENSE_FILES
:=LICENSE libtomcrypt
/LICENSE libtommath
/LICENSE
22 PKG_CPE_ID
:=cpe
:/a
:matt_johnston
:dropbear_ssh_server
25 PKG_ASLR_PIE_REGULAR
:=1
29 PKG_CONFIG_DEPENDS
:= \
30 CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_ECC_FULL \
31 CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
32 CONFIG_DROPBEAR_ED25519 CONFIG_DROPBEAR_CHACHA20POLY1305 \
33 CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE \
34 CONFIG_DROPBEAR_DBCLIENT
36 include $(INCLUDE_DIR
)/package.mk
39 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell echo
$(CONFIG_TARGET_INIT_PATH
) | mkhash md5
)
42 define Package
/dropbear
/Default
43 URL
:=http
://matt.ucc.asn.au
/dropbear
/
46 define Package
/dropbear
/config
47 source
"$(SOURCE)/Config.in"
50 define Package
/dropbear
51 $(call Package
/dropbear
/Default
)
54 TITLE
:=Small SSH2 client
/server
55 DEPENDS
:= +DROPBEAR_ZLIB
:zlib
57 100:/usr
/bin
/ssh
:/usr
/sbin
/dropbear \
58 100:/usr
/bin
/scp
:/usr
/sbin
/dropbear \
62 define Package
/dropbear
/description
63 A small SSH2 server
/client designed for small memory environments.
66 define Package
/dropbear
/conffiles
67 $(if
$(CONFIG_DROPBEAR_ED25519
),/etc
/dropbear
/dropbear_ed25519_host_key
)
68 $(if
$(CONFIG_DROPBEAR_ECC
),/etc
/dropbear
/dropbear_ecdsa_host_key
)
69 /etc
/dropbear
/dropbear_rsa_host_key
73 define Package
/dropbearconvert
74 $(call Package
/dropbear
/Default
)
77 TITLE
:=Utility for converting SSH keys
78 DEPENDS
:= +DROPBEAR_ZLIB
:zlib
87 $(if
$(CONFIG_DROPBEAR_UTMP
),,--disable-utmp
) \
91 $(if
$(CONFIG_DROPBEAR_PUTUTLINE
),,--disable-pututline
) \
92 --disable-pututxline \
93 $(if
$(CONFIG_DROPBEAR_ZLIB
),,--disable-zlib
) \
94 --enable-bundled-libtom
96 TARGET_CFLAGS
+= -DARGTYPE
=3 -ffunction-sections
-fdata-sections
-flto
97 TARGET_LDFLAGS
+= -Wl
,--gc-sections
-flto
=jobserver
99 define Build
/Configure
100 : > $(PKG_BUILD_DIR
)/localoptions.h
102 $(Build
/Configure
/Default
)
104 echo
'#define DEFAULT_PATH "$(TARGET_INIT_PATH)"' >> \
105 $(PKG_BUILD_DIR
)/localoptions.h
107 echo
'#define DROPBEAR_CURVE25519 $(if $(CONFIG_DROPBEAR_CURVE25519),1,0)' >> \
108 $(PKG_BUILD_DIR
)/localoptions.h
110 for OPTION in DROPBEAR_ECDSA DROPBEAR_ECDH
; do \
111 echo
"#define $$$$OPTION $(if $(CONFIG_DROPBEAR_ECC),1,0)" >> \
112 $(PKG_BUILD_DIR
)/localoptions.h
; \
115 echo
'#define DROPBEAR_ED25519 $(if $(CONFIG_DROPBEAR_ED25519),1,0)' >> \
116 $(PKG_BUILD_DIR
)/localoptions.h
118 echo
'#define DROPBEAR_CHACHA20POLY1305 $(if $(CONFIG_DROPBEAR_CHACHA20POLY1305),1,0)' >> \
119 $(PKG_BUILD_DIR
)/localoptions.h
121 # remove protocol idented software version number
122 $(ESED
) 's,^(#define LOCAL_IDENT) .*$$$$,\1 "SSH-2.0-dropbear",g' \
123 $(PKG_BUILD_DIR
)/sysoptions.h
125 # disable legacy/unsafe methods and unused functionality
126 for OPTION in INETD_MODE DROPBEAR_CLI_NETCAT \
127 DROPBEAR_3DES DROPBEAR_DSS DROPBEAR_ENABLE_CBC_MODE \
128 DROPBEAR_SHA1_96_HMAC DROPBEAR_USE_PASSWORD_ENV
; do \
129 echo
"#define $$$$OPTION 0" >> \
130 $(PKG_BUILD_DIR
)/localoptions.h
; \
133 # enable nistp384 and nistp521 only if full ECC support was requested
134 for OPTION in DROPBEAR_ECC_384 DROPBEAR_ECC_521
; do \
135 $(ESED
) 's,^(#define '$$$$OPTION') .*$$$$,\1 $(if $(CONFIG_DROPBEAR_ECC_FULL),1,0),g' \
136 $(PKG_BUILD_DIR
)/sysoptions.h
; \
139 # Enforce rebuild of svr-chansession.c
140 rm -f
$(PKG_BUILD_DIR
)/svr-chansession.o
142 # Rebuild them on config change
143 +$(MAKE
) -C
$(PKG_BUILD_DIR
)/libtomcrypt
clean
144 +$(MAKE
) -C
$(PKG_BUILD_DIR
)/libtommath
clean
148 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
149 $(TARGET_CONFIGURE_OPTS
) \
150 PROGRAMS
="dropbear $(if $(CONFIG_DROPBEAR_DBCLIENT),dbclient,) dropbearkey scp" \
151 MULTI
=1 SCPPROGRESS
=1
152 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
153 $(TARGET_CONFIGURE_OPTS
) \
154 PROGRAMS
="dropbearconvert"
157 define Package
/dropbear
/install
158 $(INSTALL_DIR
) $(1)/usr
/sbin
159 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/dropbearmulti
$(1)/usr
/sbin
/dropbear
160 $(INSTALL_DIR
) $(1)/usr
/bin
161 $(if
$(CONFIG_DROPBEAR_DBCLIENT
),$(LN
) ..
/sbin
/dropbear
$(1)/usr
/bin
/dbclient
,)
162 $(LN
) ..
/sbin
/dropbear
$(1)/usr
/bin
/dropbearkey
163 $(INSTALL_DIR
) $(1)/etc
/config
164 $(INSTALL_CONF
) .
/files
/dropbear.config
$(1)/etc
/config
/dropbear
165 $(INSTALL_DIR
) $(1)/etc
/init.d
166 $(INSTALL_BIN
) .
/files
/dropbear.init
$(1)/etc
/init.d
/dropbear
167 $(INSTALL_DIR
) $(1)/usr
/lib
/opkg
/info
168 $(INSTALL_DIR
) $(1)/etc
/dropbear
169 $(INSTALL_DIR
) $(1)/lib
/preinit
170 $(INSTALL_DATA
) .
/files
/dropbear.failsafe
$(1)/lib
/preinit
/99_10_failsafe_dropbear
171 $(if
$(CONFIG_DROPBEAR_ED25519
),touch
$(1)/etc
/dropbear
/dropbear_ed25519_host_key
)
172 $(if
$(CONFIG_DROPBEAR_ECC
),touch
$(1)/etc
/dropbear
/dropbear_ecdsa_host_key
)
173 touch
$(1)/etc
/dropbear
/dropbear_rsa_host_key
176 define Package
/dropbearconvert
/install
177 $(INSTALL_DIR
) $(1)/usr
/bin
178 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/dropbearconvert
$(1)/usr
/bin
/dropbearconvert
181 $(eval
$(call BuildPackage
,dropbear
))
182 $(eval
$(call BuildPackage
,dropbearconvert
))