Skip to content

Commit 0d550ee

Browse files
AlonNir Sonnenschein
authored andcommitted
Fix crypto service get key info out params
1 parent 355f09b commit 0d550ee

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,20 +1200,19 @@ static void psa_key_management_operation(void)
12001200
}
12011201

12021202
case PSA_GET_KEY_INFORMATION: {
1203-
psa_key_type_t type;
1204-
size_t bits;
1203+
psa_key_type_t type = 0;
1204+
size_t bits = 0;
12051205

1206-
if (!psa_crypto_access_control_is_handle_permitted(psa_key_mng.handle,
1206+
if (psa_crypto_access_control_is_handle_permitted(psa_key_mng.handle,
12071207
partition_id)) {
1208+
status = psa_get_key_information(psa_key_mng.handle, &type, &bits);
1209+
} else {
12081210
status = PSA_ERROR_INVALID_HANDLE;
1209-
break;
12101211
}
12111212

1212-
status = psa_get_key_information(psa_key_mng.handle,
1213-
&type, &bits);
1214-
if (msg.out_size[0] >= sizeof(psa_key_type_t))
1215-
psa_write(msg.handle, 0,
1216-
&type, sizeof(psa_key_type_t));
1213+
if (msg.out_size[0] >= sizeof(psa_key_type_t)) {
1214+
psa_write(msg.handle, 0, &type, sizeof(psa_key_type_t));
1215+
}
12171216
if (msg.out_size[1] >= sizeof(size_t)) {
12181217
psa_write(msg.handle, 1, &bits, sizeof(size_t));
12191218
}

0 commit comments

Comments
 (0)