Attestation: astyle fixs

Runing astyle over attestation file to pass CI
pull/9668/head
Moran Peker 2019-02-12 14:34:28 +02:00
parent a994499bf3
commit 8fc9c8fdab
5 changed files with 17 additions and 19 deletions

View File

@ -84,24 +84,24 @@ static void check_initial_attestation_get_token()
const psa_key_id_t key_id = 17; const psa_key_id_t key_id = 17;
psa_key_handle_t handle = 0; psa_key_handle_t handle = 0;
status = psa_crypto_init(); status = psa_crypto_init();
status =psa_open_key( PSA_KEY_LIFETIME_PERSISTENT, key_id, &handle ); status = psa_open_key(PSA_KEY_LIFETIME_PERSISTENT, key_id, &handle);
status =psa_destroy_key( handle ); status = psa_destroy_key(handle);
status = psa_attestation_inject_key(private_key_data, status = psa_attestation_inject_key(private_key_data,
sizeof(private_key_data), sizeof(private_key_data),
PSA_KEY_TYPE_ECC_KEYPAIR(PSA_ECC_CURVE_SECP256R1), PSA_KEY_TYPE_ECC_KEYPAIR(PSA_ECC_CURVE_SECP256R1),
exported, exported,
sizeof(exported), sizeof(exported),
&exported_length); &exported_length);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS); TEST_ASSERT_EQUAL(status, PSA_SUCCESS);
TEST_ASSERT_EQUAL(sizeof( public_key_data ), exported_length); TEST_ASSERT_EQUAL(sizeof(public_key_data), exported_length);
TEST_ASSERT_EQUAL(memcmp( public_key_data, exported, exported_length), 0); TEST_ASSERT_EQUAL(memcmp(public_key_data, exported, exported_length), 0);
attest_err = psa_initial_attest_get_token_size(TEST_CHALLENGE_OBJ_SIZE, attest_err = psa_initial_attest_get_token_size(TEST_CHALLENGE_OBJ_SIZE,
&token_size); &token_size);
TEST_ASSERT_EQUAL(attest_err, PSA_ATTEST_ERR_SUCCESS); TEST_ASSERT_EQUAL(attest_err, PSA_ATTEST_ERR_SUCCESS);
attest_err = psa_initial_attest_get_token(challenge_buffer, attest_err = psa_initial_attest_get_token(challenge_buffer,
TEST_CHALLENGE_OBJ_SIZE, TEST_CHALLENGE_OBJ_SIZE,
token_buffer, token_buffer,
@ -115,8 +115,8 @@ utest::v1::status_t case_teardown_handler(const Case *const source, const size_t
{ {
const psa_key_id_t key_id = 17; const psa_key_id_t key_id = 17;
psa_key_handle_t handle = 0; psa_key_handle_t handle = 0;
psa_open_key( PSA_KEY_LIFETIME_PERSISTENT, key_id, &handle ); psa_open_key(PSA_KEY_LIFETIME_PERSISTENT, key_id, &handle);
psa_destroy_key( handle ); psa_destroy_key(handle);
// mbedtls_psa_cr/ypto_free(); // mbedtls_psa_cr/ypto_free();
return greentea_case_teardown_handler(source, passed, failed, reason); return greentea_case_teardown_handler(source, passed, failed, reason);
} }
@ -127,10 +127,10 @@ utest::v1::status_t case_setup_handler(const Case *const source, const size_t in
} }
Case cases[] = { Case cases[] = {
Case("PSA attestation get token", check_initial_attestation_get_token, case_teardown_handler), Case("PSA attestation get token", check_initial_attestation_get_token, case_teardown_handler),
}; };
Specification specification( greentea_test_setup, cases); Specification specification(greentea_test_setup, cases);
int main() int main()
{ {

View File

@ -148,11 +148,9 @@ t_cose_crypto_hash_start(struct t_cose_crypto_hash *hash_ctx,
void t_cose_crypto_hash_update(struct t_cose_crypto_hash *hash_ctx, void t_cose_crypto_hash_update(struct t_cose_crypto_hash *hash_ctx,
struct useful_buf_c data_to_hash) struct useful_buf_c data_to_hash)
{ {
if (data_to_hash.ptr != NULL) if (data_to_hash.ptr != NULL) {
{
psa_hash_update(&hash_handle, data_to_hash.ptr, data_to_hash.len); psa_hash_update(&hash_handle, data_to_hash.ptr, data_to_hash.len);
} else } else {
{
/* Intentionally do nothing, just computing the size of the token */ /* Intentionally do nothing, just computing the size of the token */
} }
} }

View File

@ -32,7 +32,7 @@ extern const uint8_t temp_ram_page_data[];
0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, \ 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, \
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, \ 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, \
0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF
extern uint8_t impl_id_data[]; extern uint8_t impl_id_data[];
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -181,7 +181,7 @@ static void psa_attest_inject_key(void)
} }
bytes_read = psa_read(msg.handle, 1, bytes_read = psa_read(msg.handle, 1,
key_data, msg.in_size[1]); key_data, msg.in_size[1]);
if (bytes_read != msg.in_size[1]) { if (bytes_read != msg.in_size[1]) {
SPM_PANIC("SPM read length mismatch"); SPM_PANIC("SPM read length mismatch");
} }

View File

@ -84,7 +84,7 @@ enum psa_attest_err_t attest_init(void);
*/ */
enum psa_attest_err_t enum psa_attest_err_t
initial_attest_get_token(const psa_invec *in_vec, uint32_t num_invec, initial_attest_get_token(const psa_invec *in_vec, uint32_t num_invec,
psa_outvec *out_vec, uint32_t num_outvec); psa_outvec *out_vec, uint32_t num_outvec);
/** /**
* \brief Get the size of the initial attestation token * \brief Get the size of the initial attestation token
@ -100,7 +100,7 @@ initial_attest_get_token(const psa_invec *in_vec, uint32_t num_invec,
*/ */
enum psa_attest_err_t enum psa_attest_err_t
initial_attest_get_token_size(const psa_invec *in_vec, uint32_t num_invec, initial_attest_get_token_size(const psa_invec *in_vec, uint32_t num_invec,
psa_outvec *out_vec, uint32_t num_outvec); psa_outvec *out_vec, uint32_t num_outvec);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif