目次

last update: 2024/09

embOS RTOS用BSPパッケージ
第9章: 暗号・サイファーライブラリ
評価ボード:AP-RX651-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-RX651-0A (RX651 RXv2 @96MHz)
RTOS: SEGGER embOS
------------------------------------------------
AES Benchmark compiled Sep 30 2024 12:30:45

Compiler: CC-RX V3.06.00
System:   Processor speed               = 96.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.80    0.87 |    0.76    0.81 |
| AES          |  192 |    0.67    0.72 |    0.64    0.68 |
| AES          |  256 |    0.57    0.62 |    0.55    0.59 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| AES          |  128 |    0.07    0.07 |    0.37    0.37 |
| AES          |  192 |    0.07    0.07 |    0.31    0.31 |
| AES          |  256 |    0.07    0.07 |    0.27    0.27 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_Camellia

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX651-0A (RX651 RXv2 @96MHz)
RTOS: SEGGER embOS
------------------------------------------------
Camellia Benchmark compiled Sep 30 2024 12:32:45

Compiler: CC-RX V3.06.00
System:   Processor speed                 = 96.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.51    1.51 |    1.36    1.34 |
| CAMELLIA     |  192 |    1.15    1.16 |    1.06    1.05 |
| CAMELLIA     |  256 |    1.15    1.16 |    1.06    1.05 |
+--------------+------+-----------------+-----------------+
|              |      | GCM        MB/s | CCM        MB/s |
| Cipher       | Bits |     Enc     Dec |     Enc     Dec |
+--------------+------+-----------------+-----------------+
| Camellia     |  128 |    0.07    0.07 |    0.67    0.66 |
| Camellia     |  192 |    0.07    0.07 |    0.52    0.52 |
| Camellia     |  256 |    0.07    0.07 |    0.52    0.52 |
+--------------+------+-----------------+-----------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_DES

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX651-0A (RX651 RXv2 @96MHz)
RTOS: SEGGER embOS
------------------------------------------------
DES Benchmark compiled Sep 30 2024 12:34:04

Compiler: CC-RX V3.06.00
System:   Processor speed               = 96.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.81   0.83 |   0.87   0.88 |
| DES          |  128 |   0.31   0.31 |   0.32   0.32 |
| DES          |  192 |   0.31   0.31 |   0.32   0.32 |
+--------------+------+---------------+---------------+

* Note: key sizes include parity bits

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDH

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX651-0A (RX651 RXv2 @96MHz)
RTOS: SEGGER embOS
------------------------------------------------
ECDH Key Agreement Benchmark compiled Sep 30 2024 12:35:21

Compiler: CC-RX V3.06.00
System:   Processor speed          = 96.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        |       160.27 |          704 |
| secp192k1        |       226.40 |          704 |
| secp224r1        |       190.63 |          792 |
| secp224k1        |       310.93 |          792 |
| secp256r1        |       304.94 |          880 |
| secp256k1        |       396.29 |          880 |
| secp384r1        |       559.94 |         1232 |
| secp521r1        |      1230.42 |         1628 |
| brainpoolP160r1  |       162.45 |          616 |
| brainpoolP160t1  |       150.21 |          616 |
| brainpoolP192r1  |       228.37 |          704 |
| brainpoolP192t1  |       223.25 |          704 |
| brainpoolP224r1  |       303.23 |          792 |
| brainpoolP224t1  |       291.94 |          792 |
| brainpoolP256r1  |       438.45 |          880 |
| brainpoolP256t1  |       382.73 |          880 |
| brainpoolP320r1  |       666.15 |         1056 |
| brainpoolP320t1  |       608.17 |         1056 |
| brainpoolP384r1  |      1103.22 |         1232 |
| brainpoolP384t1  |      1001.80 |         1232 |
| brainpoolP512r1  |      2157.78 |         1584 |
| brainpoolP512t1  |      2026.51 |         1584 |
+------------------+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDSA

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX651-0A (RX651 RXv2 @96MHz)
RTOS: SEGGER embOS
------------------------------------------------
ECDSA Sign and Verify Benchmark compiled Sep 30 2024 12:37:16

