From d473f6d59c5b56634c011e18e8ccbe7aea7f50fe Mon Sep 17 00:00:00 2001 From: Nir Sonnenschein Date: Thu, 7 Mar 2019 17:49:52 +0200 Subject: [PATCH 1/4] synchronize latest fix to tests synchronize latest fix to test_c043 --- .../compliance_crypto/test_c043/test_c043.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/components/TARGET_PSA/TESTS/compliance_crypto/test_c043/test_c043.c b/components/TARGET_PSA/TESTS/compliance_crypto/test_c043/test_c043.c index a82a3ab454..bf4f99eca9 100644 --- a/components/TARGET_PSA/TESTS/compliance_crypto/test_c043/test_c043.c +++ b/components/TARGET_PSA/TESTS/compliance_crypto/test_c043/test_c043.c @@ -86,32 +86,35 @@ int32_t psa_key_agreement_test(security_t caller) /* Abort a generator */ status = val->crypto_function(VAL_CRYPTO_GENERATOR_ABORT, &generator); TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7)); + /* Destroy a key and restore the slot to its default state */ + status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle); + TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8)); continue; } /* Retrieve the current capacity of a generator */ status = val->crypto_function(VAL_CRYPTO_GET_GENERATOR_CAPACITY, &generator, &capacity); - TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8)); + TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9)); /* Check if the generator capacity matches with the expected capacity */ - TEST_ASSERT_EQUAL(capacity, check1[i].expected_capacity, TEST_CHECKPOINT_NUM(9)); + TEST_ASSERT_EQUAL(capacity, check1[i].expected_capacity, TEST_CHECKPOINT_NUM(10)); /* Read some data from a generator */ status = val->crypto_function(VAL_CRYPTO_GENERATOR_READ, &generator, output, check1[i].expected_output_length); - TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10)); + TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11)); /* Check if the output matches with the expected data */ TEST_ASSERT_MEMCMP(output, check1[i].expected_output, check1[i].expected_output_length, - TEST_CHECKPOINT_NUM(11)); + TEST_CHECKPOINT_NUM(12)); /* Abort a generator */ status = val->crypto_function(VAL_CRYPTO_GENERATOR_ABORT, &generator); - TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(12)); - + TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(13)); + /* Destroy a key and restore the slot to its default state */ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle); - TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(13)); + TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(14)); } return VAL_STATUS_SUCCESS; From a772d9d32709c5cdd19d6b5a8cb53f023ff0c4f9 Mon Sep 17 00:00:00 2001 From: Nir Sonnenschein Date: Thu, 7 Mar 2019 17:50:54 +0200 Subject: [PATCH 2/4] add comment explaining attestation keys for test use --- features/frameworks/TARGET_PSA/pal/pal_mbed_os_intf.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/features/frameworks/TARGET_PSA/pal/pal_mbed_os_intf.cpp b/features/frameworks/TARGET_PSA/pal/pal_mbed_os_intf.cpp index 88c593fc3e..dded6d0180 100644 --- a/features/frameworks/TARGET_PSA/pal/pal_mbed_os_intf.cpp +++ b/features/frameworks/TARGET_PSA/pal/pal_mbed_os_intf.cpp @@ -26,6 +26,9 @@ extern "C" psa_status_t psa_ps_reset(); test_entry_f test_g = NULL; compliance_test_type type_g = COMPLIANCE_TEST_UNDEFINED; +// randomly generated attestation key used for testing the attestation feature. +// The specific key chosen shouldn't matter to the attestation test +// the test just needs a key to be injected before it is run. static const uint8_t private_key_data[] = { 0x49, 0xc9, 0xa8, 0xc1, 0x8c, 0x4b, 0x88, 0x56, 0x38, 0xc4, 0x31, 0xcf, 0x1d, 0xf1, 0xc9, 0x94, From 517bb1a64ace258ddbe34feb6f3e29f6e43c8843 Mon Sep 17 00:00:00 2001 From: Nir Sonnenschein Date: Thu, 7 Mar 2019 18:04:27 +0200 Subject: [PATCH 3/4] remove sid.h as it is now supplied by PSA --- features/frameworks/TARGET_PSA/psa_manifest/sid.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 features/frameworks/TARGET_PSA/psa_manifest/sid.h diff --git a/features/frameworks/TARGET_PSA/psa_manifest/sid.h b/features/frameworks/TARGET_PSA/psa_manifest/sid.h deleted file mode 100644 index e69de29bb2..0000000000 From c99f03d0ced40dc28759c1fc2f5d03305a41b6b0 Mon Sep 17 00:00:00 2001 From: Nir Sonnenschein Date: Thu, 7 Mar 2019 18:04:59 +0200 Subject: [PATCH 4/4] add mbed_lib.json to prevent inclusion in bare-metal builds --- features/frameworks/TARGET_PSA/mbed_lib.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 features/frameworks/TARGET_PSA/mbed_lib.json diff --git a/features/frameworks/TARGET_PSA/mbed_lib.json b/features/frameworks/TARGET_PSA/mbed_lib.json new file mode 100644 index 0000000000..41b4e30fc7 --- /dev/null +++ b/features/frameworks/TARGET_PSA/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "psa-compliance-framework" +}