2727#define STSAFEA_INC_DEC_AMOUT_SIZE 4U
2828#define STSAFEA_ZONE_ACCESS_LENGTH_SIZE 2U
2929
30- stse_ReturnCode_t stsafea_switch_data_partition_access_protection (stse_Handler_t * pSTSE , PLAT_UI8 command_code , stse_cmd_protection_t protection )
31- {
32- switch (protection )
33- {
34-
35- case STSE_HOST_C_MAC_R_MAC :
36- stsafea_perso_info_set_cmd_AC (& pSTSE -> perso_info , command_code , STSE_CMD_AC_HOST );
37- case STSE_NO_PROT :
38- break ;
39-
40- case STSE_HOST_C_WRAP :
41- case STSE_HOST_R_WRAP :
42- case STSE_HOST_C_WRAP_R_WRAP :
43- default :
44- return STSE_SERVICE_INVALID_PARAMETER ;
45- break ;
46- }
47- return STSE_OK ;
30+ stse_ReturnCode_t stsafea_switch_data_partition_access_protection (stse_Handler_t * pSTSE , PLAT_UI8 command_code , stse_cmd_protection_t protection ) {
31+ switch (protection ) {
32+
33+ case STSE_HOST_C_MAC_R_MAC :
34+ stsafea_perso_info_set_cmd_AC (& pSTSE -> perso_info , command_code , STSE_CMD_AC_HOST );
35+ case STSE_NO_PROT :
36+ break ;
37+
38+ case STSE_HOST_C_WRAP :
39+ case STSE_HOST_R_WRAP :
40+ case STSE_HOST_C_WRAP_R_WRAP :
41+ default :
42+ return STSE_SERVICE_INVALID_PARAMETER ;
43+ break ;
44+ }
45+ return STSE_OK ;
4846}
4947
5048stse_ReturnCode_t stsafea_get_total_partition_count (stse_Handler_t * pSTSE ,
@@ -142,7 +140,7 @@ stse_ReturnCode_t stsafea_decrement_counter_zone(stse_Handler_t *pSTSE,
142140 PLAT_UI32 * pNew_counter_value ,
143141 stse_cmd_protection_t protection ) {
144142
145- volatile stse_ReturnCode_t ret = STSE_SERVICE_INVALID_PARAMETER ;
143+ volatile stse_ReturnCode_t ret = STSE_SERVICE_INVALID_PARAMETER ;
146144 PLAT_UI8 cmd_header = STSAFEA_CMD_DECREMENT ;
147145 PLAT_UI8 rsp_header ;
148146
@@ -156,10 +154,9 @@ stse_ReturnCode_t stsafea_decrement_counter_zone(stse_Handler_t *pSTSE,
156154
157155#ifdef STSE_CONF_USE_HOST_SESSION
158156 stse_perso_info_t perso_info_backup = pSTSE -> perso_info ;
159- ret = stsafea_switch_data_partition_access_protection (pSTSE ,cmd_header ,protection );
160- if (ret != STSE_OK )
161- {
162- return ret ;
157+ ret = stsafea_switch_data_partition_access_protection (pSTSE , cmd_header , protection );
158+ if (ret != STSE_OK ) {
159+ return ret ;
163160 }
164161#endif
165162
@@ -198,7 +195,7 @@ stse_ReturnCode_t stsafea_decrement_counter_zone(stse_Handler_t *pSTSE,
198195 stse_frame_element_swap_byte_order (& eNewCounterVal );
199196
200197#ifdef STSE_CONF_USE_HOST_SESSION
201- pSTSE -> perso_info = perso_info_backup ;
198+ pSTSE -> perso_info = perso_info_backup ;
202199#endif
203200
204201 return (ret );
@@ -227,10 +224,9 @@ stse_ReturnCode_t stsafea_read_counter_zone(stse_Handler_t *pSTSE,
227224
228225#ifdef STSE_CONF_USE_HOST_SESSION
229226 stse_perso_info_t perso_info_backup = pSTSE -> perso_info ;
230- ret = stsafea_switch_data_partition_access_protection (pSTSE ,cmd_header ,protection );
231- if (ret != STSE_OK )
232- {
233- return ret ;
227+ ret = stsafea_switch_data_partition_access_protection (pSTSE , cmd_header , protection );
228+ if (ret != STSE_OK ) {
229+ return ret ;
234230 }
235231#endif
236232
@@ -269,7 +265,7 @@ stse_ReturnCode_t stsafea_read_counter_zone(stse_Handler_t *pSTSE,
269265 stse_frame_element_swap_byte_order (& eLength );
270266
271267#ifdef STSE_CONF_USE_HOST_SESSION
272- pSTSE -> perso_info = perso_info_backup ;
268+ pSTSE -> perso_info = perso_info_backup ;
273269#endif
274270
275271 return (ret );
@@ -296,10 +292,9 @@ stse_ReturnCode_t stsafea_read_data_zone(stse_Handler_t *pSTSE,
296292
297293#ifdef STSE_CONF_USE_HOST_SESSION
298294 stse_perso_info_t perso_info_backup = pSTSE -> perso_info ;
299- ret = stsafea_switch_data_partition_access_protection (pSTSE ,cmd_header ,protection );
300- if (ret != STSE_OK )
301- {
302- return ret ;
295+ ret = stsafea_switch_data_partition_access_protection (pSTSE , cmd_header , protection );
296+ if (ret != STSE_OK ) {
297+ return ret ;
303298 }
304299#endif
305300
@@ -334,7 +329,7 @@ stse_ReturnCode_t stsafea_read_data_zone(stse_Handler_t *pSTSE,
334329 stse_frame_element_swap_byte_order (& eLength );
335330
336331#ifdef STSE_CONF_USE_HOST_SESSION
337- pSTSE -> perso_info = perso_info_backup ;
332+ pSTSE -> perso_info = perso_info_backup ;
338333#endif
339334
340335 return (ret );
@@ -348,8 +343,8 @@ stse_ReturnCode_t stsafea_update_data_zone(stse_Handler_t *pSTSE,
348343 PLAT_UI32 data_length ,
349344 stse_cmd_protection_t protection ) {
350345
351- volatile stse_ReturnCode_t ret = STSE_SERVICE_INVALID_PARAMETER ;
352- PLAT_UI8 cmd_header = STSAFEA_CMD_UPDATE ;
346+ volatile stse_ReturnCode_t ret = STSE_SERVICE_INVALID_PARAMETER ;
347+ PLAT_UI8 cmd_header = STSAFEA_CMD_UPDATE ;
353348 PLAT_UI8 rsp_header ;
354349
355350 /* - Check stsafe handler initialization */
@@ -363,10 +358,9 @@ stse_ReturnCode_t stsafea_update_data_zone(stse_Handler_t *pSTSE,
363358
364359#ifdef STSE_CONF_USE_HOST_SESSION
365360 stse_perso_info_t perso_info_backup = pSTSE -> perso_info ;
366- ret = stsafea_switch_data_partition_access_protection (pSTSE ,cmd_header ,protection );
367- if (ret != STSE_OK )
368- {
369- return ret ;
361+ ret = stsafea_switch_data_partition_access_protection (pSTSE , cmd_header , protection );
362+ if (ret != STSE_OK ) {
363+ return ret ;
370364 }
371365#endif
372366
@@ -390,16 +384,15 @@ stse_ReturnCode_t stsafea_update_data_zone(stse_Handler_t *pSTSE,
390384 stse_frame_element_swap_byte_order (& eOffset );
391385
392386 /*- Perform Transfer*/
393- ret = stsafea_frame_transfer (pSTSE ,
394- & CmdFrame ,
395- & RspFrame );
387+ ret = stsafea_frame_transfer (pSTSE ,
388+ & CmdFrame ,
389+ & RspFrame );
396390
397391#ifdef STSE_CONF_USE_HOST_SESSION
398- pSTSE -> perso_info = perso_info_backup ;
392+ pSTSE -> perso_info = perso_info_backup ;
399393#endif
400394
401- return ret ;
402-
395+ return ret ;
403396}
404397
405398#endif /* STSE_CONF_STSAFE_A_SUPPORT */
0 commit comments