Bug 259937 - OpenSSL is 20x slower at AES-GCM than on Linux on ARMv7 and ARM64
Summary: OpenSSL is 20x slower at AES-GCM than on Linux on ARMv7 and ARM64
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: 13.0-RELEASE
Hardware: arm64 Any
: --- Affects Many People
Assignee: Allan Jude
URL:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2021-11-19 15:04 UTC by Allan Jude
Modified: 2021-12-20 19:00 UTC (History)
5 users (show)

See Also:
koobs: mfc-stable13?
koobs: mfc-stable12?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Allan Jude freebsd_committer 2021-11-19 15:04:50 UTC
FreeBSD 14-current:

# openssl speed -evp aes-256-gcm
Doing aes-256-gcm for 3s on 16 size blocks: 19608265 aes-256-gcm's in 3.19s
Doing aes-256-gcm for 3s on 64 size blocks: 5182139 aes-256-gcm's in 3.07s
Doing aes-256-gcm for 3s on 256 size blocks: 1328395 aes-256-gcm's in 3.09s
Doing aes-256-gcm for 3s on 1024 size blocks: 345918 aes-256-gcm's in 3.18s
Doing aes-256-gcm for 3s on 8192 size blocks: 43314 aes-256-gcm's in 3.18s
Doing aes-256-gcm for 3s on 16384 size blocks: 21688 aes-256-gcm's in 3.18s
OpenSSL 1.1.1l-freebsd  24 Aug 2021
built on: reproducible build, date unspecified
options:bn(64,64) rc4(int) des(int) aes(partial) idea(int) blowfish(ptr)
compiler: clang
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
aes-256-gcm      98425.80k   108020.57k   110199.61k   111400.89k   111592.19k   111751.92k


Same machine with Ubuntu 20.04:
$ openssl speed -evp aes-256-gcm
Doing aes-256-gcm for 3s on 16 size blocks: 83708856 aes-256-gcm's in 3.00s
Doing aes-256-gcm for 3s on 64 size blocks: 55912628 aes-256-gcm's in 3.00s
Doing aes-256-gcm for 3s on 256 size blocks: 20800967 aes-256-gcm's in 3.00s
Doing aes-256-gcm for 3s on 1024 size blocks: 5873794 aes-256-gcm's in 3.00s
Doing aes-256-gcm for 3s on 8192 size blocks: 768122 aes-256-gcm's in 3.00s
Doing aes-256-gcm for 3s on 16384 size blocks: 386083 aes-256-gcm's in 3.00s
OpenSSL 1.1.1f  31 Mar 2020
built on: Mon Aug 23 17:02:39 2021 UTC
options:bn(64,64) rc4(char) des(int) aes(partial) blowfish(ptr)
compiler: gcc -fPIC -pthread -Wa,--noexecstack -Wall -Wa,--noexecstack -g -O2 -fdebug-prefix-map=/build/openssl-OpXo8E/openssl-1.1.1f=. -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_TLS_SECURITY_LEVEL=2 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
aes-256-gcm     446447.23k  1192802.73k  1775015.85k  2004921.69k  2097485.14k  2108527.96k
Comment 1 Allan Jude freebsd_committer 2021-11-19 15:05:46 UTC
After spending yesterday investigating this, I have determined the source of the problem to be OpenSSL incorrectly looking up the hardware capabilities, and not enabling any of the CPU offload features.

Creating a patch to fix it.
Comment 2 Allan Jude freebsd_committer 2021-11-19 15:07:35 UTC
(This is specific to ARMv7 and ARM64)
Comment 3 Allan Jude freebsd_committer 2021-11-19 15:52:14 UTC
Fix for base: https://reviews.freebsd.org/D33060
Temporary fix for ports: https://reviews.freebsd.org/D33061
Upstreaming to OpenSSL: https://github.com/openssl/openssl/pull/17079
Comment 4 Allan Jude freebsd_committer 2021-11-19 17:29:55 UTC
On my test platform, this also helps sha256:

before:

type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
sha512           23749.80k    95803.33k   217350.80k   376245.23k   478101.71k   487636.79k

after:

type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
sha256           41540.55k   154948.30k   499384.89k  1118159.41k  1761558.73k  1837259.73k

478 MB/s -> 1837 MB/s
Comment 5 Allan Jude freebsd_committer 2021-11-19 19:09:22 UTC
Updates the patches:

Fix for base: https://reviews.freebsd.org/D33060
ports openssl: https://reviews.freebsd.org/D33061
ports openssl3: https://reviews.freebsd.org/D33062
Upstream HWCAP: https://github.com/openssl/openssl/pull/17082
Upstream configure head: https://github.com/openssl/openssl/pull/17084
Upstream configure 1.1.x: https://github.com/openssl/openssl/pull/17085
Comment 6 Daniel Engberg freebsd_committer 2021-11-20 14:00:39 UTC
I might also add that performance can vary quite a bit if you have cpu clusters using different types of cores as they're (at least currently) treated as equal. Another thing I didn't investigate is if we use O2 or O3 for OpenSSL in base (upstream uses O3 on Linux at least) and if that makes any different.

