目次

last update: 2024/04

OSレス環境用BSPパッケージ
第7章: 暗号・サイファーライブラリ
評価ボード: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
 |   |- libNo_OSLayer_RXv3_L.lib  ....... OSインターフェース設定ファイル
 |
 |- SYS   ........................ SYS インターフェース設定(ソース・ヘッダ)

ビルド・動作確認方法

プロジェクト設定では「\Application\_Exclude\CRYPTO」フォルダはビルド対象外に設定しています。以下のどちらかの方法で動作確認を行うサンプルアプリケーションを選択します。

  1. 「\_Exclude\CRYPTO」フォルダ下の対象テストサンプルファイルをビルド対象設定の「\Application」フォルダ下にコピーします。
  2. 「\_Exclude\CRYPTO」フォルダ下の対象テストサンプルファイルのみ「ビルド対象外」の設定を解除します。

プロジェクトを再ビルドし、評価ボードに接続してデバッグセッションを開始します。
デバッガのIOコンソールのログ画面から結果を確認します。

テストレポート

Sample: CRYPTO_Bench_AES

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: Baremetal (No RTOS)
------------------------------------------------
AES Benchmark compiled Apr  1 2024 11:30:34

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.25    2.40 |    2.11    2.22 |
| AES          |  192 |    1.87    2.01 |    1.77    1.88 |
| AES          |  256 |    1.60    1.72 |    1.53    1.63 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| AES          |  128 |    0.18    0.18 |    1.04    1.04 |
| AES          |  192 |    0.18    0.18 |    0.87    0.87 |
| AES          |  256 |    0.19    0.19 |    0.75    0.75 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_Camellia

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: Baremetal (No RTOS)
------------------------------------------------
Camellia Benchmark compiled Apr  1 2024 11:35:29

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 |    4.08    4.19 |    3.62    3.67 |
| CAMELLIA     |  192 |    3.16    3.19 |    2.88    2.88 |
| CAMELLIA     |  256 |    3.16    3.19 |    2.88    2.88 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| Camellia     |  128 |    0.19    0.19 |    1.78    1.78 |
| Camellia     |  192 |    0.18    0.18 |    1.41    1.41 |
| Camellia     |  256 |    0.19    0.19 |    1.41    1.41 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_DES

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: Baremetal (No RTOS)
------------------------------------------------
DES Benchmark compiled Apr  1 2024 12:33:19

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.41   2.44 |   2.23   2.19 |
| DES          |  128 |   0.83   0.83 |   0.80   0.80 |
| DES          |  192 |   0.83   0.83 |   0.80   0.80 |
+--------------+------+---------------+---------------+

* Note: key sizes include parity bits

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDH

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: Baremetal (No RTOS)
------------------------------------------------
ECDH Key Agreement Benchmark compiled Apr  1 2024 12:35:13

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        |        59.00 |          704 |
| secp192k1        |       133.88 |          704 |
| secp224r1        |        71.71 |          792 |
| secp224k1        |       172.83 |          792 |
| secp256r1        |       112.60 |          880 |
| secp256k1        |       226.83 |          880 |
| secp384r1        |       215.33 |         1232 |
| secp521r1        |       465.50 |         1628 |
| brainpoolP160r1  |        94.92 |          616 |
| brainpoolP160t1  |        88.17 |          616 |
| brainpoolP192r1  |       135.75 |          704 |
| brainpoolP192t1  |       123.00 |          704 |
| brainpoolP224r1  |       178.67 |          792 |
| brainpoolP224t1  |       161.00 |          792 |
| brainpoolP256r1  |       237.83 |          880 |
| brainpoolP256t1  |       218.33 |          880 |
| brainpoolP320r1  |       375.25 |         1056 |
| brainpoolP320t1  |       342.75 |         1056 |
| brainpoolP384r1  |       588.50 |         1232 |
| brainpoolP384t1  |       550.00 |         1232 |
| brainpoolP512r1  |      1154.50 |         1584 |
| brainpoolP512t1  |      1025.00 |         1584 |
+------------------+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDSA

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: Baremetal (No RTOS)
------------------------------------------------
ECDSA Sign and Verify Benchmark compiled Apr  1 2024 12:37:38

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.27 |      1152 |     14.90 |      1920 |
| secp192k1        |     32.78 |      1152 |     30.65 |      1920 |
| secp224r1        |     18.43 |      1296 |     17.72 |      2160 |
| secp224k1        |     44.21 |      1296 |     41.19 |      2160 |
| secp256r1        |     29.50 |      1440 |     28.17 |      2400 |
| secp256k1        |     58.33 |      1440 |     55.10 |      2400 |
| secp384r1        |     53.65 |      2016 |     50.55 |      3360 |
| secp521r1        |    115.70 |      2664 |    107.80 |      4440 |
| brainpoolP160r1  |     24.33 |      1008 |     23.48 |      1680 |
| brainpoolP160t1  |     22.04 |      1008 |     21.25 |      1680 |
| brainpoolP192r1  |     34.40 |      1152 |     31.09 |      1920 |
| brainpoolP192t1  |     31.53 |      1152 |     28.97 |      1920 |
| brainpoolP224r1  |     45.91 |      1296 |     41.71 |      2160 |
| brainpoolP224t1  |     40.73 |      1296 |     37.07 |      2160 |
| brainpoolP256r1  |     60.83 |      1440 |     55.78 |      2400 |
| brainpoolP256t1  |     55.72 |      1440 |     52.70 |      2400 |
| brainpoolP320r1  |     95.25 |      1728 |     88.42 |      2880 |
| brainpoolP320t1  |     85.75 |      1728 |     79.29 |      2880 |
| brainpoolP384r1  |    146.38 |      2016 |    139.38 |      3360 |
| brainpoolP384t1  |    137.00 |      2016 |    124.90 |      3360 |
| brainpoolP512r1  |    290.75 |      2592 |    265.75 |      4320 |
| brainpoolP512t1  |    271.50 |      2592 |    246.17 |      4320 |
+------------------+-----------+-----------+-----------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_EdDSA

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: Baremetal (No RTOS)
------------------------------------------------
EdDSA Sign and Verify Benchmark compiled Apr  1 2024 12:43:24

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      |        27.97 |
| Ed448        |        63.06 |
+--------------+--------------+

+--------------+--------------+
| Curve        | ms/Verify    |
+--------------+--------------+
| Ed25519      |        63.25 |
| Ed448        |       138.50 |
+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_MD5

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: Baremetal (No RTOS)
------------------------------------------------
MD5 Benchmark compiled Apr  1 2024 12:49:40

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.42 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA1

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: Baremetal (No RTOS)
------------------------------------------------
SHA-1 Benchmark compiled Apr  1 2024 12:52:13

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.67 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA3

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: Baremetal (No RTOS)
------------------------------------------------
SHA-3 Benchmark compiled Apr  1 2024 12:54:12

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.05 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA256

Debug IO Console:

Eval Board: RX72N Envision Kit
Base: Baremetal (No RTOS)
------------------------------------------------
SHA-256 Benchmark compiled Apr  1 2024 12:55:46

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.22 |
| SHA-256 (SW) |      5.23 |
+--------------+-----------+

Benchmark complete

STOP.
前の章

セキュリティ機能の評価

次の章

FAT32 ファイルシステム