Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
@ 2020-07-19 21:46 q66
  2020-07-19 22:19 ` [PR PATCH] [Updated] " q66
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: q66 @ 2020-07-19 21:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1612 bytes --]

There is a new pull request by q66 against master on the void-packages repository

https://github.com/void-ppc/void-packages lssl-asm
https://github.com/void-linux/void-packages/pull/23655

[RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
This yields significant speedups (20x) in some things (AES/ghash) on platforms with hardware crypto support (e.g. POWER8 and newer, and most aarch64) as well as enhances performance of assorted alogrithms by using optimized assembly implementations instead of portable fallbacks. E.g. on aarch64 https://gist.githubusercontent.com/q66/c75a46fc7d0c27eff21cc9d70639bf95/raw/dde1f60e304ef8f4a4049d41388d9c25e63b4a1e/gistfile1.txt

As it is now, libressl only supports asm for x86(_64) and to a limited degree, 32-bit ARM. The extra support was added by my project: https://github.com/q66/libressl-portable-asm

Everything was tested, test suite passes on all platforms, and benchmarks were run on relevant hardware, confirming the speedups.

I still think we should move back to OpenSSL, since there are many reasons to do so (even disregarding performance) and the performance is still better on it (as there are various algos that don't have optimized implementations under libressl at all) but this could be a decent stopgap solution, enabling at least basic things (like hardware AES on non-x86 systems).

More testing (mainly benchmarking, test suite is known to pass universally) on armv7 and aarch64 is still pending.

@void-linux/pkg-committers

A patch file from https://github.com/void-linux/void-packages/pull/23655.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-lssl-asm-23655.patch --]
[-- Type: text/x-diff, Size: 3141 bytes --]

From ca3fce7483c7788e5f1005386152c9404166a280 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sun, 19 Jul 2020 20:24:23 +0200
Subject: [PATCH] libressl: add assembly for aarch64, ppc*, extra assembly for
 arm

This yields significant speedups (20x) on platforms with hardware
crypto support (e.g. POWER8 and newer, and most aarch64) as well
as enhances performance of assorted alogrithms by using optimized
assembly implementations instead of portable fallbacks.

As it is now, libressl only supports asm for x86(_64) and to a
limited degree, 32-bit ARM.

Everything was tested, test suite passes on all platforms, and
benchmarks were run on relevant hardware, confirming the speedups.
---
 srcpkgs/libressl/template | 54 +++++++++++++++++++++++++++++++--------
 1 file changed, 43 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libressl/template b/srcpkgs/libressl/template
index f8a201c19b5..4ac72d4e626 100644
--- a/srcpkgs/libressl/template
+++ b/srcpkgs/libressl/template
@@ -1,9 +1,10 @@
 # Template file for 'libressl'
 pkgname=libressl
 version=3.1.3
-revision=1
+revision=2
 bootstrap=yes
 build_style=gnu-configure
+configure_args="$(vopt_enable asm)"
 short_desc="Version of the TLS/crypto stack forked from OpenSSL"
 maintainer="Juan RP <xtraeme@gmail.com>"
 license="OpenSSL-License, SSLeay-License, ISC"
@@ -14,21 +15,52 @@ checksum=c76b0316acf612ecb62f5cb014a20d972a663bd9e40abf952a86f3b998b69fa0
 provides="openssl-${version}_${revision}"
 replaces="openssl>=0"
 conf_files="/etc/ssl/openssl.cnf /etc/ssl/x509v3.cnf"
+_lssl_asm_ver="1.0-rc1"
 
-if [ "$XBPS_TARGET_MACHINE" = "i686-musl" ]; then
-	# XXX disable SSP
-	configure_args+=" --disable-hardening"
-elif [ "$XBPS_TARGET_MACHINE" = "armv5tel" ]; then
-	configure_args+=" --disable-asm"
+build_options="asm"
+desc_option_asm="Use platform assembly for faster crypto"
+
+if [ "$build_option_asm" ]; then
+	distfiles+=" https://github.com/q66/libressl-portable-asm/archive/v${_lssl_asm_ver}.tar.gz"
+	checksum+=" f86cc77319835344222f13c223e5cdae882bf2509f64be1762f3b35dda49b572"
 fi
 
-if [ "$CROSS_BUILD" ]; then
-	hostmakedepends="automake libtool"
-	pre_configure() {
-		autoreconf -fi
-	}
+# only enable asm for full chroots by default
+# otherwise we'd be introducing an autotools dependency on the host
+if [ "$CHROOT_READY" ]; then
+	build_options_default="asm"
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	# disable ssp
+	i686-musl) configure_args+=" --disable-hardening";;
+	# on armv5 always disable asm as it's not supported
+	armv5*) configure_args+=" --disable-asm";;
+esac
+
+if [ "$CROSS_BUILD" -o "$build_option_asm" ]; then
+	_regen_build=yes
 fi
 
+if [ -n "$_regen_build" ]; then
+	hostmakedepends=" automake libtool"
+fi
+
+post_extract() {
+	[ -z "$build_option_asm" ] && return 0
+	mv ../libressl-portable-asm-${_lssl_asm_ver} .
+}
+
+pre_configure() {
+	[ -z "$_regen_build" ] && return 0
+	if [ "$build_option_asm" ]; then
+		cd libressl-portable-asm-${_lssl_asm_ver}
+		./patch_libressl.sh ..
+		cd ..
+	fi
+	autoreconf -if
+}
+
 post_install() {
 	# Use CA file from ca-certificates instead.
 	rm -f ${DESTDIR}/etc/ssl/cert.pem

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

* Re: [PR PATCH] [Updated] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
  2020-07-19 21:46 [PR PATCH] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm q66
@ 2020-07-19 22:19 ` q66
  2020-07-19 22:22 ` q66
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: q66 @ 2020-07-19 22:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]

There is an updated pull request by q66 against master on the void-packages repository

https://github.com/void-ppc/void-packages lssl-asm
https://github.com/void-linux/void-packages/pull/23655

[RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
This yields significant speedups (20x) in some things (AES/ghash) on platforms with hardware crypto support (e.g. POWER8 and newer, and most aarch64) as well as enhances performance of assorted alogrithms by using optimized assembly implementations instead of portable fallbacks. E.g. on aarch64 https://gist.githubusercontent.com/q66/c75a46fc7d0c27eff21cc9d70639bf95/raw/dde1f60e304ef8f4a4049d41388d9c25e63b4a1e/gistfile1.txt

As it is now, libressl only supports asm for x86(_64) and to a limited degree, 32-bit ARM. The extra support was added by my project: https://github.com/q66/libressl-portable-asm

Everything was tested, test suite passes on all platforms, and benchmarks were run on relevant hardware, confirming the speedups.

I still think we should move back to OpenSSL, since there are many reasons to do so (even disregarding performance) and the performance is still better on it (as there are various algos that don't have optimized implementations under libressl at all) but this could be a decent stopgap solution, enabling at least basic things (like hardware AES on non-x86 systems).

More testing (mainly benchmarking, test suite is known to pass universally) on armv7 and aarch64 is still pending.

@void-linux/pkg-committers

A patch file from https://github.com/void-linux/void-packages/pull/23655.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-lssl-asm-23655.patch --]
[-- Type: text/x-diff, Size: 3141 bytes --]

From 5583ea99bd7e1b0c6a7de44a38124868fee1fa89 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sun, 19 Jul 2020 20:24:23 +0200
Subject: [PATCH] libressl: add assembly for aarch64, ppc*, extra assembly for
 arm

This yields significant speedups (20x) on platforms with hardware
crypto support (e.g. POWER8 and newer, and most aarch64) as well
as enhances performance of assorted alogrithms by using optimized
assembly implementations instead of portable fallbacks.

As it is now, libressl only supports asm for x86(_64) and to a
limited degree, 32-bit ARM.

Everything was tested, test suite passes on all platforms, and
benchmarks were run on relevant hardware, confirming the speedups.
---
 srcpkgs/libressl/template | 54 +++++++++++++++++++++++++++++++--------
 1 file changed, 43 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libressl/template b/srcpkgs/libressl/template
index f8a201c19b5..3d62d958ecd 100644
--- a/srcpkgs/libressl/template
+++ b/srcpkgs/libressl/template
@@ -1,9 +1,10 @@
 # Template file for 'libressl'
 pkgname=libressl
 version=3.1.3
-revision=1
+revision=2
 bootstrap=yes
 build_style=gnu-configure
+configure_args="$(vopt_enable asm)"
 short_desc="Version of the TLS/crypto stack forked from OpenSSL"
 maintainer="Juan RP <xtraeme@gmail.com>"
 license="OpenSSL-License, SSLeay-License, ISC"
@@ -14,21 +15,52 @@ checksum=c76b0316acf612ecb62f5cb014a20d972a663bd9e40abf952a86f3b998b69fa0
 provides="openssl-${version}_${revision}"
 replaces="openssl>=0"
 conf_files="/etc/ssl/openssl.cnf /etc/ssl/x509v3.cnf"
+_lssl_asm_ver="1.0-rc2"
 
-if [ "$XBPS_TARGET_MACHINE" = "i686-musl" ]; then
-	# XXX disable SSP
-	configure_args+=" --disable-hardening"
-elif [ "$XBPS_TARGET_MACHINE" = "armv5tel" ]; then
-	configure_args+=" --disable-asm"
+build_options="asm"
+desc_option_asm="Use platform assembly for faster crypto"
+
+if [ "$build_option_asm" ]; then
+	distfiles+=" https://github.com/q66/libressl-portable-asm/archive/v${_lssl_asm_ver}.tar.gz"
+	checksum+=" 9b966581b0e0c063f9829458c6740274cc48cafb9074e8211505221c5096dc8f"
 fi
 
-if [ "$CROSS_BUILD" ]; then
-	hostmakedepends="automake libtool"
-	pre_configure() {
-		autoreconf -fi
-	}
+# only enable asm for full chroots by default
+# otherwise we'd be introducing an autotools dependency on the host
+if [ "$CHROOT_READY" ]; then
+	build_options_default="asm"
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	# disable ssp
+	i686-musl) configure_args+=" --disable-hardening";;
+	# on armv5 always disable asm as it's not supported
+	armv5*) configure_args+=" --disable-asm";;
+esac
+
+if [ "$CROSS_BUILD" -o "$build_option_asm" ]; then
+	_regen_build=yes
 fi
 
+if [ -n "$_regen_build" ]; then
+	hostmakedepends=" automake libtool"
+fi
+
+post_extract() {
+	[ -z "$build_option_asm" ] && return 0
+	mv ../libressl-portable-asm-${_lssl_asm_ver} .
+}
+
+pre_configure() {
+	[ -z "$_regen_build" ] && return 0
+	if [ "$build_option_asm" ]; then
+		cd libressl-portable-asm-${_lssl_asm_ver}
+		./patch_libressl.sh ..
+		cd ..
+	fi
+	autoreconf -if
+}
+
 post_install() {
 	# Use CA file from ca-certificates instead.
 	rm -f ${DESTDIR}/etc/ssl/cert.pem

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

* Re: [PR PATCH] [Updated] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
  2020-07-19 21:46 [PR PATCH] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm q66
  2020-07-19 22:19 ` [PR PATCH] [Updated] " q66