Years ago I did compared O2 to O3 on Linux (MIPS) and there was roughly a 10% increase going from O2 to O3.
Comment 7 commit-hook freebsd_committer 2021-11-20 14:11:19 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f5164ae6014c9bbebcea3c573280cf6aa03d1178

commit f5164ae6014c9bbebcea3c573280cf6aa03d1178
Author:     Bernard Spil <brnrd@FreeBSD.org>
AuthorDate: 2021-11-20 14:07:29 +0000
Commit:     Bernard Spil <brnrd@FreeBSD.org>
CommitDate: 2021-11-20 14:10:12 +0000

    security/openssl-devel: Fix detection of ARM CPU features

    Upstream:
     * https://github.com/openssl/openssl/pull/17082
     * https://github.com/openssl/openssl/pull/17084

    PR:             259937
    Submitted by:   allanjude
    Differential Revision:  https://reviews.freebsd.org/D33062

 security/openssl-devel/Makefile                 |  2 +-
 security/openssl-devel/files/patch-D33062 (new) | 65 +++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 1 deletion(-)
Comment 8 commit-hook freebsd_committer 2021-11-22 18:11:24 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=d9bb798725cfce9c72b80440659b48e8668eb10d

commit d9bb798725cfce9c72b80440659b48e8668eb10d
Author:     Allan Jude <allanjude@FreeBSD.org>
AuthorDate: 2021-11-19 15:14:30 +0000
Commit:     Allan Jude <allanjude@FreeBSD.org>
CommitDate: 2021-11-22 18:10:43 +0000

    openssl: Fix detection of ARMv7 and ARM64 CPU features

    OpenSSL assumes the same value for AT_HWCAP=16 (Linux)
    So it ends up calling elf_auxv_info() with AT_CANARY which
    returns ENOENT, and all acceleration features are disabled.

    With this, my ARM64 test machine runs the benchmark
    `openssl speed -evp aes-256-gcm` nearly 20x faster
    going from 100 MB/sec to 2000 MB/sec

    It also improves sha256 from 300 MB/sec to 1800 MB/sec

    This fix has been accepted but not yet merged upstream:
    https://github.com/openssl/openssl/pull/17082

    PR:             259937
    Reviewed by:    manu, imp
    MFC after:      immediate
    Relnotes:       yes
    Fixes:          88e852c0b5c872b1a ("OpenSSL: Merge OpenSSL 1.1.1j")
    Sponsored by:   Ampere Computing LLC
    Sponsored by:   Klara Inc.
    Differential Revision:  https://reviews.freebsd.org/D33060

 crypto/openssl/crypto/armcap.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
Comment 9 commit-hook freebsd_committer 2021-11-22 18:14:25 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=32a2fed6e71f896266d4c695754104d82a72c60d

commit 32a2fed6e71f896266d4c695754104d82a72c60d
Author:     Allan Jude <allanjude@FreeBSD.org>
AuthorDate: 2021-11-19 15:14:30 +0000
Commit:     Allan Jude <allanjude@FreeBSD.org>
CommitDate: 2021-11-22 18:12:20 +0000

    openssl: Fix detection of ARMv7 and ARM64 CPU features

    OpenSSL assumes the same value for AT_HWCAP=16 (Linux)
    So it ends up calling elf_auxv_info() with AT_CANARY which
    returns ENOENT, and all acceleration features are disabled.

    With this, my ARM64 test machine runs the benchmark
    `openssl speed -evp aes-256-gcm` nearly 20x faster
    going from 100 MB/sec to 2000 MB/sec

    It also improves sha256 from 300 MB/sec to 1800 MB/sec

    This fix has been accepted but not yet merged upstream:
    https://github.com/openssl/openssl/pull/17082

    PR:             259937
    Reviewed by:    manu, imp
    MFC after:      immediate
    Relnotes:       yes
    Fixes:          88e852c0b5c872b1a ("OpenSSL: Merge OpenSSL 1.1.1j")
    Sponsored by:   Ampere Computing LLC
    Sponsored by:   Klara Inc.
    Differential Revision:  https://reviews.freebsd.org/D33060

    (cherry picked from commit d9bb798725cfce9c72b80440659b48e8668eb10d)

 crypto/openssl/crypto/armcap.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
Comment 10 commit-hook freebsd_committer 2021-11-22 18:23:30 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0ed191d116f511c1e67338f05386d87aad53076f

