PolarFire SoC combines four 64-bit RISC-V application cores with FPGA fabric, which makes it a natural platform for network and storage equipment that must encrypt everything it sends and stores. The U54 cores have no cryptographic instructions, so in software AES-GCM runs at about 4.7 MB/s on this device and takes most of a core to do it. This post shows what changes when the cryptography moves into the fabric, using StealthAES and StealthSHA behind StealthDMA on the PolarFire SoC Icicle Kit, with standard Linux software on top.
The Design
StealthDMA reads data from DDR memory, passes it through the cryptographic engines and writes the result back, so the processor only prepares descriptors and handles the completion. In this design it carries StealthAES with two AES engines and StealthSHA. StealthAES provides AES-GCM, AES-XTS and the SP 800-38A modes, including CBC and CTR, with 128-bit and 256-bit keys. StealthSHA provides SHA-224, SHA-256, SHA-384 and SHA-512 with HMAC. The engines connect to the processor through one AXI4 master port into the memory subsystem and one AXI4-Lite register interface.
At the 100 MHz clock of the fabric interface, the two AES engines reach 213 MB/s, or 1.7 Gbps, for AES-GCM and AES-XTS, and one AES engine reaches 107 MB/s. The table gives the area of StealthAES, StealthSHA and StealthDMA with one AES engine and with two. It also gives the area of the whole Icicle Kit design, which adds the connection of the subsystem to the processor and the PCIe controller for the kit's NVMe drive.
| Design | 4LUTs | Flip-flops | LSRAM blocks | uSRAM blocks | Logic of an MPFS250T |
|---|---|---|---|---|---|
| One AES engine | |||||
| StealthAES, StealthSHA and StealthDMA | 33,023 | 15,408 | 19 | 1 | 13 % |
| Whole Icicle Kit design | 37,756 | 20,023 | 25 | 22 | 15 % |
| Two AES engines | |||||
| StealthAES, StealthSHA and StealthDMA | 41,502 | 16,776 | 27 | 35 | 16 % |
| Whole Icicle Kit design | 46,271 | 21,400 | 33 | 56 | 18 % |
Standard Linux Interfaces
The StealthCores Linux driver registers the engines with the Linux kernel crypto API, so kernel users such as IPsec, MACsec, kernel TLS, dm-crypt and the SMB server and client pick them up without any change. An OpenSSL 3 provider makes the same engines available to OpenSSL applications such as OpenSSH, and a module of wolfCrypt crypto callbacks does the same for wolfSSL. Several processes and kernel users can share the engines at the same time, and the driver loads the key of each request into the engine when it changes.
Measured Performance
The table compares each use with the same software running on the four U54 cores at 600 MHz without the engines. The software figures are those of the Linux kernel, OpenSSL 3.5.7 and wolfSSL 5.9.4 as built for this platform, with wolfSSL's optimized code for 64-bit RISC-V. The table gives the rates with one AES engine and with two, and the speedup of two engines over software. Where a row gives two figures, they are the two directions of the transfer.
| Use | Software | One AES engine | Two AES engines | Speedup with two engines |
|---|---|---|---|---|
| The engines through the Linux driver | ||||
| AES-256-GCM, 64 KiB requests from eight threads | – | 100 MB/s | 186 MB/s (1.5 Gbps) | – |
| AES-256-XTS, 64 KiB requests from eight threads | – | 101 MB/s | 185 MB/s | – |
| SHA-512, 64 KiB requests from eight threads | – | 151 MB/s | – | |
| OpenSSL, 64 KiB buffers | ||||
| AES-256-GCM | 4.7 MB/s | 70 MB/s | 102 MB/s | 22x |
| AES-256-XTS | 6.2 MB/s | 86 MB/s | 141 MB/s | 23x |
| AES-256-CTR | 6.4 MB/s | 85 MB/s | 13x | |
| AES-256-CBC | 7.0 MB/s | 83 MB/s | 12x | |
| SHA-384 | 14.8 MB/s | 81 MB/s | 5.5x | |
| wolfSSL, 64 KiB buffers | ||||
| AES-256-GCM | 2.5 MB/s | 86 MB/s | 142 MB/s | 57x |
| SHA-384 | 15 MB/s | 56 MB/s | 3.7x | |
| Network security | ||||
| IPsec ESP with AES-256-GCM, 9000-byte MTU | 1.2 MB/s | 32 MB/s | 37 MB/s | 30x |
| IPsec ESP with AES-256-GCM, 1500-byte MTU | 1.1 MB/s | 7.5 MB/s | 8.7 MB/s | 7.9x |
| MACsec with GCM-AES-256, 9000-byte MTU | 1.2 MB/s | 31 MB/s | 33 MB/s | 27x |
| MACsec with GCM-AES-256, 1500-byte MTU | 1.1 MB/s | 11 MB/s | 11 MB/s | 10x |
| Kernel TLS 1.3 with AES-256-GCM | 2.3 MB/s | 21 MB/s | 24 MB/s | 10x |
| TLS 1.3 server with OpenSSL, send / receive | 4.0 / 4.2 MB/s | 19 / 22 MB/s | 21 / 25 MB/s | 5.3x / 6.0x |
| TLS 1.3 server with wolfSSL, send / receive | 2.3 / 2.4 MB/s | 27 / 32 MB/s | 31 / 38 MB/s | 13x / 16x |
| Storage encryption, LUKS2 with AES-256-XTS on NVMe | ||||
| Four streams, write / read | 21 / 22 MB/s | 90 / 96 MB/s | 96 / 145 MB/s | 4.6x / 6.6x |
| One stream, write / read | 19 / 21 MB/s | 60 / 80 MB/s | 67 / 117 MB/s | 3.5x / 5.6x |
| File sharing, SMB 3.1.1 with AES-128-GCM | ||||
| A PC writing to and reading from the kit | 7.6 / 5.2 MB/s | 41 / 33 MB/s | 43 / 35 MB/s | 5.7x / 6.7x |
| SSH, one session | ||||
| AES-256-GCM, upload / download | 3.0 / 3.4 MB/s | 13 / 18 MB/s | 13 / 21 MB/s | 4.4x / 6.1x |
| AES-256-CTR, upload / download | 2.6 / 2.8 MB/s | 10 / 13 MB/s | 4.0x / 4.7x | |
The first three rows show the engines through the Linux driver alone, with several requests in flight. Large requests keep the engines close to their limits of 213 MB/s with two AES engines and 107 MB/s with one. The difference is the time the processor needs to prepare and complete each request. Smaller requests take a larger share of that time. With two AES engines, a single thread sending 4 KiB requests reaches 72 MB/s, and one sending 16 KiB requests reaches 134 MB/s. With one AES engine the same threads reach 54 MB/s and 82 MB/s. The SP 800-38A modes reach 94 MB/s with 64 KiB requests from eight threads.
The rows below the libraries include all of each protocol's own work on the processor, which the engines do not change. IPsec and MACsec gain the most, because the kernel spends most of its time in the cipher when it runs in software. With 1500-byte packets the per-packet work of the kernel and the driver sets the limit rather than the engines.
Through the driver, one AES engine runs AES-GCM and AES-XTS at about 100 MB/s, which is a little over half the rate of two engines. The libraries keep 60 to 70 percent of their rate with two engines. Most protocols keep 85 to 100 percent, because the work of each protocol on the processor limits them more than the engines do. LUKS2 reads are the exception, because their rate with two engines is more than one engine can decrypt. With one engine they reach 96 MB/s. The SP 800-38A modes use a single AES engine in both configurations, and StealthSHA is the same in both, so their rows and the row for SSH with AES-CTR give one figure for both.
Storage Encryption With LUKS2
The engines register AES-XTS with the kernel, so dm-crypt uses them for a LUKS2 volume as soon as the driver is loaded. The table's figures are for the kit's NVMe drive with 4 KiB sectors. With four streams the processor load falls from 99 percent of the four cores in software to 40 percent.
File Sharing With SMB 3
The Linux kernel's SMB server, ksmbd, encrypts SMB 3.1.1 sessions through the kernel crypto API, so the engines carry the encryption of every share that requires it. The table's figures are for a PC that copies a 256 MiB file to and from an encrypted share on the kit. AES-256-GCM gives the same rates.
SSH
OpenSSH uses the engines through the OpenSSL provider for both of its AES cipher families. The table's rows are for the ciphers that OpenSSH names aes256-gcm@openssh.com and aes256-ctr. With AES-256-GCM, the encryption that SSH performs on each 32 KiB packet runs at 81 MB/s with two AES engines and 58 MB/s with one, against 4.0 MB/s in software. A single session is limited by the SSH server process, which runs in one thread on one U54 core, and not by the engines. Several sessions at once share the engines, which handle 16 KiB requests from eight threads at 171 MB/s with two AES engines and 95 MB/s with one.
wolfSSL
wolfSSL applications reach the engines through wolfCrypt's crypto callbacks, with no change to the application. The wolfSSL rows compare the engines with wolfSSL's own software, so their speedups differ from those of OpenSSL. The TLS rows are for a server on the kit that sends a 64 MiB file to a PC and receives one from it.
Optional Side-Channel Countermeasures
StealthAES is also available in a countermeasure configuration that protects the AES keys against power and electromagnetic side-channel attacks. StealthAES's countermeasures are tested beyond 1 billion traces with TVLA. In a countermeasure configuration measured on the same Icicle Kit, AES-GCM, AES-XTS and SHA-2 ran at the same rates as without countermeasures. The countermeasures add area, and the amount depends on the configuration.
Availability
StealthAES, StealthSHA and StealthDMA are available for PolarFire and PolarFire SoC, and for the other FPGA families that StealthCores supports, as Verilog or VHDL. The Linux driver, the OpenSSL provider and a Yocto layer for these cores are available as StealthAPI for Linux. Contact StealthCores for the datasheets and an evaluation.