目次

last update: 2024/04

FreeRTOS用BSPパッケージ
第3章: 暗号・サイファーライブラリ
評価ボード:EK-RX671




テストサンプル

Demo Sample Application Folder:

Application
 └ _Exclude
     ├ CRYPTO  ....... 暗号・サイファー機能のデモサンプル
Sample説明
CRYPTO_Bench_AESAES 暗号ライブラリのベンチマークテスト
CRYPTO_Bench_CamelliaCamellia 暗号ライブラリのベンチマークテスト
CRYPTO_Bench_DESDES 暗号ライブラリのベンチマークテスト
CRYPTO_Bench_ECDHECDH 鍵アグリーメントライブラリのベンチマークテスト
CRYPTO_Bench_ECDSAECDSA デジタル署名暗号(Sign・Verify)のベンチマークテスト
CRYPTO_Bench_EdDSAEdDSA デジタル署名暗号(Sign・Verify)のベンチマークテスト
CRYPTO_Bench_MD5MD5 ハッシュアルゴリズムライブラリのベンチマークテスト
CRYPTO_Bench_SHA1SHA-1 ハッシュアルゴリズムライブラリのベンチマークテスト
CRYPTO_Bench_SHA3SHA-3 ハッシュアルゴリズムライブラリのベンチマークテスト
CRYPTO_Bench_SHA256SHA-256 ハッシュアルゴリズムライブラリのベンチマークテスト

関連設定ファイル:

BSP
 |- Setup
     |- CRYPTO_X_Config_Full_Generic.c  .... 初期化設定ファイル

Config
 |- CRYPTO_Conf.h  ............... コンフィグレーション設定ファイル 
 |
 |- OS
 |   |- libFreeRT_OSLayer_RXv3_L.lib  ....... OSインターフェース設定ファイル
 |
 |- SYS   ........................ SYS インターフェース設定(ソース・ヘッダ)

ビルド・動作確認方法

プロジェクト設定では「\Application\_Exclude\CRYPTO」フォルダはビルド対象外に設定しています。

「\_Exclude\CRYPTO」フォルダ下の動作確認を行うテストサンプルファイルをビルド対象設定の「\Application」フォルダ下にコピーします。
プロジェクトを再ビルドし、評価ボードに接続してデバッグセッションを開始します。
デバッガのIOコンソールのログ画面から結果を確認します。

テストレポート

Sample: CRYPTO_Bench_AES

Debug IO Console:

Eval Board: EK-RX671
Base: FreeRTOS V10.0.0
------------------------------------------------
AES Benchmark compiled Apr  7 2024 18:57:48

Compiler: CC-RX V3.05.00
System:   Processor speed               = 120.000 MHz
Config:   CRYPTO_VERSION                = 24001 [2.40a]
Config:   CRYPTO_CONFIG_AES_OPTIMIZE    = 7
Config:   CRYPTO_CONFIG_AES_HW_OPTIMIZE = 1
Config:   CRYPTO_CONFIG_GCM_OPTIMIZE    = 0

+--------------+------+-----------------+-----------------+
|              |      | ECB        MB/s | CBC        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| AES          |  128 |    1.36    1.44 |    1.26    1.31 |
| AES          |  192 |    1.13    1.21 |    1.07    1.12 |
| AES          |  256 |    0.97    1.04 |    0.93    0.97 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| AES          |  128 |    0.09    0.09 |    0.62    0.62 |
| AES          |  192 |    0.09    0.09 |    0.52    0.52 |
| AES          |  256 |    0.10    0.10 |    0.45    0.45 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_Camellia

Debug IO Console:

Eval Board: EK-RX671
Base: FreeRTOS V10.0.0
------------------------------------------------
Camellia Benchmark compiled Apr  7 2024 19:01:55

Compiler: CC-RX V3.05.00
System:   Processor speed                 = 120.000 MHz
Config:   CRYPTO_VERSION                  = 24001 [2.40a]
Config:   CRYPTO_CONFIG_CAMELLIA_OPTIMIZE = 3
Config:   CRYPTO_CONFIG_GCM_OPTIMIZE      = 0

+--------------+------+-----------------+-----------------+
|              |      | ECB        MB/s | CBC        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| CAMELLIA     |  128 |    2.04    2.12 |    1.82    1.86 |
| CAMELLIA     |  192 |    1.59    1.61 |    1.46    1.46 |
| CAMELLIA     |  256 |    1.59    1.61 |    1.46    1.45 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| Camellia     |  128 |    0.10    0.10 |    0.89    0.89 |
| Camellia     |  192 |    0.09    0.09 |    0.71    0.71 |
| Camellia     |  256 |    0.09    0.09 |    0.71    0.71 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_DES

