目次

last update: 2024/04

embOS RTOS用BSPパッケージ
第7章: 暗号・サイファーライブラリ
評価ボード:Renesas 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
 |   |- 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:

AES Benchmark compiled Mar 26 2024 14:50:42

Eval Board: RX72N Envision Kit
RTOS:     SEGGER embOS
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.22    2.40 |    1.88    1.99 |
| AES          |  192 |    1.85    2.01 |    1.61    1.71 |
| AES          |  256 |    1.59    1.72 |    1.41    1.50 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| AES          |  128 |    0.11    0.11 |    0.92    0.92 |
| AES          |  192 |    0.11    0.11 |    0.79    0.79 |
| AES          |  256 |    0.12    0.12 |    0.69    0.69 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_Camellia

Debug IO Console:

Camellia Benchmark compiled Mar 26 2024 14:54:58

Eval Board: RX72N Envision Kit
RTOS:     SEGGER embOS
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.98    4.11 |    3.01    3.00 |
| CAMELLIA     |  192 |    3.09    3.13 |    2.47    2.44 |
| CAMELLIA     |  256 |    3.09    3.13 |    2.47    2.44 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| Camellia     |  128 |    0.11    0.11 |    1.47    1.47 |
| Camellia     |  192 |    0.10    0.10 |    1.21    1.21 |
| Camellia     |  256 |    0.11    0.11 |    1.21    1.21 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_DES

Debug IO Console:

DES Benchmark compiled Mar 26 2024 14:58:41

Eval Board: RX72N Envision Kit
RTOS:     SEGGER embOS
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.11   2.13 |   1.86   1.88 |
| DES          |  128 |   0.79   0.80 |   0.76   0.76 |
| DES          |  192 |   0.79   0.80 |   0.76   0.76 |
+--------------+------+---------------+---------------+

* Note: key sizes include parity bits

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDH

Debug IO Console:

ECDH Key Agreement Benchmark compiled Mar 26 2024 15:05:36

Eval Board: RX72N Envision Kit
RTOS:     SEGGER embOS
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        |        65.29 |          704 |
| secp192k1        |        94.29 |          704 |
| secp224r1        |        78.45 |          792 |
| secp224k1        |       122.33 |          792 |
| secp256r1        |       126.07 |          880 |
| secp256k1        |       164.50 |          880 |
| secp384r1        |       227.28 |         1232 |
| secp521r1        |       480.56 |         1628 |
| brainpoolP160r1  |        67.75 |          616 |
| brainpoolP160t1  |        62.67 |          616 |
| brainpoolP192r1  |        93.88 |          704 |
| brainpoolP192t1  |        86.25 |          704 |
| brainpoolP224r1  |       125.99 |          792 |
| brainpoolP224t1  |       114.18 |          792 |
| brainpoolP256r1  |       171.64 |          880 |
| brainpoolP256t1  |       157.22 |          880 |
| brainpoolP320r1  |       272.75 |         1056 |
| brainpoolP320t1  |       247.60 |         1056 |
| brainpoolP384r1  |       439.13 |         1232 |
| brainpoolP384t1  |       389.59 |         1232 |
| brainpoolP512r1  |       871.96 |         1584 |
| brainpoolP512t1  |       807.57 |         1584 |
+------------------+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDSA

Debug IO Console:

ECDSA Sign and Verify Benchmark compiled Mar 26 2024 15:33:56

Eval Board: RX72N Envision Kit
RTOS:     SEGGER embOS
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        |     16.58 |      1152 |     15.09 |      1920 |
| secp192k1        |     23.64 |      1152 |     22.00 |      1920 |
| secp224r1        |     20.13 |      1296 |     18.89 |      2160 |
| secp224k1        |     31.69 |      1296 |     29.88 |      2160 |
| secp256r1        |     32.13 |      1440 |     29.69 |      2400 |
| secp256k1        |     41.15 |      1440 |     37.19 |      2400 |
| secp384r1        |     56.85 |      2016 |     52.69 |      3360 |
| secp521r1        |    126.01 |      2664 |    113.44 |      4440 |
| brainpoolP160r1  |     17.17 |      1008 |     16.66 |      1680 |
| brainpoolP160t1  |     15.98 |      1008 |     15.12 |      1680 |
| brainpoolP192r1  |     24.42 |      1152 |     23.08 |      1920 |
| brainpoolP192t1  |     22.54 |      1152 |     20.67 |      1920 |
| brainpoolP224r1  |     31.65 |      1296 |     30.18 |      2160 |
| brainpoolP224t1  |     29.92 |      1296 |     28.23 |      2160 |
| brainpoolP256r1  |     43.88 |      1440 |     41.18 |      2400 |
| brainpoolP256t1  |     40.49 |      1440 |     38.23 |      2400 |
| brainpoolP320r1  |     68.24 |      1728 |     64.01 |      2880 |
| brainpoolP320t1  |     63.39 |      1728 |     59.62 |      2880 |
| brainpoolP384r1  |    110.80 |      2016 |    104.94 |      3360 |
| brainpoolP384t1  |    104.41 |      2016 |     95.75 |      3360 |
| brainpoolP512r1  |    221.91 |      2592 |    207.65 |      4320 |
| brainpoolP512t1  |    205.01 |      2592 |    184.90 |      4320 |
+------------------+-----------+-----------+-----------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_EdDSA

Debug IO Console:

EdDSA Sign and Verify Benchmark compiled Mar 26 2024 15:44:18

Eval Board: RX72N Envision Kit
RTOS:     SEGGER embOS
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      |        31.08 |
| Ed448        |        67.30 |
+--------------+--------------+

+--------------+--------------+
| Curve        | ms/Verify    |
+--------------+--------------+
| Ed25519      |        70.24 |
| Ed448        |       147.62 |
+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_MD5

Debug IO Console:

MD5 Benchmark compiled Mar 26 2024 15:52:32

Eval Board: RX72N Envision Kit
RTOS:     SEGGER embOS
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.39 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA1

Debug IO Console:

SHA-1 Benchmark compiled Mar 26 2024 15:55:08

Eval Board: RX72N Envision Kit
RTOS:     SEGGER embOS
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.76 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA3

Debug IO Console:

SHA-3 Benchmark compiled Mar 26 2024 15:56:45

Eval Board: RX72N Envision Kit
RTOS:     SEGGER embOS
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:

SHA-256 Benchmark compiled Mar 26 2024 15:58:01

Eval Board: RX72N Envision Kit
RTOS:     SEGGER embOS
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.32 |
| SHA-256 (SW) |      5.32 |
+--------------+-----------+

Benchmark complete

STOP.
前の章

セキュリティ機能の評価

次の章

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