Skip navigation

Crypto Library Hardware Acceleration: STM32 CRYP

The STM32 Cryptographic processor (CRYP) is a capable hardware accelerator presented as
a memory-mapped peripheral.

The SEGGER crypto library has specialized hardware-assisted ciphering support

There are two variants of the CRYP processor with different capabilities present on the following family members:

  • STM32F41x CRYP, hereafter referred to as the standard CRYP processor, and
  • STM32F43x/F47x CRYP, hereafter referred to as the enhanced CRYP processor.

The following cryptographic algorithms using using both CRYP variants:

  • DES in ECB and CBC modes.
  • TDES in ECB and CBC modes with keying options 1, 2, and 3.
  • AES-128, AES-192, and AES-256 in ECB and CBC modes.

For the enhanced CRYP processor, direct acceleration is provided for:

  • AES-128, AES-192, and AES-256 in CCM(12,4) and GCM(12,4) modes.

For the standard CRYP processor, acceleration is provided for:

  • AES-128, AES-192, and AES-256 ciphering with GCM and CCM in software.

Benchmarks

All algorithms in emCrypt can be independently tailored for higher speed or lower size. The benchmarks are done on an STM32756G-EVAL board with an STM32F756NG, running @ 200 MHz, configured for highest speed, compiled with Embedded Studio using clang.

Modular exponentiation benchmark

Copyright (c) 2014-2017 SEGGER Microcontroller GmbH & Co. KG    www.segger.com
Modular Exponentiation Benchmark compiled Dec  7 2017 16:06:48

Compiler: clang 4.0.1 (tags/RELEASE_401/final)
System:   Processor speed          = 200.000 MHz
Config:   CRYPTO_VERSION           = 22400 [2.24]
Config:   CRYPTO_MPI_BITS_PER_LIMB = 32

Modular Arithmetic Performance
==============================

CRT private key, exponent length = modulus length, all times in ms

