目次

last update: 2024/10

embOS RTOS用BSPパッケージ
第5章: 暗号・サイファーライブラリ
評価ボード:EK-RX261




テストサンプル

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_RXv3_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: EK-RX261 (32-bit RXv3 @64MHz)
RTOS: SEGGER embOS
----------------------------------------------
AES Benchmark compiled Oct  2 2024 20:06:07

Compiler: CC-RX V3.06.00
System:   Processor speed               = 64.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.48    0.50 |    0.46    0.47 |
| AES          |  192 |    0.40    0.41 |    0.38    0.39 |
| AES          |  256 |    0.34    0.36 |    0.33    0.34 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| AES          |  128 |    0.04    0.04 |    0.22    0.22 |
| AES          |  192 |    0.04    0.04 |    0.19    0.19 |
| AES          |  256 |    0.05    0.05 |    0.16    0.16 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_Camellia

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
RTOS: SEGGER embOS
----------------------------------------------
Camellia Benchmark compiled Oct  2 2024 20:09:44

Compiler: CC-RX V3.06.00
System:   Processor speed                 = 64.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 |    0.74    0.75 |    0.68    0.68 |
| CAMELLIA     |  192 |    0.57    0.57 |    0.53    0.53 |
| CAMELLIA     |  256 |    0.57    0.57 |    0.53    0.53 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| Camellia     |  128 |    0.05    0.05 |    0.33    0.33 |
| Camellia     |  192 |    0.04    0.04 |    0.26    0.26 |
| Camellia     |  256 |    0.04    0.04 |    0.26    0.26 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_DES

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
RTOS: SEGGER embOS
----------------------------------------------
DES Benchmark compiled Oct  2 2024 20:14:16

Compiler: CC-RX V3.06.00
System:   Processor speed               = 64.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.49   0.50 |   0.52   0.52 |
| DES          |  128 |   0.18   0.18 |   0.19   0.19 |
| DES          |  192 |   0.18   0.18 |   0.19   0.19 |
+--------------+------+---------------+---------------+

* Note: key sizes include parity bits

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDH

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
RTOS: SEGGER embOS
----------------------------------------------
ECDH Key Agreement Benchmark compiled Oct  2 2024 20:16:02

Compiler: CC-RX V3.06.00
System:   Processor speed          = 64.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        |       231.87 |          704 |
| secp192k1        |       367.79 |          704 |
| secp224r1        |       286.00 |          792 |
| secp224k1        |       468.99 |          792 |
| secp256r1        |       471.18 |          880 |
| secp256k1        |       651.87 |          880 |
| secp384r1        |       829.50 |         1232 |
| secp521r1        |      1787.21 |         1628 |
| brainpoolP160r1  |       256.70 |          616 |
| brainpoolP160t1  |       226.96 |          616 |
| brainpoolP192r1  |       358.99 |          704 |
| brainpoolP192t1  |       325.40 |          704 |
| brainpoolP224r1  |       466.08 |          792 |
| brainpoolP224t1  |       434.35 |          792 |
| brainpoolP256r1  |       692.04 |          880 |
| brainpoolP256t1  |       647.81 |          880 |
| brainpoolP320r1  |      1087.51 |         1056 |
| brainpoolP320t1  |       966.38 |         1056 |
| brainpoolP384r1  |      1761.17 |         1232 |
| brainpoolP384t1  |      1625.46 |         1232 |
| brainpoolP512r1  |      3586.25 |         1584 |
| brainpoolP512t1  |      3177.18 |         1584 |
+------------------+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDSA

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
RTOS: SEGGER embOS
----------------------------------------------
ECDSA Sign and Verify Benchmark compiled Oct  2 2024 20:18:12