@ 2020-07-19 22:22 ` q66
  2020-07-19 23:29 ` q66
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: q66 @ 2020-07-19 22:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]

There is an updated pull request by q66 against master on the void-packages repository

https://github.com/void-ppc/void-packages lssl-asm
https://github.com/void-linux/void-packages/pull/23655

[RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
This yields significant speedups (20x) in some things (AES/ghash) on platforms with hardware crypto support (e.g. POWER8 and newer, and most aarch64) as well as enhances performance of assorted alogrithms by using optimized assembly implementations instead of portable fallbacks. E.g. on aarch64 https://gist.githubusercontent.com/q66/c75a46fc7d0c27eff21cc9d70639bf95/raw/dde1f60e304ef8f4a4049d41388d9c25e63b4a1e/gistfile1.txt

As it is now, libressl only supports asm for x86(_64) and to a limited degree, 32-bit ARM. The extra support was added by my project: https://github.com/q66/libressl-portable-asm

Everything was tested, test suite passes on all platforms, and benchmarks were run on relevant hardware, confirming the speedups.

I still think we should move back to OpenSSL, since there are many reasons to do so (even disregarding performance) and the performance is still better on it (as there are various algos that don't have optimized implementations under libressl at all) but this could be a decent stopgap solution, enabling at least basic things (like hardware AES on non-x86 systems).

More testing (mainly benchmarking, test suite is known to pass universally) on armv7 and aarch64 is still pending.

@void-linux/pkg-committers

A patch file from https://github.com/void-linux/void-packages/pull/23655.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-lssl-asm-23655.patch --]
[-- Type: text/x-diff, Size: 3381 bytes --]

From 41e6e8689b4b68ebe10163c2608230eb84a77f2e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sun, 19 Jul 2020 20:24:23 +0200
Subject: [PATCH] libressl: add assembly for aarch64, ppc*, extra assembly for
 arm

This yields significant speedups (20x) on platforms with hardware
crypto support (e.g. POWER8 and newer, and most aarch64) as well
as enhances performance of assorted alogrithms by using optimized
assembly implementations instead of portable fallbacks.

As it is now, libressl only supports asm for x86(_64) and to a
limited degree, 32-bit ARM.

Everything was tested, test suite passes on all platforms, and
benchmarks were run on relevant hardware, confirming the speedups.
---
 srcpkgs/libressl/template | 56 ++++++++++++++++++++++++++++++---------
 1 file changed, 44 insertions(+), 12 deletions(-)

diff --git a/srcpkgs/libressl/template b/srcpkgs/libressl/template
index f8a201c19b5..2c354f36f1c 100644
--- a/srcpkgs/libressl/template
+++ b/srcpkgs/libressl/template
@@ -1,12 +1,13 @@
 # Template file for 'libressl'
 pkgname=libressl
 version=3.1.3
-revision=1
+revision=2
 bootstrap=yes
 build_style=gnu-configure
+configure_args="$(vopt_enable asm)"
 short_desc="Version of the TLS/crypto stack forked from OpenSSL"
 maintainer="Juan RP <xtraeme@gmail.com>"
-license="OpenSSL-License, SSLeay-License, ISC"
+license="OpenSSL, ISC"
 #changelog="https://raw.githubusercontent.com/libressl-portable/portable/master/ChangeLog"
 homepage="http://www.libressl.org/"
 distfiles="http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/${pkgname}-${version}.tar.gz"
@@ -14,21 +15,52 @@ checksum=c76b0316acf612ecb62f5cb014a20d972a663bd9e40abf952a86f3b998b69fa0
 provides="openssl-${version}_${revision}"
 replaces="openssl>=0"
 conf_files="/etc/ssl/openssl.cnf /etc/ssl/x509v3.cnf"
+_lssl_asm_ver="1.0-rc2"
 
-if [ "$XBPS_TARGET_MACHINE" = "i686-musl" ]; then
-	# XXX disable SSP
-	configure_args+=" --disable-hardening"
-elif [ "$XBPS_TARGET_MACHINE" = "armv5tel" ]; then
-	configure_args+=" --disable-asm"
+build_options="asm"
+desc_option_asm="Use platform assembly for faster crypto"
+
+if [ "$build_option_asm" ]; then
+	distfiles+=" https://github.com/q66/libressl-portable-asm/archive/v${_lssl_asm_ver}.tar.gz"
+	checksum+=" 9b966581b0e0c063f9829458c6740274cc48cafb9074e8211505221c5096dc8f"
 fi
 
-if [ "$CROSS_BUILD" ]; then
-	hostmakedepends="automake libtool"
-	pre_configure() {
-		autoreconf -fi
-	}
+# only enable asm for full chroots by default
+# otherwise we'd be introducing an autotools dependency on the host
+if [ "$CHROOT_READY" ]; then
+	build_options_default="asm"
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	# disable ssp
+	i686-musl) configure_args+=" --disable-hardening";;
+	# on armv5 always disable asm as it's not supported
+	armv5*) configure_args+=" --disable-asm";;
+esac
+
+if [ "$CROSS_BUILD" -o "$build_option_asm" ]; then
+	_regen_build=yes
 fi
 
