目次

last update: 2025/01

OSレス環境用BSPパッケージ
第9章: 暗号・サイファーライブラリ
評価ボード: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
 |   |- libNo_OSLayer_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)
Base: Baremetal (No RTOS)
------------------------------------------------
AES Benchmark compiled Jan 26 2025 19:46:20

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.77    0.82 |    0.74    0.77 |
| AES          |  192 |    0.65    0.68 |    0.62    0.65 |
| AES          |  256 |    0.55    0.58 |    0.53    0.56 |
+--------------+------+-----------------+-----------------+
|              |      | 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)
Base: Baremetal (No RTOS)
------------------------------------------------
Camellia Benchmark compiled Jan 26 2025 19:48:29

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.66    1.63 |    1.51    1.46 |
| CAMELLIA     |  192 |    1.24    1.25 |    1.15    1.15 |
| CAMELLIA     |  256 |    1.24    1.25 |    1.15    1.16 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| Camellia     |  128 |    0.08    0.08 |    0.74    0.74 |
| Camellia     |  192 |    0.08    0.08 |    0.56    0.56 |
| Camellia     |  256 |    0.08    0.08 |    0.56    0.56 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_DES

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
DES Benchmark compiled Jan 26 2025 19:50:07

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.86   0.89 |   0.81   0.83 |
| DES          |  128 |   0.30   0.30 |   0.29   0.29 |
| DES          |  192 |   0.30   0.30 |   0.29   0.29 |
+--------------+------+---------------+---------------+

* 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)
Base: Baremetal (No RTOS)
------------------------------------------------
ECDH Key Agreement Benchmark compiled Jan 26 2025 19:51:37

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.50 |          704 |
| secp192k1        |       193.50 |          704 |
| secp224r1        |       163.50 |          792 |
| secp224k1        |       268.00 |          792 |
| secp256r1        |       262.00 |          880 |
| secp256k1        |       343.00 |          880 |
| secp384r1        |       476.00 |         1232 |
| secp521r1        |      1007.50 |         1628 |
| brainpoolP160r1  |       138.75 |          616 |
| brainpoolP160t1  |       128.25 |          616 |
| brainpoolP192r1  |       196.33 |          704 |
| brainpoolP192t1  |       189.83 |          704 |
| brainpoolP224r1  |       263.75 |          792 |
| brainpoolP224t1  |       250.75 |          792 |
| brainpoolP256r1  |       373.00 |          880 |
| brainpoolP256t1  |       332.50 |          880 |
| brainpoolP320r1  |       564.00 |         1056 |
| brainpoolP320t1  |       519.50 |         1056 |
| brainpoolP384r1  |       935.00 |         1232 |
| brainpoolP384t1  |       849.50 |         1232 |
| brainpoolP512r1  |      1894.00 |         1584 |
| brainpoolP512t1  |      1718.00 |         1584 |
+------------------+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDSA

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
ECDSA Sign and Verify Benchmark compiled Jan 26 2025 19:53:53

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        |     34.97 |      1152 |     31.50 |      1920 |
| secp192k1        |     47.95 |      1152 |     47.45 |      1920 |
| secp224r1        |     42.08 |      1296 |     39.65 |      2160 |
| secp224k1        |     65.00 |      1296 |     60.44 |      2160 |
| secp256r1        |     67.19 |      1440 |     60.89 |      2400 |
| secp256k1        |     87.00 |      1440 |     80.71 |      2400 |
| secp384r1        |    123.20 |      2016 |    114.90 |      3360 |
| secp521r1        |    259.50 |      2664 |    239.17 |      4440 |
| brainpoolP160r1  |     35.89 |      1008 |     32.91 |      1680 |
| brainpoolP160t1  |     33.60 |      1008 |     32.56 |      1680 |
| brainpoolP192r1  |     50.75 |      1152 |     46.86 |      1920 |
| brainpoolP192t1  |     47.73 |      1152 |     45.17 |      1920 |
| brainpoolP224r1  |     65.75 |      1296 |     62.81 |      2160 |
| brainpoolP224t1  |     62.17 |      1296 |     58.44 |      2160 |
| brainpoolP256r1  |     93.42 |      1440 |     84.25 |      2400 |
| brainpoolP256t1  |     85.67 |      1440 |     79.86 |      2400 |
| brainpoolP320r1  |    143.38 |      1728 |    134.00 |      2880 |
| brainpoolP320t1  |    132.00 |      1728 |    124.80 |      2880 |
| brainpoolP384r1  |    232.17 |      2016 |    218.00 |      3360 |
| brainpoolP384t1  |    211.50 |      2016 |    200.33 |      3360 |
| brainpoolP512r1  |    468.75 |      2592 |    433.25 |      4320 |
| brainpoolP512t1  |    420.00 |      2592 |    403.75 |      4320 |
+------------------+-----------+-----------+-----------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_EdDSA

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
EdDSA Sign and Verify Benchmark compiled Jan 26 2025 19:56:41

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      |        64.25 |
| Ed448        |       145.00 |
+--------------+--------------+

+--------------+--------------+
| Curve        | ms/Verify    |
+--------------+--------------+
| Ed25519      |       145.25 |
| Ed448        |       318.50 |
+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_MD5

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
MD5 Benchmark compiled Jan 26 2025 19:58:08

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

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA1

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
SHA-1 Benchmark compiled Jan 26 2025 19:59:44

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

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA3

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
SHA-3 Benchmark compiled Jan 26 2025 20:01:42

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

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA256

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
SHA-256 Benchmark compiled Jan 26 2025 20:00:47

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

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA512

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX65N-0A (RX65N RXv2 @120MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
SHA-512 Benchmark compiled Jan 26 2025 20:02:51

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.
前の章

セキュリティ機能の評価