Compiler: CC-RX V3.06.00
System:   Processor speed                   = 96.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        |     41.02 |      1152 |     39.32 |      1920 |
| secp192k1        |     56.80 |      1152 |     54.19 |      1920 |
| secp224r1        |     49.22 |      1296 |     45.79 |      2160 |
| secp224k1        |     77.08 |      1296 |     74.45 |      2160 |
| secp256r1        |     78.04 |      1440 |     72.85 |      2400 |
| secp256k1        |    103.49 |      1440 |     95.57 |      2400 |
| secp384r1        |    141.22 |      2016 |    135.33 |      3360 |
| secp521r1        |    307.98 |      2664 |    285.30 |      4440 |
| brainpoolP160r1  |     42.32 |      1008 |     40.10 |      1680 |
| brainpoolP160t1  |     38.60 |      1008 |     38.19 |      1680 |
| brainpoolP192r1  |     59.62 |      1152 |     57.35 |      1920 |
| brainpoolP192t1  |     54.75 |      1152 |     52.82 |      1920 |
| brainpoolP224r1  |     80.39 |      1296 |     74.76 |      2160 |
| brainpoolP224t1  |     72.94 |      1296 |     69.29 |      2160 |
| brainpoolP256r1  |    108.33 |      1440 |    102.93 |      2400 |
| brainpoolP256t1  |    100.06 |      1440 |     94.11 |      2400 |
| brainpoolP320r1  |    170.72 |      1728 |    157.33 |      2880 |
| brainpoolP320t1  |    155.82 |      1728 |    147.04 |      2880 |
| brainpoolP384r1  |    282.20 |      2016 |    267.21 |      3360 |
| brainpoolP384t1  |    259.86 |      2016 |    235.11 |      3360 |
| brainpoolP512r1  |    562.56 |      2592 |    519.82 |      4320 |
| brainpoolP512t1  |    529.04 |      2592 |    468.47 |      4320 |
+------------------+-----------+-----------+-----------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_EdDSA

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX651-0A (RX651 RXv2 @96MHz)
RTOS: SEGGER embOS
------------------------------------------------
EdDSA Sign and Verify Benchmark compiled Sep 30 2024 12:39:39

Compiler: CC-RX V3.06.00
System:   Processor speed          = 96.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      |        75.70 |
| Ed448        |       168.26 |
+--------------+--------------+

+--------------+--------------+
| Curve        | ms/Verify    |
+--------------+--------------+
| Ed25519      |       171.19 |
| Ed448        |       369.18 |
+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_MD5

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX651-0A (RX651 RXv2 @96MHz)
RTOS: SEGGER embOS
------------------------------------------------
MD5 Benchmark compiled Sep 30 2024 12:41:07

Compiler: CC-RX V3.06.00
System:   Processor speed               = 96.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-RX651-0A (RX651 RXv2 @96MHz)
RTOS: SEGGER embOS
------------------------------------------------
SHA-1 Benchmark compiled Sep 30 2024 12:41:56

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

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA3

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX651-0A (RX651 RXv2 @96MHz)
RTOS: SEGGER embOS
------------------------------------------------
SHA-3 Benchmark compiled Sep 30 2024 12:43:09

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

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

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA256

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX651-0A (RX651 RXv2 @96MHz)
RTOS: SEGGER embOS
------------------------------------------------
SHA-256 Benchmark compiled Sep 30 2024 12:44:05

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

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA512

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: AP-RX651-0A (RX651 RXv2 @96MHz)
RTOS: SEGGER embOS
------------------------------------------------
SHA-512 Benchmark compiled Sep 30 2024 12:44:58

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

Benchmark complete

STOP.
前の章

セキュリティ機能の評価