SE050 キー管理シンプル化と不要チップ削除
- ACTIVE_*マクロをシンプル化:チップ選択で ENC/MAC/DEK 全体が選択 - test_scp03_hardware.c: SE050C0 キーに整理 - SE050E0/E1 削除(実在しないため) - 対応チップ:SE050C0, SE050C1, SE050E2 のみ 変更前: ACTIVE_ENC_KEY = 条件付きマクロ 変更後: ENC_KEY = 選択チップのキー MAC_KEY = 選択チップのキー DEK_KEY = 選択チップのキー
This commit is contained in:
@@ -40,14 +40,10 @@ ifeq ($(SE050_CHIP),SE050C0)
|
||||
CHIP_ID = 0
|
||||
else ifeq ($(SE050_CHIP),SE050C1)
|
||||
CHIP_ID = 1
|
||||
else ifeq ($(SE050_CHIP),SE050E0)
|
||||
CHIP_ID = 2
|
||||
else ifeq ($(SE050_CHIP),SE050E1)
|
||||
CHIP_ID = 3
|
||||
else ifeq ($(SE050_CHIP),SE050E2)
|
||||
CHIP_ID = 4
|
||||
CHIP_ID = 2
|
||||
else
|
||||
$(error Invalid SE050_CHIP. Use SE050C0, SE050C1, SE050E0, SE050E1, or SE050E2)
|
||||
$(error Invalid SE050_CHIP. Use SE050C0, SE050C1, or SE050E2)
|
||||
endif
|
||||
|
||||
# Default target
|
||||
|
||||
@@ -24,7 +24,7 @@ MIT ライセンスで実装された NXP SE050 用 WireGuard クリーンルー
|
||||
|
||||
### 対応チップ
|
||||
|
||||
- SE050C0, SE050C1, SE050E0, SE050E1 (すべて X25519 サポート)
|
||||
- SE050C0, SE050C1, SE050E2 (すべて X25519 サポート)
|
||||
|
||||
### ハードウェアテスト
|
||||
|
||||
@@ -32,8 +32,8 @@ MIT ライセンスで実装された NXP SE050 用 WireGuard クリーンルー
|
||||
# SE050C0 でテスト
|
||||
make SE050_CHIP=SE050C0 test_se050
|
||||
|
||||
# SE050E1 でテスト
|
||||
make SE050_CHIP=SE050E1 test_se050
|
||||
# SE050E2 でテスト
|
||||
make SE050_CHIP=SE050E2 test_se050
|
||||
|
||||
# 別の I2C バス指定
|
||||
make SE050_CHIP=SE050C0 test_se050 I2C_OPTS="-b /dev/i2c-2"
|
||||
|
||||
+94
-99
@@ -3,7 +3,7 @@
|
||||
* @brief Platform SCP03 Hardware Test with SE050
|
||||
*
|
||||
* Tests Platform SCP03 communication with actual SE050 hardware
|
||||
* using default keys from NXP AN12436.
|
||||
* using SE050C0 default keys.
|
||||
*
|
||||
* License: MIT (Clean-room implementation)
|
||||
*/
|
||||
@@ -15,18 +15,18 @@
|
||||
#include "se050_wireguard.h"
|
||||
#include "se050_crypto_utils.h"
|
||||
|
||||
/* AN12436 Default Platform SCP03 Keys */
|
||||
static const uint8_t DEFAULT_ENC_KEY[16] = {
|
||||
/* SE050C0 Default Platform SCP03 Keys */
|
||||
static const uint8_t SE050C0_ENC_KEY[16] = {
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF
|
||||
};
|
||||
|
||||
static const uint8_t DEFAULT_MAC_KEY[16] = {
|
||||
static const uint8_t SE050C0_MAC_KEY[16] = {
|
||||
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
|
||||
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10
|
||||
};
|
||||
|
||||
static const uint8_t DEFAULT_DEK_KEY[16] = {
|
||||
static const uint8_t SE050C0_DEK_KEY[16] = {
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
|
||||
};
|
||||
@@ -86,7 +86,7 @@ static mock_i2c_ctx_t *g_mock_ctx = NULL;
|
||||
|
||||
int se050_i2c_read_mock(se050_i2c_hal_t *hal, uint8_t *buffer, int length)
|
||||
{
|
||||
(void)hal; /* Mock implementation uses global context */
|
||||
(void)hal;
|
||||
mock_i2c_ctx_t *mock = g_mock_ctx;
|
||||
|
||||
if (!mock || !buffer || length <= 0) {
|
||||
@@ -111,7 +111,7 @@ int se050_i2c_read_mock(se050_i2c_hal_t *hal, uint8_t *buffer, int length)
|
||||
|
||||
int se050_i2c_write_mock(se050_i2c_hal_t *hal, const uint8_t *buffer, int length)
|
||||
{
|
||||
(void)hal; /* Mock implementation uses global context */
|
||||
(void)hal;
|
||||
mock_i2c_ctx_t *mock = g_mock_ctx;
|
||||
|
||||
if (!mock || !buffer || length <= 0) {
|
||||
@@ -122,12 +122,7 @@ int se050_i2c_write_mock(se050_i2c_hal_t *hal, const uint8_t *buffer, int length
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("[MOCK I2C] Write %d bytes: ", length);
|
||||
for (int i = 0; i < length && i < 16; i++) {
|
||||
printf("%02x ", buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("[MOCK I2C] Write %d bytes\n", length);
|
||||
return length;
|
||||
}
|
||||
|
||||
@@ -152,57 +147,29 @@ static void mock_i2c_set_response(mock_i2c_ctx_t *mock, const uint8_t *response,
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
* Test Case 1: Default Key Validation
|
||||
* Test Case 1: Key Validation
|
||||
*/
|
||||
static void test_default_keys(void)
|
||||
static void test_keys(void)
|
||||
{
|
||||
printf("\n=== Test 1: AN12436 Default Key Validation ===\n");
|
||||
printf("\n=== Test 1: SE050C0 Key Validation ===\n");
|
||||
|
||||
TEST_ASSERT_EQ(sizeof(DEFAULT_ENC_KEY), 16, "ENC key should be 16 bytes");
|
||||
TEST_ASSERT_EQ(sizeof(DEFAULT_MAC_KEY), 16, "MAC key should be 16 bytes");
|
||||
TEST_ASSERT_EQ(sizeof(DEFAULT_DEK_KEY), 16, "DEK key should be 16 bytes");
|
||||
TEST_ASSERT_EQ(sizeof(SE050C0_ENC_KEY), 16, "ENC key should be 16 bytes");
|
||||
TEST_ASSERT_EQ(sizeof(SE050C0_MAC_KEY), 16, "MAC key should be 16 bytes");
|
||||
TEST_ASSERT_EQ(sizeof(SE050C0_DEK_KEY), 16, "DEK key should be 16 bytes");
|
||||
|
||||
print_hex("Default ENC Key", DEFAULT_ENC_KEY, 16);
|
||||
print_hex("Default MAC Key", DEFAULT_MAC_KEY, 16);
|
||||
print_hex("Default DEK Key", DEFAULT_DEK_KEY, 16);
|
||||
print_hex("SE050C0 ENC Key", SE050C0_ENC_KEY, 16);
|
||||
print_hex("SE050C0 MAC Key", SE050C0_MAC_KEY, 16);
|
||||
print_hex("SE050C0 DEK Key", SE050C0_DEK_KEY, 16);
|
||||
|
||||
TEST_ASSERT(1, "Default keys from AN12436 loaded");
|
||||
TEST_ASSERT(1, "SE050C0 keys loaded");
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
* Test Case 2: SCP03 with Default Keys
|
||||
* Test Case 2: SCP03 with SE050C0 Keys
|
||||
*/
|
||||
static void test_scp03_default_keys(void)
|
||||
static void test_scp03_se050c0_keys(void)
|
||||
{
|
||||
printf("\n=== Test 2: SCP03 with AN12436 Default Keys ===\n");
|
||||
|
||||
se050_session_ctx_t *session = NULL;
|
||||
mock_i2c_ctx_t mock;
|
||||
|
||||
mock_i2c_init(&mock, "/dev/i2c-1-mock");
|
||||
|
||||
se050_status_t status = se050_session_create(&session, &mock.hal);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Session creation with default keys");
|
||||
|
||||
status = se050_session_scp03_init(session);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "SCP03 initialization with default keys");
|
||||
|
||||
status = se050_session_scp03_set_keys(session,
|
||||
DEFAULT_ENC_KEY,
|
||||
DEFAULT_MAC_KEY,
|
||||
DEFAULT_DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "SCP03 set_keys with AN12436 defaults");
|
||||
|
||||
se050_session_delete(session);
|
||||
TEST_ASSERT(1, "SCP03 with default keys completed");
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
* Test Case 3: SCP03 Command Encryption with Default Keys
|
||||
*/
|
||||
static void test_scp03_encrypt_default_keys(void)
|
||||
{
|
||||
printf("\n=== Test 3: SCP03 Command Encryption with Default Keys ===\n");
|
||||
printf("\n=== Test 2: SCP03 with SE050C0 Keys ===\n");
|
||||
|
||||
se050_session_ctx_t *session = NULL;
|
||||
mock_i2c_ctx_t mock;
|
||||
@@ -216,10 +183,38 @@ static void test_scp03_encrypt_default_keys(void)
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "SCP03 initialization");
|
||||
|
||||
status = se050_session_scp03_set_keys(session,
|
||||
DEFAULT_ENC_KEY,
|
||||
DEFAULT_MAC_KEY,
|
||||
DEFAULT_DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Set AN12436 default keys");
|
||||
SE050C0_ENC_KEY,
|
||||
SE050C0_MAC_KEY,
|
||||
SE050C0_DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Set SE050C0 keys");
|
||||
|
||||
se050_session_delete(session);
|
||||
TEST_ASSERT(1, "SCP03 with SE050C0 keys completed");
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
* Test Case 3: SCP03 Command Encryption
|
||||
*/
|
||||
static void test_scp03_encrypt(void)
|
||||
{
|
||||
printf("\n=== Test 3: SCP03 Command Encryption ===\n");
|
||||
|
||||
se050_session_ctx_t *session = NULL;
|
||||
mock_i2c_ctx_t mock;
|
||||
|
||||
mock_i2c_init(&mock, "/dev/i2c-1-mock");
|
||||
|
||||
se050_status_t status = se050_session_create(&session, &mock.hal);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Session creation");
|
||||
|
||||
status = se050_session_scp03_init(session);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "SCP03 initialization");
|
||||
|
||||
status = se050_session_scp03_set_keys(session,
|
||||
SE050C0_ENC_KEY,
|
||||
SE050C0_MAC_KEY,
|
||||
SE050C0_DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Set SE050C0 keys");
|
||||
|
||||
uint8_t cmd[64];
|
||||
size_t cmd_len = 6;
|
||||
@@ -232,7 +227,7 @@ static void test_scp03_encrypt_default_keys(void)
|
||||
cmd[5] = 0x00;
|
||||
|
||||
status = se050_session_scp03_encrypt(session, cmd, &cmd_len);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Command encryption with default keys");
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Command encryption");
|
||||
TEST_ASSERT(cmd_len > 6, "Encrypted command should be padded");
|
||||
|
||||
print_hex("Encrypted Command", cmd, cmd_len < 32 ? cmd_len : 32);
|
||||
@@ -259,10 +254,10 @@ static void test_scp03_full_flow(void)
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Step 2: SCP03 initialization");
|
||||
|
||||
status = se050_session_scp03_set_keys(session,
|
||||
DEFAULT_ENC_KEY,
|
||||
DEFAULT_MAC_KEY,
|
||||
DEFAULT_DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Step 3: Set AN12436 default keys");
|
||||
SE050C0_ENC_KEY,
|
||||
SE050C0_MAC_KEY,
|
||||
SE050C0_DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Step 3: Set SE050C0 keys");
|
||||
|
||||
uint8_t cmd[64];
|
||||
size_t cmd_len = 6;
|
||||
@@ -289,28 +284,28 @@ static void test_scp03_full_flow(void)
|
||||
rsp_len = (size_t)bytes_read;
|
||||
|
||||
uint16_t sw = se050_session_scp03_decrypt(session, cmd_len, rsp, &rsp_len);
|
||||
TEST_ASSERT_EQ(sw, 0x9000, "Step 6: Decrypt response - success status");
|
||||
TEST_ASSERT_EQ(sw, 0x9000, "Step 6: Decrypt response");
|
||||
|
||||
print_hex("Decrypted Response", rsp, rsp_len < 32 ? rsp_len : 32);
|
||||
|
||||
se050_session_delete(session);
|
||||
TEST_ASSERT(1, "Step 7: Full flow completed successfully");
|
||||
TEST_ASSERT(1, "Step 7: Full flow completed");
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
* Test Case 5: Key File with AN12436 Defaults
|
||||
* Test Case 5: Key File
|
||||
*/
|
||||
static void test_default_keys_file(void)
|
||||
static void test_keys_file(void)
|
||||
{
|
||||
printf("\n=== Test 5: AN12436 Default Keys File ===\n");
|
||||
printf("\n=== Test 5: SE050C0 Keys File ===\n");
|
||||
|
||||
const char *key_file = "/tmp/an12436_default_keys.bin";
|
||||
const char *key_file = "/tmp/se050c0_keys.bin";
|
||||
FILE *fp = fopen(key_file, "wb");
|
||||
TEST_ASSERT(fp != NULL, "Should be able to create default key file");
|
||||
TEST_ASSERT(fp != NULL, "Create key file");
|
||||
|
||||
fwrite(DEFAULT_ENC_KEY, 1, 16, fp);
|
||||
fwrite(DEFAULT_MAC_KEY, 1, 16, fp);
|
||||
fwrite(DEFAULT_DEK_KEY, 1, 16, fp);
|
||||
fwrite(SE050C0_ENC_KEY, 1, 16, fp);
|
||||
fwrite(SE050C0_MAC_KEY, 1, 16, fp);
|
||||
fwrite(SE050C0_DEK_KEY, 1, 16, fp);
|
||||
fclose(fp);
|
||||
|
||||
se050_session_ctx_t *session = NULL;
|
||||
@@ -329,16 +324,16 @@ static void test_default_keys_file(void)
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "SCP03 context creation");
|
||||
|
||||
status = se050_scp03_load_keys_from_file(scp03, key_file);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Load AN12436 default keys from file");
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Load SE050C0 keys from file");
|
||||
|
||||
se050_scp03_free(scp03);
|
||||
se050_session_delete(session);
|
||||
remove(key_file);
|
||||
TEST_ASSERT(1, "AN12436 default keys file test completed");
|
||||
TEST_ASSERT(1, "Key file test completed");
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
* Test Case 6: Multiple Command/Response Cycles
|
||||
* Test Case 6: Multiple Cycles
|
||||
*/
|
||||
static void test_multiple_cycles(void)
|
||||
{
|
||||
@@ -356,10 +351,10 @@ static void test_multiple_cycles(void)
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "SCP03 initialization");
|
||||
|
||||
status = se050_session_scp03_set_keys(session,
|
||||
DEFAULT_ENC_KEY,
|
||||
DEFAULT_MAC_KEY,
|
||||
DEFAULT_DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Set AN12436 default keys");
|
||||
SE050C0_ENC_KEY,
|
||||
SE050C0_MAC_KEY,
|
||||
SE050C0_DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Set SE050C0 keys");
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
uint8_t cmd[64];
|
||||
@@ -370,7 +365,7 @@ static void test_multiple_cycles(void)
|
||||
cmd[3] = 0x00;
|
||||
|
||||
status = se050_session_scp03_encrypt(session, cmd, &cmd_len);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Encrypt command cycle");
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Encrypt cycle");
|
||||
|
||||
uint8_t response[16] = {0x90, 0x00};
|
||||
mock_i2c_set_response(&mock, response, sizeof(response));
|
||||
@@ -381,19 +376,19 @@ static void test_multiple_cycles(void)
|
||||
rsp_len = (size_t)bytes_read;
|
||||
|
||||
uint16_t sw = se050_session_scp03_decrypt(session, cmd_len, rsp, &rsp_len);
|
||||
TEST_ASSERT_EQ(sw, 0x9000, "Decrypt response cycle");
|
||||
TEST_ASSERT_EQ(sw, 0x9000, "Decrypt cycle");
|
||||
}
|
||||
|
||||
se050_session_delete(session);
|
||||
TEST_ASSERT(1, "Multiple cycles completed successfully");
|
||||
TEST_ASSERT(1, "Multiple cycles completed");
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
* Test Case 7: Counter Increment Verification
|
||||
* Test Case 7: Counter Increment
|
||||
*/
|
||||
static void test_counter_increment(void)
|
||||
{
|
||||
printf("\n=== Test 7: SCP03 Counter Increment Verification ===\n");
|
||||
printf("\n=== Test 7: SCP03 Counter Increment ===\n");
|
||||
|
||||
se050_session_ctx_t *session = NULL;
|
||||
mock_i2c_ctx_t mock;
|
||||
@@ -407,10 +402,10 @@ static void test_counter_increment(void)
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "SCP03 initialization");
|
||||
|
||||
status = se050_session_scp03_set_keys(session,
|
||||
DEFAULT_ENC_KEY,
|
||||
DEFAULT_MAC_KEY,
|
||||
DEFAULT_DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Set AN12436 default keys");
|
||||
SE050C0_ENC_KEY,
|
||||
SE050C0_MAC_KEY,
|
||||
SE050C0_DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Set SE050C0 keys");
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
uint8_t cmd[64];
|
||||
@@ -421,11 +416,11 @@ static void test_counter_increment(void)
|
||||
cmd[3] = (uint8_t)i;
|
||||
|
||||
status = se050_session_scp03_encrypt(session, cmd, &cmd_len);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Command encrypt cycle");
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Encrypt cycle");
|
||||
}
|
||||
|
||||
se050_session_delete(session);
|
||||
TEST_ASSERT(1, "Counter increment verification completed");
|
||||
TEST_ASSERT(1, "Counter increment verified");
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
@@ -433,17 +428,18 @@ static void test_counter_increment(void)
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
(void)argc; (void)argv; /* Unused */
|
||||
(void)argc; (void)argv;
|
||||
|
||||
printf("========================================\n");
|
||||
printf("Platform SCP03 Hardware Test Suite\n");
|
||||
printf("AN12436 Default Keys\n");
|
||||
printf("SE050C0 Keys\n");
|
||||
printf("========================================\n");
|
||||
|
||||
test_default_keys();
|
||||
test_scp03_default_keys();
|
||||
test_scp03_encrypt_default_keys();
|
||||
test_keys();
|
||||
test_scp03_se050c0_keys();
|
||||
test_scp03_encrypt();
|
||||
test_scp03_full_flow();
|
||||
test_default_keys_file();
|
||||
test_keys_file();
|
||||
test_multiple_cycles();
|
||||
test_counter_increment();
|
||||
|
||||
@@ -456,8 +452,7 @@ int main(int argc, char *argv[])
|
||||
printf("========================================\n");
|
||||
|
||||
if (test_failed == 0) {
|
||||
printf("\nAll tests passed! AN12436 default keys verified.\n");
|
||||
printf(" Ready for SE050 hardware testing.\n");
|
||||
printf("\n✓ All tests passed! SE050C0 keys verified.\n");
|
||||
}
|
||||
|
||||
return test_failed > 0 ? 1 : 0;
|
||||
|
||||
+61
-179
@@ -3,13 +3,11 @@
|
||||
* @brief SE050 Hardware Platform SCP03 Connection Test
|
||||
*
|
||||
* Tests actual SE050 hardware connection using chip-specific PlatformSCP03 keys.
|
||||
* Supports multiple SE050 variants via compile-time options.
|
||||
* Supports SE050C0, SE050C1, and SE050E2 via compile-time options.
|
||||
*
|
||||
* Usage:
|
||||
* make SE050_CHIP=SE050C0 test_se050
|
||||
* make SE050_CHIP=SE050C1 test_se050
|
||||
* make SE050_CHIP=SE050E0 test_se050
|
||||
* make SE050_CHIP=SE050E1 test_se050
|
||||
* make SE050_CHIP=SE050E2 test_se050
|
||||
*
|
||||
* License: MIT (Clean-room implementation)
|
||||
@@ -36,23 +34,31 @@
|
||||
#define SE050_CHIP 0 /* Default: SE050C0 */
|
||||
#endif
|
||||
|
||||
#if SE050_CHIP == 0
|
||||
/* Chip type constants */
|
||||
#define CHIP_SE050C0 0
|
||||
#define CHIP_SE050C1 1
|
||||
#define CHIP_SE050E2 2
|
||||
|
||||
#if SE050_CHIP == CHIP_SE050C0
|
||||
#define CHIP_NAME "SE050C0"
|
||||
#define SE050_DEFAULT_I2C_ADDR 0x90
|
||||
#elif SE050_CHIP == 1
|
||||
#define ENC_KEY SE050C0_ENC_KEY
|
||||
#define MAC_KEY SE050C0_MAC_KEY
|
||||
#define DEK_KEY SE050C0_DEK_KEY
|
||||
#elif SE050_CHIP == CHIP_SE050C1
|
||||
#define CHIP_NAME "SE050C1"
|
||||
#define SE050_DEFAULT_I2C_ADDR 0x90
|
||||
#elif SE050_CHIP == 2
|
||||
#define CHIP_NAME "SE050E0"
|
||||
#define SE050_DEFAULT_I2C_ADDR 0x90
|
||||
#elif SE050_CHIP == 3
|
||||
#define CHIP_NAME "SE050E1"
|
||||
#define SE050_DEFAULT_I2C_ADDR 0x90
|
||||
#elif SE050_CHIP == 4
|
||||
#define ENC_KEY SE050C1_ENC_KEY
|
||||
#define MAC_KEY SE050C1_MAC_KEY
|
||||
#define DEK_KEY SE050C1_DEK_KEY
|
||||
#elif SE050_CHIP == CHIP_SE050E2
|
||||
#define CHIP_NAME "SE050E2"
|
||||
#define SE050_DEFAULT_I2C_ADDR 0x90
|
||||
#define ENC_KEY SE050E2_ENC_KEY
|
||||
#define MAC_KEY SE050E2_MAC_KEY
|
||||
#define DEK_KEY SE050E2_DEK_KEY
|
||||
#else
|
||||
#error "Invalid SE050_CHIP value. Use 0=SE050C0, 1=SE050C1, 2=SE050E0, 3=SE050E1, or 4=SE050E2"
|
||||
#error "Invalid SE050_CHIP. Use SE050C0, SE050C1, or SE050E2"
|
||||
#endif
|
||||
|
||||
/* ============================================================================
|
||||
@@ -92,38 +98,6 @@ static const uint8_t SE050C1_DEK_KEY[16] = {
|
||||
0x98, 0x76, 0x54, 0x32, 0x10, 0xFE, 0xDC, 0xBA
|
||||
};
|
||||
|
||||
/* SE050E0 Platform SCP03 Keys */
|
||||
static const uint8_t SE050E0_ENC_KEY[16] = {
|
||||
0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
|
||||
0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0
|
||||
};
|
||||
|
||||
static const uint8_t SE050E0_MAC_KEY[16] = {
|
||||
0x21, 0x43, 0x65, 0x87, 0xA9, 0xCB, 0xED, 0xF0,
|
||||
0x21, 0x43, 0x65, 0x87, 0xA9, 0xCB, 0xED, 0xF0
|
||||
};
|
||||
|
||||
static const uint8_t SE050E0_DEK_KEY[16] = {
|
||||
0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11,
|
||||
0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11
|
||||
};
|
||||
|
||||
/* SE050E1 Platform SCP03 Keys */
|
||||
static const uint8_t SE050E1_ENC_KEY[16] = {
|
||||
0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE, 0xBA, 0xBE,
|
||||
0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE, 0xBA, 0xBE
|
||||
};
|
||||
|
||||
static const uint8_t SE050E1_MAC_KEY[16] = {
|
||||
0xBA, 0xAD, 0xF0, 0x0D, 0xDE, 0xAD, 0xBE, 0xEF,
|
||||
0xBA, 0xAD, 0xF0, 0x0D, 0xDE, 0xAD, 0xBE, 0xEF
|
||||
};
|
||||
|
||||
static const uint8_t SE050E1_DEK_KEY[16] = {
|
||||
0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
|
||||
0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12
|
||||
};
|
||||
|
||||
/* SE050E2 Platform SCP03 Keys */
|
||||
static const uint8_t SE050E2_ENC_KEY[16] = {
|
||||
0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC,
|
||||
@@ -140,25 +114,6 @@ static const uint8_t SE050E2_DEK_KEY[16] = {
|
||||
0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66
|
||||
};
|
||||
|
||||
/* Active keys based on chip selection */
|
||||
#define ACTIVE_ENC_KEY (SE050_CHIP == 0 ? SE050C0_ENC_KEY : \
|
||||
(SE050_CHIP == 1 ? SE050C1_ENC_KEY : \
|
||||
(SE050_CHIP == 2 ? SE050E0_ENC_KEY : \
|
||||
(SE050_CHIP == 3 ? SE050E1_ENC_KEY : \
|
||||
SE050E2_ENC_KEY))))
|
||||
|
||||
#define ACTIVE_MAC_KEY (SE050_CHIP == 0 ? SE050C0_MAC_KEY : \
|
||||
(SE050_CHIP == 1 ? SE050C1_MAC_KEY : \
|
||||
(SE050_CHIP == 2 ? SE050E0_MAC_KEY : \
|
||||
(SE050_CHIP == 3 ? SE050E1_MAC_KEY : \
|
||||
SE050E2_MAC_KEY))))
|
||||
|
||||
#define ACTIVE_DEK_KEY (SE050_CHIP == 0 ? SE050C0_DEK_KEY : \
|
||||
(SE050_CHIP == 1 ? SE050C1_DEK_KEY : \
|
||||
(SE050_CHIP == 2 ? SE050E0_DEK_KEY : \
|
||||
(SE050_CHIP == 3 ? SE050E1_DEK_KEY : \
|
||||
SE050E2_DEK_KEY))))
|
||||
|
||||
/* ============================================================================
|
||||
* Test Result Tracking
|
||||
* ============================================================================ */
|
||||
@@ -259,11 +214,9 @@ static void real_i2c_close(real_i2c_ctx_t *ctx)
|
||||
* SE050 APDU Commands
|
||||
* ============================================================================ */
|
||||
|
||||
/* SE050 APDU command codes */
|
||||
#define SE050_INS_OPEN_SESSION 0x70
|
||||
#define SE050_INS_CLOSE_SESSION 0x71
|
||||
#define SE050_INS_GET_VERSION 0x6F
|
||||
#define SE050_INS_CONNECT 0x72
|
||||
|
||||
/* ============================================================================
|
||||
* Test Case 1: I2C Connection Check
|
||||
@@ -281,7 +234,6 @@ static void test_i2c_connection(const char *i2c_bus)
|
||||
if (ret == 0) {
|
||||
TEST_ASSERT(1, "I2C connection established");
|
||||
|
||||
/* Try to read device ID (if supported) */
|
||||
uint8_t buffer[4];
|
||||
int bytes_read = real_i2c_read(&i2c, buffer, 4);
|
||||
if (bytes_read > 0) {
|
||||
@@ -292,17 +244,14 @@ static void test_i2c_connection(const char *i2c_bus)
|
||||
printf("\n");
|
||||
TEST_ASSERT(1, "Device responded to I2C read");
|
||||
} else {
|
||||
printf("[INFO] Device did not respond to read (may be normal for sleep mode)\n");
|
||||
TEST_ASSERT(1, "I2C bus accessible (device may be in sleep mode)");
|
||||
printf("[INFO] Device may be in sleep mode\n");
|
||||
TEST_ASSERT(1, "I2C bus accessible");
|
||||
}
|
||||
|
||||
real_i2c_close(&i2c);
|
||||
} else {
|
||||
TEST_ASSERT(0, "I2C connection failed");
|
||||
printf("[WARN] Check that:\n");
|
||||
printf(" 1. SE050 is properly connected to I2C bus %s\n", i2c_bus);
|
||||
printf(" 2. I2C permissions are correct (sudo or i2c group)\n");
|
||||
printf(" 3. SE050 is powered and not in sleep mode\n");
|
||||
printf("[WARN] Check I2C connection and permissions\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,34 +267,27 @@ static void test_session_with_scp03(const char *i2c_bus)
|
||||
se050_i2c_hal_t hal;
|
||||
se050_session_ctx_t *session = NULL;
|
||||
|
||||
/* Initialize I2C */
|
||||
int ret = real_i2c_init(&i2c, i2c_bus, SE050_DEFAULT_I2C_ADDR);
|
||||
TEST_ASSERT_EQ(ret, 0, "I2C initialization");
|
||||
|
||||
/* Setup HAL */
|
||||
memset(&hal, 0, sizeof(hal));
|
||||
hal.handle = &i2c;
|
||||
hal.slave_addr = SE050_DEFAULT_I2C_ADDR;
|
||||
hal.dev_path = i2c_bus;
|
||||
|
||||
/* Create session */
|
||||
se050_status_t status = se050_session_create(&session, &hal);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Session creation");
|
||||
|
||||
if (session) {
|
||||
/* Initialize SCP03 */
|
||||
status = se050_session_scp03_init(session);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "SCP03 initialization");
|
||||
|
||||
/* Set chip-specific PlatformSCP03 keys */
|
||||
status = se050_session_scp03_set_keys(session,
|
||||
ACTIVE_ENC_KEY,
|
||||
ACTIVE_MAC_KEY,
|
||||
ACTIVE_DEK_KEY);
|
||||
/* Use chip-specific keys */
|
||||
status = se050_session_scp03_set_keys(session, ENC_KEY, MAC_KEY, DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Set chip-specific PlatformSCP03 keys");
|
||||
|
||||
se050_session_delete(session);
|
||||
TEST_ASSERT(1, "Session with SCP03 cleanup successful");
|
||||
TEST_ASSERT(1, "Session cleanup successful");
|
||||
}
|
||||
|
||||
real_i2c_close(&i2c);
|
||||
@@ -363,20 +305,17 @@ static void test_scp03_encrypt_hardware(const char *i2c_bus)
|
||||
se050_i2c_hal_t hal;
|
||||
se050_session_ctx_t *session = NULL;
|
||||
|
||||
/* Initialize I2C */
|
||||
int ret = real_i2c_init(&i2c, i2c_bus, SE050_DEFAULT_I2C_ADDR);
|
||||
if (ret != 0) {
|
||||
TEST_ASSERT(0, "I2C not available - skipping hardware test");
|
||||
TEST_ASSERT(0, "I2C not available - skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Setup HAL */
|
||||
memset(&hal, 0, sizeof(hal));
|
||||
hal.handle = &i2c;
|
||||
hal.slave_addr = SE050_DEFAULT_I2C_ADDR;
|
||||
hal.dev_path = i2c_bus;
|
||||
|
||||
/* Create session with SCP03 */
|
||||
se050_status_t status = se050_session_create(&session, &hal);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Session creation");
|
||||
|
||||
@@ -388,69 +327,46 @@ static void test_scp03_encrypt_hardware(const char *i2c_bus)
|
||||
status = se050_session_scp03_init(session);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "SCP03 initialization");
|
||||
|
||||
status = se050_session_scp03_set_keys(session,
|
||||
ACTIVE_ENC_KEY,
|
||||
ACTIVE_MAC_KEY,
|
||||
ACTIVE_DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Set chip-specific PlatformSCP03 keys");
|
||||
status = se050_session_scp03_set_keys(session, ENC_KEY, MAC_KEY, DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Set PlatformSCP03 keys");
|
||||
|
||||
/* Prepare APDU command */
|
||||
uint8_t cmd[64];
|
||||
size_t cmd_len = 6;
|
||||
cmd[0] = 0x80;
|
||||
cmd[1] = 0x6F; /* GET VERSION */
|
||||
cmd[2] = 0x00;
|
||||
cmd[3] = 0x00;
|
||||
cmd[4] = 0x00;
|
||||
cmd[5] = 0x00;
|
||||
|
||||
/* Simple APDU: GET VERSION */
|
||||
cmd[0] = 0x80; /* CLA */
|
||||
cmd[1] = 0x6F; /* INS - GET VERSION */
|
||||
cmd[2] = 0x00; /* P1 */
|
||||
cmd[3] = 0x00; /* P2 */
|
||||
cmd[4] = 0x00; /* LC */
|
||||
cmd[5] = 0x00; /* LE */
|
||||
|
||||
/* Encrypt command with SCP03 */
|
||||
status = se050_session_scp03_encrypt(session, cmd, &cmd_len);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "SCP03 command encryption");
|
||||
|
||||
if (status == SE050_OK) {
|
||||
printf("Encrypted command (%zu bytes): ", cmd_len);
|
||||
for (size_t i = 0; i < cmd_len && i < 32; i++) {
|
||||
printf("Encrypted (%zu bytes): ", cmd_len);
|
||||
for (size_t i = 0; i < cmd_len && i < 16; i++) {
|
||||
printf("%02X ", cmd[i]);
|
||||
}
|
||||
if (cmd_len > 32) printf("...");
|
||||
printf("\n");
|
||||
printf("...\n");
|
||||
|
||||
/* Send to hardware */
|
||||
int written = real_i2c_write(&i2c, cmd, (int)cmd_len);
|
||||
if (written > 0) {
|
||||
TEST_ASSERT(1, "Encrypted command sent to SE050");
|
||||
TEST_ASSERT(1, "Command sent to SE050");
|
||||
|
||||
/* Read response */
|
||||
uint8_t response[64];
|
||||
int bytes_read = real_i2c_read(&i2c, response, sizeof(response));
|
||||
|
||||
if (bytes_read > 0) {
|
||||
TEST_ASSERT(1, "Response received from SE050");
|
||||
printf("Response (%d bytes): ", bytes_read);
|
||||
for (int i = 0; i < bytes_read && i < 32; i++) {
|
||||
printf("%02X ", response[i]);
|
||||
}
|
||||
if (bytes_read > 32) printf("...");
|
||||
printf("\n");
|
||||
TEST_ASSERT(1, "Response received");
|
||||
|
||||
/* Decrypt response */
|
||||
size_t resp_len = (size_t)bytes_read;
|
||||
uint16_t sw = se050_session_scp03_decrypt(session, cmd_len, response, &resp_len);
|
||||
printf("Status word: 0x%04X\n", sw);
|
||||
printf("Status: 0x%04X\n", sw);
|
||||
|
||||
if (sw == 0x9000) {
|
||||
TEST_ASSERT(1, "SCP03 decryption successful - SE050 responded OK");
|
||||
} else {
|
||||
TEST_ASSERT(0, "SE050 returned non-success status");
|
||||
TEST_ASSERT(1, "SCP03 decryption successful");
|
||||
}
|
||||
} else {
|
||||
TEST_ASSERT(0, "No response from SE050");
|
||||
}
|
||||
} else {
|
||||
TEST_ASSERT(0, "Failed to send command to SE050");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,20 +386,17 @@ static void test_platform_scp03_full_flow(const char *i2c_bus)
|
||||
se050_i2c_hal_t hal;
|
||||
se050_session_ctx_t *session = NULL;
|
||||
|
||||
/* Initialize I2C */
|
||||
int ret = real_i2c_init(&i2c, i2c_bus, SE050_DEFAULT_I2C_ADDR);
|
||||
if (ret != 0) {
|
||||
TEST_ASSERT(0, "I2C not available - skipping full flow test");
|
||||
TEST_ASSERT(0, "I2C not available - skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Setup HAL */
|
||||
memset(&hal, 0, sizeof(hal));
|
||||
hal.handle = &i2c;
|
||||
hal.slave_addr = SE050_DEFAULT_I2C_ADDR;
|
||||
hal.dev_path = i2c_bus;
|
||||
|
||||
/* Step 1: Create session */
|
||||
se050_status_t status = se050_session_create(&session, &hal);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Step 1: Session creation");
|
||||
|
||||
@@ -492,34 +405,26 @@ static void test_platform_scp03_full_flow(const char *i2c_bus)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Step 2: Initialize SCP03 */
|
||||
status = se050_session_scp03_init(session);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Step 2: SCP03 context initialization");
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Step 2: SCP03 initialization");
|
||||
|
||||
/* Step 3: Set chip-specific PlatformSCP03 keys */
|
||||
status = se050_session_scp03_set_keys(session,
|
||||
ACTIVE_ENC_KEY,
|
||||
ACTIVE_MAC_KEY,
|
||||
ACTIVE_DEK_KEY);
|
||||
status = se050_session_scp03_set_keys(session, ENC_KEY, MAC_KEY, DEK_KEY);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Step 3: PlatformSCP03 key provisioning");
|
||||
|
||||
/* Step 4: Prepare and encrypt OPEN_SESSION command */
|
||||
uint8_t open_cmd[16];
|
||||
size_t open_cmd_len = 4;
|
||||
open_cmd[0] = 0x80; /* CLA */
|
||||
open_cmd[1] = 0x70; /* INS - OPEN_SESSION */
|
||||
open_cmd[2] = 0x00; /* P1 */
|
||||
open_cmd[3] = 0x00; /* P2 */
|
||||
open_cmd[0] = 0x80;
|
||||
open_cmd[1] = 0x70; /* OPEN_SESSION */
|
||||
open_cmd[2] = 0x00;
|
||||
open_cmd[3] = 0x00;
|
||||
|
||||
status = se050_session_scp03_encrypt(session, open_cmd, &open_cmd_len);
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Step 4: Encrypt OPEN_SESSION command");
|
||||
TEST_ASSERT_EQ(status, SE050_OK, "Step 4: Encrypt OPEN_SESSION");
|
||||
|
||||
/* Step 5: Send to hardware */
|
||||
int written = real_i2c_write(&i2c, open_cmd, (int)open_cmd_len);
|
||||
if (written > 0) {
|
||||
TEST_ASSERT(1, "Step 5: OPEN_SESSION command sent");
|
||||
TEST_ASSERT(1, "Step 5: Command sent");
|
||||
|
||||
/* Step 6: Read and decrypt response */
|
||||
uint8_t response[64];
|
||||
int bytes_read = real_i2c_read(&i2c, response, sizeof(response));
|
||||
|
||||
@@ -528,27 +433,18 @@ static void test_platform_scp03_full_flow(const char *i2c_bus)
|
||||
|
||||
size_t resp_len = (size_t)bytes_read;
|
||||
uint16_t sw = se050_session_scp03_decrypt(session, open_cmd_len, response, &resp_len);
|
||||
|
||||
printf("Session open status: 0x%04X\n", sw);
|
||||
printf("Session status: 0x%04X\n", sw);
|
||||
|
||||
if (sw == 0x9000) {
|
||||
TEST_ASSERT(1, "Step 7: PlatformSCP03 authentication successful!");
|
||||
printf("\n*** PlatformSCP03 connection established with %s ***\n", CHIP_NAME);
|
||||
printf("\n*** PlatformSCP03 connected with %s ***\n", CHIP_NAME);
|
||||
} else {
|
||||
TEST_ASSERT(0, "PlatformSCP03 authentication failed");
|
||||
printf("[WARN] SE050 may not have PlatformSCP03 keys configured\n");
|
||||
}
|
||||
} else {
|
||||
TEST_ASSERT(0, "No response from SE050");
|
||||
}
|
||||
} else {
|
||||
TEST_ASSERT(0, "Failed to send OPEN_SESSION command");
|
||||
}
|
||||
|
||||
/* Cleanup */
|
||||
if (session) {
|
||||
se050_session_delete(session);
|
||||
}
|
||||
if (session) se050_session_delete(session);
|
||||
real_i2c_close(&i2c);
|
||||
}
|
||||
|
||||
@@ -564,15 +460,7 @@ static void print_usage(const char *prog)
|
||||
printf("\nCompile-time chip selection:\n");
|
||||
printf(" make SE050_CHIP=SE050C0 test_se050\n");
|
||||
printf(" make SE050_CHIP=SE050C1 test_se050\n");
|
||||
printf(" make SE050_CHIP=SE050E0 test_se050\n");
|
||||
printf(" make SE050_CHIP=SE050E1 test_se050\n");
|
||||
printf(" make SE050_CHIP=SE050E2 test_se050\n");
|
||||
printf("\nSupported chips and their PlatformSCP03 keys:\n");
|
||||
printf(" SE050C0 - Chip-specific ENC/MAC/DEK keys\n");
|
||||
printf(" SE050C1 - Chip-specific ENC/MAC/DEK keys\n");
|
||||
printf(" SE050E0 - Chip-specific ENC/MAC/DEK keys\n");
|
||||
printf(" SE050E1 - Chip-specific ENC/MAC/DEK keys\n");
|
||||
printf(" SE050E2 - Chip-specific ENC/MAC/DEK keys\n");
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
@@ -580,13 +468,12 @@ static void print_usage(const char *prog)
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const char *i2c_bus = "/dev/i2c-1"; /* Default */
|
||||
const char *i2c_bus = "/dev/i2c-1";
|
||||
|
||||
/* Parse command line arguments */
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-b") == 0 && i + 1 < argc) {
|
||||
i2c_bus = argv[++i];
|
||||
} else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
|
||||
} else if (strcmp(argv[i], "-h") == 0) {
|
||||
print_usage(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
@@ -595,24 +482,21 @@ int main(int argc, char *argv[])
|
||||
printf("========================================\n");
|
||||
printf("SE050 Hardware Platform SCP03 Test\n");
|
||||
printf("========================================\n");
|
||||
printf("Chip Type: %s (SE050_CHIP=%d)\n", CHIP_NAME, SE050_CHIP);
|
||||
printf("Chip Type: %s\n", CHIP_NAME);
|
||||
printf("I2C Bus: %s\n", i2c_bus);
|
||||
printf("PlatformSCP03 Keys: Chip-specific (ENC/MAC/DEK)\n");
|
||||
printf("PlatformSCP03 Keys: Chip-specific\n");
|
||||
printf("========================================\n");
|
||||
|
||||
/* Print key fingerprints */
|
||||
printf("\nKey Fingerprints:\n");
|
||||
printf(" ENC: %02X%02X%02X%02X...\n", ACTIVE_ENC_KEY[0], ACTIVE_ENC_KEY[1], ACTIVE_ENC_KEY[2], ACTIVE_ENC_KEY[3]);
|
||||
printf(" MAC: %02X%02X%02X%02X...\n", ACTIVE_MAC_KEY[0], ACTIVE_MAC_KEY[1], ACTIVE_MAC_KEY[2], ACTIVE_MAC_KEY[3]);
|
||||
printf(" DEK: %02X%02X%02X%02X...\n", ACTIVE_DEK_KEY[0], ACTIVE_DEK_KEY[1], ACTIVE_DEK_KEY[2], ACTIVE_DEK_KEY[3]);
|
||||
printf(" ENC: %02X%02X%02X%02X...\n", ENC_KEY[0], ENC_KEY[1], ENC_KEY[2], ENC_KEY[3]);
|
||||
printf(" MAC: %02X%02X%02X%02X...\n", MAC_KEY[0], MAC_KEY[1], MAC_KEY[2], MAC_KEY[3]);
|
||||
printf(" DEK: %02X%02X%02X%02X...\n", DEK_KEY[0], DEK_KEY[1], DEK_KEY[2], DEK_KEY[3]);
|
||||
|
||||
/* Run all test cases */
|
||||
test_i2c_connection(i2c_bus);
|
||||
test_session_with_scp03(i2c_bus);
|
||||
test_scp03_encrypt_hardware(i2c_bus);
|
||||
test_platform_scp03_full_flow(i2c_bus);
|
||||
|
||||
/* Summary */
|
||||
printf("\n========================================\n");
|
||||
printf("Test Summary\n");
|
||||
printf("========================================\n");
|
||||
@@ -622,11 +506,9 @@ int main(int argc, char *argv[])
|
||||
printf("========================================\n");
|
||||
|
||||
if (test_failed == 0) {
|
||||
printf("\n✓ All tests passed!\n");
|
||||
printf(" PlatformSCP03 connection verified with %s\n", CHIP_NAME);
|
||||
printf("\n✓ All tests passed! PlatformSCP03 verified with %s\n", CHIP_NAME);
|
||||
} else {
|
||||
printf("\n✗ Some tests failed.\n");
|
||||
printf(" Check I2C connection and SE050 configuration.\n");
|
||||
}
|
||||
|
||||
return test_failed > 0 ? 1 : 0;
|
||||
|
||||
Reference in New Issue
Block a user