目次

last update: 2024/04

FreeRTOS用BSPパッケージ
第6章: 暗号・サイファーライブラリ
評価ボード:RX72N Envision Kit




テストサンプル

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: RX72N Envision Kit
Base: FreeRTOS V10.0.0
------------------------------------------------
AES Benchmark compiled Apr  3 2024 16:39:26

Compiler: CC-RX V3.05.00
System:   Processor speed               = 240.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 |    2.17    2.35 |    2.04    2.17 |
| AES          |  192 |    1.81    1.96 |    1.72    1.84 |
| AES          |  256 |    1.55    1.69 |    1.48    1.59 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| AES          |  128 |    0.17    0.17 |    1.01    1.01 |
| AES          |  192 |    0.17    0.17 |    0.85    0.84 |
| AES          |  256 |    0.18    0.18 |    0.73    0.73 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_Camellia

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: FreeRTOS V10.0.0
------------------------------------------------
Camellia Benchmark compiled Apr  3 2024 16:48:16

Compiler: CC-RX V3.05.00
System:   Processor speed                 = 240.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 |    3.92    4.02 |    3.51    3.51 |
| CAMELLIA     |  192 |    3.04    3.07 |    2.78    2.76 |
| CAMELLIA     |  256 |    3.04    3.07 |    2.78    2.76 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| Camellia     |  128 |    0.19    0.19 |    1.72    1.71 |
| Camellia     |  192 |    0.18    0.18 |    1.36    1.36 |
| Camellia     |  256 |    0.18    0.18 |    1.36    1.36 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_DES

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: FreeRTOS V10.0.0
------------------------------------------------
DES Benchmark compiled Apr  3 2024 16:50:47

Compiler: CC-RX V3.05.00
System:   Processor speed               = 240.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 |   2.33   2.40 |   2.16   2.20 |
| DES          |  128 |   0.81   0.82 |   0.79   0.79 |
| DES          |  192 |   0.81   0.82 |   0.79   0.79 |
+--------------+------+---------------+---------------+

* Note: key sizes include parity bits

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDH

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: FreeRTOS V10.0.0
------------------------------------------------
ECDH Key Agreement Benchmark compiled Apr  3 2024 16:53:19

Compiler: CC-RX V3.05.00
System:   Processor speed          = 240.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        |        60.17 |          704 |
| secp192k1        |        89.50 |          704 |
| secp224r1        |        72.71 |          792 |
| secp224k1        |       118.20 |          792 |
| secp256r1        |       119.00 |          880 |
| secp256k1        |       158.50 |          880 |
| secp384r1        |       219.83 |         1232 |
| secp521r1        |       461.50 |         1628 |
| brainpoolP160r1  |        63.31 |          616 |
| brainpoolP160t1  |        59.06 |          616 |
| brainpoolP192r1  |        88.67 |          704 |
| brainpoolP192t1  |        82.07 |          704 |
| brainpoolP224r1  |       119.20 |          792 |
| brainpoolP224t1  |       110.30 |          792 |
| brainpoolP256r1  |       165.38 |          880 |
| brainpoolP256t1  |       154.75 |          880 |
| brainpoolP320r1  |       258.50 |         1056 |
| brainpoolP320t1  |       243.67 |         1056 |
| brainpoolP384r1  |       421.50 |         1232 |
| brainpoolP384t1  |       396.50 |         1232 |
| brainpoolP512r1  |       871.50 |         1584 |
| brainpoolP512t1  |       826.50 |         1584 |
+------------------+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDSA

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: FreeRTOS V10.0.0
------------------------------------------------
ECDSA Sign and Verify Benchmark compiled Apr  3 2024 16:57:03

Compiler: CC-RX V3.05.00
System:   Processor speed                   = 240.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        |     15.58 |      1152 |     15.17 |      1920 |
| secp192k1        |     22.63 |      1152 |     21.19 |      1920 |
| secp224r1        |     18.85 |      1296 |     18.09 |      2160 |
| secp224k1        |     30.79 |      1296 |     28.81 |      2160 |
| secp256r1        |     29.85 |      1440 |     28.06 |      2400 |
| secp256k1        |     40.92 |      1440 |     37.39 |      2400 |
| secp384r1        |     54.65 |      2016 |     50.90 |      3360 |
| secp521r1        |    117.90 |      2664 |    110.00 |      4440 |
| brainpoolP160r1  |     16.24 |      1008 |     15.35 |      1680 |
| brainpoolP160t1  |     15.24 |      1008 |     14.39 |      1680 |
| brainpoolP192r1  |     23.41 |      1152 |     21.85 |      1920 |
| brainpoolP192t1  |     21.38 |      1152 |     20.64 |      1920 |
| brainpoolP224r1  |     30.94 |      1296 |     29.36 |      2160 |
| brainpoolP224t1  |     28.78 |      1296 |     26.66 |      2160 |
| brainpoolP256r1  |     42.88 |      1440 |     40.35 |      2400 |
| brainpoolP256t1  |     40.00 |      1440 |     37.71 |      2400 |
| brainpoolP320r1  |     68.00 |      1728 |     63.19 |      2880 |
| brainpoolP320t1  |     62.17 |      1728 |     58.83 |      2880 |
| brainpoolP384r1  |    114.20 |      2016 |    103.80 |      3360 |
| brainpoolP384t1  |    101.60 |      2016 |     93.75 |      3360 |
| brainpoolP512r1  |    230.17 |      2592 |    208.00 |      4320 |
| brainpoolP512t1  |    208.33 |      2592 |    191.17 |      4320 |
+------------------+-----------+-----------+-----------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_EdDSA

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: FreeRTOS V10.0.0
------------------------------------------------
EdDSA Sign and Verify Benchmark compiled Apr  3 2024 16:59:34

Compiler: CC-RX V3.05.00
System:   Processor speed          = 240.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      |        28.83 |
| Ed448        |        64.94 |
+--------------+--------------+

+--------------+--------------+
| Curve        | ms/Verify    |
+--------------+--------------+
| Ed25519      |        65.25 |
| Ed448        |       142.50 |
+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_MD5

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: FreeRTOS V10.0.0
------------------------------------------------
MD5 Benchmark compiled Apr  3 2024 17:22:56

Compiler: CC-RX V3.05.00
System:   Processor speed               = 240.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          |      9.13 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA1

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: FreeRTOS V10.0.0
------------------------------------------------
SHA-1 Benchmark compiled Apr  3 2024 17:26:12

Compiler: CC-RX V3.05.00
System:   Processor speed                = 240.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        |      5.63 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA3

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: FreeRTOS V10.0.0
------------------------------------------------
SHA-3 Benchmark compiled Apr  3 2024 17:27:38

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

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

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA256

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: RX72N Envision Kit
Base: FreeRTOS V10.0.0
------------------------------------------------
SHA-256 Benchmark compiled Apr  3 2024 17:29:26

Compiler: CC-RX V3.05.00
System:   Processor speed                  = 240.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) |      5.17 |
| SHA-256 (SW) |      5.17 |
+--------------+-----------+

Benchmark complete

STOP.
前の章

セキュリティ機能の評価

次の章

HTTPクライアント、JSONパーサー