Skip to contentSkip to conversation

pppd: use uclibc libcrypt instead of openssl

PATCH New Alexander Mukhin 3 participants 7 messages Sep 6, 2019 – Sep 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pppd: use uclibc libcrypt instead of openssl

If building with uclibc, fall back to using its cryptographic routines instead of openssl. This removes unnecessary dependence.

---
 package/pppd/Config.in |  2 +-
 package/pppd/pppd.mk   | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)
package/pppd/Config.in +1 -1
index bf05689f53..7db5674bf1 100644
@@ -3,7 +3,7 @@ config BR2_PACKAGE_PPPD
 	depends on !BR2_STATIC_LIBS
 	depends on !BR2_TOOLCHAIN_USES_MUSL # Use __P() macro all over the tree
 	depends on BR2_USE_MMU
-	select BR2_PACKAGE_OPENSSL
+	select BR2_PACKAGE_OPENSSL if BR2_TOOLCHAIN_USES_GLIBC
 	help
 	  An implementation of the Point-to-point protocol.
 
package/pppd/pppd.mk +7 -3
index 4dffc17941..be6c443eec 100644
@@ -12,10 +12,14 @@ PPPD_LICENSE_FILES = \
 	pppd/tdb.c pppd/plugins/pppoatm/COPYING \
 	pppdump/bsd-comp.c pppd/ccp.c pppd/plugins/passprompt.c
 
+PPPD_MAKE_OPTS = HAVE_INET6=y
+ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
 PPPD_DEPENDENCIES = openssl
-PPPD_MAKE_OPTS = \
-	HAVE_INET6=y \
-	OPENSSL_INCLUDE_DIR=$(STAGING_DIR)/usr/include/openssl
+PPPD_MAKE_OPTS += OPENSSL_INCLUDE_DIR=$(STAGING_DIR)/usr/include/openssl
+else
+PPPD_MAKE_OPTS += USE_CRYPT=y
+endif
+
 PPPD_INSTALL_STAGING = YES
 PPPD_TARGET_BINS = chat pppd pppdump pppstats
 PPPD_RADIUS_CONF = \
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 pppd: use uclibc libcrypt instead of openssl

Hello Alexander,

Quoted 4 lines · On Fri, 6 Sep 2019 13:18:49 +0300 Alexander Mukhin…

If building with uclibc, fall back to using its cryptographic routines instead of openssl. This removes unnecessary dependence.

I am surprised: which functions are provided by uClibc that glibc doesn't provide ?

Also, what about the musl C library that we support ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 pppd: use uclibc libcrypt instead of openssl

Hi Thomas,

Quoted 6 lines · Thomas Petazzoni
Quoted 3 lines · On Fri, 6 Sep 2019 13:18:49 +0300 Alexander Mukhin…

If building with uclibc, fall back to using its cryptographic routines instead of openssl. This removes unnecessary dependence.

Quoted 6 lines
Quoted 1 line

I am surprised: which functions are provided by uClibc that glibc doesn't provide ?

Also, what about the musl C library that we support ?

pppd has:

depends on !BR2_TOOLCHAIN_USES_MUSL # Use __P() macro all over the tree

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#3 lore raw

PATCH 1/1 pppd: use uclibc libcrypt instead of openssl

In reply to Thomas Petazzoni

Hello Thomas,

Quoted 2 lines · Thomas Petazzoni

I am surprised: which functions are provided by uClibc that glibc doesn't provide ?

According to Fabrice Fontaine's commit 541021, glibc since 2.28 dropped support for DES encryption functions encrypt(), setkey(), etc. But uclibc still provides them.

Signature · 1 line
Alexander.
#4 lore raw

PATCH 1/1 pppd: use uclibc libcrypt instead of openssl

Hello Alexander,

Quoted 7 lines · On Fri, 6 Sep 2019 19:31:07 +0300 Alexander Mukhin…
Quoted 2 lines · Thomas Petazzoni

I am surprised: which functions are provided by uClibc that glibc doesn't provide ?

According to Fabrice Fontaine's commit 541021, glibc since 2.28 dropped support for DES encryption functions encrypt(), setkey(), etc. But uclibc still provides them.

OK, thanks for the additional details. Could you send an updated version which explains this in the commit log ?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

PATCH 1/1 package/pppd: use uclibc libcrypt instead of openssl

glibc since 2.28 dropped DES encryption routines setkey() and encrypt(), but uclibc still provides them. So, if building with uclibc, we can avoid using huge openssl library.

---
 package/pppd/Config.in |  2 +-
 package/pppd/pppd.mk   | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)
package/pppd/Config.in +1 -1
index bf05689f53..7db5674bf1 100644
@@ -3,7 +3,7 @@ config BR2_PACKAGE_PPPD
 	depends on !BR2_STATIC_LIBS
 	depends on !BR2_TOOLCHAIN_USES_MUSL # Use __P() macro all over the tree
 	depends on BR2_USE_MMU
-	select BR2_PACKAGE_OPENSSL
+	select BR2_PACKAGE_OPENSSL if BR2_TOOLCHAIN_USES_GLIBC
 	help
 	  An implementation of the Point-to-point protocol.
 
package/pppd/pppd.mk +7 -3
index 4dffc17941..be6c443eec 100644
@@ -12,10 +12,14 @@ PPPD_LICENSE_FILES = \
 	pppd/tdb.c pppd/plugins/pppoatm/COPYING \
 	pppdump/bsd-comp.c pppd/ccp.c pppd/plugins/passprompt.c
 
+PPPD_MAKE_OPTS = HAVE_INET6=y
+ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
 PPPD_DEPENDENCIES = openssl
-PPPD_MAKE_OPTS = \
-	HAVE_INET6=y \
-	OPENSSL_INCLUDE_DIR=$(STAGING_DIR)/usr/include/openssl
+PPPD_MAKE_OPTS += OPENSSL_INCLUDE_DIR=$(STAGING_DIR)/usr/include/openssl
+else
+PPPD_MAKE_OPTS += USE_CRYPT=y
+endif
+
 PPPD_INSTALL_STAGING = YES
 PPPD_TARGET_BINS = chat pppd pppdump pppstats
 PPPD_RADIUS_CONF = \
Signature · 1 line
2.20.1
#6 lore raw

PATCH 1/1 package/pppd: use uclibc libcrypt instead of openssl

Quoted 5 lines · On Sat, 7 Sep 2019 21:35:17 +0300 Alexander Mukhin…

glibc since 2.28 dropped DES encryption routines setkey() and encrypt(), but uclibc still provides them. So, if building with uclibc, we can avoid using huge openssl library.

I've applied, after doing one small change, see below.

package/pppd/pppd.mk PPPD_LICENSE_FILES = \ · line 17

Quoted 3 lines
package/pppd/pppd.mk +2 -0
+PPPD_MAKE_OPTS = HAVE_INET6=y
+ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
 PPPD_DEPENDENCIES = openssl

I changed this to PPPD_DEPENDENCIES += instead of PPPD_DEPENDENCIES =. Indeed, we're now in a conditional block, and we want to avoid overwriting any PPPD_DEPENDENCIES assignment that could have been done before that. There is none in the current pppd.mk, but one could be added in the future, so we really like to use += to add conditional dependencies.

Thanks for your contribution!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com