目次

last update: 2025/01

embOS RTOS用BSPパッケージ
第11章: 暗号・サイファーライブラリ
評価ボード:AP-RX65N-0A




テストサンプル

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 ハッシュアルゴリズムライブラリのベンチマークテスト
CRYPTO_Bench_SHA512SHA-512 ハッシュアルゴリズムライブラリのベンチマークテスト

関連設定ファイル:

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

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

ビルド・動作確認方法

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

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

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

テストレポート

Sample: CRYPTO_Bench_AES

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
RTOS: SEGGER embOS
------------------------------------------------
AES Benchmark compiled Jan 22 2025 14:10:56

Compiler: CC-RX V3.06.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 |    0.76    0.79 |    0.73    0.75 |
| AES          |  192 |    0.63    0.66 |    0.61    0.63 |
| AES          |  256 |    0.54    0.57 |    0.52    0.54 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| AES          |  128 |    0.08    0.08 |    0.36    0.36 |
| AES          |  192 |    0.08    0.08 |    0.30    0.30 |
| AES          |  256 |    0.08    0.08 |    0.26    0.26 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_Camellia

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
RTOS: SEGGER embOS
------------------------------------------------
Camellia Benchmark compiled Jan 22 2025 14:32:17

Compiler: CC-RX V3.06.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 |    1.73    1.63 |    1.57    1.47 |
| CAMELLIA     |  192 |    1.27    1.25 |    1.19    1.15 |
| CAMELLIA     |  256 |    1.27    1.25 |    1.19    1.15 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| Camellia     |  128 |    0.09    0.09 |    0.77    0.77 |
| Camellia     |  192 |    0.08    0.08 |    0.58    0.58 |
| Camellia     |  256 |    0.09    0.09 |    0.58    0.58 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_DES

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
RTOS: SEGGER embOS
------------------------------------------------
DES Benchmark compiled Jan 22 2025 14:33:50

Compiler: CC-RX V3.06.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 |   0.79   0.79 |   0.84   0.83 |
| DES          |  128 |   0.29   0.29 |   0.30   0.30 |
| DES          |  192 |   0.29   0.29 |   0.30   0.30 |
+--------------+------+---------------+---------------+

* Note: key sizes include parity bits

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDH

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
RTOS: SEGGER embOS
------------------------------------------------
ECDH Key Agreement Benchmark compiled Jan 22 2025 14:35:11

Compiler: CC-RX V3.06.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        |       137.47 |          704 |
| secp192k1        |       192.88 |          704 |
| secp224r1        |       163.25 |          792 |
| secp224k1        |       267.12 |          792 |
| secp256r1        |       261.14 |          880 |
| secp256k1        |       341.99 |          880 |
| secp384r1        |       480.83 |         1232 |
| secp521r1        |      1021.17 |         1628 |
| brainpoolP160r1  |       138.15 |          616 |
| brainpoolP160t1  |       127.76 |          616 |
| brainpoolP192r1  |       195.84 |          704 |
| brainpoolP192t1  |       189.18 |          704 |
| brainpoolP224r1  |       262.67 |          792 |
| brainpoolP224t1  |       248.53 |          792 |
| brainpoolP256r1  |       361.70 |          880 |
| brainpoolP256t1  |       334.04 |          880 |
| brainpoolP320r1  |       562.09 |         1056 |
| brainpoolP320t1  |       539.85 |         1056 |
| brainpoolP384r1  |       944.53 |         1232 |
| brainpoolP384t1  |       855.74 |         1232 |
| brainpoolP512r1  |      1925.36 |         1584 |
| brainpoolP512t1  |      1695.34 |         1584 |
+------------------+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDSA

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
RTOS: SEGGER embOS
------------------------------------------------
ECDSA Sign and Verify Benchmark compiled Jan 22 2025 14:37:40

