OpenSSL
OpenSSL can use three different implementations of the cryptographic methods, providing different performance tiers:
- Portable C-based methods: most portable but typically the slowest.
- Processor family assembler based methods: faster but less portable, and may have problems on some processor compatible implementations
- Methods utilizing hardware acceleration: typically the fastest option, but has specific hardware requirements
A simple compile time option ('no-asm') disables the assembler implementations used by default, so a. & b. are simple to test. For c. appropriate hardware is required. Fortunately three of the options supported by OpenSSL are available to us:
- VIA PadLock (Wikipedia): as implemented in the VIA C3 Nehemiah processors (Wikipedia)
- Intel Advanced Encryption Standard New Instructions (AES-NI; Wikipedia): implemented on Intel x86_64 since 2010 and AMD x86_64 processors since 2011
- Intel SHA extensions (SHA Ext.; Wikipedia): implemented on Intel x86_64 processors from 2016 and AMD Ryzen from 2017
To illustrate the effect on performance a set of methods have been selected which show the effects of each type of implementation.
Using the results for 8,192 byte blocks:
VIA Luke @ 1.0 GHz | ||||||
---|---|---|---|---|---|---|
OpenSSL 1.1.0l on Debian Linux 11 for x86 | ||||||
Method | AES-256 CBC | IDEA CBC | MD5 | SHA-1 | SHA-256 | SHA-512 |
no-asm | 6,916.78k | 9,684.21k | 80,191.49k | 36,410.71k | 12,064.09k | 1,832.28k |
asm | 11,122.01k | 9,661.10k | 106,332.16k | 45,978.97k | 21,534.04k | 9,393.49k |
Kerneld,e | 11,127.92k | 9,655.64k | 104,336.04k | 45,566.63k | 21,515.64k | 9,374.38k |
Padlockb | 520,596.10k | 9,662.71k | 104,357.28k | 45,472.50k | 21,460.31k | 9,376.82k |
OpenSSL 3.0.2 on Debian Linux 11 for x86 | ||||||
Method | AES-256 CBC | IDEAa CBC | MD5 | SHA-1 | SHA-256 | SHA-512 |
no-asm | 6,916.47k | 9,662.71k | 78,665.19k | 36,050.26k | 12,125.81k | 1,829.55k |
asm | 11,127.47k | 9,655.64k | 103,931.19k | 45,509.29k | 21,493.73k | 9,368.92k |
Kerneld | 2,033,909.76k | 9,627.65k | 104,328.02k | 45,512.02k | 21,442.15k | 9,366.19k |
Padlockb | 515,844.78k | 9,658.37k | 103,765.33k | 45,520.21k | 21,435.73k | 9,368.92k |
AMD Ryzen 5 3600 | ||||||
OpenSSL 1.1.0l with Debian Linux 11 for x86_64 | ||||||
Method | AES-256 CBC | IDEA CBC | MD5 | SHA-1 | SHA-256 | SHA-512 |
no-asm | 212,366.68k | 119,010.65k | 749,469.70k | 845,922.30k | 307,301.03k | 553,937.58k |
asm | 232,721.07k | 119,545.86k | 793,971.37k | 1,050,842.45k | 470,701.40k | 604,972.40k |
AES-NI & SHA Ext. | 1,086,559.57k | 119,250.94k | 790,495.23k | 1,027,295.91k | 470,671.36k | 605,863.94k |
Kerneld,e | 1,092,332.20k | 120,416.94k | 787,464.19k | 1,029,693.44k | 475,791.36k | 601,159.00k |
OpenSSL 3.0.2 with Debian Linux 11 for x86_64 | ||||||
Method | AES-256 CBC | IDEAa CBC | MD5 | SHA-1 | SHA-256 | SHA-512 |
no-asm | 210,668.20k | 117,587.97k | 740,698.79k | 832,288.09k | 310,059.01k | 559,205.03k |
asmc | 1,097,910.95k | 119,048.87k | 789,848.06k | 1,036,997.97k | 473,503.06k | 599,274.84k |
Kerneld | 37,086,822.40k | 120,220.33k | 793,990.49k | 1,041,334.27k | 474,685.44k | 598,278.14k |
Notes:
- In OpenSSL 3.0.2 access to the IDEA method requires use of the legacy provider (to use without installing $ LD_LIBRARY_PATH=`pwd` apps/openssl speed -provider-path ./providers/ -provider legacy -provider default idea)
- The OpenSSL PadLock engine only supports AES on our VIA Luke (C3 Nehemiah) based system, more recent versions of the VIA PadLock hardware provide additional methods, including SHA
- On systems that support AES-NI and/or SHA Ext. the standard assembler implementations in OpenSSL 3.0.2, detect and use the instruction set extensions to accelerate the methods
- The OpenSSL 'afalg' engine (used for "Kernel") uses the Linux Kernel Crypto API (AF_ALG) to access the methods in the Linux kernel, which make use of hardware acceleration and processor features beyond those used by the standard assembler implementations in OpenSSL
- The OpenSSL 1.1.0 implementation of the 'afalg' engine only supports use of the kernel methods for AES-128-CBC