All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/3] php: libsodium support
@ 2019-11-08  8:21 Pascal de Bruijn
  2019-11-08  8:21 ` [Buildroot] [PATCH 2/3] libargon2: add new package Pascal de Bruijn
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Pascal de Bruijn @ 2019-11-08  8:21 UTC (permalink / raw)
  To: buildroot

---
 package/php/Config.ext | 6 ++++++
 package/php/php.mk     | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/package/php/Config.ext b/package/php/Config.ext
index c7f0332fd8..0c6ed4b401 100644
--- a/package/php/Config.ext
+++ b/package/php/Config.ext
@@ -70,6 +70,12 @@ config BR2_PACKAGE_PHP_EXT_HASH
 	help
 	  HASH message digest framework
 
+config BR2_PACKAGE_PHP_EXT_LIBSODIUM
+	bool "libsodium"
+	select BR2_PACKAGE_LIBSODIUM
+	help
+	  libsodium support
+
 config BR2_PACKAGE_PHP_EXT_MCRYPT
 	bool "mcrypt"
 	select BR2_PACKAGE_LIBMCRYPT
diff --git a/package/php/php.mk b/package/php/php.mk
index b679531238..85bf2075ae 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -122,6 +122,11 @@ PHP_CONF_OPTS += \
 	$(if $(BR2_PACKAGE_PHP_EXT_MBSTRING),--enable-mbstring) \
 	$(if $(BR2_PACKAGE_PHP_EXT_PHAR),--enable-phar)
 
+ifeq ($(BR2_PACKAGE_PHP_EXT_LIBSODIUM),y)
+PHP_CONF_OPTS += --with-sodium=$(STAGING_DIR)/usr
+PHP_DEPENDENCIES += libsodium
+endif
+
 ifeq ($(BR2_PACKAGE_PHP_EXT_MCRYPT),y)
 PHP_CONF_OPTS += --with-mcrypt=$(STAGING_DIR)/usr
 PHP_DEPENDENCIES += libmcrypt
-- 
2.17.1

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

* [Buildroot] [PATCH 2/3] libargon2: add new package
  2019-11-08  8:21 [Buildroot] [PATCH 1/3] php: libsodium support Pascal de Bruijn
@ 2019-11-08  8:21 ` Pascal de Bruijn
  2019-11-08  9:18   ` Thomas Petazzoni
  2019-11-08  8:21 ` [Buildroot] [PATCH 3/3] php: libargon2 support Pascal de Bruijn
  2019-11-08  9:10 ` [Buildroot] [PATCH 1/3] php: libsodium support Thomas Petazzoni
  2 siblings, 1 reply; 6+ messages in thread
From: Pascal de Bruijn @ 2019-11-08  8:21 UTC (permalink / raw)
  To: buildroot

---
 package/Config.in                             |  1 +
 ...argon2-dont-fail-on-existing-symlink.patch | 12 +++++++
 .../0002-libargon2-fix-cross-compile.patch    | 34 +++++++++++++++++++
 package/libargon2/Config.in                   |  6 ++++
 package/libargon2/libargon2.hash              |  3 ++
 package/libargon2/libargon2.mk                | 25 ++++++++++++++
 6 files changed, 81 insertions(+)
 create mode 100644 package/libargon2/0001-libargon2-dont-fail-on-existing-symlink.patch
 create mode 100644 package/libargon2/0002-libargon2-fix-cross-compile.patch
 create mode 100644 package/libargon2/Config.in
 create mode 100644 package/libargon2/libargon2.hash
 create mode 100644 package/libargon2/libargon2.mk

diff --git a/package/Config.in b/package/Config.in
index f72c77b416..694f985bec 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1253,6 +1253,7 @@ menu "Crypto"
 	source "package/libscrypt/Config.in"
 	source "package/libsecret/Config.in"
 	source "package/libsha1/Config.in"
+	source "package/libargon2/Config.in"
 	source "package/libsodium/Config.in"
 	source "package/libssh/Config.in"
 	source "package/libssh2/Config.in"
diff --git a/package/libargon2/0001-libargon2-dont-fail-on-existing-symlink.patch b/package/libargon2/0001-libargon2-dont-fail-on-existing-symlink.patch
new file mode 100644
index 0000000000..1a65486554
--- /dev/null
+++ b/package/libargon2/0001-libargon2-dont-fail-on-existing-symlink.patch
@@ -0,0 +1,12 @@
+diff -Nurpd a/Makefile b/Makefile
+--- a/Makefile	2017-12-27 20:56:31.000000000 +0100
++++ b/Makefile	2019-11-07 09:52:49.554284682 +0100
+@@ -176,7 +176,7 @@ install: $(RUN) libs
+ 	$(INSTALL) -d $(INST_LIBRARY)
+ 	$(INSTALL) $(LIBRARIES) $(INST_LIBRARY)
+ ifdef LINKED_LIB_SH
+-	cd $(INST_LIBRARY) && ln -s $(notdir $(LIB_SH) $(LINKED_LIB_SH))
++	cd $(INST_LIBRARY) && ln -sf $(notdir $(LIB_SH) $(LINKED_LIB_SH))
+ endif
+ 	$(INSTALL) -d $(INST_BINARY)
+ 	$(INSTALL) $(RUN) $(INST_BINARY)
diff --git a/package/libargon2/0002-libargon2-fix-cross-compile.patch b/package/libargon2/0002-libargon2-fix-cross-compile.patch
new file mode 100644
index 0000000000..b50b8ddb52
--- /dev/null
+++ b/package/libargon2/0002-libargon2-fix-cross-compile.patch
@@ -0,0 +1,34 @@
+From cd1c1d8d204e4ec4557e358013567c097cb70562 Mon Sep 17 00:00:00 2001
+From: Vika <kisik21@fireburn.ru>
+Date: Mon, 26 Aug 2019 14:05:22 +0300
+Subject: [PATCH] Fix cross-compilation on some systems
+
+Some Linux distributions (e.g. NixOS, where this issue was spotted) don't provide an unprefixed ar when cross-compiling. This PR aims to fix this.
+
+See[NixOS/nixpkgs#67490](https://github.com/NixOS/nixpkgs/pull/67490) for information on where did it start.
+---
+ Makefile | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 837e7f7..38f16fc 100644
+--- a/Makefile
++++ b/Makefile
+@@ -123,6 +123,8 @@ ifdef LINKED_LIB_EXT
+ LINKED_LIB_SH := lib$(LIB_NAME).$(LINKED_LIB_EXT)
+ endif
+ 
++# Some systems don't provide an unprefixed ar when cross-compiling.
++AR=ar
+ 
+ LIBRARIES = $(LIB_SH) $(LIB_ST)
+ HEADERS = include/argon2.h
+@@ -182,7 +184,7 @@ $(LIB_SH): 	$(SRC)
+ 		$(CC) $(CFLAGS) $(LIB_CFLAGS) $(LDFLAGS) $(SO_LDFLAGS) $^ -o $@
+ 
+ $(LIB_ST): 	$(OBJ)
+-		ar rcs $@ $^
++		$(AR) rcs $@ $^
+ 
+ .PHONY: clean
+ clean:
diff --git a/package/libargon2/Config.in b/package/libargon2/Config.in
new file mode 100644
index 0000000000..1f9a5f435f
--- /dev/null
+++ b/package/libargon2/Config.in
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_LIBARGON2
+	bool "libargon2"
+	help
+	  A modern pass hashing algorithm
+
+	  https://password-hashing.net/#argon2
diff --git a/package/libargon2/libargon2.hash b/package/libargon2/libargon2.hash
new file mode 100644
index 0000000000..43fdb5467b
--- /dev/null
+++ b/package/libargon2/libargon2.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 eaea0172c1f4ee4550d1b6c9ce01aab8d1ab66b4207776aa67991eb5872fdcd8  libargon2-20171227.tar.gz
+
diff --git a/package/libargon2/libargon2.mk b/package/libargon2/libargon2.mk
new file mode 100644
index 0000000000..204af49148
--- /dev/null
+++ b/package/libargon2/libargon2.mk
@@ -0,0 +1,25 @@
+################################################################################
+#
+# libargon2
+#
+################################################################################
+
+LIBARGON2_VERSION = 20171227		# 20190702 is not recognized by php7.3
+LIBARGON2_SITE = $(call github,P-H-C,phc-winner-argon2,$(LIBARGON2_VERSION))
+LIBARGON2_LICENSE = CC0
+LIBARGON2_LICENSE_FILES = LICENSE
+LIBARGON2_INSTALL_STAGING = YES
+
+define LIBARGON2_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) OPTTARGET=$(GCC_TARGET_ARCH)
+endef
+
+define LIBARGON2_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) DESTDIR=$(STAGING_DIR) install
+endef
+
+define LIBARGON2_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) DESTDIR=$(TARGET_DIR) install
+endef
+
+$(eval $(generic-package))
-- 
2.17.1

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

* [Buildroot] [PATCH 3/3] php: libargon2 support
  2019-11-08  8:21 [Buildroot] [PATCH 1/3] php: libsodium support Pascal de Bruijn
  2019-11-08  8:21 ` [Buildroot] [PATCH 2/3] libargon2: add new package Pascal de Bruijn
