Skip to content

Commit c94b3e4

Browse files
committed
Fix psa_key_management_operations
At these locations, psa_key_attribute variables are used without initialisation. The function getting it (psa_get_key_attributes), is freeing attributes->domain_parameters, which can contain random address from the stack. Signed-off-by: Gabor Abonyi <[email protected]>
1 parent d847f9f commit c94b3e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ static void psa_key_management_operation(void)
18221822

18231823
switch (psa_key_mng.func) {
18241824
case PSA_GET_KEY_ATTRIBUTES: {
1825-
psa_key_attributes_t attributes;
1825+
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
18261826
psa_client_key_attributes_t client;
18271827

18281828
if (!psa_crypto_access_control_is_handle_permitted(psa_key_mng.handle,
@@ -1882,7 +1882,7 @@ static void psa_key_management_operation(void)
18821882

18831883
case PSA_IMPORT_KEY: {
18841884
size_t attributes_length = msg.in_size[1];
1885-
psa_key_attributes_t attributes;
1885+
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
18861886
size_t data_length = msg.in_size[2];
18871887
uint8_t *data = NULL;
18881888
psa_key_handle_t handle;

0 commit comments

Comments
 (0)