鍵管理の統一と重複削除

- 共通鍵ファイル追加:include/se050_scp03_keys.h, src/se050_scp03_keys.c
- test_scp03_hardware.c: 重複鍵定義削除し共通ファイルを参照
- test_scp03_se050.c: 重複鍵定義削除し共通ファイルを参照
- 鍵値はプレースホルダー (TODO: PDF から正しい値に置き換え)

構造:
  se050_scp03_keys.c
    ├─ SE050C0_ENC/MAC/DEK_KEY
    ├─ SE050C1_ENC/MAC/DEK_KEY
    └─ SE050E2_ENC/MAC/DEK_KEY
This commit is contained in:
km
2026-03-26 10:13:25 +09:00
parent 163fad68a7
commit 74789be2c3
6 changed files with 127 additions and 71 deletions
+1
View File
@@ -17,6 +17,7 @@ set(SOURCES
src/se050_rng.c
src/se050_x25519.c
src/se050_scp03.c
src/se050_scp03_keys.c
)
# Create library
+2 -1
View File
@@ -12,7 +12,8 @@ SRCS = src/se050_i2c_hal.c \
src/se050_keystore.c \
src/se050_rng.c \
src/se050_x25519.c \
src/se050_scp03.c
src/se050_scp03.c \
src/se050_scp03_keys.c
# Object files
OBJS = $(SRCS:.c=.o)
+40
View File
@@ -0,0 +1,40 @@
/**
* @file se050_scp03_keys.h
* @brief SE050 Platform SCP03 Keys
*
* Platform SCP03 keys for each SE050 chip type.
* Keys should be obtained from NXP documentation or secure provisioning.
*
* License: MIT (Clean-room implementation)
*/
#ifndef SE050_SCP03_KEYS_H
#define SE050_SCP03_KEYS_H
#include <stdint.h>
/* ============================================================================
* SE050C0 Platform SCP03 Keys
* ============================================================================ */
extern const uint8_t SE050C0_ENC_KEY[16];
extern const uint8_t SE050C0_MAC_KEY[16];
extern const uint8_t SE050C0_DEK_KEY[16];
/* ============================================================================
* SE050C1 Platform SCP03 Keys
* ============================================================================ */
extern const uint8_t SE050C1_ENC_KEY[16];
extern const uint8_t SE050C1_MAC_KEY[16];
extern const uint8_t SE050C1_DEK_KEY[16];
/* ============================================================================
* SE050E2 Platform SCP03 Keys
* ============================================================================ */
extern const uint8_t SE050E2_ENC_KEY[16];
extern const uint8_t SE050E2_MAC_KEY[16];
extern const uint8_t SE050E2_DEK_KEY[16];
#endif /* SE050_SCP03_KEYS_H */
+81
View File
@@ -0,0 +1,81 @@
/**
* @file se050_scp03_keys.c
* @brief SE050 Platform SCP03 Keys Implementation
*
* Platform SCP03 keys for each SE050 chip type.
*
* IMPORTANT: These are placeholder values. Replace with actual keys from:
* - NXP documentation
* - Secure provisioning process
* - Your organization's key management system
*
* License: MIT (Clean-room implementation)
*/
#include "se050_scp03_keys.h"
/* ============================================================================
* SE050C0 Platform SCP03 Keys
*
* TODO: Replace with actual keys from NXP documentation or secure provisioning
* Reference: [Add PDF reference here]
* ============================================================================ */
const uint8_t SE050C0_ENC_KEY[16] = {
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF
};
const uint8_t SE050C0_MAC_KEY[16] = {
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10
};
const uint8_t SE050C0_DEK_KEY[16] = {
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
};
/* ============================================================================
* SE050C1 Platform SCP03 Keys
*
* TODO: Replace with actual keys from NXP documentation or secure provisioning
* Reference: [Add PDF reference here]
* ============================================================================ */
const uint8_t SE050C1_ENC_KEY[16] = {
0xA1, 0xB2, 0xC3, 0xD4, 0xE5, 0xF6, 0x07, 0x18,
0x29, 0x3A, 0x4B, 0x5C, 0x6D, 0x7E, 0x8F, 0x90
};
const uint8_t SE050C1_MAC_KEY[16] = {
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00
};
const uint8_t SE050C1_DEK_KEY[16] = {
0x98, 0x76, 0x54, 0x32, 0x10, 0xFE, 0xDC, 0xBA,
0x98, 0x76, 0x54, 0x32, 0x10, 0xFE, 0xDC, 0xBA
};
/* ============================================================================
* SE050E2 Platform SCP03 Keys
*
* TODO: Replace with actual keys from NXP documentation or secure provisioning
* Reference: [Add PDF reference here]
* ============================================================================ */
const uint8_t SE050E2_ENC_KEY[16] = {
0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC,
0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44
};
const uint8_t SE050E2_MAC_KEY[16] = {
0x44, 0x33, 0x22, 0x11, 0x00, 0xFF, 0xEE, 0xDD,
0xCC, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x55
};
const uint8_t SE050E2_DEK_KEY[16] = {
0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE,
0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66
};
+1 -16
View File
@@ -14,22 +14,7 @@
#include <stdint.h>
#include "se050_wireguard.h"
#include "se050_crypto_utils.h"
/* 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 SE050C0_MAC_KEY[16] = {
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10
};
static const uint8_t SE050C0_DEK_KEY[16] = {
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
};
#include "se050_scp03_keys.h"
/* Test result counters */
static int test_passed = 0;
+2 -54
View File
@@ -25,9 +25,10 @@
#include "se050_wireguard.h"
#include "se050_crypto_utils.h"
#include "se050_scp03_keys.h"
/* ============================================================================
* SE050 Chip Selection (compile-time)
* Chip Selection and Key Mapping
* ============================================================================ */
#ifndef SE050_CHIP
@@ -61,59 +62,6 @@
#error "Invalid SE050_CHIP. Use SE050C0, SE050C1, or SE050E2"
#endif
/* ============================================================================
* Platform SCP03 Keys per Chip Type
* Each chip type has its own 3-key set (ENC, MAC, DEK)
* ============================================================================ */
/* SE050C0 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 SE050C0_MAC_KEY[16] = {
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10
};
static const uint8_t SE050C0_DEK_KEY[16] = {
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
};
/* SE050C1 Platform SCP03 Keys */
static const uint8_t SE050C1_ENC_KEY[16] = {
0xA1, 0xB2, 0xC3, 0xD4, 0xE5, 0xF6, 0x07, 0x18,
0x29, 0x3A, 0x4B, 0x5C, 0x6D, 0x7E, 0x8F, 0x90
};
static const uint8_t SE050C1_MAC_KEY[16] = {
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00
};
static const uint8_t SE050C1_DEK_KEY[16] = {
0x98, 0x76, 0x54, 0x32, 0x10, 0xFE, 0xDC, 0xBA,
0x98, 0x76, 0x54, 0x32, 0x10, 0xFE, 0xDC, 0xBA
};
/* SE050E2 Platform SCP03 Keys */
static const uint8_t SE050E2_ENC_KEY[16] = {
0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC,
0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44
};
static const uint8_t SE050E2_MAC_KEY[16] = {
0x44, 0x33, 0x22, 0x11, 0x00, 0xFF, 0xEE, 0xDD,
0xCC, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x55
};
static const uint8_t SE050E2_DEK_KEY[16] = {
0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE,
0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66
};
/* ============================================================================
* Test Result Tracking
* ============================================================================ */