All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/3] dropbear: Use macro to set options
@ 2018-04-18 14:24 Stefan Sørensen
  2018-04-18 14:24 ` [Buildroot] [PATCH 2/3] dropbear: Add configuration options for security features Stefan Sørensen
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Stefan Sørensen @ 2018-04-18 14:24 UTC (permalink / raw)
  To: buildroot

Introduce a macro for editing options.h according to the Buildroot
configuration, replacing individual sed scripts.

Signed-off-by: Stefan S?rensen <stefan.sorensen@spectralink.com>
---
 package/dropbear/dropbear.mk | 37 +++++++++++++++---------------------
 1 file changed, 15 insertions(+), 22 deletions(-)

diff --git a/package/dropbear/dropbear.mk b/package/dropbear/dropbear.mk
index 01a1a07b76..dc1fee207f 100644
--- a/package/dropbear/dropbear.mk
+++ b/package/dropbear/dropbear.mk
@@ -32,24 +32,25 @@ endef
 
 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_FIX_XAUTH
 
-define DROPBEAR_ENABLE_REVERSE_DNS
-	$(SED) 's:.*\(#define DO_HOST_LOOKUP\).*:\1:' $(@D)/options.h
+define DROPBEAR_SET_OPT # (define, option)
+	if [ 'x$(2)' = 'xy' -o 'x$(2)' = 'x!' ]; then \
+		$(SED) 's:.*\(#define $(1)\)\([^A-Z0-9_]\|$$\).*:\1 1:' $(@D)/options.h; \
+	else \
+		$(SED) 's:.*\(#define $(1)\)\([^A-Z0-9_]\|$$\).*:/*\1*/:' $(@D)/options.h; \
+	fi
 endef
 
-define DROPBEAR_BUILD_SMALL
-	$(SED) 's:.*\(#define NO_FAST_EXPTMOD\).*:\1:' $(@D)/options.h
+define DROPBEAR_SET_OPTIONS
+	$(call DROPBEAR_SET_OPT,DROPBEAR_SMALL_CODE,$(BR2_PACKAGE_DROPBEAR_SMALL))
+	$(call DROPBEAR_SET_OPT,NO_FAST_EXPTMOD,$(BR2_PACKAGE_DROPBEAR_SMALL))
+	$(call DROPBEAR_SET_OPT,DO_HOST_LOOKUP,$(BR2_PACKAGE_DROPBEAR_ENABLE_REVERSE_DNS))
+	$(call DROPBEAR_SET_OPT,NON_INETD_MODE,$(BR2_USE_MMU))
+	$(call DROPBEAR_SET_OPT,DROPBEAR_BLOWFISH,!$(BR2_PACKAGE_DROPBEAR_SMALL))
+	$(call DROPBEAR_SET_OPT,DROPBEAR_TWOFISH128,!$(BR2_PACKAGE_DROPBEAR_SMALL))
+	$(call DROPBEAR_SET_OPT,DROPBEAR_TWOFISH256,!$(BR2_PACKAGE_DROPBEAR_SMALL))
 endef
 
-define DROPBEAR_BUILD_FEATURED
-	$(SED) 's:^#define DROPBEAR_SMALL_CODE::' $(@D)/options.h
-	$(SED) 's:.*\(#define DROPBEAR_BLOWFISH\).*:\1:' $(@D)/options.h
-	$(SED) 's:.*\(#define DROPBEAR_TWOFISH128\).*:\1:' $(@D)/options.h
-	$(SED) 's:.*\(#define DROPBEAR_TWOFISH256\).*:\1:' $(@D)/options.h
-endef
-
-define DROPBEAR_DISABLE_STANDALONE
-	$(SED) 's:\(#define NON_INETD_MODE\):/*\1 */:' $(@D)/options.h
-endef
+DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_SET_OPTIONS
 
 define DROPBEAR_INSTALL_INIT_SYSTEMD
 	$(INSTALL) -D -m 644 package/dropbear/dropbear.service \
@@ -64,19 +65,11 @@ define DROPBEAR_INSTALL_INIT_SYSV
 	$(INSTALL) -D -m 755 package/dropbear/S50dropbear \
 		$(TARGET_DIR)/etc/init.d/S50dropbear
 endef
-else
-DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_DISABLE_STANDALONE
-endif
-
-ifeq ($(BR2_PACKAGE_DROPBEAR_DISABLE_REVERSEDNS),)
-DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_ENABLE_REVERSE_DNS
 endif
 
 ifeq ($(BR2_PACKAGE_DROPBEAR_SMALL),y)
-DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_BUILD_SMALL
 DROPBEAR_CONF_OPTS += --disable-zlib
 else
-DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_BUILD_FEATURED
 DROPBEAR_DEPENDENCIES += zlib
 endif
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-04-28 15:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-18 14:24 [Buildroot] [PATCH 1/3] dropbear: Use macro to set options Stefan Sørensen
2018-04-18 14:24 ` [Buildroot] [PATCH 2/3] dropbear: Add configuration options for security features Stefan Sørensen
2018-04-18 15:10   ` Thomas Petazzoni
2018-04-19  7:50     ` Sørensen, Stefan
2018-04-18 21:58   ` Arnout Vandecappelle
2018-04-19  7:57     ` Sørensen, Stefan
2018-04-18 14:24 ` [Buildroot] [PATCH 3/3] dropbear: Disable insecure options Stefan Sørensen
2018-04-18 15:11   ` Thomas Petazzoni
2018-04-20  3:45 ` [Buildroot] [PATCH 1/3] dropbear: Use macro to set options François Perrad
2018-04-28 15:51 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.