Debug IO Console:

Eval Board: EK-RX671
Base: FreeRTOS V10.0.0
------------------------------------------------
DES Benchmark compiled Apr  7 2024 19:05:15

Compiler: CC-RX V3.05.00
System:   Processor speed               = 120.000 MHz
Config:   CRYPTO_VERSION                = 24001 [2.40a]
Config:   CRYPTO_CONFIG_DES_OPTIMIZE    = 5

+--------------+------+---------------+---------------+
|              |      | ECB      MB/s | CBC      MB/s |
| Cipher       | Bits |    Enc    Dec |    Enc    Dec |
+--------------+------+---------------+---------------+
| DES          |   64 |   1.42   1.45 |   1.30   1.27 |
| DES          |  128 |   0.49   0.50 |   0.47   0.48 |
| DES          |  192 |   0.49   0.50 |   0.47   0.48 |
+--------------+------+---------------+---------------+

* Note: key sizes include parity bits

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDH

Debug IO Console:

Eval Board: EK-RX671
Base: FreeRTOS V10.0.0
------------------------------------------------
ECDH Key Agreement Benchmark compiled Apr  7 2024 19:08:07

Compiler: CC-RX V3.05.00
System:   Processor speed          = 120.000 MHz
Config:   Static heap size         = 3256 bytes
Config:   CRYPTO_VERSION           = 24001 [2.40a]
Config:   CRYPTO_MPI_BITS_PER_LIMB = 32

This benchmarks both ends of an ECDH key agreement, but
timing is reported as the time for one end's calculation.

+------------------+--------------+--------------+
| Curve            | ms/Agreement |       Memory |
+------------------+--------------+--------------+
| secp192r1        |       118.10 |          704 |
| secp192k1        |       166.83 |          704 |
| secp224r1        |       144.38 |          792 |
| secp224k1        |       233.33 |          792 |
| secp256r1        |       224.50 |          880 |
| secp256k1        |       311.00 |          880 |
| secp384r1        |       409.25 |         1232 |
| secp521r1        |       885.50 |         1628 |
| brainpoolP160r1  |       120.70 |          616 |
| brainpoolP160t1  |       117.40 |          616 |
| brainpoolP192r1  |       171.00 |          704 |
| brainpoolP192t1  |       167.17 |          704 |
| brainpoolP224r1  |       230.50 |          792 |
| brainpoolP224t1  |       216.00 |          792 |
| brainpoolP256r1  |       317.50 |          880 |
| brainpoolP256t1  |       297.25 |          880 |
| brainpoolP320r1  |       512.00 |         1056 |
| brainpoolP320t1  |       471.75 |         1056 |
| brainpoolP384r1  |       805.50 |         1232 |
| brainpoolP384t1  |       774.00 |         1232 |
| brainpoolP512r1  |      1692.50 |         1584 |
| brainpoolP512t1  |      1526.50 |         1584 |
+------------------+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDSA

Debug IO Console:

Eval Board: EK-RX671
Base: FreeRTOS V10.0.0
------------------------------------------------
ECDSA Sign and Verify Benchmark compiled Apr  7 2024 19:10:23

Compiler: CC-RX V3.05.00
System:   Processor speed                   = 120.000 MHz
Config:   Static heap size                  = 4440 bytes
Config:   CRYPTO_VERSION                    = 24001 [2.40a]
Config:   CRYPTO_MPI_BITS_PER_LIMB          = 32
Config:   CRYPTO_CONFIG_ECDSA_TWIN_MULTIPLY = 1

+------------------+-----------+-----------+-----------+-----------+
|                  |      Sign |     Sign  |    Verify |    Verify |
| Curve            |        ms |     bytes |        ms |     bytes |
+------------------+-----------+-----------+-----------+-----------+
| secp192r1        |     30.06 |      1152 |     28.83 |      1920 |
| secp192k1        |     42.58 |      1152 |     40.00 |      1920 |
| secp224r1        |     36.89 |      1296 |     35.10 |      2160 |
| secp224k1        |     57.89 |      1296 |     53.85 |      2160 |
| secp256r1        |     57.78 |      1440 |     54.30 |      2400 |
| secp256k1        |     77.93 |      1440 |     73.29 |      2400 |
| secp384r1        |    106.70 |      2016 |    100.40 |      3360 |
| secp521r1        |    231.17 |      2664 |    213.00 |      4440 |
| brainpoolP160r1  |     30.88 |      1008 |     30.56 |      1680 |
| brainpoolP160t1  |     28.92 |      1008 |     27.05 |      1680 |
| brainpoolP192r1  |     44.79 |      1152 |     41.67 |      1920 |
| brainpoolP192t1  |     41.15 |      1152 |     38.00 |      1920 |
| brainpoolP224r1  |     59.06 |      1296 |     56.44 |      2160 |
| brainpoolP224t1  |     54.35 |      1296 |     50.95 |      2160 |
| brainpoolP256r1  |     83.33 |      1440 |     75.43 |      2400 |
| brainpoolP256t1  |     75.50 |      1440 |     70.19 |      2400 |
| brainpoolP320r1  |    128.88 |      1728 |    118.20 |      2880 |
| brainpoolP320t1  |    120.60 |      1728 |    110.50 |      2880 |
| brainpoolP384r1  |    211.33 |      2016 |    195.00 |      3360 |
| brainpoolP384t1  |    196.83 |      2016 |    180.67 |      3360 |
| brainpoolP512r1  |    440.75 |      2592 |    392.75 |      4320 |
| brainpoolP512t1  |    392.25 |      2592 |    361.75 |      4320 |
+------------------+-----------+-----------+-----------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_EdDSA

