This is evaluated against a rocket core with Zb/Zk support (note: current impl only needs 1 cycle for aes64esm, with considerable hardware cost) with this config running in 100MHz on an xc7k325tffg900-2 FPGA board.
We have the following implementations of AES
We will also evaluate the following implementations of GHASH
- pure C version
- rv64i zbb zbc asm from #17640
All openssl are statically compiled (busybox rootfs) using riscv64-musl-ubuntu-18.04-nightly-2022.04.23-nightly.tar.gz as the toolchain (CC="riscv64-unknown-linux-musl-gcc" ./config linux64-riscv64 --static -static
), and the flags are
version: 3.1.0-dev
built on: Wed Apr 27 12:28:05 2022 UTC
options: bn(64,64)
compiler: riscv64-unknown-linux-gnu-gcc -fPIC -pthread -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
CPUINFO: N/A
You may get the compiled binary from here. In this archive, openssl-c
is compiled from master,
openssl
is compiled from the result of merging #17640 and #18197. If you want to enable zkn/zbb/zbc, you need to export OPENSSL_riscvcap="rv64gc_zknd_zkne_zbb_zbc"
. openssl-zkn
always turns on zknd/zkne
.
Thus, to evaluate aes-gcm, you need to use openssl-c
, openssl
, OPENSSL_riscvcap="rv64gc_zbb_zbc" openssl
, openssl-zkn
, OPENSSL_riscvcap="rv64gc_zbb_zbc" openssl-zkn
.
The results are produced via openssl speed -evp aes-128-cbc
and similar commands.
- pure C
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes
aes-128-cbc 992.20k 1151.62k 1205.93k 1219.90k 1206.95k 1202.94k
aes-192-cbc 870.31k 1000.02k 1043.09k 1047.55k 1040.38k 1039.65k
aes-256-cbc 778.06k 878.81k 910.42k 919.20k 912.04k 912.04k
- rv64i asm
aes-128-cbc 1117.01k 1311.21k 1374.95k 1380.69k 1365.33k 1364.42k
aes-192-cbc 985.86k 1127.53k 1173.76k 1185.31k 1171.46k 1164.84k
aes-256-cbc 862.07k 987.25k 1020.25k 1031.88k 1024.00k 1021.27k
- rv64i zknd zkne asm
aes-128-cbc 2982.12k 5290.10k 6566.44k 6993.92k 6991.97k 6673.75k
aes-192-cbc 2882.87k 4948.61k 6093.14k 6458.37k 6430.72k 6191.95k
aes-256-cbc 2626.09k 4543.57k 5619.41k 5985.43k 5955.58k 5739.86k
- pure C
AES-128-GCM 669.18k 789.44k 820.31k 829.82k 824.68k 824.66k
AES-192-GCM 613.60k 710.79k 737.11k 748.31k 740.27k 740.27k
AES-256-GCM 567.73k 652.84k 669.44k 676.18k 676.73k 677.21k
- rv64i asm AES with pure C GHASH
AES-128-GCM 769.17k 879.58k 913.38k 917.50k 912.35k 912.04k
AES-192-GCM 701.95k 794.22k 820.23k 827.08k 819.20k 816.48k
AES-256-GCM 645.42k 723.03k 743.17k 748.99k 745.47k 743.25k
- rv64i asm AES with rv64i zbb zbc asm GHASH
AES-128-GCM 1071.15k 1280.19k 1357.49k 1366.02k 1356.20k 1348.95k
AES-192-GCM 944.85k 1110.39k 1164.59k 1177.77k 1157.80k 1157.80k
AES-256-GCM 844.49k 974.10k 1018.61k 1024.68k 1016.47k 1015.81k
- rv64i zknd zkne AES with pure C GHASH
AES-128-GCM 1454.57k 1826.72k 1960.41k 1992.36k 1966.08k 1956.22k
AES-192-GCM 1428.87k 1783.33k 1914.54k 1945.94k 1926.08k 1906.01k
AES-256-GCM 1406.88k 1743.47k 1870.34k 1902.11k 1882.24k 1862.31k
- rv64i zknd zkne AES with rv64i zbb zbc asm GHASH
AES-128-GCM 2997.58k 5072.03k 6260.44k 6614.36k 6605.66k 6346.07k
AES-192-GCM 2902.73k 4780.91k 5834.40k 6132.05k 6120.71k 5887.32k
AES-256-GCM 2790.03k 4505.79k 5467.53k 5721.77k 5682.52k 5507.00k
- pure C
AES-128-ECB 1094.13k 1260.14k 1312.85k 1328.12k 1306.37k 1305.26k
AES-192-ECB 961.99k 1086.69k 1124.69k 1132.56k 1116.84k 1117.84k
AES-256-ECB 847.37k 946.86k 971.52k 980.16k 972.63k 969.89k
- rv64i asm AES
AES-128-ECB 1269.05k 1456.46k 1512.19k 1529.49k 1504.15k 1490.94k
AES-192-ECB 1081.70k 1232.67k 1275.98k 1284.97k 1267.03k 1261.57k
AES-256-ECB 973.74k 1074.26k 1106.45k 1111.67k 1094.08k 1095.92k
- rv64i zknd zkne asm AED
AES-128-ECB 4478.88k 8493.74k 11570.60k 12583.56k 12566.53k 11736.41k
AES-192-ECB 4240.11k 7866.35k 10170.45k 10936.32k 10934.54k 10267.31k
AES-256-ECB 3888.08k 7267.68k 9070.42k 9681.42k 9622.87k 9134.49k
- pure C
AES-128-CFB 917.28k 1004.54k 1082.73k 1090.78k 1079.48k 1072.31k
AES-192-CFB 823.19k 914.43k 941.65k 946.18k 939.35k 936.23k
AES-256-CFB 745.31k 816.36k 843.34k 844.46k 838.31k 838.25k
- rv64i asm
AES-128-CFB 338.70k 355.04k 358.66k 360.28k 361.65k 359.91k
AES-192-CFB 325.36k 337.29k 343.55k 345.90k 345.64k 346.06k
AES-256-CFB 311.81k 327.06k 328.87k 330.83k 332.03k 332.03k
- rv64i zknd zkne asm
AES-128-CFB 428.22k 457.01k 463.45k 467.14k 465.39k 465.02k
AES-192-CFB 426.39k 454.89k 460.29k 462.85k 464.21k 464.21k
AES-256-CFB 423.84k 452.54k 459.52k 462.34k 459.95k 461.83k
- pure C
AES-128-CTR 841.20k 990.67k 1025.37k 1026.73k 1021.27k 1015.81k
AES-192-CTR 793.91k 873.56k 898.22k 907.22k 898.65k 895.66k
AES-256-CTR 719.43k 771.75k 807.13k 807.94k 805.55k 802.82k
- rv64i asm
AES-128-CTR 331.19k 347.53k 349.70k 352.90k 351.09k 351.47k
AES-192-CTR 317.47k 331.01k 335.45k 335.19k 337.48k 336.36k
AES-256-CTR 307.51k 318.98k 323.87k 322.90k 324.95k 324.44k
- rv64i zknd zkne asm
AES-128-CTR 422.02k 444.53k 450.30k 451.93k 453.29k 451.78k
AES-192-CTR 418.08k 442.71k 448.51k 451.72k 450.56k 451.78k
AES-256-CTR 414.99k 438.55k 445.78k 448.64k 447.83k 446.34k
- pure C
AES-128-OFB 937.65k 1051.63k 1090.73k 1100.37k 1086.81k 1083.19k
AES-192-OFB 838.62k 922.20k 955.25k 956.76k 950.27k 947.11k
AES-256-OFB 759.83k 823.06k 845.23k 850.37k 846.51k 843.69k
- rv64i asm
AES-128-OFB 338.41k 354.54k 359.68k 360.45k 361.97k 361.09k
AES-192-OFB 326.45k 337.02k 344.53k 344.06k 345.64k 346.06k
AES-256-OFB 312.18k 326.96k 330.23k 332.20k 332.03k 333.14k
- rv64i zknd zkne asm
AES-128-OFB 432.85k 460.03k 465.66k 468.51k 466.56k 468.11k
AES-192-OFB 431.09k 456.45k 464.13k 467.14k 465.39k 466.56k
AES-256-OFB 425.91k 455.15k 460.29k 463.37k 462.67k 462.67k
- pure C
AES-128-CCM 281.98k 483.10k 588.89k 621.23k 630.78k 633.51k
AES-192-CCM 248.12k 416.60k 503.38k 533.58k 538.88k 542.48k
AES-256-CCM 217.79k 364.82k 439.64k 465.42k 472.41k 473.56k
- rv64i asm
AES-128-CCM 318.22k 548.56k 676.17k 717.49k 725.73k 723.94k
AES-192-CCM 278.81k 470.10k 570.11k 605.15k 616.45k 615.08k
AES-256-CCM 244.97k 411.01k 499.76k 527.75k 535.21k 537.00k
- rv64i zknd zkne asm
AES-128-CCM 1255.25k 2669.89k 3968.51k 4475.80k 4542.59k 4427.52k
AES-192-CCM 1142.58k 2470.68k 3606.77k 4029.44k 4090.54k 4011.07k
AES-256-CCM 1085.42k 2300.51k 3309.76k 3670.36k 3723.39k 3642.71k
- pure C
AES-128-OCB 955.12k 1073.37k 1145.92k 1159.96k 1145.24k 1141.42k
AES-192-OCB 848.50k 960.06k 995.99k 1001.47k 991.81k 988.50k
AES-256-OCB 760.24k 849.12k 877.85k 885.64k 876.74k 873.81k
- rv64i asm
AES-128-OCB 1061.44k 1250.25k 1305.69k 1318.23k 1299.80k 1294.34k
AES-192-OCB 939.57k 1077.00k 1125.37k 1129.13k 1120.58k 1119.57k
AES-256-OCB 847.00k 954.28k 991.21k 998.31k 982.50k 983.04k
- rv64i zknd zkne asm
AES-128-OCB 1046.05k 1246.97k 1301.83k 1315.45k 1298.66k 1290.04k
AES-192-OCB 929.53k 1080.77k 1124.43k 1133.93k 1116.84k 1117.84k
AES-256-OCB 834.92k 945.92k 987.70k 994.55k 983.04k 979.77k
- pure C
AES-128-XTS 556.05k 936.43k 1118.12k 1179.48k 1182.38k 1179.65k
AES-256-XTS 437.51k 709.95k 850.54k 889.51k 898.65k 895.66k
- rv64i asm
AES-128-XTS 641.34k 1069.89k 1277.27k 1348.32k 1343.49k 1343.49k
AES-256-XTS 488.29k 803.56k 962.01k 1007.27k 1014.38k 1010.35k
- rv64i zknd zkne asm
AES-128-XTS 631.39k 1060.79k 1275.63k 1338.03k 1340.76k 1338.03k
AES-256-XTS 481.96k 799.72k 957.22k 1001.13k 1008.25k 1004.89k