Skip to contentSkip to conversation

libtommath: new package

PATCH New Francois Perrad 5 participants 10 messages Apr 10, 2016 – May 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/3 libtommath: new package

---
 package/Config.in                  |  1 +
 package/libtommath/Config.in       |  7 +++++++
 package/libtommath/libtommath.hash |  2 ++
 package/libtommath/libtommath.mk   | 23 +++++++++++++++++++++++
 4 files changed, 33 insertions(+)
 create mode 100644 package/libtommath/Config.in
 create mode 100644 package/libtommath/libtommath.hash
 create mode 100644 package/libtommath/libtommath.mk
package/Config.in +1 -0
index 64822bf..24dbe09 100644
@@ -1234,6 +1234,7 @@ menu "Other"
 	source "package/libsigc/Config.in"
 	source "package/libsigsegv/Config.in"
 	source "package/libtasn1/Config.in"
+	source "package/libtommath/Config.in"
 	source "package/libtpl/Config.in"
 	source "package/libubox/Config.in"
 	source "package/libuci/Config.in"
package/libtommath/Config.in new file +7 -0
new file mode 100644
index 0000000..b2ffc72
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_LIBTOMMATH
+	bool "libtommath"
+	help
+	  LibTomMath is a free open source portable number theoretic
+	  multiple-precision integer library written entirely in C.
+
+	  http://www.libtom.net
package/libtommath/libtommath.hash new file +2 -0
new file mode 100644
index 0000000..fcf2ddc
@@ -0,0 +1,2 @@
+# Locally computed
+sha256  993a7df9ee091fca430cdde3263df57d88ef62af8103903214da49fc51bbb56c  ltm-1.0.tar.xz
package/libtommath/libtommath.mk new file +23 -0
new file mode 100644
index 0000000..463ea7b
@@ -0,0 +1,23 @@
+################################################################################
+#
+# libtommath
+#
+################################################################################
+
+LIBTOMMATH_VERSION = 1.0
+LIBTOMMATH_SITE = https://github.com/libtom/libtommath/releases/download/v$(LIBTOMMATH_VERSION)
+LIBTOMMATH_SOURCE = ltm-$(LIBTOMMATH_VERSION).tar.xz
+LIBTOMMATH_LICENSE = WTFPL
+LIBTOMMATH_LICENSE_FILES = LICENSE
+LIBTOMMATH_INSTALL_STAGING = YES
+LIBTOMMATH_INSTALL_TARGET = NO  # only static library
+
+define LIBTOMMATH_BUILD_CMDS
+	$(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) CFLAGS="-I./ $(TARGET_CFLAGS)"
+endef
+
+define LIBTOMMATH_INSTALL_STAGING_CMDS
+	$(MAKE) -C $(@D) DESTDIR="$(STAGING_DIR)" install
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.5.0
#1 lore raw

PATCH v4 2/3 libtomcrypt: new package

---
 package/Config.in                    |  1 +
 package/libtomcrypt/Config.in        | 11 +++++++++++
 package/libtomcrypt/libtomcrypt.hash |  2 ++
 package/libtomcrypt/libtomcrypt.mk   | 24 ++++++++++++++++++++++++
 4 files changed, 38 insertions(+)
 create mode 100644 package/libtomcrypt/Config.in
 create mode 100644 package/libtomcrypt/libtomcrypt.hash
 create mode 100644 package/libtomcrypt/libtomcrypt.mk
package/Config.in +1 -0
index 24dbe09..9c2d56d 100644
@@ -840,6 +840,7 @@ menu "Crypto"
 	source "package/libsodium/Config.in"
 	source "package/libssh/Config.in"
 	source "package/libssh2/Config.in"
+	source "package/libtomcrypt/Config.in"
 	source "package/libuecc/Config.in"
 	source "package/mbedtls/Config.in"
 	source "package/nettle/Config.in"
