Benchmarking wolfCrypt with NXP’s Hardware Security Engine (HSE) on S32K

wolfSSL supports hardware-accelerated cryptography on NXP parts that use the Hardware Security Engine (HSE), a secure coprocessor built into NXP’s product lines. The HSE runs NXP proprietary firmware on a dedicated core and talks to the application core over a Messaging Unit (MU). It performs cryptographic operations, manages a protected key store, and enforces access policies on those keys. wolfSSL reaches the HSE through wolfCrypt’s crypto callbacks, so your application keeps using the normal wolfSSL API while the HSE does the work. Keys are held inside the HSE and referenced by handle rather than by value, so keys are never exposed to application memory.

NXP ships the HSE firmware in several variants for different product lines, and wolfSSL can support any of them, including:

  • S32K3 microcontrollers (HSE_B)

    • Including the ACE found on the S32K388
  • S32G3 vehicle network processors (HSE_H)
  • MCX E32/E31 microcontrollers (ELE_HSEB)
  • Other NXP parts that run the HSE firmware

Currently Supported HSE Algorithms:

Random number generation:

  • Hardware TRNG

Hashing:

  • SHA-256

Symmetric encryption:

  • AES-CBC with 128-bit and 256-bit keys
  • AES-GCM with 128-bit and 256-bit keys
  • AES-ECB with 128-bit and 256-bit keys
    • Also supported on the ACE: encrypt and decrypt, 128-bit and 256-bit keys

Message authentication:

  • AES-CMAC with 128, 192, and 256-bit keys
    • Also supported on the ACE: 128-bit and 256-bit keys