@ 2019-11-08  8:21 ` Pascal de Bruijn
  2019-11-08  9:19   ` Thomas Petazzoni
  2019-11-08  9:10 ` [Buildroot] [PATCH 1/3] php: libsodium support Thomas Petazzoni
  2 siblings, 1 reply; 6+ messages in thread
From: Pascal de Bruijn @ 2019-11-08  8:21 UTC (permalink / raw)
  To: buildroot

---
 package/php/Config.ext | 6 ++++++
 package/php/php.mk     | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/package/php/Config.ext b/package/php/Config.ext
index 0c6ed4b401..d5c723ca39 100644
--- a/package/php/Config.ext
+++ b/package/php/Config.ext
@@ -70,6 +70,12 @@ config BR2_PACKAGE_PHP_EXT_HASH
 	help
 	  HASH message digest framework
 
+config BR2_PACKAGE_PHP_EXT_LIBARGON2
+	bool "libargon2"
+	select BR2_PACKAGE_LIBARGON2
+	help
+	  libargon2 support
+
 config BR2_PACKAGE_PHP_EXT_LIBSODIUM
 	bool "libsodium"
 	select BR2_PACKAGE_LIBSODIUM
diff --git a/package/php/php.mk b/package/php/php.mk
index 85bf2075ae..007b8a64c3 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -122,6 +122,11 @@ PHP_CONF_OPTS += \
 	$(if $(BR2_PACKAGE_PHP_EXT_MBSTRING),--enable-mbstring) \
 	$(if $(BR2_PACKAGE_PHP_EXT_PHAR),--enable-phar)
 
+ifeq ($(BR2_PACKAGE_PHP_EXT_LIBARGON2),y)
+PHP_CONF_OPTS += --with-password-argon2=$(STAGING_DIR)/usr
+PHP_DEPENDENCIES += libargon2
+endif
+
 ifeq ($(BR2_PACKAGE_PHP_EXT_LIBSODIUM),y)
 PHP_CONF_OPTS += --with-sodium=$(STAGING_DIR)/usr
 PHP_DEPENDENCIES += libsodium
-- 
2.17.1

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

* [Buildroot] [PATCH 1/3] php: libsodium support
  2019-11-08  8:21 [Buildroot] [PATCH 1/3] php: libsodium support Pascal de Bruijn
  2019-11-08  8:21 ` [Buildroot] [PATCH 2/3] libargon2: add new package Pascal de Bruijn
  2019-11-08  8:21 ` [Buildroot] [PATCH 3/3] php: libargon2 support Pascal de Bruijn
@ 2019-11-08  9:10 ` Thomas Petazzoni
  2 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2019-11-08  9:10 UTC (permalink / raw)
  To: buildroot

