Github messages for voidlinux
 help / color / mirror / Atom feed
From: q66 <q66@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] [RFC] libressl: add assembly for aarch64, ppc*, extra assembly for arm
Date: Mon, 20 Jul 2020 00:22:35 +0200	[thread overview]
Message-ID: <20200719222235.j_wX9rHFn8NJ9BpC2FF62aTNuHbyRm6iGBTPHC8-BAs@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-23655@inbox.vuxu.org>

[-- 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

  parent reply	other threads:[~2020-07-19 22:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-19 21:46 [PR PATCH] " q66
2020-07-19 22:19 ` [PR PATCH] [Updated] " q66
2020-07-19 22:22 ` q66 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200719222235.j_wX9rHFn8NJ9BpC2FF62aTNuHbyRm6iGBTPHC8-BAs@z \
    --to=q66@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).