+if [ -n "$_regen_build" ]; then
+	hostmakedepends=" automake libtool"
+fi
+
+post_extract() {
+	[ -z "$build_option_asm" ] && return 0
+	mv ../libressl-portable-asm-${_lssl_asm_ver} .
+}
+
+pre_configure() {
+	[ -z "$_regen_build" ] && return 0
+	if [ "$build_option_asm" ]; then
+		cd libressl-portable-asm-${_lssl_asm_ver}
+		./patch_libressl.sh ..
+		cd ..
+	fi
+	autoreconf -if
+}
+
 post_install() {
 	# Use CA file from ca-certificates instead.
 	rm -f ${DESTDIR}/etc/ssl/cert.pem

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

* Re: [PR PATCH] [Updated] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
  2020-07-19 21:46 [PR PATCH] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm q66
  2020-07-19 22:19 ` [PR PATCH] [Updated] " q66
  2020-07-19 22:22 ` q66
@ 2020-07-19 23:29 ` q66
  2020-07-20  0:03 ` ahesford
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: q66 @ 2020-07-19 23:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]

There is an updated pull request by q66 against master on the void-packages repository

https://github.com/void-ppc/void-packages lssl-asm
https://github.com/void-linux/void-packages/pull/23655

[RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
This yields significant speedups (20x) in some things (AES/ghash) on platforms with hardware crypto support (e.g. POWER8 and newer, and most aarch64) as well as enhances performance of assorted alogrithms by using optimized assembly implementations instead of portable fallbacks. E.g. on aarch64 https://gist.githubusercontent.com/q66/c75a46fc7d0c27eff21cc9d70639bf95/raw/dde1f60e304ef8f4a4049d41388d9c25e63b4a1e/gistfile1.txt

As it is now, libressl only supports asm for x86(_64) and to a limited degree, 32-bit ARM. The extra support was added by my project: https://github.com/q66/libressl-portable-asm

Everything was tested, test suite passes on all platforms, and benchmarks were run on relevant hardware, confirming the speedups.

I still think we should move back to OpenSSL, since there are many reasons to do so (even disregarding performance) and the performance is still better on it (as there are various algos that don't have optimized implementations under libressl at all) but this could be a decent stopgap solution, enabling at least basic things (like hardware AES on non-x86 systems).

More testing (mainly benchmarking, test suite is known to pass universally) on armv7 and aarch64 is still pending.

@void-linux/pkg-committers

A patch file from https://github.com/void-linux/void-packages/pull/23655.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-lssl-asm-23655.patch --]
[-- Type: text/x-diff, Size: 3365 bytes --]

From 4758ad61387adec98594a58176ddcf0582e62e12 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sun, 19 Jul 2020 20:24:23 +0200
Subject: [PATCH] libressl: add assembly for aarch64, ppc*, extra assembly for
 arm

This yields significant speedups (20x) on platforms with hardware
crypto support (e.g. POWER8 and newer, and most aarch64) as well
as enhances performance of assorted alogrithms by using optimized
assembly implementations instead of portable fallbacks.

As it is now, libressl only supports asm for x86(_64) and to a
limited degree, 32-bit ARM.

Everything was tested, test suite passes on all platforms, and
benchmarks were run on relevant hardware, confirming the speedups.
---
 srcpkgs/libressl/template | 54 ++++++++++++++++++++++++++++++---------
 1 file changed, 42 insertions(+), 12 deletions(-)

diff --git a/srcpkgs/libressl/template b/srcpkgs/libressl/template
index f8a201c19b5..75285492cd9 100644
--- a/srcpkgs/libressl/template
+++ b/srcpkgs/libressl/template
@@ -1,12 +1,13 @@
 # Template file for 'libressl'
 pkgname=libressl
 version=3.1.3
-revision=1
+revision=2
 bootstrap=yes
 build_style=gnu-configure
+configure_args="$(vopt_enable asm)"
 short_desc="Version of the TLS/crypto stack forked from OpenSSL"
 maintainer="Juan RP <xtraeme@gmail.com>"
-license="OpenSSL-License, SSLeay-License, ISC"
+license="OpenSSL, ISC"
 #changelog="https://raw.githubusercontent.com/libressl-portable/portable/master/ChangeLog"
 homepage="http://www.libressl.org/"
 distfiles="http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/${pkgname}-${version}.tar.gz"
@@ -14,21 +15,50 @@ checksum=c76b0316acf612ecb62f5cb014a20d972a663bd9e40abf952a86f3b998b69fa0
 provides="openssl-${version}_${revision}"
 replaces="openssl>=0"
 conf_files="/etc/ssl/openssl.cnf /etc/ssl/x509v3.cnf"
+_lssl_asm_ver="1.0-rc3"
 
-if [ "$XBPS_TARGET_MACHINE" = "i686-musl" ]; then
-	# XXX disable SSP
-	configure_args+=" --disable-hardening"
-elif [ "$XBPS_TARGET_MACHINE" = "armv5tel" ]; then
-	configure_args+=" --disable-asm"
+build_options="asm"
+desc_option_asm="Use platform assembly for faster crypto"
+
+if [ "$build_option_asm" ]; then
+	distfiles+=" https://github.com/q66/libressl-portable-asm/archive/v${_lssl_asm_ver}.tar.gz"
+	checksum+=" 401571e6d003bbb1c535d8c7cc4b2c92234512c585d755516c74f6b3a311be47"
 fi
 
-if [ "$CROSS_BUILD" ]; then
-	hostmakedepends="automake libtool"
-	pre_configure() {
-		autoreconf -fi
-	}
+# only enable asm for full chroots by default
+# otherwise we'd be introducing an autotools dependency on the host
+if [ "$CHROOT_READY" ]; then
+	build_options_default="asm"
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	# disable ssp
+	i686-musl) configure_args+=" --disable-hardening";;
+	# on armv5 always disable asm as it's not supported
+	armv5*) configure_args+=" --disable-asm";;
+esac
+
+if [ "$CROSS_BUILD" -o "$build_option_asm" ]; then
+	_regen_build=yes
 fi
 