Debug IO Console:

Eval Board: EK-RX671
Base: FreeRTOS V10.0.0
------------------------------------------------
EdDSA Sign and Verify Benchmark compiled Apr  7 2024 19:14:03

Compiler: CC-RX V3.05.00
System:   Processor speed          = 120.000 MHz
Config:   Static heap size         = 3844 bytes
Config:   CRYPTO_VERSION           = 24001 [2.40a]
Config:   CRYPTO_MPI_BITS_PER_LIMB = 32

+--------------+--------------+
| Curve        | ms/Sign      |
+--------------+--------------+
| Ed25519      |        55.89 |
| Ed448        |       125.75 |
+--------------+--------------+

+--------------+--------------+
| Curve        | ms/Verify    |
+--------------+--------------+
| Ed25519      |       126.50 |
| Ed448        |       276.25 |
+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_MD5

Debug IO Console:

Eval Board: EK-RX671
Base: FreeRTOS V10.0.0
------------------------------------------------
MD5 Benchmark compiled Apr  7 2024 19:15:43

Compiler: CC-RX V3.05.00
System:   Processor speed               = 120.000 MHz
Config:   CRYPTO_VERSION                = 24001 [2.40a]
Config:   CRYPTO_CONFIG_MD5_OPTIMIZE    = 1
Config:   CRYPTO_CONFIG_MD5_HW_OPTIMIZE = 1

+--------------+-----------+
| Algorithm    | Hash MB/s |
+--------------+-----------+
| MD5          |      5.38 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA1

Debug IO Console:

Eval Board: EK-RX671
Base: FreeRTOS V10.0.0
------------------------------------------------
SHA-1 Benchmark compiled Apr  7 2024 19:16:44

Compiler: CC-RX V3.05.00
System:   Processor speed                = 120.000 MHz
Config:   CRYPTO_VERSION                 = 24001 [2.40a]
Config:   CRYPTO_CONFIG_SHA1_OPTIMIZE    = 1
Config:   CRYPTO_CONFIG_SHA1_HW_OPTIMIZE = 1

+--------------+-----------+
| Algorithm    | Hash MB/s |
+--------------+-----------+
| SHA-1        |      2.85 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA3

Debug IO Console:

Eval Board: EK-RX671
Base: FreeRTOS V10.0.0
------------------------------------------------
SHA-3 Benchmark compiled Apr  7 2024 19:17:50

Compiler: CC-RX V3.05.00
System:   Processor speed                = 120.000 MHz
Config:   CRYPTO_VERSION                 = 24001 [2.40a]
Config:   CRYPTO_CONFIG_SHA3_OPTIMIZE    = 1

+--------------+-----------+
| Algorithm    | Hash MB/s |
+--------------+-----------+
| SHA-3        |      0.52 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA256

Debug IO Console:

Eval Board: EK-RX671
Base: FreeRTOS V10.0.0
------------------------------------------------
SHA-256 Benchmark compiled Apr  7 2024 19:18:57

Compiler: CC-RX V3.05.00
System:   Processor speed                  = 120.000 MHz
Config:   CRYPTO_VERSION                   = 24001 [2.40a]
Config:   CRYPTO_CONFIG_SHA256_OPTIMIZE    = 1
Config:   CRYPTO_CONFIG_SHA256_HW_OPTIMIZE = 1

+--------------+-----------+
| Algorithm    | Hash MB/s |
+--------------+-----------+
| SHA-224 (SW) |      2.66 |
| SHA-256 (SW) |      2.66 |
+--------------+-----------+

Benchmark complete

STOP.
前の章

圧縮・解凍機能のデモサンプル

次の章

FAT32 ファイルシステム