目次

last update: 2024/04

embOS RTOS用BSPパッケージ
第4章: 暗号・サイファーライブラリ
評価ボード: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
 |   |- lib_embOSLayer_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: EK-RX671
RTOS: SEGGER embOS
----------------------------------------------
AES Benchmark compiled Apr  6 2024 18:32:25

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.45 |    1.25    1.32 |
| AES          |  192 |    1.13    1.21 |    1.06    1.12 |
| AES          |  256 |    0.97    1.05 |    0.92    0.98 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| AES          |  128 |    0.09    0.09 |    0.61    0.61 |
| 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
RTOS: SEGGER embOS
----------------------------------------------
Camellia Benchmark compiled Apr  6 2024 18:41:05

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.12    2.20 |    1.89    1.91 |
| CAMELLIA     |  192 |    1.65    1.67 |    1.51    1.50 |
| CAMELLIA     |  256 |    1.65    1.67 |    1.51    1.50 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| Camellia     |  128 |    0.10    0.10 |    0.93    0.92 |
| Camellia     |  192 |    0.09    0.09 |    0.74    0.74 |
| Camellia     |  256 |    0.10    0.10 |    0.74    0.74 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_DES

Debug IO Console:

Eval Board: EK-RX671
RTOS: SEGGER embOS
----------------------------------------------
DES Benchmark compiled Apr  6 2024 18:44:51

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.21   1.25 |   1.29   1.31 |
| DES          |  128 |   0.46   0.47 |   0.48   0.48 |
| DES          |  192 |   0.46   0.47 |   0.48   0.48 |
+--------------+------+---------------+---------------+

* Note: key sizes include parity bits

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDH

Debug IO Console:

Eval Board: EK-RX671
RTOS: SEGGER embOS
----------------------------------------------
ECDH Key Agreement Benchmark compiled Apr  6 2024 18:47:03

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        |       117.33 |          704 |
| secp192k1        |       258.81 |          704 |
| secp224r1        |       140.99 |          792 |
| secp224k1        |       358.35 |          792 |
| secp256r1        |       224.05 |          880 |
| secp256k1        |       450.36 |          880 |
| secp384r1        |       418.65 |         1232 |
| secp521r1        |       897.44 |         1628 |
| brainpoolP160r1  |       185.78 |          616 |
| brainpoolP160t1  |       169.02 |          616 |
| brainpoolP192r1  |       263.22 |          704 |
| brainpoolP192t1  |       252.66 |          704 |
| brainpoolP224r1  |       367.18 |          792 |
| brainpoolP224t1  |       315.40 |          792 |
| brainpoolP256r1  |       487.78 |          880 |
| brainpoolP256t1  |       439.02 |          880 |
| brainpoolP320r1  |       726.68 |         1056 |
| brainpoolP320t1  |       696.57 |         1056 |
| brainpoolP384r1  |      1166.73 |         1232 |
| brainpoolP384t1  |      1094.22 |         1232 |
| brainpoolP512r1  |      2285.50 |         1584 |
| brainpoolP512t1  |      2116.06 |         1584 |
+------------------+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDSA

Debug IO Console:

Eval Board: EK-RX671
RTOS: SEGGER embOS
----------------------------------------------
ECDSA Sign and Verify Benchmark compiled Apr  6 2024 18:49:14

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.17 |      1152 |     28.98 |      1920 |
| secp192k1        |     65.20 |      1152 |     60.82 |      1920 |
| secp224r1        |     36.99 |      1296 |     34.58 |      2160 |
| secp224k1        |     88.01 |      1296 |     80.19 |      2160 |
| secp256r1        |     58.34 |      1440 |     55.20 |      2400 |
| secp256k1        |    115.71 |      1440 |    106.23 |      2400 |
| secp384r1        |    107.57 |      2016 |    100.39 |      3360 |
| secp521r1        |    231.75 |      2664 |    215.91 |      4440 |
| brainpoolP160r1  |     47.62 |      1008 |     43.35 |      1680 |
| brainpoolP160t1  |     43.71 |      1008 |     41.28 |      1680 |
| brainpoolP192r1  |     66.85 |      1152 |     62.58 |      1920 |
| brainpoolP192t1  |     62.71 |      1152 |     54.70 |      1920 |
| brainpoolP224r1  |     89.70 |      1296 |     84.30 |      2160 |
| brainpoolP224t1  |     80.22 |      1296 |     74.81 |      2160 |
| brainpoolP256r1  |    120.33 |      1440 |    112.70 |      2400 |
| brainpoolP256t1  |    111.44 |      1440 |    102.14 |      2400 |
| brainpoolP320r1  |    186.68 |      1728 |    177.63 |      2880 |
| brainpoolP320t1  |    172.97 |      1728 |    152.49 |      2880 |
| brainpoolP384r1  |    291.69 |      2016 |    274.99 |      3360 |
| brainpoolP384t1  |    274.42 |      2016 |    246.91 |      3360 |
| brainpoolP512r1  |    573.56 |      2592 |    530.28 |      4320 |
| brainpoolP512t1  |    508.19 |      2592 |    488.56 |      4320 |
+------------------+-----------+-----------+-----------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_EdDSA

Debug IO Console:

Eval Board: EK-RX671
RTOS: SEGGER embOS
----------------------------------------------
EdDSA Sign and Verify Benchmark compiled Apr  6 2024 18:53:23

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.61 |
| Ed448        |       125.27 |
+--------------+--------------+

+--------------+--------------+
| Curve        | ms/Verify    |
+--------------+--------------+
| Ed25519      |       125.76 |
| Ed448        |       274.86 |
+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_MD5

Debug IO Console:

Eval Board: EK-RX671
RTOS: SEGGER embOS
----------------------------------------------
MD5 Benchmark compiled Apr  6 2024 18:55:05

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

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA1

Debug IO Console:

Eval Board: EK-RX671
RTOS: SEGGER embOS
----------------------------------------------
SHA-1 Benchmark compiled Apr  6 2024 18:56:10

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

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA3

Debug IO Console:

Eval Board: EK-RX671
RTOS: SEGGER embOS
----------------------------------------------
SHA-3 Benchmark compiled Apr  6 2024 18:57:54

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

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA256

Debug IO Console:

Eval Board: EK-RX671
RTOS: SEGGER embOS
----------------------------------------------
SHA-256 Benchmark compiled Apr  6 2024 18:59:17

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.71 |
| SHA-256 (SW) |      2.71 |
+--------------+-----------+

Benchmark complete

STOP.
前の章

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

次の章

FAT32 ファイルシステム