Page MenuHomeFreeBSD

openssl: Fix detection of ARMv7 and ARM64 CPU features
ClosedPublic

Authored by allanjude on Fri, Nov 19, 3:18 PM.

Details

Summary

OpenSSL assumes the same value for AT_HWCAP at 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, the benchmark
openssl speed -evp aes-256-gcm is nearly 20x faster
going from 100 MB/sec to 2000 MB/sec

PR: 259937
Sponsored by: Klara Inc.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Fixes: 88e852c0b5c872b1a ("OpenSSL: Merge OpenSSL 1.1.1j")

This would need to be an EN as 13.0 is affected too

Do you need to do the same for AT_hWCAP2? That's a frequent source of problems in bsd-user, so much so we've had to implement a faithful version there. Don't know if that's for crypto or for $OTHER_THINGS though.

crypto/openssl/crypto/armcap.c
118–119

I think this should be AT_HWCAP2 on FreeBSD

This revision is now accepted and ready to land.Fri, Nov 19, 6:03 PM

Update to the cleaner style patch

This revision now requires review to proceed.Fri, Nov 19, 6:43 PM
This revision is now accepted and ready to land.Fri, Nov 19, 6:51 PM

Do you have a pointer to an upstream OpenSSL PR? I'm happy to comment on it if so (if only to provide a LGTM)

crypto/openssl/crypto/armcap.c
108

I would be tempted to stick these fallbacks under an #ifdef __linux.