package/libtomcrypt/Config.in new file +11 -0
new file mode 100644
index 0000000..6678b30
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_LIBTOMCRYPT
+	bool "libtomcrypt"
+	select BR2_PACKAGE_LIBTOMMATH
+	help
+	  LibTomCrypt is a fairly comprehensive, modular and portable
+	  cryptographic toolkit that provides developers with a vast array
+	  of well known published block ciphers, one-way hash functions,
+	  chaining modes, pseudo-random number generators, public key
+	  cryptography and a plethora of other routines.
+
+	  http://www.libtom.net
package/libtomcrypt/libtomcrypt.hash new file +2 -0
new file mode 100644
index 0000000..562016d
@@ -0,0 +1,2 @@
+# Locally computed
+sha256  e33b47d77a495091c8703175a25c8228aff043140b2554c08a3c3cd71f79d116  crypt-1.17.tar.bz2
package/libtomcrypt/libtomcrypt.mk new file +24 -0
new file mode 100644
index 0000000..9943f00
@@ -0,0 +1,24 @@
+################################################################################
+#
+# libtomcrypt
+#
+################################################################################
+
+LIBTOMCRYPT_VERSION = 1.17
+LIBTOMCRYPT_SITE = https://github.com/libtom/libtomcrypt/releases/download/$(LIBTOMCRYPT_VERSION)
+LIBTOMCRYPT_SOURCE = crypt-$(LIBTOMCRYPT_VERSION).tar.bz2
+LIBTOMCRYPT_LICENSE = WTFPL
+LIBTOMCRYPT_LICENSE_FILES = LICENSE
+LIBTOMCRYPT_INSTALL_STAGING = YES
+LIBTOMCRYPT_INSTALL_TARGET = NO # only static library
+LIBTOMCRYPT_DEPENDENCIES = libtommath
+
+define LIBTOMCRYPT_BUILD_CMDS
+	$(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) CFLAGS="-I./src/headers $(TARGET_CFLAGS) -DLTC_SOURCE -DLTM_DESC"
+endef
+
+define LIBTOMCRYPT_INSTALL_STAGING_CMDS
+	$(MAKE) -C $(@D) DESTDIR="$(STAGING_DIR)" NODOCS=1 INSTALL_USER=$(shell id -u) INSTALL_GROUP=$(shell id -g) install
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.5.0
#2 lore raw

PATCH v4 2/3 libtomcrypt: new package

Quoted 23 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

---
 package/Config.in                    |  1 +
 package/libtomcrypt/Config.in        | 11 +++++++++++
 package/libtomcrypt/libtomcrypt.hash |  2 ++
 package/libtomcrypt/libtomcrypt.mk   | 24 ++++++++++++++++++++++++
 4 files changed, 38 insertions(+)
 create mode 100644 package/libtomcrypt/Config.in
 create mode 100644 package/libtomcrypt/libtomcrypt.hash
 create mode 100644 package/libtomcrypt/libtomcrypt.mk

+++ b/package/libtomcrypt/libtomcrypt.mk

package/libtomcrypt/libtomcrypt.mk new file +7 -0
@@ -0,0 +1,24 @@
+################################################################################
+#
+# libtomcrypt
+#
+################################################################################
+
+LIBTOMCRYPT_VERSION = 1.17

package/libtomcrypt/libtomcrypt.mk line 17

Quoted 10 lines
package/libtomcrypt/libtomcrypt.mk new file +10 -0
+LIBTOMCRYPT_SITE = https://github.com/libtom/libtomcrypt/releases/download/$(LIBTOMCRYPT_VERSION)
+LIBTOMCRYPT_SOURCE = crypt-$(LIBTOMCRYPT_VERSION).tar.bz2
+LIBTOMCRYPT_LICENSE = WTFPL
+LIBTOMCRYPT_LICENSE_FILES = LICENSE
+LIBTOMCRYPT_INSTALL_STAGING = YES
+LIBTOMCRYPT_INSTALL_TARGET = NO # only static library
+LIBTOMCRYPT_DEPENDENCIES = libtommath
+
+define LIBTOMCRYPT_BUILD_CMDS
+	$(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) CFLAGS="-I./src/headers $(TARGET_CFLAGS) -DLTC_SOURCE -DLTM_DESC"

We also need to pass -DLTC_NO_WCHAR when the toolchain doesn't have wchar support. Committed with that fixed, thanks!

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH v4 3/3 dropbear: use libtomath & libtomcrypt

In reply to Francois Perrad
---
 package/dropbear/0001-fix-linking.patch | 36 +++++++++++++++++++++++++++++++++
 package/dropbear/Config.in              |  1 +
 package/dropbear/dropbear.mk            |  2 ++
 3 files changed, 39 insertions(+)
 create mode 100644 package/dropbear/0001-fix-linking.patch