On Fri,  8 Nov 2019 09:21:10 +0100
Pascal de Bruijn <p.debruijn@unilogic.nl> wrote:

> ---

Patch looks good, but we need your Signed-off-by line to be able to
apply the patch.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH 2/3] libargon2: add new package
  2019-11-08  8:21 ` [Buildroot] [PATCH 2/3] libargon2: add new package Pascal de Bruijn
@ 2019-11-08  9:18   ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2019-11-08  9:18 UTC (permalink / raw)
  To: buildroot

Hello Pascal,

On Fri,  8 Nov 2019 09:21:11 +0100
Pascal de Bruijn <p.debruijn@unilogic.nl> wrote:

> ---

We need your Signed-off-by.

>  package/Config.in                             |  1 +
>  ...argon2-dont-fail-on-existing-symlink.patch | 12 +++++++
>  .../0002-libargon2-fix-cross-compile.patch    | 34 +++++++++++++++++++
>  package/libargon2/Config.in                   |  6 ++++
>  package/libargon2/libargon2.hash              |  3 ++
>  package/libargon2/libargon2.mk                | 25 ++++++++++++++
>  6 files changed, 81 insertions(+)

Could you add an entry in the DEVELOPERS file for this new package ?

> diff --git a/package/libargon2/0001-libargon2-dont-fail-on-existing-symlink.patch b/package/libargon2/0001-libargon2-dont-fail-on-existing-symlink.patch
> new file mode 100644
> index 0000000000..1a65486554
> --- /dev/null
> +++ b/package/libargon2/0001-libargon2-dont-fail-on-existing-symlink.patch
> @@ -0,0 +1,12 @@
> +diff -Nurpd a/Makefile b/Makefile
> +--- a/Makefile	2017-12-27 20:56:31.000000000 +0100
> ++++ b/Makefile	2019-11-07 09:52:49.554284682 +0100
> +@@ -176,7 +176,7 @@ install: $(RUN) libs
> + 	$(INSTALL) -d $(INST_LIBRARY)
> + 	$(INSTALL) $(LIBRARIES) $(INST_LIBRARY)
> + ifdef LINKED_LIB_SH
> +-	cd $(INST_LIBRARY) && ln -s $(notdir $(LIB_SH) $(LINKED_LIB_SH))
> ++	cd $(INST_LIBRARY) && ln -sf $(notdir $(LIB_SH) $(LINKED_LIB_SH))
> + endif
> + 	$(INSTALL) -d $(INST_BINARY)
> + 	$(INSTALL) $(RUN) $(INST_BINARY)

Since the project is maintained with Git, please use patches generated
with "git format-patch", with a proper commit log and Signed-off-by.

Also, make sure to submit this patch to the upstream project.

> diff --git a/package/libargon2/0002-libargon2-fix-cross-compile.patch b/package/libargon2/0002-libargon2-fix-cross-compile.patch
> new file mode 100644
> index 0000000000..b50b8ddb52
> --- /dev/null
> +++ b/package/libargon2/0002-libargon2-fix-cross-compile.patch
> @@ -0,0 +1,34 @@
> +From cd1c1d8d204e4ec4557e358013567c097cb70562 Mon Sep 17 00:00:00 2001
> +From: Vika <kisik21@fireburn.ru>
> +Date: Mon, 26 Aug 2019 14:05:22 +0300
> +Subject: [PATCH] Fix cross-compilation on some systems
> +
> +Some Linux distributions (e.g. NixOS, where this issue was spotted) don't provide an unprefixed ar when cross-compiling. This PR aims to fix this.
> +
> +See[NixOS/nixpkgs#67490](https://github.com/NixOS/nixpkgs/pull/67490) for information on where did it start.

Please add your Signed-off-by here.

> +---
> + Makefile | 4 +++-
> + 1 file changed, 3 insertions(+), 1 deletion(-)
> +
> +diff --git a/Makefile b/Makefile
> +index 837e7f7..38f16fc 100644
> +--- a/Makefile
> ++++ b/Makefile
> +@@ -123,6 +123,8 @@ ifdef LINKED_LIB_EXT
> + LINKED_LIB_SH := lib$(LIB_NAME).$(LINKED_LIB_EXT)
> + endif
> + 
> ++# Some systems don't provide an unprefixed ar when cross-compiling.
> ++AR=ar
> + 
> + LIBRARIES = $(LIB_SH) $(LIB_ST)
> + HEADERS = include/argon2.h
> +@@ -182,7 +184,7 @@ $(LIB_SH): 	$(SRC)
> + 		$(CC) $(CFLAGS) $(LIB_CFLAGS) $(LDFLAGS) $(SO_LDFLAGS) $^ -o $@
> + 
> + $(LIB_ST): 	$(OBJ)
> +-		ar rcs $@ $^
> ++		$(AR) rcs $@ $^
> + 
> + .PHONY: clean
> + clean:
> diff --git a/package/libargon2/Config.in b/package/libargon2/Config.in
> new file mode 100644
> index 0000000000..1f9a5f435f
> --- /dev/null
> +++ b/package/libargon2/Config.in
> @@ -0,0 +1,6 @@
> +config BR2_PACKAGE_LIBARGON2
> +	bool "libargon2"

No dependencies on toolchain features? Could you test this package with
./utils/test-pkg, just to make sure it builds in most configurations ?

> +	help
> +	  A modern pass hashing algorithm
> +
> +	  https://password-hashing.net/#argon2
> diff --git a/package/libargon2/libargon2.hash b/package/libargon2/libargon2.hash
> new file mode 100644
> index 0000000000..43fdb5467b
> --- /dev/null
> +++ b/package/libargon2/libargon2.hash
> @@ -0,0 +1,3 @@
> +# Locally calculated
> +sha256 eaea0172c1f4ee4550d1b6c9ce01aab8d1ab66b4207776aa67991eb5872fdcd8  libargon2-20171227.tar.gz

Please add a hash for the license file.

> +
> diff --git a/package/libargon2/libargon2.mk b/package/libargon2/libargon2.mk
> new file mode 100644
> index 0000000000..204af49148
> --- /dev/null
> +++ b/package/libargon2/libargon2.mk
> @@ -0,0 +1,25 @@
> +################################################################################
> +#
> +# libargon2
> +#
> +################################################################################
> +
> +LIBARGON2_VERSION = 20171227		# 20190702 is not recognized by php7.3
> +LIBARGON2_SITE = $(call github,P-H-C,phc-winner-argon2,$(LIBARGON2_VERSION))
> +LIBARGON2_LICENSE = CC0
> +LIBARGON2_LICENSE_FILES = LICENSE
> +LIBARGON2_INSTALL_STAGING = YES
> +
> +define LIBARGON2_BUILD_CMDS
> +	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) OPTTARGET=$(GCC_TARGET_ARCH)

Could you give some details about the values expected for OPTTARGET ?
Indeed, GCC_TARGET_ARCH only has a value on MIPS, NDS32, x86 and
RISC-V. On all other architectures, it is empty as far as I can see. So
I am really not sure GCC_TARGET_ARCH is what you want here.

> +define LIBARGON2_INSTALL_STAGING_CMDS
> +	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) DESTDIR=$(STAGING_DIR) install
> +endef
> +
> +define LIBARGON2_INSTALL_TARGET_CMDS
> +	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) DESTDIR=$(TARGET_DIR) install
> +endef

In all these commands, I suppose you have used $(MAKE1) because you
faced some parallel build issues with this package ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH 3/3] php: libargon2 support
  2019-11-08  8:21 ` [Buildroot] [PATCH 3/3] php: libargon2 support Pascal de Bruijn
@ 2019-11-08  9:19   ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2019-11-08  9:19 UTC (permalink / raw)
  To: buildroot

On Fri,  8 Nov 2019 09:21:12 +0100
Pascal de Bruijn <p.debruijn@unilogic.nl> wrote:

> ---

Looks good, but we will need your Signed-off-by in the commit log as
well.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2019-11-08  9:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-08  8:21 [Buildroot] [PATCH 1/3] php: libsodium support Pascal de Bruijn
2019-11-08  8:21 ` [Buildroot] [PATCH 2/3] libargon2: add new package Pascal de Bruijn
2019-11-08  9:18   ` Thomas Petazzoni
2019-11-08  8:21 ` [Buildroot] [PATCH 3/3] php: libargon2 support Pascal de Bruijn
2019-11-08  9:19   ` Thomas Petazzoni
2019-11-08  9:10 ` [Buildroot] [PATCH 1/3] php: libsodium support 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.