mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #9990 from kfnta/sync_complinace_test_to_latest
Sync PSA compliance test to latest versionpull/10012/head
commit
57ec1d57b9
|
@ -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;
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"name": "psa-compliance-framework"
|
||||
}
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue