Cryptographic Performances on STM32L1 Series

Revision as of 15:18, 6 May 2021 by Registered User (Created page with "{{DISPLAYTITLE:Cryptographic Performances on STM32L1 Series}} == Measurement configuration == === Hardware configuration === {| class="st-table" | '''''STM32 MCU''''' ||...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


1. Measurement configuration

1.1. Hardware configuration

STM32 MCU STM32L152RET6
Device ID 0x437
Revision ID 0x1008
Board STM32L152RE-Nucleo Rev C

1.2. Firmware Configuration

Cryptographic Library version 040000B1

1.3. System Configuration

System Core Clock Frequency 32 MHz
Flash latency 1 wait states
Voltage scaling Range 1
Prefetch Cache (ART) 1 (0: disabled / 1: enabled)

1.4. Development Toolchains and Compilers

IAR Embedded Workbench IAR ANSI C/C++ Compiler V8.50.4.261/W32 for ARM
Info white.png Information
NOTE: The measurements are done using a project build with High Speed optimization setting enabled.


2. Performances Values

2.1. AES Symmetric key encryption & decryption

In this section we provide the performance results for AES CBC using different modes of operation:

  • Sole buffer: one sole buffer is encrypted or decrypted. Time to perform is given in µs.
  • Data flow: a big message is encrypted or decrypted by chunk. Bit rate is given in Kbytes per s.

2.1.1. Sole buffer mode

In this mode, operation is performed in one single call to one of the CMOX library APIs to encrypt or decrypt the whole message size.

Tables below shows the clock cycles and time (in us) needed to perform described operation in small and in fast configuration.

AES Mode Key size Buffer Size Cipher Operation Configuration Cycles Time
AES CBC 128Bits 32 bytes Encryption Small 6032 188 µs
AES CBC 128Bits 32 bytes Encryption Fast 5558 173 µs
AES CBC 128Bits 64 bytes Encryption Small 9873 308 µs
AES CBC 128Bits 64 bytes Encryption Fast 8938 279 µs
AES CBC 128Bits 128 bytes Encryption Small 17550 548 µs
AES CBC 128Bits 128 bytes Encryption Fast 15693 490 µs
AES CBC 192Bits 32 bytes Encryption Small 6686 208 µs
AES CBC 192Bits 32 bytes Encryption Fast 6103 190 µs
AES CBC 192Bits 64 bytes Encryption Small 11151 348 µs
AES CBC 192Bits 64 bytes Encryption Fast 9990 312 µs
AES CBC 192Bits 128 bytes Encryption Small 20070 627 µs
AES CBC 192Bits 128 bytes Encryption Fast 17759 554 µs
AES CBC 256Bits 32 bytes Encryption Small 7683 240 µs
AES CBC 256Bits 32 bytes Encryption Fast 6986 218 µs
AES CBC 256Bits 64 bytes Encryption Small 12765 398 µs
AES CBC 256Bits 64 bytes Encryption Fast 11378 355 µs
AES CBC 256Bits 128 bytes Encryption Small 22908 715 µs
AES CBC 256Bits 128 bytes Encryption Fast 20159 629 µs
AES CBC 128Bits 32 bytes Decryption Small 10332 322 µs
AES CBC 128Bits 32 bytes Decryption Fast 7195 224 µs
AES CBC 128Bits 64 bytes Decryption Small 18478 577 µs
AES CBC 128Bits 64 bytes Decryption Fast 10680 333 µs
AES CBC 128Bits 128 bytes Decryption Small 34759 1086 µs
AES CBC 128Bits 128 bytes Decryption Fast 17651 551 µs
AES CBC 192Bits 32 bytes Decryption Small 11944 373 µs
AES CBC 192Bits 32 bytes Decryption Fast 8088 252 µs
AES CBC 192Bits 64 bytes Decryption Small 21655 676 µs
AES CBC 192Bits 64 bytes Decryption Fast 12103 378 µs
AES CBC 192Bits 128 bytes Decryption Small 41082 1283 µs
AES CBC 192Bits 128 bytes Decryption Fast 20128 629 µs
AES CBC 256Bits 32 bytes Decryption Small 13888 434 µs
AES CBC 256Bits 32 bytes Decryption Fast 9324 291 µs
AES CBC 256Bits 64 bytes Decryption Small 25171 786 µs
AES CBC 256Bits 64 bytes Decryption Fast 13868 433 µs
AES CBC 256Bits 128 bytes Decryption Small 47745 1492 µs
AES CBC 256Bits 128 bytes Decryption Fast 22958 717 µs
Cryptolib STM32L152 AES CBC SB Enc.svg
Cryptolib STM32L152 AES CBC SB Dec.svg


Table below shows flash and RAM usage (in bytes).

Cipher Operation Configuration Code Constant data Global Data Stack usage
Encryption Small 2840 bytes 380 bytes 1 bytes 524 bytes
Encryption Fast 3092 bytes 1404 bytes 1 bytes 548 bytes
Decryption Small 2972 bytes 636 bytes 1 bytes 552 bytes
Decryption Fast 3548 bytes 1660 bytes 1 bytes 556 bytes
Cryptolib STM32L152 AES CBC SB Enc FP.svg
Cryptolib STM32L152 AES CBC SB Dec FP.svg


2.1.2. Data flow mode

In this mode, operation is performed in several calls to the CMOX library APIs, as below:

  • cmox_cipher_init
  • cmox_cipher_setKey
  • cmox_cipher_setIV
  • cmox_cipher_append: called several times to encrypt or decrypt the whole message by chunk of fixed size

Tables below shows the clock cycles and bit rate (in KBytes per second) needed to perform described operation in small and in fast configuration.

AES Mode Key size Message size Chunk Size Cipher Operation Configuration Cycles Bit Rate
AES CBC 128Bits 8000 bytes 128 bytes Encryption Small 971480 263 kB/s
AES CBC 128Bits 8000 bytes 128 bytes Encryption Fast 855704 299 kB/s
AES CBC 128Bits 8000 bytes 512 bytes Encryption Small 964048 265 kB/s
AES CBC 128Bits 8000 bytes 512 bytes Encryption Fast 848288 301 kB/s
AES CBC 128Bits 8000 bytes 1024 bytes Encryption Small 962792 265 kB/s
AES CBC 128Bits 8000 bytes 1024 bytes Encryption Fast 847024 302 kB/s
AES CBC 128Bits 8000 bytes 2048 bytes Encryption Small 962160 266 kB/s
AES CBC 128Bits 8000 bytes 2048 bytes Encryption Fast 846384 302 kB/s
AES CBC 192Bits 8000 bytes 128 bytes Encryption Small 1126920 227 kB/s
AES CBC 192Bits 8000 bytes 128 bytes Encryption Fast 982512 260 kB/s
AES CBC 192Bits 8000 bytes 512 bytes Encryption Small 1119496 228 kB/s
AES CBC 192Bits 8000 bytes 512 bytes Encryption Fast 975096 262 kB/s
AES CBC 192Bits 8000 bytes 1024 bytes Encryption Small 1118224 228 kB/s
AES CBC 192Bits 8000 bytes 1024 bytes Encryption Fast 973824 262 kB/s
AES CBC 192Bits 8000 bytes 2048 bytes Encryption Small 1117600 229 kB/s
AES CBC 192Bits 8000 bytes 2048 bytes Encryption Fast 973192 263 kB/s
AES CBC 256Bits 8000 bytes 128 bytes Encryption Small 1282464 199 kB/s
AES CBC 256Bits 8000 bytes 128 bytes Encryption Fast 1109416 230 kB/s
AES CBC 256Bits 8000 bytes 512 bytes Encryption Small 1275024 200 kB/s
AES CBC 256Bits 8000 bytes 512 bytes Encryption Fast 1101984 232 kB/s
AES CBC 256Bits 8000 bytes 1024 bytes Encryption Small 1273776 200 kB/s
AES CBC 256Bits 8000 bytes 1024 bytes Encryption Fast 1100728 232 kB/s
AES CBC 256Bits 8000 bytes 2048 bytes Encryption Small 1273136 201 kB/s
AES CBC 256Bits 8000 bytes 2048 bytes Encryption Fast 1100088 232 kB/s
AES CBC 128Bits 8000 bytes 128 bytes Decryption Small 2069600 123 kB/s
AES CBC 128Bits 8000 bytes 128 bytes Decryption Fast 907416 282 kB/s
AES CBC 128Bits 8000 bytes 512 bytes Decryption Small 2059424 124 kB/s
AES CBC 128Bits 8000 bytes 512 bytes Decryption Fast 897032 285 kB/s
AES CBC 128Bits 8000 bytes 1024 bytes Decryption Small 2056472 124 kB/s
AES CBC 128Bits 8000 bytes 1024 bytes Decryption Fast 893928 286 kB/s
AES CBC 128Bits 8000 bytes 2048 bytes Decryption Small 2052976 124 kB/s
AES CBC 128Bits 8000 bytes 2048 bytes Decryption Fast 890168 287 kB/s
AES CBC 192Bits 8000 bytes 128 bytes Decryption Small 2461952 103 kB/s
AES CBC 192Bits 8000 bytes 128 bytes Decryption Fast 1039696 246 kB/s
AES CBC 192Bits 8000 bytes 512 bytes Decryption Small 2451800 104 kB/s
AES CBC 192Bits 8000 bytes 512 bytes Decryption Fast 1029312 248 kB/s
AES CBC 192Bits 8000 bytes 1024 bytes Decryption Small 2448832 104 kB/s
AES CBC 192Bits 8000 bytes 1024 bytes Decryption Fast 1026208 249 kB/s
AES CBC 192Bits 8000 bytes 2048 bytes Decryption Small 2445328 104 kB/s
AES CBC 192Bits 8000 bytes 2048 bytes Decryption Fast 1022448 250 kB/s
AES CBC 256Bits 8000 bytes 128 bytes Decryption Small 2854560 89 kB/s
AES CBC 256Bits 8000 bytes 128 bytes Decryption Fast 1172144 218 kB/s
AES CBC 256Bits 8000 bytes 512 bytes Decryption Small 2844400 90 kB/s
AES CBC 256Bits 8000 bytes 512 bytes Decryption Fast 1161784 220 kB/s
AES CBC 256Bits 8000 bytes 1024 bytes Decryption Small 2841440 90 kB/s
AES CBC 256Bits 8000 bytes 1024 bytes Decryption Fast 1158672 220 kB/s
AES CBC 256Bits 8000 bytes 2048 bytes Decryption Small 2837936 90 kB/s
AES CBC 256Bits 8000 bytes 2048 bytes Decryption Fast 1154904 221 kB/s
Cryptolib STM32L152 AES CBC DF Enc.svg
Cryptolib STM32L152 AES CBC DF Dec.svg


Table below shows flash and RAM usage (in bytes).

Cipher Operation Configuration Code Constant data Global Data Stack usage
Encryption Small 2732 bytes 372 bytes 1 bytes 140 bytes
Encryption Fast 2984 bytes 1396 bytes 1 bytes 172 bytes
Decryption Small 2864 bytes 628 bytes 1 bytes 176 bytes
Decryption Fast 3440 bytes 1652 bytes 1 bytes 180 bytes
Cryptolib STM32L152 AES CBC DF Enc FP.svg
Cryptolib STM32L152 AES CBC DF Dec FP.svg


2.2. HASH Digest

In this section we provide the performance results for HASH using different modes of operation:

  • Sole buffer: one sole buffer is hashed. Time to perform is given in us.
  • Data flow: a big message is hashed by chunk. Bit rate is given in bytes per s.

2.2.1. Sole buffer mode

In this mode, operation is performed in one single call to one of the CMOX library APIs to digest the whole message size.

Tables below shows the clock cycles and time (in µs) needed to perform described operation.

HASH Mode Buffer Size Cycles Time
SHA256 32 bytes 5724 178 µs
SHA256 64 bytes 9159 286 µs
SHA256 128 bytes 12307 384 µs
SHA384 32 bytes 19388 605 µs
SHA384 64 bytes 19626 613 µs
SHA384 128 bytes 36343 1135 µs
Cryptolib STM32L152 HASH SB Dig.svg


Table below shows flash and RAM usage (in bytes).

HASH Mode Code Constant data Global Data Stack usage
SHA256 1752 296 bytes 1 bytes 564 bytes
SHA384 2904 744 bytes 1 bytes 1124 bytes
Cryptolib STM32L152 HASH SB Dig FP.svg


2.2.2. Data flow mode

In this mode, operation is performed in several calls to the CMOX library APIs, as below:

  • cmox_hash_init
  • cmox_hash_append: called several times to hash the whole message by chunk of fixed size
  • cmox_hash_generateTag

Tables below shows the clock cycles and bit rate (in KBytes per second) needed to perform described operation.

HASH Mode Message size Chunk Size Cycles Bit Rate
SHA256 8000 bytes 128 bytes 435407 587 kB/s
SHA256 8000 bytes 512 bytes 404998 632 kB/s
SHA256 8000 bytes 1024 bytes 399822 640 kB/s
SHA256 8000 bytes 2048 bytes 397234 644 kB/s
SHA384 8000 bytes 128 bytes 1075430 238 kB/s
SHA384 8000 bytes 512 bytes 1021851 250 kB/s
SHA384 8000 bytes 1024 bytes 1012555 252 kB/s
SHA384 8000 bytes 2048 bytes 1007907 253 kB/s
Cryptolib STM32L152 HASH DF Dig.svg


Table below shows final tag generation done through the call to cmox_hash_generateTag.

HASH Mode Cycles Time
SHA256 4725 147 µs
SHA384 18114 566 µs

Table below shows flash and RAM usage (in bytes).

HASH Mode Code Constant data Global Data Stack usage
SHA256 1760 bytes 288 bytes 1 bytes 372 bytes
SHA384 2912 bytes 736 bytes 1 bytes 828 bytes
Cryptolib STM32L152 HASH DF Dig FP.svg


2.3. ECDSA Signature & Verification

In this section we provide the performance results for ECDSA Signature & Verification.

Tables below shows the clock cycles and time (in ms) needed to perform described operation in different configurations.

Curve Operation ECC Mathematics configuration Curve definition Cycles Time
SECP256R1 Signature Small Low 6131424 191 ms
SECP256R1 Signature Small High 5927864 185 ms
SECP256R1 Signature Small Low 6131424 191 ms
SECP256R1 Signature Small High 5927864 185 ms
SECP256R1 Verification Small Low 14497416 453 ms
SECP256R1 Verification Small High 12845088 401 ms
SECP256R1 Verification Small Low 14497424 453 ms
SECP256R1 Verification Small High 12845088 401 ms
SECP384R1 Signature Small Low 18333904 572 ms
SECP384R1 Signature Small High 17477232 546 ms
SECP384R1 Signature Small Low 18333904 572 ms
SECP384R1 Signature Small High 17477232 546 ms
SECP384R1 Verification Small Low 43241256 1351 ms
SECP384R1 Verification Small High 37579704 1174 ms
SECP384R1 Verification Small Low 43241256 1351 ms
SECP384R1 Verification Small High 37579712 1174 ms
Cryptolib STM32L152 ECDSA Sig.svg
Cryptolib STM32L152 ECDSA Ver.svg


Table below shows ECDSA flash and RAM usage (in bytes).

Curve Operation ECC Mathematics configuration Curve definition Code Constant data Global Data Stack usage Working buffer
SECP256R1 Signature Small Low 12954 bytes 1184 bytes 1 bytes 360 bytes 628 bytes
SECP256R1 Signature Small High 12954 bytes 1568 bytes 1 bytes 360 bytes 696 bytes
SECP256R1 Signature Small Low 12954 bytes 1184 bytes 1 bytes 360 bytes 628 bytes
SECP256R1 Signature Small High 12954 bytes 1568 bytes 1 bytes 360 bytes 696 bytes
SECP256R1 Verification Small Low 13438 bytes 1200 bytes 1 bytes 456 bytes 856 bytes
SECP256R1 Verification Small High 13438 bytes 1584 bytes 1 bytes 456 bytes 1648 bytes
SECP256R1 Verification Small Low 13438 bytes 1200 bytes 1 bytes 456 bytes 856 bytes
SECP256R1 Verification Small High 13438 bytes 1584 bytes 1 bytes 456 bytes 1648 bytes
SECP384R1 Signature Small Low 12954 bytes 1664 bytes 1 bytes 360 bytes 884 bytes
SECP384R1 Signature Small High 12954 bytes 2240 bytes 1 bytes 360 bytes 984 bytes
SECP384R1 Signature Small Low 12954 bytes 1664 bytes 1 bytes 360 bytes 884 bytes
SECP384R1 Signature Small High 12954 bytes 2240 bytes 1 bytes 360 bytes 984 bytes
SECP384R1 Verification Small Low 13438 bytes 1680 bytes 1 bytes 456 bytes 1192 bytes
SECP384R1 Verification Small High 13438 bytes 2256 bytes 1 bytes 456 bytes 2272 bytes
SECP384R1 Verification Small Low 13438 bytes 1680 bytes 1 bytes 456 bytes 1192 bytes
SECP384R1 Verification Small High 13438 bytes 2256 bytes 1 bytes 456 bytes 2272 bytes
Cryptolib STM32L152 ECDSA SECP256R1 Sig FP.svg
Cryptolib STM32L152 ECDSA SECP256R1 Ver FP.svg
Cryptolib STM32L152 ECDSA SECP384R1 Sig FP.svg
Cryptolib STM32L152 ECDSA SECP384R1 Ver FP.svg


2.4. EdDSA Signature & Verification

In this section we provide the performance results for EdDSA Signature & Verification.

Tables below shows the clock cycles and time (in ms) needed to perform described operation in different configurations.

Curve Message size Operation ECC Mathematics configuration Curve definition Cycles Time
Ed25519 1023 bytes Signature Small OptLow 9077592 283 ms
Ed25519 1023 bytes Signature Small OptHigh 5213408 162 ms
Ed25519 1023 bytes Signature Small OptLow 9077600 283 ms
Ed25519 1023 bytes Signature Small OptHigh 5213400 162 ms
Ed25519 1023 bytes Verification Small OptLow 14192240 443 ms
Ed25519 1023 bytes Verification Small OptHigh 12439136 388 ms
Ed25519 1023 bytes Verification Small OptLow 14192232 443 ms
Ed25519 1023 bytes Verification Small OptHigh 12439144 388 ms
Cryptolib STM32L152 EdDSA Sig.svg
Cryptolib STM32L152 EdDSA Ver.svg


Table below shows EdDSA flash and RAM usage (in bytes).

Curve Message size Operation ECC Mathematics configuration Curve definition Code Constant data Global Data Stack usage Working buffer
Ed25519 1023 bytes Signature Small OptLow 15306 bytes 1744 bytes 1 bytes 1236 bytes 1388 bytes
Ed25519 1023 bytes Signature Small OptHigh 15712 bytes 2896 bytes 1 bytes 1236 bytes 1388 bytes
Ed25519 1023 bytes Signature Small OptLow 15306 bytes 1744 bytes 1 bytes 1236 bytes 1388 bytes
Ed25519 1023 bytes Signature Small OptHigh 15712 bytes 2896 bytes 1 bytes 1236 bytes 1388 bytes
Ed25519 1023 bytes Verification Small OptLow 15396 bytes 1748 bytes 1 bytes 1244 bytes 1152 bytes
Ed25519 1023 bytes Verification Small OptHigh 15802 bytes 2900 bytes 1 bytes 1244 bytes 1992 bytes
Ed25519 1023 bytes Verification Small OptLow 15396 bytes 1748 bytes 1 bytes 1244 bytes 1152 bytes
Ed25519 1023 bytes Verification Small OptHigh 15802 bytes 2900 bytes 1 bytes 1244 bytes 1992 bytes
Cryptolib STM32L152 EdDSA Sig FP.svg
Cryptolib STM32L152 EdDSA Ver FP.svg


2.5. RSA Signature & Verification

In this section we provide the performance results for RSA Signature & Verification.

Tables below shows the clock cycles and time (in ms) needed to perform described operation in different configurations.

PKCS#1 Priv. key mod. exp. method Hash method Modulus size Operation RSA Mathematics configuration Priv. key mod. exp.implementation Cycles Time
v2.2 CRT SHA-256 3K Signature Small Low 471052432 14720 ms
v2.2 CRT SHA-256 3K Signature Small Mid 354206184 11068 ms
v2.2 CRT SHA-256 3K Signature Small High 296878408 9277 ms
v2.2 CRT SHA-256 3K Signature Small Low 471052432 14720 ms
v2.2 CRT SHA-256 3K Signature Small Mid 353837160 11057 ms
v2.2 CRT SHA-256 3K Signature Small High 296878408 9277 ms
v2.2 No CRT SHA-256 3K Signature Small Low 1817407016 56793 ms
v2.2 No CRT SHA-256 3K Signature Small Mid 1364481928 42640 ms
v2.2 No CRT SHA-256 3K Signature Small High 1140186872 35630 ms
v2.2 No CRT SHA-256 3K Signature Small Low 1817407032 56793 ms
v2.2 No CRT SHA-256 3K Signature Small Mid 1363729480 42616 ms
v2.2 No CRT SHA-256 3K Signature Small High 1140186872 35630 ms
v2.2 n/a SHA-256 3K Verification Small n/a 7621096 238 ms
v2.2 n/a SHA-256 3K Verification Small n/a 7634616 238 ms
Cryptolib STM32L152 RSA Sig.svg
Cryptolib STM32L152 RSA Ver.svg


Table below shows RSA flash and RAM usage (in bytes).

PKCS#1 Priv. key mod. exp. method Hash method Modulus size Operation RSA Mathematics configuration Priv. key mod. exp.implementation Code Constant data Global Data Stack usage Working buffer
v2.2 CRT SHA-256 3K Signature Small Low 8256 bytes 370 bytes 5 bytes 700 bytes 3704 bytes
v2.2 CRT SHA-256 3K Signature Small Mid 8504 bytes 370 bytes 5 bytes 700 bytes 4308 bytes
v2.2 CRT SHA-256 3K Signature Small High 8504 bytes 370 bytes 5 bytes 700 bytes 6708 bytes
v2.2 CRT SHA-256 3K Signature Small Low 8256 bytes 370 bytes 5 bytes 700 bytes 3704 bytes
v2.2 CRT SHA-256 3K Signature Small Mid 8504 bytes 370 bytes 5 bytes 700 bytes 4308 bytes
v2.2 CRT SHA-256 3K Signature Small High 8504 bytes 370 bytes 5 bytes 700 bytes 6708 bytes
v2.2 No CRT SHA-256 3K Signature Small Low 7286 bytes 362 bytes 5 bytes 700 bytes 3484 bytes
v2.2 No CRT SHA-256 3K Signature Small Mid 7534 bytes 362 bytes 5 bytes 700 bytes 4664 bytes
v2.2 No CRT SHA-256 3K Signature Small High 7534 bytes 362 bytes 5 bytes 700 bytes 9368 bytes
v2.2 No CRT SHA-256 3K Signature Small Low 7286 bytes 362 bytes 5 bytes 700 bytes 3484 bytes
v2.2 No CRT SHA-256 3K Signature Small Mid 7534 bytes 362 bytes 5 bytes 700 bytes 4664 bytes
v2.2 No CRT SHA-256 3K Signature Small High 7534 bytes 362 bytes 5 bytes 700 bytes 9368 bytes
v2.2 n/a SHA-256 3K Verification Small n/a 8032 bytes 366 bytes 5 bytes 716 bytes 3108 bytes
v2.2 n/a SHA-256 3K Verification Small n/a 8032 bytes 366 bytes 5 bytes 716 bytes 3108 bytes
Cryptolib STM32L152 RSA 3K CRT Sig FP.svg
Cryptolib STM32L152 RSA 3K NoCRT Sig FP.svg
Cryptolib STM32L152 RSA 3K Ver FP.svg


No categories assignedEdit