package/dropbear/0001-fix-linking.patch new file +36 -0
new file mode 100644
index 0000000..93925eb
@@ -0,0 +1,36 @@
+fix linking
+
+see https://github.com/mkj/dropbear/pull/28
+
+Signed-off-by: Francois Perrad <[email protected]>
+
+diff --git a/Makefile.in b/Makefile.in
+index d9bfdfa..0356b0f 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -16,12 +16,12 @@ endif
+ STATIC_LTC=libtomcrypt/libtomcrypt.a
+ STATIC_LTM=libtommath/libtommath.a
+ 
+-LIBTOM_LIBS=@LIBTOM_LIBS@
++LIBTOM_LIBS=-ltomcrypt -ltommath
+ 
+ ifeq (@BUNDLED_LIBTOM@, 1)
+ LIBTOM_DEPS=$(STATIC_LTC) $(STATIC_LTM) 
+ CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/
+-LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM) 
++LDFLAGS+=-L ./libtomcrypt -L ./libtommath
+ endif
+ 
+ COMMONOBJS=dbutil.o buffer.o dbhelpers.o \
+@@ -84,7 +84,7 @@ INSTALL=@INSTALL@
+ CPPFLAGS=@CPPFLAGS@
+ CFLAGS+=-I. -I$(srcdir) $(CPPFLAGS) @CFLAGS@
+ LIBS+=@LIBS@
+-LDFLAGS=@LDFLAGS@
++LDFLAGS+=@LDFLAGS@
+ 
+ EXEEXT=@EXEEXT@
+ 
+-- 
+
package/dropbear/Config.in +1 -0
index d92361f..ef4f2ad 100644
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_DROPBEAR
 	bool "dropbear"
 	select BR2_PACKAGE_ZLIB if !BR2_PACKAGE_DROPBEAR_SMALL
+	select BR2_PACKAGE_LIBTOMCRYPT
 	help
 	  A small SSH 2 server designed for small memory environments.
 
package/dropbear/dropbear.mk +2 -0
index 32e2167..fa3642c 100644
@@ -9,6 +9,8 @@ DROPBEAR_SITE = http://matt.ucc.asn.au/dropbear/releases
 DROPBEAR_SOURCE = dropbear-$(DROPBEAR_VERSION).tar.bz2
 DROPBEAR_LICENSE = MIT, BSD-2c-like, BSD-2c
 DROPBEAR_LICENSE_FILES = LICENSE
+DROPBEAR_DEPENDENCIES = libtomcrypt
+DROPBEAR_CONF_OPTS = --disable-bundled-libtom
 DROPBEAR_TARGET_BINS = dropbearkey dropbearconvert scp
 DROPBEAR_PROGRAMS = dropbear $(DROPBEAR_TARGET_BINS)
 
Signature · 1 line
2.5.0
#4 lore raw

PATCH v4 3/3 dropbear: use libtomath & libtomcrypt

Francois,

Quoted 26 lines · Francois Perrad
---
 package/dropbear/0001-fix-linking.patch | 36 +++++++++++++++++++++++++++++++++
 package/dropbear/Config.in              |  1 +
 package/dropbear/dropbear.mk            |  2 ++
 3 files changed, 39 insertions(+)
 create mode 100644 package/dropbear/0001-fix-linking.patch
package/dropbear/0001-fix-linking.patch new file +12 -0
new file mode 100644
index 0000000..93925eb
@@ -0,0 +1,36 @@
+fix linking
+
+see https://github.com/mkj/dropbear/pull/28
+
+Signed-off-by: Francois Perrad <[email protected]>
+
+diff --git a/Makefile.in b/Makefile.in
+index d9bfdfa..0356b0f 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -16,12 +16,12 @@ endif
+ STATIC_LTC=libtomcrypt/libtomcrypt.a

package/dropbear/0001-fix-linking.patch line 22

Quoted 10 lines
package/dropbear/0001-fix-linking.patch new file +10 -0
+ STATIC_LTM=libtommath/libtommath.a
+
+-LIBTOM_LIBS=@LIBTOM_LIBS@
++LIBTOM_LIBS=-ltomcrypt -ltommath
+
+ ifeq (@BUNDLED_LIBTOM@, 1)
+ LIBTOM_DEPS=$(STATIC_LTC) $(STATIC_LTM)
+ CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/
+-LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM)
++LDFLAGS+=-L ./libtomcrypt -L ./libtommath

Since you are changing the dropbear package from using the bundled library set that would match up a set of versions, do you think there will be an issue when they are broken out? ie. a bump of dropbear would also need to take into account a bump of one or both libs.

Quoted 19 lines
package/dropbear/0001-fix-linking.patch new file +14 -0
+ endif
+
+ COMMONOBJS=dbutil.o buffer.o dbhelpers.o \
+@@ -84,7 +84,7 @@ INSTALL=@INSTALL@
+ CPPFLAGS=@CPPFLAGS@
+ CFLAGS+=-I. -I$(srcdir) $(CPPFLAGS) @CFLAGS@
+ LIBS+=@LIBS@
+-LDFLAGS=@LDFLAGS@
++LDFLAGS+=@LDFLAGS@
+
+ EXEEXT=@EXEEXT@
+
+--
+
package/dropbear/Config.in +0 -0
index d92361f..ef4f2ad 100644

package/dropbear/Config.in line 4

Quoted 4 lines
package/dropbear/Config.in +1 -0
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_DROPBEAR
        bool "dropbear"
        select BR2_PACKAGE_ZLIB if !BR2_PACKAGE_DROPBEAR_SMALL