Compiler: CC-RX V3.06.00
System:   Processor speed                   = 64.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        |     62.44 |      1152 |     58.89 |      1920 |
| secp192k1        |     88.91 |      1152 |     84.49 |      1920 |
| secp224r1        |     74.39 |      1296 |     71.41 |      2160 |
| secp224k1        |    120.99 |      1296 |    114.42 |      2160 |
| secp256r1        |    117.14 |      1440 |    112.64 |      2400 |
| secp256k1        |    155.41 |      1440 |    147.89 |      2400 |
| secp384r1        |    217.83 |      2016 |    200.88 |      3360 |
| secp521r1        |    452.77 |      2664 |    426.70 |      4440 |
| brainpoolP160r1  |     64.25 |      1008 |     62.59 |      1680 |
| brainpoolP160t1  |     60.87 |      1008 |     56.74 |      1680 |
| brainpoolP192r1  |     91.69 |      1152 |     87.01 |      1920 |
| brainpoolP192t1  |     85.43 |      1152 |     79.68 |      1920 |
| brainpoolP224r1  |    121.78 |      1296 |    113.12 |      2160 |
| brainpoolP224t1  |    114.98 |      1296 |    103.31 |      2160 |
| brainpoolP256r1  |    165.15 |      1440 |    155.58 |      2400 |
| brainpoolP256t1  |    156.06 |      1440 |    144.28 |      2400 |
| brainpoolP320r1  |    263.18 |      1728 |    245.10 |      2880 |
| brainpoolP320t1  |    248.46 |      1728 |    225.33 |      2880 |
| brainpoolP384r1  |    444.88 |      2016 |    404.23 |      3360 |
| brainpoolP384t1  |    406.01 |      2016 |    362.75 |      3360 |
| brainpoolP512r1  |    892.21 |      2592 |    823.75 |      4320 |
| brainpoolP512t1  |    809.20 |      2592 |    749.23 |      4320 |
+------------------+-----------+-----------+-----------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_EdDSA

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
RTOS: SEGGER embOS
----------------------------------------------
EdDSA Sign and Verify Benchmark compiled Oct  2 2024 20:21:20

Compiler: CC-RX V3.06.00
System:   Processor speed          = 64.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      |       113.36 |
| Ed448        |       254.49 |
+--------------+--------------+

+--------------+--------------+
| Curve        | ms/Verify    |
+--------------+--------------+
| Ed25519      |       256.36 |
| Ed448        |       558.31 |
+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_MD5

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
RTOS: SEGGER embOS
----------------------------------------------
MD5 Benchmark compiled Oct  2 2024 20:25:20

Compiler: CC-RX V3.06.00
System:   Processor speed               = 64.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          |      2.14 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA1

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
RTOS: SEGGER embOS
----------------------------------------------
SHA-1 Benchmark compiled Oct  2 2024 20:26:42

Compiler: CC-RX V3.06.00
System:   Processor speed                = 64.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        |      1.25 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA3

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
RTOS: SEGGER embOS
----------------------------------------------
SHA-3 Benchmark compiled Oct  2 2024 20:27:48

Compiler: CC-RX V3.06.00
System:   Processor speed                = 64.000 MHz
Config:   CRYPTO_VERSION                 = 24001 [2.40a]
Config:   CRYPTO_CONFIG_SHA3_OPTIMIZE    = 1

+--------------+-----------+
| Algorithm    | Hash MB/s |
+--------------+-----------+
| SHA-3        |      0.22 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA256

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
RTOS: SEGGER embOS
----------------------------------------------
SHA-256 Benchmark compiled Oct  2 2024 20:28:48

Compiler: CC-RX V3.06.00
System:   Processor speed                  = 64.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.14 |
| SHA-256 (SW) |      1.14 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA512

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
RTOS: SEGGER embOS
----------------------------------------------
SHA-512 Benchmark compiled Oct  2 2024 20:29:47

Compiler: CC-RX V3.06.00
System:   Processor speed                  = 64.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) |      0.74 |
+--------------+-----------+

Benchmark complete

STOP.
前の章

MODBUS通信(RS232経由)

次の章

セキュリティ機能の評価