Asymmetric:

  • RSA sign and verify, encrypt and decrypt (PKCS #1 v1.5) on 2048-bit and 4096-bit
  • ECDSA sign and verify on P-256 and P-521
  • ECC and RSA key generation inside the HSE

Key agreement:

  • ECDH on P-256 and P-521, with the shared secret kept inside the HSE

SHE (Secure Hardware Extension):

  • SHE key loading and updating with the M1 through M5 memory-update protocol, including M4 and M5 verification
  • SHE key-usage and protection flags
  • AES and CMAC operations with SHE-managed keys
  • Reading the device identity

Benchmarks:

Setup:

Hardware NXP S32K388 (board S32K388EVB-Q289). The benchmark runs on Cortex-M7 core 0. HW is the HSE, reached through the wolfSSL HSE port’s crypto callback FreeRTOS,. Caches and MPU on.
Clock Core clock 48 MHz from FIRC; HSE clock 48 MHz. The benchmark clock is the FreeRTOS tick at 1000 Hz.

Public key operations (HSE-accelerated):
ECDSA
P-256 Sign/Verify

Engine Operations per second (ops/s) Time per operation
C 27.59 36.2 ms
ASM 54.26 18.4 ms
HSE 32.32 30.9 ms

Engine Operations per second (ops/s) Time per operation
C 16.03 62.4 ms
ASM 40.62 24.6 ms
HSE 33.07 30.2 ms

P-521 Sign/Verify

Engine Operations per second (ops/s) Time per operation
C 2.87 348.2 ms
ASM 6.32 158.1 ms
HSE 11.44 87.4 ms

Engine Operations per second (ops/s) Time per operation
C 1.46 686.5 ms
ASM 3.14 318.5 ms
HSE 8.95 111.7 ms

RSA
2048 bit key Sign/Verify

Engine Operations per second (ops/s) Time per operation
C 0.558 1793.0 ms
ASM 2.43 411.8 ms
HSE 4.77 209.7 ms

Engine Operations per second (ops/s) Time per operation
C 32.50 30.8 ms
ASM 96.55 10.4 ms
HSE 184.89 5.4 ms

4096 bit key Sign/Verify

Engine Operations per second (ops/s) Time per operation
C 0.060 16.6 s
ASM 0.347 2885.5 ms
HSE 0.815 1227.0 ms

Engine Operations per second (ops/s) Time per operation
C 7.04 142.1 ms
ASM 27.16 36.8 ms
HSE 77.30 12.9 ms

AES:

AES-ECB
128 bit key Encrypt/Decrypt

AES-128-ECB encrypt speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.496 0.834 0.939 1.003 1.041 1.059 1.069 1.074 1.071 1.069 1.071 1.071
ASM 1.313 1.599 1.660 1.689 1.731 1.744 1.749 1.727 1.734 1.727 1.723 1.723
HSE 0.054 0.213 0.408 0.753 1.325 2.110 2.482 3.018 3.377 3.477 3.594 3.647
ACE 0.027 0.352 0.666 1.212 1.994 3.018 3.992 4.776 5.109 5.391 5.509 5.597

AES-128-ECB decrypt speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.492 0.821 0.925 0.990 1.025 1.044 1.051 1.056 1.054 1.052 1.052 1.053
ASM 1.278 1.597 1.660 1.690 1.728 1.717 1.733 1.732 1.725 1.712 1.715 1.713
HSE 0.054 0.207 0.393 0.714 1.195 1.797 2.063 2.415 2.638 2.701 2.767 2.802
ACE 0.027 0.350 0.661 1.207 1.986 3.009 3.984 4.772 5.109 5.385 5.509 5.597

256 bit key Encrypt/Decrypt

AES-256-ECB encrypt speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.429 0.664 0.732 0.771 0.791 0.802 0.808 0.810 0.810 0.809 0.809 0.810
ASM 1.034 1.215 1.241 1.268 1.286 1.292 1.285 1.271 1.281 1.277 1.274 1.278
HSE 0.054 0.208 0.396 0.717 1.214 1.853 2.129 2.515 2.769 2.837 2.913 2.951
ACE 0.027 0.352 0.666 1.213 1.994 3.018 3.984 4.776 5.109 5.391 5.509 5.591

AES-256-ECB decrypt speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.427 0.655 0.719 0.757 0.777 0.789 0.795 0.795 0.795 0.794 0.795 0.795
ASM 1.003 1.196 1.225 1.258 1.256 1.253 1.280 1.269 1.266 1.263 1.263 1.263
HSE 0.054 0.205 0.379 0.662 1.063 1.528 1.710 1.953 2.096 2.136 2.176 2.198
ACE 0.027 0.351 0.660 1.207 1.984 3.009 3.976 4.772 5.109 5.385 5.509 5.591

AES-CBC
128 bit key Encrypt/Decrypt

AES-128-CBC encrypt speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.493 0.784 0.870 0.921 0.949 0.963 0.971 0.975 0.972 0.972 0.971 0.972
ASM 1.415 1.637 1.687 1.713 1.728 1.728 1.729 1.742 1.733 1.717 1.722 1.722
HSE 0.053 0.201 0.396 0.738 1.289 2.075 2.428 2.950 3.312 3.412 3.524 3.586

AES-128-CBC decrypt speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.491 0.777 0.862 0.912 0.940 0.954 0.963 0.962 0.963 0.962 0.963 0.963
ASM 1.354 1.573 1.618 1.644 1.658 1.658 1.651 1.682 1.662 1.648 1.648 1.651
HSE 0.052 0.200 0.379 0.689 1.157 1.756 2.010 2.360 2.586 2.641 2.713 2.752

256 bit key Encrypt/Decrypt

AES-256-CBC encrypt speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.429 0.633 0.688 0.719 0.736 0.746 0.749 0.752 0.751 0.750 0.750 0.750
ASM 1.093 1.221 1.241 1.253 1.267 1.266 1.270 1.268 1.269 1.262 1.262 1.263
HSE 0.053 0.201 0.386 0.702 1.189 1.827 2.095 2.472 2.720 2.786 2.866 2.903

AES-256-CBC decrypt speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.425 0.624 0.680 0.710 0.727 0.736 0.740 0.742 0.740 0.740 0.740 0.740
ASM 1.046 1.168 1.196 1.209 1.211 1.223 1.224 1.223 1.218 1.213 1.211 1.215
HSE 0.052 0.196 0.365 0.646 1.038 1.500 1.677 1.914 2.058 2.097 2.141 2.162

AES-128-GCM encrypt speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.132 0.301 0.382 0.442 0.480 0.501 0.512 0.516 0.517 0.517 0.518 0.518
ASM 0.233 0.511 0.639 0.731 0.788 0.819 0.835 0.844 0.843 0.844 0.845 0.845
HSE 0.029 0.115 0.226 0.432 0.801 1.389 1.903 2.552 3.070 3.315 3.517 3.626

AES-128-GCM decrypt speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.128 0.289 0.367 0.424 0.460 0.480 0.490 0.494 0.494 0.495 0.495 0.495
ASM 0.232 0.511 0.639 0.731 0.788 0.819 0.838 0.845 0.844 0.842 0.845 0.845
HSE 0.030 0.116 0.230 0.439 0.812 1.401 1.920 2.563 3.078 3.321 3.521 3.625

256 bit key Encrypt/Decrypt

AES-128-GCM decrypt speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.122 0.269 0.337 0.386 0.416 0.433 0.442 0.446 0.446 0.447 0.447 0.448
ASM 0.213 0.451 0.555 0.629 0.673 0.697 0.714 0.716 0.717 0.717 0.718 0.719
HSE 0.029 0.113 0.220 0.415 0.752 1.264 1.681 2.173 2.547 2.716 2.849 2.920

AES-256-GCM decrypt speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.118 0.260 0.326 0.372 0.401 0.417 0.426 0.429 0.429 0.429 0.430 0.430
ASM 0.212 0.450 0.555 0.630 0.674 0.697 0.713 0.717 0.718 0.717 0.718 0.718
HSE 0.029 0.115 0.223 0.423 0.761 1.277 1.694 2.186 2.558 2.716 2.852 2.923

Hashing and message authentication:

SHA-256
One message hashed in updates of the block size, then one final.

SHA-256 speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.914 1.047 1.069 1.083 1.092 1.095 1.098 1.099 1.100 1.098 1.100 1.101
ASM 1.341 1.695 1.737 1.766 1.780 1.785 1.790 1.792 1.792 1.786 1.786 1.786
HSE 0.035 0.054 0.107 0.213 0.422 0.827 1.586 2.713 4.210 5.463 7.469 9.125

AES-CMAC
128 bit key

AES-128-CMAC speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.420 0.664 0.735 0.776 0.798 0.810 0.815 0.819 0.820 0.801 0.828 0.843
ASM 0.944 1.054 1.074 1.086 1.093 1.095 1.095 1.098 1.094 1.061 1.106 1.129
HSE 0.013 0.051 0.099 0.193 0.367 0.666 1.047 1.544 2.021 2.095 2.767 3.299
ACE 0.076 0.276 0.492 0.809 1.193 1.567 1.854 1.657 — — — —

256 bit key

AES-256-CMAC speed (MiB/s)
Engine 16 B 64 B 128 B 256 B 512 B 1 KiB 2 KiB 4 KiB 8 KiB 16 KiB 32 KiB 64 KiB
C 0.372 0.552 0.600 0.627 0.642 0.649 0.652 0.655 0.656 0.644 0.661 0.671
ASM 0.774 0.857 0.876 0.880 0.885 0.885 0.884 0.888 0.891 0.863 0.891 0.907
HSE 0.013 0.050 0.099 0.191 0.358 0.639 0.980 1.403 1.785 1.840 2.344 2.712
ACE 0.076 0.276 0.492 0.809 1.194 1.567 1.854 1.656 — — — —

Questions?

Want to know if we support your NXP part or HSE firmware version, or need an algorithm or HSE operation that isn’t listed here? Email us at facts@wolfssl.com or call +1 425 245 8247.

Download wolfSSL Now