+       select BR2_PACKAGE_LIBTOMCRYPT

I'm not sure if you should also provide the select for the LIBTOMMATH so that it's clear it's a required dependency for this build. Hopefully someone else weighs in.

package/dropbear/dropbear.mk DROPBEAR_SITE = http://matt.ucc.asn.au/dropbear/releases · line 12

Quoted 12 lines
package/dropbear/Config.in +0 -0
        help
          A small SSH 2 server designed for small memory environments.
 
package/dropbear/dropbear.mk +1 -0
index 32e2167..fa3642c 100644
@@ -9,6 +9,8 @@ DROPBEAR_SITE = http://matt.ucc.asn.au/dropbear/releases
 DROPBEAR_SOURCE = dropbear-$(DROPBEAR_VERSION).tar.bz2
 DROPBEAR_LICENSE = MIT, BSD-2c-like, BSD-2c
 DROPBEAR_LICENSE_FILES = LICENSE
+DROPBEAR_DEPENDENCIES = libtomcrypt

Shouldn't this also capture the libtommath library as your patch above is explicitly linking against it?

Signature · 2 lines
Thanks,
Matt
#5 lore raw

PATCH v4 3/3 dropbear: use libtomath & libtomcrypt

In reply to Francois Perrad

Hello,

Quoted 7 lines · Francois Perrad
---
 package/dropbear/0001-fix-linking.patch | 36 +++++++++++++++++++++++++++++++++
 package/dropbear/Config.in              |  1 +
 package/dropbear/dropbear.mk            |  2 ++
 3 files changed, 39 insertions(+)
 create mode 100644 package/dropbear/0001-fix-linking.patch

Following the feedback from Peter and the discussion you had with him, I marked this patch as Rejected in patchwork.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

PATCH v4 1/3 libtommath: new package

In reply to Francois Perrad
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

I was going to apply this, but I'm now not so sure after all.

- Dropbear linked with external libtom* is 25% bigger (375K vs 300K)
- We need to patch dropbear
- Libtomcrypt and dropbear need extra fixes to build without wchar (LTC_NO_WCHAR)
- Nothing else uses libtommath/crypt, and other distributions (E.G. Debian) also use the bundled libraries.

Can you explain if there's any strong reasons to not use the bundled versions?

Signature · 1 line
Bye, Peter Korsgaard
#7 lore raw

PATCH v4 1/3 libtommath: new package

Peter,

I am also in doubt with Dropbear.
1) Dropbear is a critical component for many system.
2) Dropbear is often released (5 releases in 2015, 2015.67 to 2015.71), but the bundled libraries (libtommath & libtomcrypt) seem never updated (most of files are 9 years old, see github.com/mkj/dropbear).
3) in V1 & V2 of this serie, by default, Dropbear was built with the bundled libraries, but the BR policy is "always use unbundled library" (see review from Thomas P.)

I need libtommath & libtomcrypt as dependencies for other packages, so could you at least commit the 2 first patches ?

Fran?ois.

Note: I did some upstream works (C linting, ...) on these 3 packages, with some Pull Requests (pending or already merged).

2016-04-27 22:28 GMT+02:00 Peter Korsgaard <[email protected]>:

Quoted 23 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

I was going to apply this, but I'm now not so sure after all.

- Dropbear linked with external libtom* is 25% bigger (375K vs 300K)
- We need to patch dropbear
- Libtomcrypt and dropbear need extra fixes to build without wchar (LTC_NO_WCHAR)
- Nothing else uses libtommath/crypt, and other distributions (E.G. Debian) also use the bundled libraries.

Can you explain if there's any strong reasons to not use the bundled versions?

--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#8 lore raw

PATCH v4 1/3 libtommath: new package

Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fran?ois" == Fran?ois Perrad <[email protected]> writes:

Peter,
I am also in doubt with Dropbear.
1) Dropbear is a critical component for many system.
2) Dropbear is often released (5 releases in 2015, 2015.67 to 2015.71), but the bundled libraries (libtommath & libtomcrypt) seem never updated (most of files are 9 years old, see github.com/mkj/dropbear).
3) in V1 & V2 of this serie, by default, Dropbear was built with the bundled libraries, but the BR policy is "always use unbundled library" (see review from Thomas P.)

Quoted 2 lines

I need libtommath & libtomcrypt as dependencies for other packages, so could you at least commit the 2 first patches ?

Sure, I'll do so now.

Quoted 4 lines

Fran?ois.

Note: I did some upstream works (C linting, ...) on these 3 packages, with some Pull Requests (pending or already merged).

Yes, I saw - Thanks!

Signature · 2 lines
Venlig hilsen,
Peter Korsgaard