+---------------------------+--------------------------------+--------------------------------+
|                   Modulus |                      1024 bits |                      2048 bits |
| Algorithm                 |    Time      x   Memory      x |    Time      x   Memory      x |
+---------------------------+--------------------------------+--------------------------------+
| Basic, fast               |   59.29  1.00x      700  1.00x |  329.47  1.00x     1340  1.00x |
| Basic, ladder             |   83.70  0.71x      840  1.20x |  490.12  0.67x     1608  1.20x |
| Basic, 2b, FW             |   55.15  1.08x     1260  1.80x |  307.69  1.07x     2412  1.80x |
| Basic, 3b, FW             |   51.48  1.15x     1820  2.60x |  292.47  1.13x     3484  2.60x |
| Basic, 4b, FW             |   49.49  1.20x     2940  4.20x |  280.95  1.17x     5628  4.20x |
| Basic, 5b, FW             |   49.07  1.21x     5180  7.40x |  275.33  1.20x     9916  7.40x |
| Basic, 6b, FW             |   50.42  1.18x     9660 13.80x |  273.75  1.20x    18492 13.80x |
+---------------------------+--------------------------------+--------------------------------+
| Basic, 2b, RM             |   54.28  1.09x     1260  1.80x |  304.85  1.08x     2412  1.80x |
| Basic, 3b, RM             |   51.08  1.16x     1540  2.20x |  288.57  1.14x     2948  2.20x |
| Basic, 4b, RM             |   48.95  1.21x     2100  3.00x |  277.34  1.19x     4020  3.00x |
| Basic, 5b, RM             |   47.93  1.24x     3220  4.60x |  271.07  1.22x     6164  4.60x |
| Basic, 6b, RM             |   47.98  1.24x     5460  7.80x |  267.65  1.23x    10452  7.80x |
+---------------------------+--------------------------------+--------------------------------+
| Barrett, fast             |   72.12  0.82x      980  1.40x |  345.17  0.95x     1876  1.40x |
| Barrett, ladder           |   99.66  0.59x     1120  1.60x |  511.70  0.64x     2144  1.60x |
| Barrett, 2b, FW           |   67.75  0.88x     1540  2.20x |  329.96  1.00x     2948  2.20x |
| Barrett, 3b, FW           |   62.79  0.94x     2100  3.00x |  310.01  1.06x     4020  3.00x |
| Barrett, 4b, FW           |   60.31  0.98x     3220  4.60x |  296.86  1.11x     6164  4.60x |
| Barrett, 5b, FW           |   59.68  0.99x     5460  7.80x |  290.48  1.13x    10452  7.80x |
| Barrett, 6b, FW           |   61.34  0.97x     9940 14.20x |  289.20  1.14x    19028 14.20x |
+---------------------------+--------------------------------+--------------------------------+
| Barrett, 2b, RM           |   65.62  0.90x     1540  2.20x |  323.86  1.02x     2948  2.20x |
| Barrett, 3b, RM           |   61.95  0.96x     1820  2.60x |  305.48  1.08x     3484  2.60x |
| Barrett, 4b, RM           |   59.52  1.00x     2380  3.40x |  293.20  1.12x     4556  3.40x |
| Barrett, 5b, RM           |   58.37  1.02x     3500  5.00x |  286.35  1.15x     6700  5.00x |
| Barrett, 6b, RM           |   58.38  1.02x     5740  8.20x |  281.86  1.17x    10988  8.20x |
+---------------------------+--------------------------------+--------------------------------+
| Montgomery, fast          |   34.33  1.73x      700  1.00x |  196.52  1.68x     1340  1.00x |
| Montgomery, 2b, FW        |   34.94  1.70x     1260  1.80x |  196.41  1.68x     2412  1.80x |
| Montgomery, 3b, FW        |   31.37  1.89x     1820  2.60x |  175.43  1.88x     3484  2.60x |
| Montgomery, 4b, FW        |   29.89  1.98x     2940  4.20x |  165.91  1.99x     5628  4.20x |
| Montgomery, 5b, FW        |   29.54  2.01x     5180  7.40x |  161.58  2.04x     9916  7.40x |
| Montgomery, 6b, FW        |   30.34  1.95x     9660 13.80x |  161.48  2.04x    18492 13.80x |
+---------------------------+--------------------------------+--------------------------------+
| Montgomery, 2b, RM        |   31.66  1.87x     1260  1.80x |  180.16  1.83x     2412  1.80x |
| Montgomery, 3b, RM        |   29.99  1.98x     1540  2.20x |  169.22  1.95x     2948  2.20x |
| Montgomery, 4b, RM        |   28.98  2.05x     2100  3.00x |  162.21  2.03x     4020  3.00x |
| Montgomery, 5b, RM        |   28.51  2.08x     3220  4.60x |  158.64  2.08x     6164  4.60x |
| Montgomery, 6b, RM        |   28.57  2.08x     5460  7.80x |  156.64  2.10x    10452  7.80x |
+---------------------------+--------------------------------+--------------------------------+
| Configured                |   59.39  1.00x      700  1.00x |  329.38  1.00x     1340  1.00x |
+---------------------------+--------------------------------+--------------------------------+

Public key, exponent length = 17 bits, all times in ms

