Page MenuHomeFreeBSD

Add assembly optimized code for OpenSSL on powerpc, powerpc64 and powerpc64le
ClosedPublic

Authored by pkubaj on Nov 22 2021, 2:32 AM.

Details

Summary
  1. https://github.com/openssl/openssl/commit/34ab13b7d8e3e723adb60be8142e38b7c9cd382a

needs to be merged for ELFv2 support on big-endian.

  1. crypto/openssl/crypto/ppccap.c needs to be patched.

Same reason as in https://github.com/openssl/openssl/pull/17082.

After committing to main, please also MFC to stable/13. It should be possible to do it without any changes. MFC'ing to stable/12 won't be possible unless this patch is modified and may prove straight impossible, given that stable/12 uses GCC 4.2.

Test Plan

Test on powerpc, powerpc64 and powerpc64le.

I test using "openssl speed -evp aes-256-gcm"
powerpc64le unpatched:
Doing aes-256-gcm for 3s on 16 size blocks: 9552470 aes-256-gcm's in 3.01s
Doing aes-256-gcm for 3s on 64 size blocks: 3083878 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 256 size blocks: 830906 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 1024 size blocks: 211122 aes-256-gcm's in 3.00s
Doing aes-256-gcm for 3s on 8192 size blocks: 26861 aes-256-gcm's in 3.05s
Doing aes-256-gcm for 3s on 16384 size blocks: 13415 aes-256-gcm's in 3.05s
OpenSSL 1.1.1k-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 50814.18k 65448.52k 70536.60k 72062.98k 72220.00k 72136.65k

powerpc64le patched:
Doing aes-256-gcm for 3s on 16 size blocks: 19873877 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 64 size blocks: 12461931 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 256 size blocks: 9315680 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 1024 size blocks: 3705172 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 8192 size blocks: 545984 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 16384 size blocks: 275305 aes-256-gcm's in 3.02s
OpenSSL 1.1.1k-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 105172.35k 264477.04k 788775.72k 1254894.84k 1483175.44k 1491877.08k

powerpc64 unpatched:
Doing aes-256-gcm for 3s on 16 size blocks: 7070177 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 64 size blocks: 2484593 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 256 size blocks: 673707 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 1024 size blocks: 171983 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 8192 size blocks: 21644 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 16384 size blocks: 10819 aes-256-gcm's in 3.02s
OpenSSL 1.1.1k-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 37415.30k 52730.02k 57044.01k 58248.46k 58644.39k 58780.02k

powerpc64 patched:
Doing aes-256-gcm for 3s on 16 size blocks: 15075576 aes-256-gcm's in 3.04s
Doing aes-256-gcm for 3s on 64 size blocks: 10145628 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 256 size blocks: 7837733 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 1024 size blocks: 3106231 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 8192 size blocks: 461837 aes-256-gcm's in 3.05s
Doing aes-256-gcm for 3s on 16384 size blocks: 231623 aes-256-gcm's in 3.05s
OpenSSL 1.1.1k-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 79369.61k 215318.61k 663635.23k 1054766.61k 1241721.01k 1245509.33k

powerpc unpatched:
Doing aes-256-gcm for 3s on 16 size blocks: 5233246 aes-256-gcm's in 3.01s
Doing aes-256-gcm for 3s on 64 size blocks: 1972493 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 256 size blocks: 543703 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 1024 size blocks: 139295 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 8192 size blocks: 17494 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 16384 size blocks: 8752 aes-256-gcm's in 3.02s
OpenSSL 1.1.1k-freebsd 25 Mar 2021
built on: reproducible build, date unspecified
options:bn(64,32) rc4(int) des(long) 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 27838.15k 41861.82k 46036.33k 47299.67k 47399.97k 47549.93k

powerpc patched:
Doing aes-256-gcm for 3s on 16 size blocks: 11680952 aes-256-gcm's in 3.01s
Doing aes-256-gcm for 3s on 64 size blocks: 8420502 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 256 size blocks: 6846209 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 1024 size blocks: 2946064 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 8192 size blocks: 454328 aes-256-gcm's in 3.02s
Doing aes-256-gcm for 3s on 16384 size blocks: 229675 aes-256-gcm's in 3.02s
OpenSSL 1.1.1k-freebsd 24 Aug 2021
built on: reproducible build, date unspecified
options:bn(64,32) rc4(int) des(long) 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 62136.60k 178706.61k 581182.84k 997794.58k 1234190.25k 1244608.23k

Diff Detail

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

Event Timeline

pkubaj edited the test plan for this revision. (Show Details)
jhibbits added a subscriber: jhibbits.

Thanks for adding this!

This revision is now accepted and ready to land.Nov 23 2021, 9:43 PM

I am okay with it as powerpc maintainers approved.