Cryptographic Performances on STM32G4 Series

Revision as of 15:14, 6 May 2021 by Registered User (Created page with "{{DISPLAYTITLE:Cryptographic Performances on STM32G4 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 STM32G474RET6
Device ID 0x469
Revision ID 0x2000
Board NUCLEO-G474RE RevC

1.2. Firmware Configuration

Cryptographic Library version 040000B1

1.3. System Configuration

System Core Clock Frequency 170 MHz
Flash latency 8 wait states
Voltage scaling Range 0
Dual bank 0 (0: Single / 1: Dual)
Instruction Cache (ART/ICU) 1 (0: disabled / 1: enabled)
Data Cache (ART/DCU) 1 (0: disabled / 1: enabled)
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 6993 41 µs
AES CBC 128Bits 32 bytes Encryption Fast 8860 52 µs
AES CBC 128Bits 64 bytes Encryption Small 10888 64 µs
AES CBC 128Bits 64 bytes Encryption Fast 14364 84 µs
AES CBC 128Bits 128 bytes Encryption Small 18572 109 µs
AES CBC 128Bits 128 bytes Encryption Fast 25151 147 µs
AES CBC 192Bits 32 bytes Encryption Small 7521 44 µs
AES CBC 192Bits 32 bytes Encryption Fast 9815 57 µs
AES CBC 192Bits 64 bytes Encryption Small 12022 70 µs
AES CBC 192Bits 64 bytes Encryption Fast 16291 95 µs
AES CBC 192Bits 128 bytes Encryption Small 20943 123 µs
AES CBC 192Bits 128 bytes Encryption Fast 28738 169 µs
AES CBC 256Bits 32 bytes Encryption Small 8947 52 µs
AES CBC 256Bits 32 bytes Encryption Fast 11230 66 µs
AES CBC 256Bits 64 bytes Encryption Small 14108 82 µs
AES CBC 256Bits 64 bytes Encryption Fast 18495 108 µs
AES CBC 256Bits 128 bytes Encryption Small 24080 141 µs
AES CBC 256Bits 128 bytes Encryption Fast 32657 192 µs
AES CBC 128Bits 32 bytes Decryption Small 11239 66 µs
AES CBC 128Bits 32 bytes Decryption Fast 12335 72 µs
AES CBC 128Bits 64 bytes Decryption Small 18951 111 µs
AES CBC 128Bits 64 bytes Decryption Fast 17811 104 µs
AES CBC 128Bits 128 bytes Decryption Small 34403 202 µs
AES CBC 128Bits 128 bytes Decryption Fast 28649 168 µs
AES CBC 192Bits 32 bytes Decryption Small 12455 73 µs
AES CBC 192Bits 32 bytes Decryption Fast 14250 83 µs
AES CBC 192Bits 64 bytes Decryption Small 21794 128 µs
AES CBC 192Bits 64 bytes Decryption Fast 20754 122 µs
AES CBC 192Bits 128 bytes Decryption Small 40409 237 µs
AES CBC 192Bits 128 bytes Decryption Fast 33476 196 µs
AES CBC 256Bits 32 bytes Decryption Small 14549 85 µs
AES CBC 256Bits 32 bytes Decryption Fast 16193 95 µs
AES CBC 256Bits 64 bytes Decryption Small 25416 149 µs
AES CBC 256Bits 64 bytes Decryption Fast 23435 137 µs
AES CBC 256Bits 128 bytes Decryption Small 47180 277 µs
AES CBC 256Bits 128 bytes Decryption Fast 37869 222 µs
Cryptolib STM32G474 AES CBC SB Enc.svg
Cryptolib STM32G474 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 2936 bytes 380 bytes 1 bytes 524 bytes
Encryption Fast 3188 bytes 1404 bytes 1 bytes 548 bytes
Decryption Small 3068 bytes 636 bytes 1 bytes 552 bytes
Decryption Fast 3644 bytes 1660 bytes 1 bytes 556 bytes
Cryptolib STM32G474 AES CBC SB Enc FP.svg
Cryptolib STM32G474 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 995848 1365 kB/s
AES CBC 128Bits 8000 bytes 128 bytes Encryption Fast 1376936 987 kB/s
AES CBC 128Bits 8000 bytes 512 bytes Encryption Small 981672 1385 kB/s
AES CBC 128Bits 8000 bytes 512 bytes Encryption Fast 1325952 1025 kB/s
AES CBC 128Bits 8000 bytes 1024 bytes Encryption Small 979264 1388 kB/s
AES CBC 128Bits 8000 bytes 1024 bytes Encryption Fast 1312832 1035 kB/s
AES CBC 128Bits 8000 bytes 2048 bytes Encryption Small 978088 1390 kB/s
AES CBC 128Bits 8000 bytes 2048 bytes Encryption Fast 1306064 1041 kB/s
AES CBC 192Bits 8000 bytes 128 bytes Encryption Small 1142656 1190 kB/s
AES CBC 192Bits 8000 bytes 128 bytes Encryption Fast 1600632 849 kB/s
AES CBC 192Bits 8000 bytes 512 bytes Encryption Small 1133704 1199 kB/s
AES CBC 192Bits 8000 bytes 512 bytes Encryption Fast 1550344 877 kB/s
AES CBC 192Bits 8000 bytes 1024 bytes Encryption Small 1132152 1201 kB/s
AES CBC 192Bits 8000 bytes 1024 bytes Encryption Fast 1538360 884 kB/s
AES CBC 192Bits 8000 bytes 2048 bytes Encryption Small 1131416 1202 kB/s
AES CBC 192Bits 8000 bytes 2048 bytes Encryption Fast 1531480 888 kB/s
AES CBC 256Bits 8000 bytes 128 bytes Encryption Small 1303512 1043 kB/s
AES CBC 256Bits 8000 bytes 128 bytes Encryption Fast 1825304 745 kB/s
AES CBC 256Bits 8000 bytes 512 bytes Encryption Small 1289280 1054 kB/s
AES CBC 256Bits 8000 bytes 512 bytes Encryption Fast 1767080 769 kB/s
AES CBC 256Bits 8000 bytes 1024 bytes Encryption Small 1286864 1056 kB/s
AES CBC 256Bits 8000 bytes 1024 bytes Encryption Fast 1755480 774 kB/s
AES CBC 256Bits 8000 bytes 2048 bytes Encryption Small 1285672 1057 kB/s
AES CBC 256Bits 8000 bytes 2048 bytes Encryption Fast 1749592 777 kB/s
AES CBC 128Bits 8000 bytes 128 bytes Decryption Small 2007112 677 kB/s
AES CBC 128Bits 8000 bytes 128 bytes Decryption Fast 1439616 944 kB/s
AES CBC 128Bits 8000 bytes 512 bytes Decryption Small 1982184 686 kB/s
AES CBC 128Bits 8000 bytes 512 bytes Decryption Fast 1395696 974 kB/s
AES CBC 128Bits 8000 bytes 1024 bytes Decryption Small 1977008 687 kB/s
AES CBC 128Bits 8000 bytes 1024 bytes Decryption Fast 1386136 981 kB/s
AES CBC 128Bits 8000 bytes 2048 bytes Decryption Small 1971088 689 kB/s
AES CBC 128Bits 8000 bytes 2048 bytes Decryption Fast 1377064 987 kB/s
AES CBC 192Bits 8000 bytes 128 bytes Decryption Small 2379848 571 kB/s
AES CBC 192Bits 8000 bytes 128 bytes Decryption Fast 1666904 815 kB/s
AES CBC 192Bits 8000 bytes 512 bytes Decryption Small 2355176 577 kB/s
AES CBC 192Bits 8000 bytes 512 bytes Decryption Fast 1614960 842 kB/s
AES CBC 192Bits 8000 bytes 1024 bytes Decryption Small 2348760 579 kB/s
AES CBC 192Bits 8000 bytes 1024 bytes Decryption Fast 1602424 848 kB/s
AES CBC 192Bits 8000 bytes 2048 bytes Decryption Small 2342600 580 kB/s
AES CBC 192Bits 8000 bytes 2048 bytes Decryption Fast 1596944 851 kB/s
AES CBC 256Bits 8000 bytes 128 bytes Decryption Small 2749360 494 kB/s
AES CBC 256Bits 8000 bytes 128 bytes Decryption Fast 1906672 713 kB/s
AES CBC 256Bits 8000 bytes 512 bytes Decryption Small 2724360 499 kB/s
AES CBC 256Bits 8000 bytes 512 bytes Decryption Fast 1857408 732 kB/s
AES CBC 256Bits 8000 bytes 1024 bytes Decryption Small 2721888 499 kB/s
AES CBC 256Bits 8000 bytes 1024 bytes Decryption Fast 1839936 739 kB/s
AES CBC 256Bits 8000 bytes 2048 bytes Decryption Small 2718888 500 kB/s
AES CBC 256Bits 8000 bytes 2048 bytes Decryption Fast 1830112 743 kB/s
Cryptolib STM32G474 AES CBC DF Enc.svg
Cryptolib STM32G474 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 2828 bytes 372 bytes 1 bytes 140 bytes
Encryption Fast 3080 bytes 1396 bytes 1 bytes 172 bytes
Decryption Small 2960 bytes 628 bytes 1 bytes 176 bytes
Decryption Fast 3536 bytes 1652 bytes 1 bytes 180 bytes
Cryptolib STM32G474 AES CBC DF Enc FP.svg
Cryptolib STM32G474 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 6240 36 µs
SHA256 64 bytes 9708 57 µs
SHA256 128 bytes 12833 75 µs
SHA384 32 bytes 20316 119 µs
SHA384 64 bytes 20522 120 µs
SHA384 128 bytes 37709 221 µs
Cryptolib STM32G474 HASH SB Dig.svg


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

HASH Mode Code Constant data Global Data Stack usage
SHA256 1848 296 bytes 1 bytes 564 bytes
SHA384 3004 744 bytes 1 bytes 1124 bytes
Cryptolib STM32G474 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 431844 3149 kB/s
SHA256 8000 bytes 512 bytes 404819 3359 kB/s
SHA256 8000 bytes 1024 bytes 400219 3398 kB/s
SHA256 8000 bytes 2048 bytes 397919 3417 kB/s
SHA384 8000 bytes 128 bytes 1109125 1226 kB/s
SHA384 8000 bytes 512 bytes 1055668 1288 kB/s
SHA384 8000 bytes 1024 bytes 1046404 1299 kB/s
SHA384 8000 bytes 2048 bytes 1041772 1305 kB/s
Cryptolib STM32G474 HASH DF Dig.svg


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

HASH Mode Cycles Time
SHA256 4932 29 µs
SHA384 18731 110 µs

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

HASH Mode Code Constant data Global Data Stack usage
SHA256 1856 bytes 288 bytes 1 bytes 372 bytes
SHA384 3012 bytes 736 bytes 1 bytes 828 bytes
Cryptolib STM32G474 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 3146816 18 ms
SECP256R1 Signature Small High 3060560 18 ms
SECP256R1 Signature SuperFast Low 3042360 17 ms
SECP256R1 Signature SuperFast High 2957360 17 ms
SECP256R1 Verification Small Low 7704120 45 ms
SECP256R1 Verification Small High 6821808 40 ms
SECP256R1 Verification SuperFast Low 7414376 43 ms
SECP256R1 Verification SuperFast High 6575536 38 ms
SECP384R1 Signature Small Low 8498928 49 ms
SECP384R1 Signature Small High 8140592 47 ms
SECP384R1 Signature Fast Low 8480176 49 ms
SECP384R1 Signature Fast High 8102872 47 ms
SECP384R1 Verification Small Low 20555648 120 ms
SECP384R1 Verification Small High 17872888 105 ms
SECP384R1 Verification Fast Low 20536648 120 ms
SECP384R1 Verification Fast High 17816224 104 ms
Cryptolib STM32G474 ECDSA Sig.svg
Cryptolib STM32G474 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 11732 bytes 1184 bytes 1 bytes 328 bytes 628 bytes
SECP256R1 Signature Small High 11732 bytes 1568 bytes 1 bytes 328 bytes 696 bytes
SECP256R1 Signature SuperFast Low 13042 bytes 1184 bytes 1 bytes 332 bytes 628 bytes
SECP256R1 Signature SuperFast High 13042 bytes 1568 bytes 1 bytes 332 bytes 696 bytes
SECP256R1 Verification Small Low 12216 bytes 1200 bytes 1 bytes 424 bytes 856 bytes
SECP256R1 Verification Small High 12216 bytes 1584 bytes 1 bytes 424 bytes 1648 bytes
SECP256R1 Verification SuperFast Low 13526 bytes 1200 bytes 1 bytes 428 bytes 856 bytes
SECP256R1 Verification SuperFast High 13526 bytes 1584 bytes 1 bytes 428 bytes 1648 bytes
SECP384R1 Signature Small Low 11732 bytes 1664 bytes 1 bytes 328 bytes 884 bytes
SECP384R1 Signature Small High 11732 bytes 2240 bytes 1 bytes 328 bytes 984 bytes
SECP384R1 Signature Fast Low 12102 bytes 1664 bytes 1 bytes 344 bytes 884 bytes
SECP384R1 Signature Fast High 12102 bytes 2240 bytes 1 bytes 344 bytes 984 bytes
SECP384R1 Verification Small Low 12216 bytes 1680 bytes 1 bytes 424 bytes 1192 bytes
SECP384R1 Verification Small High 12216 bytes 2256 bytes 1 bytes 424 bytes 2272 bytes
SECP384R1 Verification Fast Low 12586 bytes 1680 bytes 1 bytes 440 bytes 1192 bytes
SECP384R1 Verification Fast High 12586 bytes 2256 bytes 1 bytes 440 bytes 2272 bytes
Cryptolib STM32G474 ECDSA SECP256R1 Sig FP.svg
Cryptolib STM32G474 ECDSA SECP256R1 Ver FP.svg
Cryptolib STM32G474 ECDSA SECP384R1 Sig FP.svg
Cryptolib STM32G474 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 5034568 29 ms
Ed25519 1023 bytes Signature Small OptHigh 2936224 17 ms
Ed25519 1023 bytes Signature SuperFast OptLow 4867600 28 ms
Ed25519 1023 bytes Signature SuperFast OptHigh 2857728 16 ms
Ed25519 1023 bytes Verification Small OptLow 7482072 44 ms
Ed25519 1023 bytes Verification Small OptHigh 6556072 38 ms
Ed25519 1023 bytes Verification SuperFast OptLow 7202600 42 ms
Ed25519 1023 bytes Verification SuperFast OptHigh 6341968 37 ms
Cryptolib STM32G474 EdDSA Sig.svg
Cryptolib STM32G474 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 14088 bytes 1744 bytes 1 bytes 1236 bytes 1388 bytes
Ed25519 1023 bytes Signature Small OptHigh 14494 bytes 2896 bytes 1 bytes 1236 bytes 1388 bytes
Ed25519 1023 bytes Signature SuperFast OptLow 15398 bytes 1744 bytes 1 bytes 1236 bytes 1388 bytes
Ed25519 1023 bytes Signature SuperFast OptHigh 15804 bytes 2896 bytes 1 bytes 1236 bytes 1388 bytes
Ed25519 1023 bytes Verification Small OptLow 14178 bytes 1748 bytes 1 bytes 1244 bytes 1152 bytes
Ed25519 1023 bytes Verification Small OptHigh 14584 bytes 2900 bytes 1 bytes 1244 bytes 1992 bytes
Ed25519 1023 bytes Verification SuperFast OptLow 15488 bytes 1748 bytes 1 bytes 1244 bytes 1152 bytes
Ed25519 1023 bytes Verification SuperFast OptHigh 15894 bytes 2900 bytes 1 bytes 1244 bytes 1992 bytes
Cryptolib STM32G474 EdDSA Sig FP.svg
Cryptolib STM32G474 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 187676128 1103 ms
v2.2 CRT SHA-256 3K Signature Small Mid 141312344 831 ms
v2.2 CRT SHA-256 3K Signature Small High 118686408 698 ms
v2.2 CRT SHA-256 3K Signature Fast Low 187014168 1100 ms
v2.2 CRT SHA-256 3K Signature Fast Mid 141097208 829 ms
v2.2 CRT SHA-256 3K Signature Fast High 118396064 696 ms
v2.2 No CRT SHA-256 3K Signature Small Low 713575920 4197 ms
v2.2 No CRT SHA-256 3K Signature Small Mid 536012128 3153 ms
v2.2 No CRT SHA-256 3K Signature Small High 448377888 2637 ms
v2.2 No CRT SHA-256 3K Signature Fast Low 712492720 4191 ms
v2.2 No CRT SHA-256 3K Signature Fast Mid 535410056 3149 ms
v2.2 No CRT SHA-256 3K Signature Fast High 447765488 2633 ms
v2.2 n/a SHA-256 3K Verification Small n/a 3801888 22 ms
v2.2 n/a SHA-256 3K Verification Fast n/a 3780824 22 ms
Cryptolib STM32G474 RSA Sig.svg
Cryptolib STM32G474 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 7034 bytes 370 bytes 5 bytes 700 bytes 3704 bytes
v2.2 CRT SHA-256 3K Signature Small Mid 7282 bytes 370 bytes 5 bytes 700 bytes 4308 bytes
v2.2 CRT SHA-256 3K Signature Small High 7282 bytes 370 bytes 5 bytes 700 bytes 6708 bytes
v2.2 CRT SHA-256 3K Signature Fast Low 7404 bytes 370 bytes 5 bytes 700 bytes 3704 bytes
v2.2 CRT SHA-256 3K Signature Fast Mid 7652 bytes 370 bytes 5 bytes 700 bytes 4308 bytes
v2.2 CRT SHA-256 3K Signature Fast High 7652 bytes 370 bytes 5 bytes 700 bytes 6708 bytes
v2.2 No CRT SHA-256 3K Signature Small Low 6064 bytes 362 bytes 5 bytes 700 bytes 3484 bytes
v2.2 No CRT SHA-256 3K Signature Small Mid 6312 bytes 362 bytes 5 bytes 700 bytes 4664 bytes
v2.2 No CRT SHA-256 3K Signature Small High 6312 bytes 362 bytes 5 bytes 700 bytes 9368 bytes
v2.2 No CRT SHA-256 3K Signature Fast Low 6434 bytes 362 bytes 5 bytes 700 bytes 3484 bytes
v2.2 No CRT SHA-256 3K Signature Fast Mid 6682 bytes 362 bytes 5 bytes 700 bytes 4664 bytes
v2.2 No CRT SHA-256 3K Signature Fast High 6682 bytes 362 bytes 5 bytes 700 bytes 9368 bytes
v2.2 n/a SHA-256 3K Verification Small n/a 6810 bytes 366 bytes 5 bytes 716 bytes 3108 bytes
v2.2 n/a SHA-256 3K Verification Fast n/a 7180 bytes 366 bytes 5 bytes 716 bytes 3108 bytes
Cryptolib STM32G474 RSA 3K CRT Sig FP.svg
Cryptolib STM32G474 RSA 3K NoCRT Sig FP.svg
Cryptolib STM32G474 RSA 3K Ver FP.svg


No categories assignedEdit