+---------------------------+--------------------------------+--------------------------------+
|                   Modulus |                      1024 bits |                      2048 bits |
| Algorithm                 |    Time      x   Memory      x |    Time      x   Memory      x |
+---------------------------+--------------------------------+--------------------------------+
| Basic, fast               |    1.74  1.00x      804  1.00x |    5.78  1.00x     1572  1.00x |
| Basic, ladder             |    3.75  0.46x     1072  1.33x |   12.63  0.46x     2096  1.33x |
| Basic, 2b, FW             |    2.08  0.83x     1876  2.33x |    6.79  0.85x     3668  2.33x |
| Basic, 3b, FW             |    2.47  0.70x     2948  3.67x |    8.15  0.71x     5764  3.67x |
| Basic, 4b, FW             |    3.58  0.48x     5092  6.33x |   11.91  0.49x     9956  6.33x |
| Basic, 5b, FW             |    5.52  0.31x     9380 11.67x |   18.40  0.31x    18340 11.67x |
| Basic, 6b, FW             |    9.29  0.19x    17956 22.33x |   30.86  0.19x    35108 22.33x |
+---------------------------+--------------------------------+--------------------------------+
| Basic, 2b, RM             |    1.98  0.88x     1876  2.33x |    6.57  0.88x     3668  2.33x |
| Basic, 3b, RM             |    2.23  0.78x     2412  3.00x |    7.43  0.78x     4716  3.00x |
| Basic, 4b, RM             |    2.75  0.63x     3484  4.33x |    9.17  0.63x     6812  4.33x |
| Basic, 5b, RM             |    3.78  0.46x     5628  7.00x |   12.62  0.46x    11004  7.00x |
| Basic, 6b, RM             |    5.82  0.30x     9916 12.33x |   19.45  0.30x    19388 12.33x |
+---------------------------+--------------------------------+--------------------------------+
| Barrett, fast             |    2.05  0.84x     1340  1.67x |    6.29  0.92x     2620  1.67x |
| Barrett, ladder           |    4.34  0.40x     1608  2.00x |   13.58  0.43x     3144  2.00x |
| Barrett, 2b, FW           |    2.53  0.69x     2412  3.00x |    7.49  0.77x     4716  3.00x |
| Barrett, 3b, FW           |    2.92  0.59x     3484  4.33x |    8.82  0.66x     6812  4.33x |
| Barrett, 4b, FW           |    4.13  0.42x     5628  7.00x |   12.65  0.46x    11004  7.00x |
| Barrett, 5b, FW           |    6.24  0.28x     9916 12.33x |   19.30  0.30x    19388 12.33x |
| Barrett, 6b, FW           |   10.34  0.17x    18492 23.00x |   32.11  0.18x    36156 23.00x |
+---------------------------+--------------------------------+--------------------------------+
| Barrett, 2b, RM           |    2.32  0.75x     2412  3.00x |    7.10  0.82x     4716  3.00x |
| Barrett, 3b, RM           |    2.60  0.67x     2948  3.67x |    7.97  0.73x     5764  3.67x |
| Barrett, 4b, RM           |    3.18  0.55x     4020  5.00x |    9.76  0.59x     7860  5.00x |
| Barrett, 5b, RM           |    4.29  0.40x     6164  7.67x |   13.30  0.43x    12052  7.67x |
| Barrett, 6b, RM           |    6.51  0.27x    10452 13.00x |   20.30  0.28x    20436 13.00x |
+---------------------------+--------------------------------+--------------------------------+
| Montgomery, fast          |    1.39  1.25x      804  1.00x |    4.58  1.26x     1572  1.00x |
| Montgomery, 2b, FW        |    2.09  0.83x     1876  2.33x |    6.90  0.84x     3668  2.33x |
| Montgomery, 3b, FW        |    2.16  0.80x     2948  3.67x |    7.12  0.81x     5764  3.67x |
| Montgomery, 4b, FW        |    2.75  0.63x     5092  6.33x |    9.04  0.64x     9956  6.33x |
| Montgomery, 5b, FW        |    3.73  0.47x     9380 11.67x |   12.24  0.47x    18340 11.67x |
| Montgomery, 6b, FW        |    5.63  0.31x    17956 22.33x |   18.44  0.31x    35108 22.33x |
+---------------------------+--------------------------------+--------------------------------+
| Montgomery, 2b, RM        |    1.59  1.09x     1876  2.33x |    5.22  1.11x     3668  2.33x |
| Montgomery, 3b, RM        |    1.72  1.01x     2412  3.00x |    5.64  1.02x     4716  3.00x |
| Montgomery, 4b, RM        |    2.10  0.83x     3484  4.33x |    6.92  0.84x     6812  4.33x |
| Montgomery, 5b, RM        |    2.63  0.66x     5628  7.00x |    8.63  0.67x    11004  7.00x |
| Montgomery, 6b, RM        |    3.55  0.49x     9916 12.33x |   11.62  0.50x    19388 12.33x |
+---------------------------+--------------------------------+--------------------------------+
| Configured                |    1.74  1.00x      804  1.00x |    5.79  1.00x     1572  1.00x |
+---------------------------+--------------------------------+--------------------------------+

Benchmark complete

AES benchmark

Benchmarked on an STM32756G-EVAL board

Copyright (c) 2014-2017 SEGGER Microcontroller GmbH & Co. KG    www.segger.com
AES Benchmark compiled Dec  7 2017 16:41:41

