Page MenuHomeFreeBSD

libcrypto: Update assembly build glue for x86 for OpenSSL 3.0.
ClosedPublic

Authored by jhb on Aug 21 2023, 10:06 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, May 4, 12:07 AM
Unknown Object (File)
Sun, Apr 28, 10:37 AM
Unknown Object (File)
Fri, Apr 26, 12:39 AM
Unknown Object (File)
Wed, Apr 17, 10:14 AM
Unknown Object (File)
Wed, Apr 17, 10:14 AM
Unknown Object (File)
Wed, Apr 17, 10:14 AM
Unknown Object (File)
Wed, Apr 17, 10:13 AM
Unknown Object (File)
Wed, Apr 17, 9:55 AM
Subscribers

Details

Summary

Notably, define AES_ASM which is required for any AES acceleration
(OpenSSL 1.0 gated all AES acceleration on OPENSSL_CPUID_OBJ instead).
Enabling this exposed that new files assembly files added in OpenSSL 3.0
needed to be included in the build (aes-x86-64.S and aes-586.S). Both
of files supplant both aes_core.c and aes_cbc.c. The last file now had
to be moved out of the MI SRCS line for aes and into each ASM_* for
non-x86.

As part of this I audited the generated configdata.pm for amd64, i386,
and aarch64 and found the following additional discrepecancies that are
fixed here as well:

  • Enabled BSAES_ASM on amd64 which requires bsase-x86_64.S
  • Enabled WHIRLPOOL_ASM on amd64 (asm sources already built)
  • Enabled CMLL_ASM on amd64 and i386 (asm sources already built)

aarch64 had no discreprecancies in configdata.pm, and no *.pl asm
generators were missing for aarch64 in Makefile.asm. I did not check
powerpc or armv7, but for armv7 all of the asm generators seem to be
present in Makefile.asm.

Reported by: gallatin (AES-GCM using plain software)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Aug 21 2023, 10:06 PM

On my desktop this change mostly restores the performance of AES-128-GCM measured by openssl speed.

Current main in a VM:

type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
AES-128-GCM     261152.77k   353254.48k   348060.35k   359404.49k   384867.93k   388735.23k

After installing updated libcrypto.so in VM:

type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
AES-128-GCM     704615.81k  1943900.35k  3979483.97k  5398264.39k  6026990.71k  6134705.96k

From stable/13 OpenSSL 1.1.x on the host:

type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
aes-128-gcm     727601.21k  2023198.12k  3991011.66k  5508665.49k  6222094.34k  6228710.30k
emaste added a reviewer: ngie.
This revision is now accepted and ready to land.Aug 21 2023, 10:48 PM

Drop avx2+ keccak1600 variants

This revision now requires review to proceed.Aug 22 2023, 3:49 AM
This revision is now accepted and ready to land.Aug 22 2023, 3:55 AM