+if [ -n "$_regen_build" ]; then
+	hostmakedepends=" automake libtool"
+fi
+
+post_extract() {
+	[ -z "$build_option_asm" ] && return 0
+	mv ../libressl-portable-asm-${_lssl_asm_ver} .
+}
+
+pre_configure() {
+	[ -z "$_regen_build" ] && return 0
+	if [ "$build_option_asm" ]; then
+		./libressl-portable-asm-${_lssl_asm_ver}/patch_libressl.sh .
+	fi
+	autoreconf -if
+}
+
 post_install() {
 	# Use CA file from ca-certificates instead.
 	rm -f ${DESTDIR}/etc/ssl/cert.pem

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

* Re: [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
  2020-07-19 21:46 [PR PATCH] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm q66
                   ` (2 preceding siblings ...)
  2020-07-19 23:29 ` q66
@ 2020-07-20  0:03 ` ahesford
  2020-07-23 15:49 ` [PR PATCH] [Updated] " q66
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ahesford @ 2020-07-20  0:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/23655#issuecomment-660731250

Comment:
I have no opinion on the switch to OpenSSL, but reducing the cost to deferring that decision is an attractive option.

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

* Re: [PR PATCH] [Updated] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
  2020-07-19 21:46 [PR PATCH] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm q66
                   ` (3 preceding siblings ...)
  2020-07-20  0:03 ` ahesford
@ 2020-07-23 15:49 ` q66
  2020-07-23 21:38 ` q66
  2020-07-24  1:52 ` [PR PATCH] [Merged]: " q66
  6 siblings, 0 replies; 8+ messages in thread
From: q66 @ 2020-07-23 15:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1621 bytes --]

There is an updated pull request by q66 against master on the void-packages repository

https://github.com/void-ppc/void-packages lssl-asm
https://github.com/void-linux/void-packages/pull/23655

[RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
This yields significant speedups (20x) in some things (AES/ghash) on platforms with hardware crypto support (e.g. POWER8 and newer, and most aarch64) as well as enhances performance of assorted alogrithms by using optimized assembly implementations instead of portable fallbacks. E.g. on aarch64 https://gist.githubusercontent.com/q66/c75a46fc7d0c27eff21cc9d70639bf95/raw/dde1f60e304ef8f4a4049d41388d9c25e63b4a1e/gistfile1.txt

As it is now, libressl only supports asm for x86(_64) and to a limited degree, 32-bit ARM. The extra support was added by my project: https://github.com/q66/libressl-portable-asm

Everything was tested, test suite passes on all platforms, and benchmarks were run on relevant hardware, confirming the speedups.

I still think we should move back to OpenSSL, since there are many reasons to do so (even disregarding performance) and the performance is still better on it (as there are various algos that don't have optimized implementations under libressl at all) but this could be a decent stopgap solution, enabling at least basic things (like hardware AES on non-x86 systems).

More testing (mainly benchmarking, test suite is known to pass universally) on ~~armv7 and~~ aarch64 is still pending.

@void-linux/pkg-committers

A patch file from https://github.com/void-linux/void-packages/pull/23655.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-lssl-asm-23655.patch --]
[-- Type: text/x-diff, Size: 3365 bytes --]

From 23b74f29c3e4d3c624b3778f1a952b9bf1324c09 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sun, 19 Jul 2020 20:24:23 +0200
Subject: [PATCH] libressl: add assembly for aarch64, ppc*, extra assembly for
 arm

This yields significant speedups (20x) on platforms with hardware
crypto support (e.g. POWER8 and newer, and most aarch64) as well
as enhances performance of assorted alogrithms by using optimized
assembly implementations instead of portable fallbacks.

As it is now, libressl only supports asm for x86(_64) and to a
limited degree, 32-bit ARM.

Everything was tested, test suite passes on all platforms, and
benchmarks were run on relevant hardware, confirming the speedups.
---
 srcpkgs/libressl/template | 54 ++++++++++++++++++++++++++++++---------
 1 file changed, 42 insertions(+), 12 deletions(-)

diff --git a/srcpkgs/libressl/template b/srcpkgs/libressl/template
index f8a201c19b5..3273af7583d 100644
--- a/srcpkgs/libressl/template
+++ b/srcpkgs/libressl/template
@@ -1,12 +1,13 @@
 # Template file for 'libressl'
 pkgname=libressl
 version=3.1.3
-revision=1
+revision=2
 bootstrap=yes
 build_style=gnu-configure
+configure_args="$(vopt_enable asm)"
 short_desc="Version of the TLS/crypto stack forked from OpenSSL"
 maintainer="Juan RP <xtraeme@gmail.com>"
-license="OpenSSL-License, SSLeay-License, ISC"
+license="OpenSSL, ISC"
 #changelog="https://raw.githubusercontent.com/libressl-portable/portable/master/ChangeLog"
 homepage="http://www.libressl.org/"
 distfiles="http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/${pkgname}-${version}.tar.gz"
@@ -14,21 +15,50 @@ checksum=c76b0316acf612ecb62f5cb014a20d972a663bd9e40abf952a86f3b998b69fa0
 provides="openssl-${version}_${revision}"
 replaces="openssl>=0"
 conf_files="/etc/ssl/openssl.cnf /etc/ssl/x509v3.cnf"
+_lssl_asm_ver="1.0-rc4"
 
-if [ "$XBPS_TARGET_MACHINE" = "i686-musl" ]; then
-	# XXX disable SSP
-	configure_args+=" --disable-hardening"
-elif [ "$XBPS_TARGET_MACHINE" = "armv5tel" ]; then
-	configure_args+=" --disable-asm"
+build_options="asm"
+desc_option_asm="Use platform assembly for faster crypto"
+
+if [ "$build_option_asm" ]; then
+	distfiles+=" https://github.com/q66/libressl-portable-asm/archive/v${_lssl_asm_ver}.tar.gz"
+	checksum+=" d9c62288d8a7bd6435f5abec4c2ef86554f1d4cb57404a5593036a0aee37672e"
 fi
 
-if [ "$CROSS_BUILD" ]; then
-	hostmakedepends="automake libtool"
-	pre_configure() {
-		autoreconf -fi
-	}
+# only enable asm for full chroots by default
+# otherwise we'd be introducing an autotools dependency on the host
+if [ "$CHROOT_READY" ]; then
+	build_options_default="asm"
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	# disable ssp
+	i686-musl) configure_args+=" --disable-hardening";;
+	# on armv5 always disable asm as it's not supported
+	armv5*) configure_args+=" --disable-asm";;
+esac
+
+if [ "$CROSS_BUILD" -o "$build_option_asm" ]; then
+	_regen_build=yes
 fi
 
+if [ -n "$_regen_build" ]; then
+	hostmakedepends=" automake libtool"
+fi
+
+post_extract() {
+	[ -z "$build_option_asm" ] && return 0
+	mv ../libressl-portable-asm-${_lssl_asm_ver} .
+}
+
+pre_configure() {
+	[ -z "$_regen_build" ] && return 0
+	if [ "$build_option_asm" ]; then
+		./libressl-portable-asm-${_lssl_asm_ver}/patch_libressl.sh .
+	fi
+	autoreconf -if
+}
+
 post_install() {
 	# Use CA file from ca-certificates instead.
 	rm -f ${DESTDIR}/etc/ssl/cert.pem

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

* Re: [PR PATCH] [Updated] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
  2020-07-19 21:46 [PR PATCH] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm q66
                   ` (4 preceding siblings ...)
  2020-07-23 15:49 ` [PR PATCH] [Updated] " q66
@ 2020-07-23 21:38 ` q66
  2020-07-24  1:52 ` [PR PATCH] [Merged]: " q66
  6 siblings, 0 replies; 8+ messages in thread
From: q66 @ 2020-07-23 21:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1666 bytes --]

There is an updated pull request by q66 against master on the void-packages repository

https://github.com/void-ppc/void-packages lssl-asm
https://github.com/void-linux/void-packages/pull/23655

[RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
This yields significant speedups (20x) in some things (AES/ghash) on platforms with hardware crypto support (e.g. POWER8 and newer, and most aarch64) as well as enhances performance of assorted alogrithms by using optimized assembly implementations instead of portable fallbacks. E.g. on aarch64 https://gist.githubusercontent.com/q66/c75a46fc7d0c27eff21cc9d70639bf95/raw/dde1f60e304ef8f4a4049d41388d9c25e63b4a1e/gistfile1.txt

As it is now, libressl only supports asm for x86(_64) and to a limited degree, 32-bit ARM. The extra support was added by my project: https://github.com/q66/libressl-portable-asm

Everything was tested, test suite passes on all platforms, and benchmarks were run on relevant hardware, confirming the speedups.

I still think we should move back to OpenSSL, since there are many reasons to do so (even disregarding performance) and the performance is still better on it (as there are various algos that don't have optimized implementations under libressl at all) but this could be a decent stopgap solution, enabling at least basic things (like hardware AES on non-x86 systems).

Tested:

- [x] ppc64le
- [x] ppc64
- [x] ppc
- [x] armv7l
- [x] aarch64

Benchmarked:

- [x] ppc64le
- [x] ppc64
- [x] ppc
- [x] armv7l
- [x] aarch64

@void-linux/pkg-committers

A patch file from https://github.com/void-linux/void-packages/pull/23655.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-lssl-asm-23655.patch --]
[-- Type: text/x-diff, Size: 3363 bytes --]

From 69b98aa98f47123fa46fbd59729cbc766be2f0b0 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sun, 19 Jul 2020 20:24:23 +0200
Subject: [PATCH] libressl: add assembly for aarch64, ppc*, extra assembly for
 arm

This yields significant speedups (20x) on platforms with hardware
crypto support (e.g. POWER8 and newer, and most aarch64) as well
as enhances performance of assorted alogrithms by using optimized
assembly implementations instead of portable fallbacks.

As it is now, libressl only supports asm for x86(_64) and to a
limited degree, 32-bit ARM.

Everything was tested, test suite passes on all platforms, and
benchmarks were run on relevant hardware, confirming the speedups.
---
 srcpkgs/libressl/template | 54 ++++++++++++++++++++++++++++++---------
 1 file changed, 42 insertions(+), 12 deletions(-)

diff --git a/srcpkgs/libressl/template b/srcpkgs/libressl/template
index f8a201c19b5..2b05f0f936a 100644
--- a/srcpkgs/libressl/template
+++ b/srcpkgs/libressl/template
@@ -1,12 +1,13 @@
 # Template file for 'libressl'
 pkgname=libressl
 version=3.1.3
-revision=1
+revision=2
 bootstrap=yes
 build_style=gnu-configure
+configure_args="$(vopt_enable asm)"
 short_desc="Version of the TLS/crypto stack forked from OpenSSL"
 maintainer="Juan RP <xtraeme@gmail.com>"
-license="OpenSSL-License, SSLeay-License, ISC"
+license="OpenSSL, ISC"
 #changelog="https://raw.githubusercontent.com/libressl-portable/portable/master/ChangeLog"
 homepage="http://www.libressl.org/"
 distfiles="http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/${pkgname}-${version}.tar.gz"
@@ -14,21 +15,50 @@ checksum=c76b0316acf612ecb62f5cb014a20d972a663bd9e40abf952a86f3b998b69fa0
 provides="openssl-${version}_${revision}"
 replaces="openssl>=0"
 conf_files="/etc/ssl/openssl.cnf /etc/ssl/x509v3.cnf"
+_lssl_asm_ver="1.0.0"
 
-if [ "$XBPS_TARGET_MACHINE" = "i686-musl" ]; then
-	# XXX disable SSP
-	configure_args+=" --disable-hardening"
-elif [ "$XBPS_TARGET_MACHINE" = "armv5tel" ]; then
-	configure_args+=" --disable-asm"
+build_options="asm"
+desc_option_asm="Use platform assembly for faster crypto"
+
+if [ "$build_option_asm" ]; then
+	distfiles+=" https://github.com/q66/libressl-portable-asm/archive/v${_lssl_asm_ver}.tar.gz"
+	checksum+=" 2c261f263319ecd73497c2eadd990ccf8310f338e84a452305aca70d2269b298"
 fi
 
-if [ "$CROSS_BUILD" ]; then
-	hostmakedepends="automake libtool"
-	pre_configure() {
-		autoreconf -fi
-	}
+# only enable asm for full chroots by default
+# otherwise we'd be introducing an autotools dependency on the host
+if [ "$CHROOT_READY" ]; then
+	build_options_default="asm"
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	# disable ssp
+	i686-musl) configure_args+=" --disable-hardening";;
+	# on armv5 always disable asm as it's not supported
+	armv5*) configure_args+=" --disable-asm";;
+esac
+
+if [ "$CROSS_BUILD" -o "$build_option_asm" ]; then
+	_regen_build=yes
 fi
 
+if [ -n "$_regen_build" ]; then
+	hostmakedepends=" automake libtool"
+fi
+
+post_extract() {
+	[ -z "$build_option_asm" ] && return 0
+	mv ../libressl-portable-asm-${_lssl_asm_ver} .
+}
+
+pre_configure() {
+	[ -z "$_regen_build" ] && return 0
+	if [ "$build_option_asm" ]; then
+		./libressl-portable-asm-${_lssl_asm_ver}/patch_libressl.sh .
+	fi
+	autoreconf -if
+}
+
 post_install() {
 	# Use CA file from ca-certificates instead.
 	rm -f ${DESTDIR}/etc/ssl/cert.pem

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

* Re: [PR PATCH] [Merged]: libressl: add assembly for aarch64, ppc*, extra assembly for arm
  2020-07-19 21:46 [PR PATCH] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm q66
                   ` (5 preceding siblings ...)
  2020-07-23 21:38 ` q66
@ 2020-07-24  1:52 ` q66
  6 siblings, 0 replies; 8+ messages in thread
From: q66 @ 2020-07-24  1:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1506 bytes --]

There's a merged pull request on the void-packages repository

libressl: add assembly for aarch64, ppc*, extra assembly for arm
https://github.com/void-linux/void-packages/pull/23655

Description:
This yields significant speedups (20x) in some things (AES/ghash) on platforms with hardware crypto support (e.g. POWER8 and newer, and most aarch64) as well as enhances performance of assorted alogrithms by using optimized assembly implementations instead of portable fallbacks. E.g. on aarch64 https://gist.githubusercontent.com/q66/c75a46fc7d0c27eff21cc9d70639bf95/raw/dde1f60e304ef8f4a4049d41388d9c25e63b4a1e/gistfile1.txt

As it is now, libressl only supports asm for x86(_64) and to a limited degree, 32-bit ARM. The extra support was added by my project: https://github.com/q66/libressl-portable-asm

Everything was tested, test suite passes on all platforms, and benchmarks were run on relevant hardware, confirming the speedups.

I still think we should move back to OpenSSL, since there are many reasons to do so (even disregarding performance) and the performance is still better on it (as there are various algos that don't have optimized implementations under libressl at all) but this could be a decent stopgap solution, enabling at least basic things (like hardware AES on non-x86 systems).

Tested:

- [x] ppc64le
- [x] ppc64
- [x] ppc
- [x] armv7l
- [x] aarch64

Benchmarked:

- [x] ppc64le
- [x] ppc64
- [x] ppc
- [x] armv7l
- [x] aarch64

@void-linux/pkg-committers

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

end of thread, other threads:[~2020-07-24  1:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-19 21:46 [PR PATCH] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm q66
2020-07-19 22:19 ` [PR PATCH] [Updated] " q66
2020-07-19 22:22 ` q66
2020-07-19 23:29 ` q66
2020-07-20  0:03 ` ahesford
2020-07-23 15:49 ` [PR PATCH] [Updated] " q66
2020-07-23 21:38 ` q66
2020-07-24  1:52 ` [PR PATCH] [Merged]: " q66

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).