Compiler: clang 4.0.1 (tags/RELEASE_401/final)
System:   Processor speed               = 200.000 MHz
Config:   CRYPTO_VERSION                = 22400 [2.24]
Config:   CRYPTO_CONFIG_AES_OPTIMIZE    = 7
Config:   CRYPTO_CONFIG_AES_HW_OPTIMIZE = 1

+--------------+------+-----------------+-----------------+
|              |      | ECB        MB/s | CBC        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| AES          |  128 |    3.86    3.69 |    3.03    2.76 |
| AES (HW)     |  128 |   44.66   45.90 |   45.94   45.34 |
| AES          |  192 |    2.91    2.83 |    2.60    2.38 |
| AES (HW)     |  192 |   41.08   42.09 |   42.15   41.64 |
| AES          |  256 |    2.51    2.44 |    2.28    2.10 |
| AES (HW)     |  256 |   41.04   42.06 |   42.13   41.56 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| AES          |  128 |    0.12    0.12 |    1.49    1.47 |
| AES (HW)     |  128 |    0.12    0.12 |    3.64    3.29 |
| AES          |  192 |    0.11    0.11 |    1.27    1.26 |
| AES (HW)     |  192 |    0.12    0.12 |    3.58    3.25 |
| AES          |  256 |    0.12    0.12 |    1.11    1.10 |
| AES (HW)     |  256 |    0.13    0.13 |    3.57    3.25 |
+--------------+------+-----------------+-----------------+

Benchmark complete

ECDSA benchmark

Benchmarked on an STM32756G-EVAL board

Copyright (c) 2014-2017 SEGGER Microcontroller GmbH & Co. KG    www.segger.com
ECDSA Sign and Verify Benchmark compiled Dec  7 2017 16:48:03

Compiler: clang 4.0.1 (tags/RELEASE_401/final)
System:   Processor speed                   = 200.000 MHz
Config:   Static heap size                  = 4440 bytes
Config:   CRYPTO_VERSION                    = 22400 [2.24]
Config:   CRYPTO_MPI_BITS_PER_LIMB          = 32
Config:   CRYPTO_CONFIG_ECDSA_TWIN_MULTIPLY = 1

+------------------+-----------+-----------+-----------+-----------+
|                  |      Sign |     Sign  |    Verify |    Verify |
| Curve            |        ms |     bytes |        ms |     bytes |
+------------------+-----------+-----------+-----------+-----------+
| secp192r1        |     21.85 |      1152 |     20.57 |      1920 |
| secp192k1        |     31.95 |      1152 |     30.38 |      1920 |
| secp224r1        |     26.19 |      1296 |     25.37 |      2160 |
| secp224k1        |     41.94 |      1296 |     39.18 |      2160 |
| secp256r1        |     38.35 |      1440 |     35.03 |      2400 |
| secp256k1        |     53.72 |      1440 |     48.94 |      2400 |
| secp384r1        |     62.82 |      2016 |     59.38 |      3360 |
| secp521r1        |    115.68 |      2664 |    107.50 |      4440 |
| brainpoolP160r1  |     24.66 |      1008 |     23.65 |      1680 |
| brainpoolP160t1  |     23.12 |      1008 |     22.56 |      1680 |
| brainpoolP192r1  |     32.99 |      1152 |     30.73 |      1920 |
| brainpoolP192t1  |     30.78 |      1152 |     28.32 |      1920 |
| brainpoolP224r1  |     44.11 |      1296 |     42.42 |      2160 |
| brainpoolP224t1  |     40.61 |      1296 |     38.70 |      2160 |
| brainpoolP256r1  |     58.36 |      1440 |     53.98 |      2400 |
| brainpoolP256t1  |     53.69 |      1440 |     49.33 |      2400 |
| brainpoolP320r1  |     85.99 |      1728 |     81.86 |      2880 |
| brainpoolP320t1  |     79.74 |      1728 |     73.78 |      2880 |
| brainpoolP384r1  |    130.73 |      2016 |    125.46 |      3360 |
| brainpoolP384t1  |    122.38 |      2016 |    112.62 |      3360 |
| brainpoolP512r1  |    243.69 |      2592 |    225.29 |      4320 |
| brainpoolP512t1  |    224.16 |      2592 |    205.19 |      4320 |
+------------------+-----------+-----------+-----------+-----------+

Benchmark complete