Fix crypto service get key info out params

pull/10067/head
Alon 2019-02-28 20:09:48 +02:00 committed by Cruz Monrreal II
parent d3fd113cbe
commit 7cb3205475
1 changed files with 8 additions and 9 deletions

View File

@ -1200,20 +1200,19 @@ static void psa_key_management_operation(void)
} }
case PSA_GET_KEY_INFORMATION: { case PSA_GET_KEY_INFORMATION: {
psa_key_type_t type; psa_key_type_t type = 0;
size_t bits; size_t bits = 0;
if (!psa_crypto_access_control_is_handle_permitted(psa_key_mng.handle, if (psa_crypto_access_control_is_handle_permitted(psa_key_mng.handle,
partition_id)) { partition_id)) {
status = psa_get_key_information(psa_key_mng.handle, &type, &bits);
} else {
status = PSA_ERROR_INVALID_HANDLE; status = PSA_ERROR_INVALID_HANDLE;
break;
} }
status = psa_get_key_information(psa_key_mng.handle, if (msg.out_size[0] >= sizeof(psa_key_type_t)) {
&type, &bits); psa_write(msg.handle, 0, &type, sizeof(psa_key_type_t));
if (msg.out_size[0] >= sizeof(psa_key_type_t)) }
psa_write(msg.handle, 0,
&type, sizeof(psa_key_type_t));
if (msg.out_size[1] >= sizeof(size_t)) { if (msg.out_size[1] >= sizeof(size_t)) {
psa_write(msg.handle, 1, &bits, sizeof(size_t)); psa_write(msg.handle, 1, &bits, sizeof(size_t));
} }