目次

last update: 2024/10

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

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.42 |    0.38    0.40 |
| 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.04    0.04 |    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)
Base: Baremetal (No RTOS)
------------------------------------------------
Camellia Benchmark compiled Sep 30 2024 20:54:18

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.73    0.75 |    0.67    0.68 |
| CAMELLIA     |  192 |    0.56    0.56 |    0.53    0.52 |
| CAMELLIA     |  256 |    0.56    0.56 |    0.53    0.52 |
+--------------+------+-----------------+-----------------+
|              |      | 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.05    0.05 |    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)
Base: Baremetal (No RTOS)
------------------------------------------------
DES Benchmark compiled Sep 30 2024 20:55:48

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.56   0.56 |   0.52   0.52 |
| DES          |  128 |   0.19   0.19 |   0.19   0.19 |
| DES          |  192 |   0.19   0.19 |   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)
Base: Baremetal (No RTOS)
------------------------------------------------
ECDH Key Agreement Benchmark compiled Sep 30 2024 20:57:01

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        |       235.33 |          704 |
| secp192k1        |       368.75 |          704 |
| secp224r1        |       289.50 |          792 |
| secp224k1        |       469.00 |          792 |
| secp256r1        |       477.25 |          880 |
| secp256k1        |       650.00 |          880 |
| secp384r1        |       832.50 |         1232 |
| secp521r1        |      1788.50 |         1628 |
| brainpoolP160r1  |       257.75 |          616 |
| brainpoolP160t1  |       228.00 |          616 |
| brainpoolP192r1  |       359.50 |          704 |
| brainpoolP192t1  |       326.25 |          704 |
| brainpoolP224r1  |       465.75 |          792 |
| brainpoolP224t1  |       434.25 |          792 |
| brainpoolP256r1  |       690.00 |          880 |
| brainpoolP256t1  |       646.00 |          880 |
| brainpoolP320r1  |      1078.00 |         1056 |
| brainpoolP320t1  |       959.00 |         1056 |
| brainpoolP384r1  |      1742.00 |         1232 |
| brainpoolP384t1  |      1609.00 |         1232 |
| brainpoolP512r1  |      3529.00 |         1584 |
| brainpoolP512t1  |      3127.50 |         1584 |
+------------------+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_ECDSA

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
ECDSA Sign and Verify Benchmark compiled Sep 30 2024 21:00:46

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.06 |      1152 |     58.56 |      1920 |
| secp192k1        |     88.67 |      1152 |     84.33 |      1920 |
| secp224r1        |     74.00 |      1296 |     71.00 |      2160 |
| secp224k1        |    120.40 |      1296 |    113.90 |      2160 |
| secp256r1        |    116.70 |      1440 |    112.20 |      2400 |
| secp256k1        |    154.50 |      1440 |    147.13 |      2400 |
| secp384r1        |    217.50 |      2016 |    200.67 |      3360 |
| secp521r1        |    455.25 |      2664 |    429.00 |      4440 |
| brainpoolP160r1  |     64.13 |      1008 |     62.44 |      1680 |
| brainpoolP160t1  |     60.78 |      1008 |     56.61 |      1680 |
| brainpoolP192r1  |     91.42 |      1152 |     86.67 |      1920 |
| brainpoolP192t1  |     85.17 |      1152 |     79.43 |      1920 |
| brainpoolP224r1  |    120.90 |      1296 |    112.20 |      2160 |
| brainpoolP224t1  |    114.10 |      1296 |    102.60 |      2160 |
| brainpoolP256r1  |    164.25 |      1440 |    154.63 |      2400 |
| brainpoolP256t1  |    155.25 |      1440 |    143.50 |      2400 |
| brainpoolP320r1  |    260.25 |      1728 |    242.50 |      2880 |
| brainpoolP320t1  |    245.83 |      1728 |    223.00 |      2880 |
| brainpoolP384r1  |    440.00 |      2016 |    399.75 |      3360 |
| brainpoolP384t1  |    401.75 |      2016 |    359.00 |      3360 |
| brainpoolP512r1  |    879.50 |      2592 |    812.50 |      4320 |
| brainpoolP512t1  |    798.50 |      2592 |    739.00 |      4320 |
+------------------+-----------+-----------+-----------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_EdDSA

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
EdDSA Sign and Verify Benchmark compiled Sep 30 2024 21:05:21

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      |       114.10 |
| Ed448        |       252.50 |
+--------------+--------------+

+--------------+--------------+
| Curve        | ms/Verify    |
+--------------+--------------+
| Ed25519      |       258.00 |
| Ed448        |       554.50 |
+--------------+--------------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_MD5

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
MD5 Benchmark compiled Sep 30 2024 21:06:50

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

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA1

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
SHA-1 Benchmark compiled Sep 30 2024 21:08:06

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)
Base: Baremetal (No RTOS)
------------------------------------------------
SHA-3 Benchmark compiled Sep 30 2024 21:09:22

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)
Base: Baremetal (No RTOS)
------------------------------------------------
SHA-256 Benchmark compiled Sep 30 2024 21:10:47

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.15 |
| SHA-256 (SW) |      1.15 |
+--------------+-----------+

Benchmark complete

STOP.

Sample: CRYPTO_Bench_SHA512

Debug IO Console:

SEGGER Software Evaluation Sample
Eval Board: EK-RX261 (32-bit RXv3 @64MHz)
Base: Baremetal (No RTOS)
------------------------------------------------
SHA-512 Benchmark compiled Sep 30 2024 21:12:24

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

Benchmark complete

STOP.
前の章

評価版パッケージ内容

次の章

MODBUS通信(RS232経由)