Skip to content

Commit 775186e

Browse files
author
Netanel Gonen
committed
staus to status
1 parent f3e4033 commit 775186e

File tree

1 file changed

+28
-29
lines changed

1 file changed

+28
-29
lines changed

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

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
#define mbedtls_free free
1818
#endif
1919
// ------------------------- Globals ---------------------------
20-
static psa_spm_init_refence_counter = 0;
20+
static uint8_t psa_spm_init_refence_counter = 0;
2121

22-
typede f struct {
22+
typedef struct {
2323
psa_key_slot_t key_slot;
2424
int32_t owner_pid;
2525
} spm_crpyto_key_slot_t;
@@ -44,7 +44,7 @@ static psa_status_t insert_key_into_spm_slot(psa_handle_t handle, psa_key_slot_t
4444

4545
static psa_status_t check_spm_key_acl(psa_handle_t handle, psa_key_slot_t key_slot)
4646
{
47-
uint32_t current_pid = psa_identity(handle);
47+
int32_t current_pid = psa_identity(handle);
4848

4949
for (uint32_t i=0; i < sizeof(spm_key_slots) / sizeof(spm_key_slots[0]); i++) {
5050
if ((spm_key_slots[i].key_slot == key_slot) &&
@@ -57,7 +57,7 @@ static psa_status_t check_spm_key_acl(psa_handle_t handle, psa_key_slot_t key_sl
5757

5858
static void free_spm_key_slot(psa_handle_t handle, psa_key_slot_t key_slot)
5959
{
60-
uint32_t current_pid = psa_identity(handle);
60+
int32_t current_pid = psa_identity(handle);
6161

6262
for (uint32_t i=0; i < sizeof(spm_key_slots) / sizeof(spm_key_slots[0]); i++) {
6363
if ((spm_key_slots[i].key_slot == key_slot) &&
@@ -181,7 +181,7 @@ static void psa_mac_operation( void )
181181
case PSA_MAC_SIGN_SETUP:
182182
{
183183
status = check_spm_key_acl(msg.handle, psa_crypto.key);
184-
if (staus == PSA_SUCCESS) {
184+
if (status == PSA_SUCCESS) {
185185
status = psa_mac_sign_setup( msg.rhandle,
186186
psa_crypto.key,
187187
psa_crypto.alg );
@@ -192,7 +192,7 @@ static void psa_mac_operation( void )
192192
case PSA_MAC_VERIFY_SETUP:
193193
{
194194
status = check_spm_key_acl(msg.handle, psa_crypto.key);
195-
if (staus == PSA_SUCCESS) {
195+
if (status == PSA_SUCCESS) {
196196
status = psa_mac_verify_setup( msg.rhandle,
197197
psa_crypto.key,
198198
psa_crypto.alg );
@@ -524,7 +524,7 @@ static void psa_asymmetric_operation( void )
524524
SPM_PANIC("SPM read length mismatch");
525525
}
526526
status = check_spm_key_acl(msg.handle, psa_crypto.key);
527-
if (staus == PSA_SUCCESS) {
527+
if (status == PSA_SUCCESS) {
528528
status = psa_asymmetric_sign( psa_crypto.key,
529529
psa_crypto.alg,
530530
hash,
@@ -572,7 +572,7 @@ static void psa_asymmetric_operation( void )
572572
SPM_PANIC("SPM read length mismatch");
573573
}
574574
status = check_spm_key_acl(msg.handle, psa_crypto.key);
575-
if (staus == PSA_SUCCESS) {
575+
if (status == PSA_SUCCESS) {
576576
status = psa_asymmetric_verify( psa_crypto.key,
577577
psa_crypto.alg,
578578
hash,
@@ -617,7 +617,7 @@ static void psa_asymmetric_operation( void )
617617
break;
618618
}
619619
status = check_spm_key_acl(msg.handle, psa_crypto.key);
620-
if (staus == PSA_SUCCESS) {
620+
if (status == PSA_SUCCESS) {
621621
if( psa_crypto.func == PSA_ASYMMETRIC_ENCRYPT )
622622
status = psa_asymmetric_encrypt( psa_crypto.key,
623623
psa_crypto.alg,
@@ -726,7 +726,7 @@ static void psa_aead_operation()
726726
break;
727727
}
728728
status = check_spm_key_acl(msg.handle, psa_crypto.key);
729-
if (staus == PSA_SUCCESS) {
729+
if (status == PSA_SUCCESS) {
730730
if( psa_crypto.func == PSA_AEAD_ENCRYPT )
731731
status = psa_aead_encrypt( psa_crypto.key,
732732
psa_crypto.alg,
@@ -820,7 +820,7 @@ static void psa_symmetric_operation( void )
820820
case PSA_CIPHER_ENCRYPT_SETUP:
821821
{
822822
status = check_spm_key_acl(msg.handle, psa_crypto_ipc.key);
823-
if (staus == PSA_SUCCESS) {
823+
if (status == PSA_SUCCESS) {
824824
status = psa_cipher_encrypt_setup( msg.rhandle,
825825
psa_crypto_ipc.key,
826826
psa_crypto_ipc.alg );
@@ -830,7 +830,7 @@ static void psa_symmetric_operation( void )
830830
case PSA_CIPHER_DECRYPT_SETUP:
831831
{
832832
status = check_spm_key_acl(msg.handle, psa_crypto_ipc.key);
833-
if (staus == PSA_SUCCESS) {
833+
if (status == PSA_SUCCESS) {
834834
status = psa_cipher_decrypt_setup( msg.rhandle,
835835
psa_crypto_ipc.key,
836836
psa_crypto_ipc.alg );
@@ -1002,7 +1002,7 @@ static void psa_key_management_operation( void )
10021002
size_t lifetime_length = msg.out_size[0];
10031003
psa_key_lifetime_t lifetime;
10041004
status = check_spm_key_acl(msg.handle, psa_key_mng.key);
1005-
if (staus == PSA_SUCCESS) {
1005+
if (status == PSA_SUCCESS) {
10061006
status = psa_get_key_lifetime( psa_key_mng.key,
10071007
&lifetime );
10081008
}
@@ -1025,7 +1025,7 @@ static void psa_key_management_operation( void )
10251025
SPM_PANIC("SPM read length mismatch");
10261026
}
10271027
status = check_spm_key_acl(msg.handle, psa_key_mng.key);
1028-
if (staus == PSA_SUCCESS) {
1028+
if (status == PSA_SUCCESS) {
10291029
status = psa_set_key_lifetime( psa_key_mng.key, lifetime );
10301030
}
10311031
break;
@@ -1042,7 +1042,7 @@ static void psa_key_management_operation( void )
10421042
SPM_PANIC("SPM read length mismatch");
10431043
}
10441044
status = check_spm_key_acl(msg.handle, psa_key_mng.key);
1045-
if (staus == PSA_SUCCESS) {
1045+
if (status == PSA_SUCCESS) {
10461046
status = psa_set_key_policy(psa_key_mng.key, &policy);
10471047
}
10481048
break;
@@ -1052,7 +1052,7 @@ static void psa_key_management_operation( void )
10521052
size_t policy_size = msg.out_size[0];
10531053
psa_key_policy_t policy;
10541054
status = check_spm_key_acl(msg.handle, psa_key_mng.key);
1055-
if (staus == PSA_SUCCESS) {
1055+
if (status == PSA_SUCCESS) {
10561056
status = psa_get_key_policy( psa_key_mng.key, &policy );
10571057
}
10581058
if( status == PSA_SUCCESS )
@@ -1077,11 +1077,11 @@ static void psa_key_management_operation( void )
10771077
SPM_PANIC("SPM read length mismatch");
10781078
}
10791079
status = insert_key_into_spm_slot(msg.handle, psa_key_mng.key);
1080-
if (staus == PSA_SUCCESS) {
1080+
if (status == PSA_SUCCESS) {
10811081
status = psa_import_key( psa_key_mng.key,
10821082
psa_key_mng.type,
10831083
key, key_length );
1084-
if (staus != PSA_SUCCESS) {
1084+
if (status != PSA_SUCCESS) {
10851085
free_spm_key_slot(msg.handle, psa_key_mng.key);
10861086
}
10871087
}
@@ -1091,9 +1091,9 @@ static void psa_key_management_operation( void )
10911091
case PSA_DESTROY_KEY:
10921092
{
10931093
status = check_spm_key_acl(msg.handle, psa_key_mng.key);
1094-
if (staus == PSA_SUCCESS) {
1094+
if (status == PSA_SUCCESS) {
10951095
status = psa_destroy_key( psa_key_mng.key );
1096-
if (staus == PSA_SUCCESS) {
1096+
if (status == PSA_SUCCESS) {
10971097
free_spm_key_slot(msg.handle, psa_key_mng.key);
10981098
}
10991099
}
@@ -1104,7 +1104,7 @@ static void psa_key_management_operation( void )
11041104
psa_key_type_t type;
11051105
size_t bits;
11061106
status = check_spm_key_acl(msg.handle, psa_key_mng.key);
1107-
if (staus == PSA_SUCCESS) {
1107+
if (status == PSA_SUCCESS) {
11081108
status = psa_get_key_information( psa_key_mng.key,
11091109
&type, &bits );
11101110
}
@@ -1129,7 +1129,7 @@ static void psa_key_management_operation( void )
11291129
break;
11301130
}
11311131
status = check_spm_key_acl(msg.handle, psa_key_mng.key);
1132-
if (staus == PSA_SUCCESS) {
1132+
if (status == PSA_SUCCESS) {
11331133
status = psa_export_key( psa_key_mng.key, key,
11341134
key_length, &data_length );
11351135
}
@@ -1152,7 +1152,7 @@ static void psa_key_management_operation( void )
11521152
break;
11531153
}
11541154
status = check_spm_key_acl(msg.handle, psa_key_mng.key);
1155-
if (staus == PSA_SUCCESS) {
1155+
if (status == PSA_SUCCESS) {
11561156
status = psa_export_public_key( psa_key_mng.key, key,
11571157
key_length, &data_length );
11581158
}
@@ -1196,12 +1196,12 @@ static void psa_key_management_operation( void )
11961196
}
11971197
}
11981198
status = insert_key_into_spm_slot(msg.handle, psa_key_mng.key);
1199-
if (staus == PSA_SUCCESS) {
1199+
if (status == PSA_SUCCESS) {
12001200
status = psa_generate_key( psa_key_mng.key,
12011201
psa_key_mng.type,
12021202
bits,
12031203
parameter, parameter_size );
1204-
if (staus != PSA_SUCCESS) {
1204+
if (status != PSA_SUCCESS) {
12051205
free_spm_key_slot(msg.handle, psa_key_mng.key);
12061206
}
12071207
}
@@ -1419,10 +1419,10 @@ void psa_crypto_generator_operations( void )
14191419
SPM_PANIC("SPM read length mismatch");
14201420
}
14211421
status = insert_key_into_spm_slot(msg.handle, psa_crypto_ipc.key);
1422-
if (staus == PSA_SUCCESS) {
1422+
if (status == PSA_SUCCESS) {
14231423
status = psa_generator_import_key( psa_crypto_ipc.key, type,
14241424
bits, msg.rhandle );
1425-
if (staus != PSA_SUCCESS) {
1425+
if (status != PSA_SUCCESS) {
14261426
free_spm_key_slot(msg.handle, psa_crypto_ipc.key);
14271427
}
14281428
}
@@ -1466,7 +1466,7 @@ void psa_crypto_generator_operations( void )
14661466
}
14671467

14681468
status = check_spm_key_acl(msg.handle, psa_crypto_ipc.key);
1469-
if (staus == PSA_SUCCESS) {
1469+
if (status == PSA_SUCCESS) {
14701470
status = psa_key_derivation( msg.rhandle, psa_crypto_ipc.key,
14711471
psa_crypto_ipc.alg,
14721472
salt,
@@ -1507,7 +1507,6 @@ void psa_crypto_generator_operations( void )
15071507
void part_main(void *ptr)
15081508
{
15091509
uint32_t signals = 0;
1510-
psa_status_t status = PSA_SUCCESS;
15111510

15121511
while (1) {
15131512
signals = psa_wait_any( PSA_BLOCK );

0 commit comments

Comments
 (0)