aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoakim Bech <joakim.bech@linaro.org>2016-07-21 15:03:48 +0200
committerJoakim Bech <joakim.bech@linaro.org>2016-08-23 23:40:26 +0200
commitd82267ad1c58deac19c95799ca5b1ee301801b32 (patch)
tree2001bff361d93fe76d69e1bf7bfae7538edefd98
parenta144372af8d8e8a7214b55b743dba7fbf6351e99 (diff)
downloadtinycrypt-d82267ad1c58deac19c95799ca5b1ee301801b32.tar.gz
Add test files and update public key points
Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
-rw-r--r--source/main.c53
-rw-r--r--test_files/blinky/0.5.0/blinky_signed_0.5.0.zipbin0 -> 3799 bytes
-rw-r--r--test_files/blinky/0.5.0/init_databin0 -> 52 bytes
-rw-r--r--test_files/blinky/0.5.0/init_data_signed.derbin0 -> 71 bytes
-rw-r--r--test_files/blinky/0.5.0/init_data_signed_forget.derbin0 -> 72 bytes
-rw-r--r--test_files/blinky/0.5.0/manifest.json21
-rw-r--r--test_files/blinky/0.5.0/nrf52832_xxaa_s132.binbin0 -> 2524 bytes
-rw-r--r--test_files/blinky/0.5.0/nrf52832_xxaa_s132.datbin0 -> 116 bytes
-rw-r--r--test_files/blinky/0.5.0/pub_from_openssl.pem4
-rw-r--r--test_files/blinky/1.0.0/blinky_signed_1.0.0.zipbin0 -> 3188 bytes
-rw-r--r--test_files/blinky/1.0.0/manifest.json8
-rw-r--r--test_files/blinky/1.0.0/nrf52832_xxaa_s132.binbin0 -> 2524 bytes
-rw-r--r--test_files/blinky/1.0.0/nrf52832_xxaa_s132.datbin0 -> 139 bytes
-rw-r--r--test_files/blinky/key_0.5.0.pem5
-rw-r--r--test_files/manifest.json21
-rw-r--r--test_files/s132_pca10040.binbin0 -> 23516 bytes
-rw-r--r--test_files/s132_pca10040.datbin0 -> 116 bytes
17 files changed, 66 insertions, 46 deletions
diff --git a/source/main.c b/source/main.c
index df89579..f16ef9c 100644
--- a/source/main.c
+++ b/source/main.c
@@ -189,42 +189,6 @@ static uint32_t fs_read_public_key(char *fname_pub, EccPoint *pub, size_t keysiz
return TC_SUCCESS;
}
-static void read_keys(void)
-{
- uint32_t private_key[NUM_ECC_DIGITS];
- char *privname = "foo2.pri";
- EccPoint public_key;
- char *pubname = "foo2.pub";
-
- if (fs_read_private_key(privname, private_key, sizeof(private_key)) != TC_SUCCESS) {
- fprintf(stderr, "Failed reading private key: %s from disk\n", privname);
- }
-
- if (fs_read_public_key(pubname, &public_key, sizeof(public_key)) != TC_SUCCESS) {
- fprintf(stderr, "Failed reading public_key key: %s from disk\n", pubname);
- }
- return;
-}
-
-static void write_keys(void)
-{
- uint32_t private_key[NUM_ECC_DIGITS];
- char *privname = "foo2.pri";
- EccPoint public_key;
- char *pubname = "foo2.pub";
-
- debug_fill_buffer((uint8_t *)private_key, sizeof(private_key));
- if (fs_write_private_key(privname, private_key, sizeof(private_key)) != TC_SUCCESS) {
- fprintf(stderr, "Failed writing private key: %s to disk\n", privname);
- }
-
- debug_fill_buffer((uint8_t *)&public_key, sizeof(public_key));
- if (fs_write_public_key(pubname, &public_key, sizeof(public_key)) != TC_SUCCESS) {
- fprintf(stderr, "Failed writing public_key key: %s to disk\n", pubname);
- }
- return;
-}
-
/*
* $ openssl ec -in ~/devel/nRF5x_tools/pc-nrfutil/nordicsemi/dfu/tests/key.pem -text -noout
* read EC key
@@ -376,16 +340,14 @@ static uint8_t m_extended_packet_length; //< Length o
#define DFU_INIT_PACKET_USES_ECDS (2)
/** @snippet [DFU BLE Signing public key curve points] */
-static uint8_t Qx[] = { 0x39, 0xb0, 0x58, 0x3d, 0x27, 0x07, 0x91, 0x38, 0x6a, 0xa3, 0x36, 0x0f, 0xa2, 0xb5, 0x86, 0x7e, 0xae, 0xba, 0xf7, 0xa3, 0xf4, 0x81, 0x5f, 0x78, 0x02, 0xf2, 0xa1, 0x21, 0xd5, 0x21, 0x84, 0x12 };
-static uint8_t Qy[] = { 0x4a, 0x0d, 0xfe, 0xa4, 0x77, 0x50, 0xb1, 0xb5, 0x26, 0xc0, 0x9d, 0xdd, 0xf0, 0x24, 0x90, 0x57, 0x6c, 0x64, 0x3b, 0xd3, 0xdf, 0x92, 0x3b, 0xb3, 0x47, 0x97, 0x83, 0xd4, 0xfc, 0x76, 0xf5, 0x9d };
-/** @snippet [DFU BLE Signing public key curve points] */
-
-static nrf_sec_ecc_point_t Q = {.p_x = Qx,
- .x_len = sizeof(Qx),
- .p_y = Qy,
- .y_len = sizeof(Qy)};
+static uint8_t Qx[] = { 0x65, 0x8d, 0xa2, 0xed, 0xdb, 0x98, 0x1f, 0x69, 0x7d, 0xae, 0x72, 0x20, 0xd6, 0x82, 0x17, 0xab, 0xed, 0x3f, 0xb8, 0x70, 0x05, 0xec, 0x8a, 0x05, 0xb9, 0xb5, 0x6b, 0xbb, 0xaa, 0x17, 0xf4, 0x60 };
+static uint8_t Qy[] = { 0x90, 0x9b, 0xae, 0xcd, 0xad, 0x72, 0x26, 0xc2, 0x04, 0xb6, 0x12, 0xb6, 0x62, 0xff, 0x4f, 0xcc, 0xbd, 0x1b, 0x0c, 0x90, 0x84, 0x10, 0x90, 0xd8, 0x3a, 0x59, 0xcd, 0xad, 0x6c, 0x98, 0x1d, 0x4c };
-static uint8_t m_init_packet[128];
+/** @snippet [DFU BLE Signing public key curve points] */
+static nrf_sec_ecc_point_t Q = {.p_x = Qx,
+ .x_len = sizeof(Qx),
+ .p_y = Qy,
+ .y_len = sizeof(Qy)};
uint32_t dfu_init_prevalidate(uint8_t *p_init_data, uint32_t init_data_len)
{
@@ -510,7 +472,6 @@ uint32_t dfu_init_prevalidate(uint8_t *p_init_data, uint32_t init_data_len)
return err_code;
}
-
static void print_usage(char *program)
{
printf("Usage: %s [OPTIONS]\n", program);
diff --git a/test_files/blinky/0.5.0/blinky_signed_0.5.0.zip b/test_files/blinky/0.5.0/blinky_signed_0.5.0.zip
new file mode 100644
index 0000000..745af0f
--- /dev/null
+++ b/test_files/blinky/0.5.0/blinky_signed_0.5.0.zip
Binary files differ
diff --git a/test_files/blinky/0.5.0/init_data b/test_files/blinky/0.5.0/init_data
new file mode 100644
index 0000000..2ec71c8
--- /dev/null
+++ b/test_files/blinky/0.5.0/init_data
Binary files differ
diff --git a/test_files/blinky/0.5.0/init_data_signed.der b/test_files/blinky/0.5.0/init_data_signed.der
new file mode 100644
index 0000000..0059d6c
--- /dev/null
+++ b/test_files/blinky/0.5.0/init_data_signed.der
Binary files differ
diff --git a/test_files/blinky/0.5.0/init_data_signed_forget.der b/test_files/blinky/0.5.0/init_data_signed_forget.der
new file mode 100644
index 0000000..75cfbaa
--- /dev/null
+++ b/test_files/blinky/0.5.0/init_data_signed_forget.der
Binary files differ
diff --git a/test_files/blinky/0.5.0/manifest.json b/test_files/blinky/0.5.0/manifest.json
new file mode 100644
index 0000000..3c25331
--- /dev/null
+++ b/test_files/blinky/0.5.0/manifest.json
@@ -0,0 +1,21 @@
+{
+ "manifest": {
+ "application": {
+ "bin_file": "nrf52832_xxaa_s132.bin",
+ "dat_file": "nrf52832_xxaa_s132.dat",
+ "init_packet_data": {
+ "application_version": 4294967295,
+ "device_revision": 65535,
+ "device_type": 65535,
+ "ext_packet_id": 2,
+ "firmware_hash": "61de209ddccec58bea1dbc25fa85341509f8415c55eb142b2366c56bcf9cc767",
+ "firmware_length": 2524,
+ "init_packet_ecds": "08f22a3d4a7e401c878c56b91e89f30f8a69357baa50d962829cb236a485793f61f9aea0796d878a50776128b0364ad58fdaff71cab11fb35a4ed083f2689d7f",
+ "softdevice_req": [
+ 65534
+ ]
+ }
+ },
+ "dfu_version": 0.8
+ }
+} \ No newline at end of file
diff --git a/test_files/blinky/0.5.0/nrf52832_xxaa_s132.bin b/test_files/blinky/0.5.0/nrf52832_xxaa_s132.bin
new file mode 100644
index 0000000..ac3b09d
--- /dev/null
+++ b/test_files/blinky/0.5.0/nrf52832_xxaa_s132.bin
Binary files differ
diff --git a/test_files/blinky/0.5.0/nrf52832_xxaa_s132.dat b/test_files/blinky/0.5.0/nrf52832_xxaa_s132.dat
new file mode 100644
index 0000000..9b3859f
--- /dev/null
+++ b/test_files/blinky/0.5.0/nrf52832_xxaa_s132.dat
Binary files differ
diff --git a/test_files/blinky/0.5.0/pub_from_openssl.pem b/test_files/blinky/0.5.0/pub_from_openssl.pem
new file mode 100644
index 0000000..34cb636
--- /dev/null
+++ b/test_files/blinky/0.5.0/pub_from_openssl.pem
@@ -0,0 +1,4 @@
+-----BEGIN PUBLIC KEY-----
+MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEZY2i7duYH2l9rnIg1oIXq+0/uHAF
+7IoFubVru6oX9GCQm67NrXImwgS2ErZi/0/MvRsMkIQQkNg6Wc2tbJgdTA==
+-----END PUBLIC KEY-----
diff --git a/test_files/blinky/1.0.0/blinky_signed_1.0.0.zip b/test_files/blinky/1.0.0/blinky_signed_1.0.0.zip
new file mode 100644
index 0000000..f6e014e
--- /dev/null
+++ b/test_files/blinky/1.0.0/blinky_signed_1.0.0.zip
Binary files differ
diff --git a/test_files/blinky/1.0.0/manifest.json b/test_files/blinky/1.0.0/manifest.json
new file mode 100644
index 0000000..471c18a
--- /dev/null
+++ b/test_files/blinky/1.0.0/manifest.json
@@ -0,0 +1,8 @@
+{
+ "manifest": {
+ "application": {
+ "bin_file": "nrf52832_xxaa_s132.bin",
+ "dat_file": "nrf52832_xxaa_s132.dat"
+ }
+ }
+} \ No newline at end of file
diff --git a/test_files/blinky/1.0.0/nrf52832_xxaa_s132.bin b/test_files/blinky/1.0.0/nrf52832_xxaa_s132.bin
new file mode 100644
index 0000000..ac3b09d
--- /dev/null
+++ b/test_files/blinky/1.0.0/nrf52832_xxaa_s132.bin
Binary files differ
diff --git a/test_files/blinky/1.0.0/nrf52832_xxaa_s132.dat b/test_files/blinky/1.0.0/nrf52832_xxaa_s132.dat
new file mode 100644
index 0000000..adf5b5d
--- /dev/null
+++ b/test_files/blinky/1.0.0/nrf52832_xxaa_s132.dat
Binary files differ
diff --git a/test_files/blinky/key_0.5.0.pem b/test_files/blinky/key_0.5.0.pem
new file mode 100644
index 0000000..84fdffc
--- /dev/null
+++ b/test_files/blinky/key_0.5.0.pem
@@ -0,0 +1,5 @@
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEID2WUBCe/4kLhl5ekJ+O8PtprcahUNFE3RIm5htQzDedoAoGCCqGSM49
+AwEHoUQDQgAEZY2i7duYH2l9rnIg1oIXq+0/uHAF7IoFubVru6oX9GCQm67NrXIm
+wgS2ErZi/0/MvRsMkIQQkNg6Wc2tbJgdTA==
+-----END EC PRIVATE KEY-----
diff --git a/test_files/manifest.json b/test_files/manifest.json
new file mode 100644
index 0000000..d38a85c
--- /dev/null
+++ b/test_files/manifest.json
@@ -0,0 +1,21 @@
+{
+ "manifest": {
+ "application": {
+ "bin_file": "s132_pca10040.bin",
+ "dat_file": "s132_pca10040.dat",
+ "init_packet_data": {
+ "application_version": 4294967295,
+ "device_revision": 65535,
+ "device_type": 65535,
+ "ext_packet_id": 2,
+ "firmware_hash": "fcdf9d67d6397ca578fcc09ed070f0ff91483b33cc2b5c62cc4ea9b76fe7b5cd",
+ "firmware_length": 23516,
+ "init_packet_ecds": "8953339a15b4e06221adc22ef1a68dcfefe9313a3f5ef5247bd93dd5c893d9582f9d794b63b8b94cf9fb61385d8a8dc92e8399440412fbf76d3b3b911f7f3805",
+ "softdevice_req": [
+ 65534
+ ]
+ }
+ },
+ "dfu_version": 0.8
+ }
+} \ No newline at end of file
diff --git a/test_files/s132_pca10040.bin b/test_files/s132_pca10040.bin
new file mode 100644
index 0000000..0803f3a
--- /dev/null
+++ b/test_files/s132_pca10040.bin
Binary files differ
diff --git a/test_files/s132_pca10040.dat b/test_files/s132_pca10040.dat
new file mode 100644
index 0000000..a84ae5e
--- /dev/null
+++ b/test_files/s132_pca10040.dat
Binary files differ