Compiler: CC-RX V3.06.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        |     35.16 |      1152 |     31.67 |      1920 |
| secp192k1        |     48.16 |      1152 |     47.68 |      1920 |
| secp224r1        |     42.19 |      1296 |     39.74 |      2160 |
| secp224k1        |     65.37 |      1296 |     60.72 |      2160 |
| secp256r1        |     67.14 |      1440 |     60.92 |      2400 |
| secp256k1        |     87.55 |      1440 |     81.19 |      2400 |
| secp384r1        |    123.37 |      2016 |    115.02 |      3360 |
| secp521r1        |    259.94 |      2664 |    239.55 |      4440 |
| brainpoolP160r1  |     36.08 |      1008 |     33.07 |      1680 |
| brainpoolP160t1  |     33.74 |      1008 |     32.71 |      1680 |
| brainpoolP192r1  |     51.04 |      1152 |     47.12 |      1920 |
| brainpoolP192t1  |     47.99 |      1152 |     45.39 |      1920 |
| brainpoolP224r1  |     66.19 |      1296 |     63.21 |      2160 |
| brainpoolP224t1  |     62.47 |      1296 |     58.78 |      2160 |
| brainpoolP256r1  |     93.88 |      1440 |     84.68 |      2400 |
| brainpoolP256t1  |     86.15 |      1440 |     80.26 |      2400 |
| brainpoolP320r1  |    144.31 |      1728 |    134.81 |      2880 |
| brainpoolP320t1  |    132.85 |      1728 |    125.55 |      2880 |
| brainpoolP384r1  |    233.21 |      2016 |    218.76 |      3360 |
| brainpoolP384t1  |    212.41 |      2016 |    201.18 |      3360 |
| brainpoolP512r1  |    470.85 |      2592 |    435.35 |      4320 |
| brainpoolP512t1  |    421.94 |      2592 |    405.60 |      4320 |
+------------------+-----------+-----------+-----------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_EdDSA

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
RTOS: SEGGER embOS
------------------------------------------------
EdDSA Sign and Verify Benchmark compiled Jan 22 2025 14:45:28

Compiler: CC-RX V3.06.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      |        65.10 |
| Ed448        |       143.79 |
+--------------+--------------+

+--------------+--------------+
| Curve        | ms/Verify    |
+--------------+--------------+
| Ed25519      |       147.21 |
| Ed448        |       315.59 |
+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_MD5

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
RTOS: SEGGER embOS
------------------------------------------------
MD5 Benchmark compiled Jan 22 2025 14:47:35

Compiler: CC-RX V3.06.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          |      3.71 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA1

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
RTOS: SEGGER embOS
------------------------------------------------
SHA-1 Benchmark compiled Jan 22 2025 14:48:36

Compiler: CC-RX V3.06.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.38 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA3

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
RTOS: SEGGER embOS
------------------------------------------------
SHA-3 Benchmark compiled Jan 22 2025 14:49:52

Compiler: CC-RX V3.06.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.46 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA256

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
RTOS: SEGGER embOS
------------------------------------------------
SHA-256 Benchmark compiled Jan 22 2025 14:51:18

Compiler: CC-RX V3.06.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) |      1.93 |
| SHA-256 (SW) |      1.93 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA512

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
RTOS: SEGGER embOS
------------------------------------------------
SHA-512 Benchmark compiled Jan 22 2025 14:52:10

Compiler: CC-RX V3.06.00
System:   Processor speed                  = 120.000 MHz
Config:   CRYPTO_VERSION                   = 24001 [2.40a]
Config:   CRYPTO_CONFIG_SHA512_OPTIMIZE    = 2
Config:   CRYPTO_CONFIG_SHA512_HW_OPTIMIZE = 1

+--------------+-----------+
| Algorithm    | Hash MB/s |
+--------------+-----------+
| SHA-512 (SW) |      1.26 |
+--------------+-----------+

Benchmark complete

STOP.
前の章

セキュリティ機能の評価