diff --git a/CMakeLists.txt b/CMakeLists.txt index 05c7a5f..7493410 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/Makefile b/Makefile index 8cbf9ae..68fa834 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/include/se050_scp03_keys.h b/include/se050_scp03_keys.h new file mode 100644 index 0000000..7176e71 --- /dev/null +++ b/include/se050_scp03_keys.h @@ -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 + +/* ============================================================================ + * 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 */ diff --git a/src/se050_scp03_keys.c b/src/se050_scp03_keys.c new file mode 100644 index 0000000..1c9dd3f --- /dev/null +++ b/src/se050_scp03_keys.c @@ -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 +}; diff --git a/tests/test_scp03_hardware.c b/tests/test_scp03_hardware.c index e05aa54..aef6940 100644 --- a/tests/test_scp03_hardware.c +++ b/tests/test_scp03_hardware.c @@ -14,22 +14,7 @@ #include #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; diff --git a/tests/test_scp03_se050.c b/tests/test_scp03_se050.c index 26f7332..b910b96 100644 --- a/tests/test_scp03_se050.c +++ b/tests/test_scp03_se050.c @@ -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 * ============================================================================ */