commit 0ed191d116f511c1e67338f05386d87aad53076f
Author:     Allan Jude <allanjude@FreeBSD.org>
AuthorDate: 2021-11-19 15:14:30 +0000
Commit:     Allan Jude <allanjude@FreeBSD.org>
CommitDate: 2021-11-22 18:22:36 +0000

    openssl: Fix detection of ARMv7 and ARM64 CPU features

    OpenSSL assumes the same value for AT_HWCAP=16 (Linux)
    So it ends up calling elf_auxv_info() with AT_CANARY which
    returns ENOENT, and all acceleration features are disabled.

    With this, my ARM64 test machine runs the benchmark
    `openssl speed -evp aes-256-gcm` nearly 20x faster
    going from 100 MB/sec to 2000 MB/sec

    It also improves sha256 from 300 MB/sec to 1800 MB/sec

    This fix has been accepted but not yet merged upstream:
    https://github.com/openssl/openssl/pull/17082

    PR:             259937
    Reviewed by:    manu, imp
    MFC after:      immediate
    Relnotes:       yes
    Fixes:          88e852c0b5c872b1a ("OpenSSL: Merge OpenSSL 1.1.1j")
    Sponsored by:   Ampere Computing LLC
    Sponsored by:   Klara Inc.
    Differential Revision:  https://reviews.freebsd.org/D33060

    (cherry picked from commit d9bb798725cfce9c72b80440659b48e8668eb10d)

 crypto/openssl/crypto/armcap.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
Comment 11 commit-hook freebsd_committer 2021-11-22 19:00:37 UTC
A commit in branch releng/12.3 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=8ffcfb399b20f027cb50afe41c7f83c52c008191

commit 8ffcfb399b20f027cb50afe41c7f83c52c008191
Author:     Allan Jude <allanjude@FreeBSD.org>
AuthorDate: 2021-11-19 15:14:30 +0000
Commit:     Allan Jude <allanjude@FreeBSD.org>
CommitDate: 2021-11-22 18:59:32 +0000

    openssl: Fix detection of ARMv7 and ARM64 CPU features

    OpenSSL assumes the same value for AT_HWCAP=16 (Linux)
    So it ends up calling elf_auxv_info() with AT_CANARY which
    returns ENOENT, and all acceleration features are disabled.

    With this, my ARM64 test machine runs the benchmark
    `openssl speed -evp aes-256-gcm` nearly 20x faster
    going from 100 MB/sec to 2000 MB/sec

    It also improves sha256 from 300 MB/sec to 1800 MB/sec

    This fix has been accepted but not yet merged upstream:
    https://github.com/openssl/openssl/pull/17082

    PR:             259937
    Reviewed by:    manu, imp
    Approved by:    re (gjb)
    Relnotes:       yes
    Fixes:          88e852c0b5c872b1a ("OpenSSL: Merge OpenSSL 1.1.1j")
    Sponsored by:   Ampere Computing LLC
    Sponsored by:   Klara Inc.
    Differential Revision:  https://reviews.freebsd.org/D33060

    (cherry picked from commit d9bb798725cfce9c72b80440659b48e8668eb10d)
    (cherry picked from commit 0ed191d116f511c1e67338f05386d87aad53076f)

 crypto/openssl/crypto/armcap.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
Comment 12 commit-hook freebsd_committer 2021-11-23 18:50:42 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e2d67bee9eb05d8c48a054edd5b52938b1c1d576

commit e2d67bee9eb05d8c48a054edd5b52938b1c1d576
Author:     Bernard Spil <brnrd@FreeBSD.org>
AuthorDate: 2021-11-23 18:44:13 +0000
Commit:     Bernard Spil <brnrd@FreeBSD.org>
CommitDate: 2021-11-23 18:44:13 +0000

    www/openssl: Fix detection of ARM CPU features

    Upstream:
     * https://github.com/openssl/openssl/pull/17082
     * https://github.com/openssl/openssl/pull/17085

    PR:             259937
    Submitted by:   allanjude
    Differential Revision:  https://reviews.freebsd.org/D33061

 security/openssl/Makefile                 |  1 +
 security/openssl/files/patch-D33061 (new) | 53 +++++++++++++++++++++++++++++++
 security/openssl/files/patch-config       |  5 +--
 3 files changed, 57 insertions(+), 2 deletions(-)
Comment 13 Helge Oldach 2021-11-23 19:08:52 UTC
On a RPi4/8G:

Before (FreeBSD 13.0-STABLE (GENERIC) #366 stable/13-n248173-d16fbc488e6):

| Doing aes-256-gcm for 3s on 16 size blocks: 6710997 aes-256-gcm's in 3.00s
| Doing aes-256-gcm for 3s on 64 size blocks: 1806261 aes-256-gcm's in 3.00s
| Doing aes-256-gcm for 3s on 256 size blocks: 468595 aes-256-gcm's in 3.00s
| Doing aes-256-gcm for 3s on 1024 size blocks: 121282 aes-256-gcm's in 3.00s
| Doing aes-256-gcm for 3s on 8192 size blocks: 14590 aes-256-gcm's in 3.00s
| Doing aes-256-gcm for 3s on 16384 size blocks: 7258 aes-256-gcm's in 3.00s
| OpenSSL 1.1.1l-freebsd  24 Aug 2021
| built on: reproducible build, date unspecified
| options:bn(64,64) rc4(int) des(int) aes(partial) idea(int) blowfish(ptr)
| compiler: clang
| The 'numbers' are in 1000s of bytes per second processed.
| type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
 16384 bytes
| aes-256-gcm      35791.98k    38533.57k    39986.77k    41397.59k
39840.43k    39638.36k

After (FreeBSD 13.0-STABLE (GENERIC) #367 stable/13-n248176-f085bb0e621)

| Doing aes-256-gcm for 3s on 16 size blocks: 3999944 aes-256-gcm's in 3.01s
| Doing aes-256-gcm for 3s on 64 size blocks: 1102925 aes-256-gcm's in 3.04s
| Doing aes-256-gcm for 3s on 256 size blocks: 279608 aes-256-gcm's in 3.03s
| Doing aes-256-gcm for 3s on 1024 size blocks: 69397 aes-256-gcm's in 3.00s
| Doing aes-256-gcm for 3s on 8192 size blocks: 9160 aes-256-gcm's in 3.14s
| Doing aes-256-gcm for 3s on 16384 size blocks: 4385 aes-256-gcm's in 3.00s
| OpenSSL 1.1.1l-freebsd  24 Aug 2021
| built on: reproducible build, date unspecified
| options:bn(64,64) rc4(int) des(int) aes(partial) idea(int) blowfish(ptr)
| compiler: clang
| The 'numbers' are in 1000s of bytes per second processed.
| type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
 16384 bytes
| aes-256-gcm      21277.62k    23226.64k    23613.90k    23687.51k
23892.93k    23947.95k

It seems that AES throughput is actually cut by almost half?
Comment 14 wcarson.bugzilla 2021-12-19 17:09:36 UTC
It looks like these changes were added between 1.1.1l and 1.1.1m, and now that ports is pulling openssl-1.1.1m,1 I'm getting this error when building on my Raspberry Pi 4 -- is it possibly related or should I open a new bug?

[00:00:00] =>> Building security/openssl
[00:00:01] build started at Sun Dec 19 03:19:26 UTC 2021
[00:00:01] port directory: /usr/ports/security/openssl
[00:00:01] package name: openssl-1.1.1m,1
[00:00:01] building for: FreeBSD FreeBSD:13:aarch64-HEAD-job-02 13.0-RELEASE-p5 FreeBSD 13.0-RELEASE-p5 1300139 arm64
[00:00:01] maintained by: brnrd@FreeBSD.org
[00:00:01] Makefile ident: 
[00:00:01] Poudriere version: 3.3.7_1
[00:00:01] Host OSVERSION: 1300139
[00:00:01] Jail OSVERSION: 1300139
[00:00:01] Job Id: 02
[00:00:01] 
[00:00:01] ---Begin Environment---
[00:00:01] SHELL=/bin/csh
[00:00:01] OSVERSION=1300139
[00:00:01] UNAME_v=FreeBSD 13.0-RELEASE-p5 1300139
[00:00:01] UNAME_r=13.0-RELEASE-p5
[00:00:01] BLOCKSIZE=K
[00:00:01] MAIL=/var/mail/root
[00:00:01] MM_CHARSET=UTF-8
[00:00:01] LANG=C.UTF-8
[00:00:01] STATUS=1
[00:00:01] HOME=/root
[00:00:01] PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
[00:00:01] LOCALBASE=/usr/local
[00:00:01] USER=root
[00:00:01] LIBEXECPREFIX=/usr/local/libexec/poudriere
[00:00:01] POUDRIERE_VERSION=3.3.7_1
[00:00:01] MASTERMNT=/usr/local/poudriere/data/.m/FreeBSD_13_aarch64-HEAD/ref
[00:00:01] POUDRIERE_BUILD_TYPE=bulk
[00:00:01] PACKAGE_BUILDING=yes
[00:00:01] SAVED_TERM=screen
[00:00:01] GID=0
[00:00:01] UID=0
[00:00:01] PWD=/usr/local/poudriere/data/.m/FreeBSD_13_aarch64-HEAD/ref/.p/pool
[00:00:01] P_PORTS_FEATURES=FLAVORS SELECTED_OPTIONS
[00:00:01] MASTERNAME=FreeBSD:13:aarch64-HEAD
[00:00:01] SCRIPTPREFIX=/usr/local/share/poudriere
[00:00:01] OLDPWD=/usr/local/poudriere/data/.m/FreeBSD_13_aarch64-HEAD/ref/.p
[00:00:01] SCRIPTPATH=/usr/local/share/poudriere/bulk.sh
[00:00:01] POUDRIEREPATH=/usr/local/bin/poudriere
[00:00:01] ---End Environment---
[00:00:01] 
[00:00:01] ---Begin Poudriere Port Flags/Env---
[00:00:01] PORT_FLAGS=
[00:00:01] PKGENV=
[00:00:01] FLAVOR=
[00:00:01] DEPENDS_ARGS=
[00:00:01] MAKE_ARGS=
[00:00:01] ---End Poudriere Port Flags/Env---
[00:00:01] 
[00:00:01] ---Begin OPTIONS List---
[00:00:01] ===> The following configuration options are available for openssl-1.1.1m,1:
[00:00:01]      ASYNC=on: Asynchronous mode
[00:00:01]      CT=on: Certificate Transparency Support
[00:00:01]      KTLS=on: Kernel TLS offload
[00:00:01]      MAN3=on: Install API manpages (section 3, 7)
[00:00:01]      RFC3779=off: RFC3779 support (BGP)
[00:00:01]      SHARED=on: Build shared libraries
[00:00:01]      ZLIB=off: zlib compression support
[00:00:01] ====> Block Cipher Support
[00:00:01]      ARIA=off: ARIA (South Korean standard)
[00:00:01]      DES=on: (Triple) Data Encryption Standard
[00:00:01]      GOST=off: GOST (Russian standard)
[00:00:02]      IDEA=off: International Data Encryption Algorithm
[00:00:02]      SM4=off: SM4 128bit (Chinese standard)
[00:00:02]      RC2=on: RC2 (unsafe)
[00:00:02]      RC4=on: RC4 (unsafe)
[00:00:02]      RC5=off: RC5 (patented)
[00:00:02]      WEAK-SSL-CIPHERS=off: Weak cipher support (unsafe)
[00:00:02] ====> Hash Function Support
[00:00:02]      MD2=off: MD2 (obsolete)
[00:00:02]      MD4=on: MD4 (unsafe)
[00:00:02]      MDC2=off: MDC-2 (patented, requires DES)
[00:00:02]      RMD160=on: RIPEMD-160
[00:00:02]      SM2=off: SM2 Elliptic Curve DH (Chinese standard)
[00:00:02]      SM3=off: SM3 256bit (Chinese standard)
[00:00:02] ====> Optimizations
[00:00:02]      ASM=on: Assembler code
[00:00:02]      SSE2=on: Runtime SSE2 detection
[00:00:02]      THREADS=on: Threading support
[00:00:02] ====> Protocol Support
[00:00:02]      NEXTPROTONEG=on: Next Protocol Negotiation (SPDY)
[00:00:02]      SCTP=on: SCTP (Stream Control Transmission)
[00:00:02]      SSL3=off: SSLv3 (unsafe)
[00:00:02]      TLS1=on: TLSv1.0 (requires TLS1_1, TLS1_2)
[00:00:02]      TLS1_1=on: TLSv1.1 (requires TLS1_2)
[00:00:02]      TLS1_2=on: TLSv1.2
[00:00:03] ===> Use 'make config' to modify these settings
[00:00:03] ---End OPTIONS List---
[00:00:03] 
[00:00:03] --MAINTAINER--
[00:00:03] brnrd@FreeBSD.org
[00:00:03] --End MAINTAINER--
[00:00:03] 
[00:00:03] --CONFIGURE_ARGS--
[00:00:03] --openssldir=/usr/local/openssl  --prefix=/usr/local no-aria no-gost no-idea enable-ktls no-mdc2 no-rfc3779 enable-sctp no-sm2 no-sm3 no-sm4
[00:00:03] --End CONFIGURE_ARGS--
[00:00:03] 
[00:00:03] --CONFIGURE_ENV--
[00:00:03] PERL="/usr/local/bin/perl" ac_cv_path_PERL=/usr/local/bin/perl ac_cv_path_PERL_PATH=/usr/local/bin/perl  PERL_USE_UNSAFE_INC=1 XDG_DATA_HOME=/wrkdirs/usr/ports/security/openssl/work  XDG_CONFIG_HOME=/wrkdirs/usr/ports/security/openssl/work  XDG_CACHE_HOME=/wrkdirs/usr/ports/security/openssl/work/.cache  HOME=/wrkdirs/usr/ports/security/openssl/work TMPDIR="/tmp" PATH=/wrkdirs/usr/ports/security/openssl/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin SHELL=/bin/sh CONFIG_SHELL=/bin/sh
[00:00:03] --End CONFIGURE_ENV--
[00:00:03] 
[00:00:03] --MAKE_ENV--
[00:00:03] LIBRPATH="/usr/local/lib" GREP_OPTIONS= SHLIBVER=11 PERL_USE_UNSAFE_INC=1 XDG_DATA_HOME=/wrkdirs/usr/ports/security/openssl/work  XDG_CONFIG_HOME=/wrkdirs/usr/ports/security/openssl/work  XDG_CACHE_HOME=/wrkdirs/usr/ports/security/openssl/work/.cache  HOME=/wrkdirs/usr/ports/security/openssl/work TMPDIR="/tmp" PATH=/wrkdirs/usr/ports/security/openssl/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing  "  MANPREFIX="/usr/local" BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444"
[00:00:03] --End MAKE_ENV--
[00:00:03] 
[00:00:03] --PLIST_SUB--
[00:00:03]  ARIA="@comment " NO_ARIA="" ASM="" NO_ASM="@comment " ASYNC="" NO_ASYNC="@comment " CRYPTODEV="@comment " NO_CRYPTODEV="" CT="" NO_CT="@comment " DES="" NO_DES="@comment " GOST="@comment " NO_GOST="" IDEA="@comment " NO_IDEA="" KTLS="" NO_KTLS="@comment " MAN3="" NO_MAN3="@comment " MD2="@comment " NO_MD2="" MD4="" NO_MD4="@comment " MDC2="@comment " NO_MDC2="" NEXTPROTONEG="" NO_NEXTPROTONEG="@comment " RC2="" NO_RC2="@comment " RC4="" NO_RC4="@comment " RC5="@comment " NO_RC5="" RFC3779="@comment " NO_RFC3779="" RMD160="" NO_RMD160="@comment " SCTP="" NO_SCTP="@comment " SHARED="" NO_SHARED="@comment " SHLIBVER=11 SM2="@comment " NO_SM2="" SM3="@comment " NO_SM3="" SM4="@comment " NO_SM4="" SSE2="" NO_SSE2="@comment " SSL3="@comment " NO_SSL3="" THREADS="" NO_THREADS="@comment " TLS1="" NO_TLS1="@comment " TLS1_1="" NO_TLS1_1="@comment " TLS1_2="" NO_TLS1_2="@comment " WEAK-SSL-CIPHERS="@comment " NO_WEAK-SSL-CIPHERS="" ZLIB="@comment " NO_ZLIB="" OPENSSLDIR=openssl OSREL=13.0 PREFIX=%D LOCALBASE=/usr/local  RESETPREFIX=/usr/local LIB32DIR=lib PERL_VERSION=5.32.1  PERL_VER=5.32  PERL5_MAN1=lib/perl5/site_perl/man/man1  PERL5_MAN3=lib/perl5/site_perl/man/man3  SITE_PERL=lib/perl5/site_perl  SITE_ARCH=lib/perl5/site_perl/mach/5.32 DOCSDIR="share/doc/openssl"  EXAMPLESDIR="share/examples/openssl"  DATADIR="share/openssl"  WWWDIR="www/openssl"  ETCDIR="etc/openssl"
[00:00:03] --End PLIST_SUB--
[00:00:03] 
[00:00:03] --SUB_LIST--
[00:00:03]  ARIA="@comment " NO_ARIA="" ASM="" NO_ASM="@comment " ASYNC="" NO_ASYNC="@comment " CRYPTODEV="@comment " NO_CRYPTODEV="" CT="" NO_CT="@comment " DES="" NO_DES="@comment " GOST="@comment " NO_GOST="" IDEA="@comment " NO_IDEA="" KTLS="" NO_KTLS="@comment " MAN3="" NO_MAN3="@comment " MD2="@comment " NO_MD2="" MD4="" NO_MD4="@comment " MDC2="@comment " NO_MDC2="" NEXTPROTONEG="" NO_NEXTPROTONEG="@comment " RC2="" NO_RC2="@comment " RC4="" NO_RC4="@comment " RC5="@comment " NO_RC5="" RFC3779="@comment " NO_RFC3779="" RMD160="" NO_RMD160="@comment " SCTP="" NO_SCTP="@comment " SHARED="" NO_SHARED="@comment " SM2="@comment " NO_SM2="" SM3="@comment " NO_SM3="" SM4="@comment " NO_SM4="" SSE2="" NO_SSE2="@comment " SSL3="@comment " NO_SSL3="" THREADS="" NO_THREADS="@comment " TLS1="" NO_TLS1="@comment " TLS1_1="" NO_TLS1_1="@comment " TLS1_2="" NO_TLS1_2="@comment " WEAK-SSL-CIPHERS="@comment " NO_WEAK-SSL-CIPHERS="" ZLIB="@comment " NO_ZLIB="" PREFIX=/usr/local LOCALBASE=/usr/local  DATADIR=/usr/local/share/openssl DOCSDIR=/usr/local/share/doc/openssl EXAMPLESDIR=/usr/local/share/examples/openssl  WWWDIR=/usr/local/www/openssl ETCDIR=/usr/local/etc/openssl
[00:00:03] --End SUB_LIST--
[00:00:03] 
[00:00:03] ---Begin make.conf---
[00:00:03] USE_PACKAGE_DEPENDS=yes
[00:00:03] BATCH=yes
[00:00:03] WRKDIRPREFIX=/wrkdirs
[00:00:03] PORTSDIR=/usr/ports
[00:00:03] PACKAGES=/packages
[00:00:03] DISTDIR=/distfiles
[00:00:03] FORCE_PACKAGE=yes
[00:00:03] PACKAGE_BUILDING=yes
[00:00:03] PACKAGE_BUILDING_FLAVORS=yes
[00:00:03] #### /usr/local/etc/poudriere.d/FreeBSD:13:aarch64-make.conf ####
[00:00:03] MALLOC_PRODUCTION=yes
[00:00:03] #OPTIONS_UNSET+=X11
[00:00:03] DEFAULT_VERSIONS+=ssl=openssl
[00:00:03] DEFAULT_VERSIONS+=mysql=10.5m
[00:00:03] DEFAULT_VERSIONS+=php=7.4
[00:00:03] DEFAULT_VERSIONS+=java=17
[00:00:03] DEFAULT_VERSIONS+=mono=5.20
[00:00:03] LICENSES_ACCEPTED+=minecraft
[00:00:03] LICENSES_ACCEPTED+=DCC
[00:00:03] 
[00:00:03] .if ${.CURDIR:M*/www/nginx}
[00:00:03] EXTRA_PATCHES+= /distfiles/local-patches/extra-patch-ngx_http_header_lighttpd_rename
[00:00:03] .endif
[00:00:03] 
[00:00:03] .if ${.CURDIR:M*/sysutils/u-boot-rpi4}
[00:00:03] EXTRA_PATCHES+= /distfiles/local-patches/patch-include_configs_rpi.h
[00:00:03] .endif
[00:00:03] #### Misc Poudriere ####
[00:00:03] .include "/etc/make.conf.ports_env"
[00:00:03] ---End make.conf---
[00:00:03] --Resource limits--
[00:00:03] cpu time               (seconds, -t)  unlimited
[00:00:03] file size           (512-blocks, -f)  unlimited
[00:00:03] data seg size           (kbytes, -d)  1048576
[00:00:03] stack size              (kbytes, -s)  1048576
[00:00:03] core file size      (512-blocks, -c)  unlimited
[00:00:03] max memory size         (kbytes, -m)  unlimited
[00:00:03] locked memory           (kbytes, -l)  unlimited
[00:00:03] max user processes              (-u)  12070
[00:00:03] open files                      (-n)  1024
[00:00:03] virtual mem size        (kbytes, -v)  unlimited
[00:00:03] swap limit              (kbytes, -w)  unlimited
[00:00:03] socket buffer size       (bytes, -b)  unlimited
[00:00:03] pseudo-terminals                (-p)  unlimited
[00:00:03] kqueues                         (-k)  unlimited
[00:00:03] umtx shared locks               (-o)  unlimited
[00:00:03] --End resource limits--
[00:00:03] =======================<phase: check-sanity   >============================
[00:00:03] ===>  License OpenSSL accepted by the user
[00:00:03] ===========================================================================
[00:00:03] =======================<phase: pkg-depends    >============================
[00:00:04] ===>   openssl-1.1.1m,1 depends on file: /usr/local/sbin/pkg - not found
[00:00:04] ===>   Installing existing package /packages/All/pkg-1.17.5.pkg
[00:00:07] [FreeBSD:13:aarch64-HEAD-job-02] Installing pkg-1.17.5...
[00:00:07] [FreeBSD:13:aarch64-HEAD-job-02] Extracting pkg-1.17.5: .......... done
[00:00:12] ===>   openssl-1.1.1m,1 depends on file: /usr/local/sbin/pkg - found
[00:00:12] ===>   Returning to build of openssl-1.1.1m,1
[00:00:12] ===========================================================================
[00:00:12] =======================<phase: fetch-depends  >============================
[00:00:12] ===========================================================================
[00:00:12] =======================<phase: fetch          >============================
[00:00:13] ===>  License OpenSSL accepted by the user
[00:00:14] => openssl-1.1.1m.tar.gz doesn't seem to exist in /portdistfiles/.
[00:00:14] => Attempting to fetch https://www.openssl.org/source/openssl-1.1.1m.tar.gz
[00:00:15] openssl-1.1.1m.tar.gz                                 9616 kB   10 MBps    01s
[00:00:16] ===> Fetching all distfiles required by openssl-1.1.1m,1 for building
[00:00:16] ===========================================================================
[00:00:16] =======================<phase: checksum       >============================
[00:00:17] ===>  License OpenSSL accepted by the user
[00:00:17] ===> Fetching all distfiles required by openssl-1.1.1m,1 for building
[00:00:17] => SHA256 Checksum OK for openssl-1.1.1m.tar.gz.
[00:00:17] ===========================================================================
[00:00:18] =======================<phase: extract-depends>============================
[00:00:18] ===========================================================================
[00:00:18] =======================<phase: extract        >============================
[00:00:19] ===>  License OpenSSL accepted by the user
[00:00:19] ===> Fetching all distfiles required by openssl-1.1.1m,1 for building
[00:00:19] ===>  Extracting for openssl-1.1.1m,1
[00:00:19] => SHA256 Checksum OK for openssl-1.1.1m.tar.gz.
[00:00:20] ===========================================================================
[00:00:20] =======================<phase: patch-depends  >============================
[00:00:21] ===========================================================================
[00:00:21] =======================<phase: patch          >============================
[00:00:22] ===>  Patching for openssl-1.1.1m,1
[00:00:22] ===>  Applying extra patch /usr/ports/security/openssl/files/extra-patch-ktls
[00:00:22] ===>  Applying FreeBSD patches for openssl-1.1.1m,1 from /usr/ports/security/openssl/files
[00:00:22] /usr/bin/sed -i.bak  -e 's|^MANDIR=.*$|MANDIR=$(INSTALLTOP)/man|'  -e 's| install_html_docs$||'  -e 's|$(LIBDIR)/pkgconfig|libdata/pkgconfig|g'  /wrkdirs/usr/ports/security/openssl/work/openssl-1.1.1m/Configurations/unix-Makefile.tmpl
[00:00:22] /usr/bin/sed -i.bak -e 's|\^GNU ld|GNU|' /wrkdirs/usr/ports/security/openssl/work/openssl-1.1.1m/Configurations/shared-info.pl
[00:00:22] ===========================================================================
[00:00:22] =======================<phase: build-depends  >============================
[00:00:23] ===>   openssl-1.1.1m,1 depends on package: perl5>=5.32.r0<5.33 - not found
[00:00:23] ===>   Installing existing package /packages/All/perl5-5.32.1_1.pkg
[00:00:23] [FreeBSD:13:aarch64-HEAD-job-02] Installing perl5-5.32.1_1...
[00:00:24] [FreeBSD:13:aarch64-HEAD-job-02] Extracting perl5-5.32.1_1: .......... done
[00:01:59] ===>   openssl-1.1.1m,1 depends on package: perl5>=5.32.r0<5.33 - found
[00:01:59] ===>   Returning to build of openssl-1.1.1m,1
[00:01:59] ===========================================================================
[00:01:59] =======================<phase: lib-depends    >============================
[00:01:59] ===========================================================================
[00:01:59] =======================<phase: configure      >============================
[00:02:00] ===>  Configuring for openssl-1.1.1m,1
[00:02:00] Operating system: arm64-whatever-freebsd
[00:02:01] This system (BSD-aarch64) is not supported. See file INSTALL for details.
[00:02:01] ===>  Script "config" failed unexpectedly.
[00:02:01] Please report the problem to brnrd@FreeBSD.org [maintainer] and attach the
[00:02:01] "/wrkdirs/usr/ports/security/openssl/work/openssl-1.1.1m/config.log" including
[00:02:01] the output of the failure of your make command. Also, it might be a good idea
[00:02:01] to provide an overview of all packages installed on your system (e.g. a
[00:02:01] /usr/local/sbin/pkg-static info -g -Ea).
[00:02:01] *** Error code 1
[00:02:01] 
[00:02:01] Stop.
[00:02:01] make: stopped in /usr/ports/security/openssl
[00:02:04] =>> Cleaning up wrkdir
[00:02:04] ===>  Cleaning for openssl-1.1.1m,1
[00:02:07] build of security/openssl | openssl-1.1.1m,1 ended at Sun Dec 19 03:21:32 UTC 2021
[00:02:07] build time: 00:02:07
[00:02:07] !!! build failure encountered !!!



For reference, on openssl-1.1.1l_1,1 that section looked like this:

[00:00:31] =======================<phase: configure      >============================
[00:00:31] ===>  Configuring for openssl-1.1.1l_1,1
[00:00:32] Operating system: arm64-whatever-freebsd
[00:00:34] Configuring OpenSSL version 1.1.1l (0x101010cfL) for BSD-aarch64
[00:00:34] Using os-specific seed configuration
[00:00:43] Creating configdata.pm
[00:00:43] Creating Makefile
[00:00:43] 
[00:00:43] **********************************************************************
[00:00:43] ***                                                                ***
[00:00:43] ***   OpenSSL has been successfully configured                     ***
Comment 15 Allan Jude freebsd_committer 2021-12-19 17:23:20 UTC
It looks like the configure script changes did not get merged back to 1.1.1m upstream
Comment 16 Bernard Spil freebsd_committer 2021-12-20 17:35:48 UTC
(In reply to Allan Jude from comment #15)

Looking at the changes and merging...
Comment 17 Bernard Spil freebsd_committer 2021-12-20 17:38:07 UTC
Closing in favor of bug #260572
Comment 18 commit-hook freebsd_committer 2021-12-20 18:06:36 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f64391dd014047d542cd394dda3dc00c1d061801

commit f64391dd014047d542cd394dda3dc00c1d061801
Author:     Bernard Spil <brnrd@FreeBSD.org>
AuthorDate: 2021-12-20 18:03:30 +0000
Commit:     Bernard Spil <brnrd@FreeBSD.org>
CommitDate: 2021-12-20 18:03:30 +0000

    security/openssl: Fix build on aarch64

     * Upstream only partly merged changes

    PR:             259937, 260572
    Reported by:    allanjude, "Naram Qashat" <cyberbotx cyberbotx com>

 security/openssl/Makefile                                |  1 +
 .../files/patch-Configurations_10-main.conf (new)        | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)
Comment 19 wcarson.bugzilla 2021-12-20 19:00:53 UTC
The commit resolved the issue for me. Thank you!