@@ -20,20 +20,20 @@ psa_status_t cracen_hmac_setup(cracen_mac_operation_t *operation,
2020 const uint8_t * key_buffer , size_t key_buffer_size ,
2121 psa_algorithm_t alg )
2222{
23- int status ;
23+ int sx_status ;
2424 const struct sxhashalg * sx_hash_algo = NULL ;
2525
2626 psa_status_t psa_status = hash_get_algo (PSA_ALG_HMAC_GET_HASH (alg ), & sx_hash_algo );
2727
28- if (psa_status ) {
28+ if (psa_status != PSA_SUCCESS ) {
2929 return psa_status ;
3030 }
3131
3232 /* HMAC task creation and configuration. */
33- status = mac_create_hmac (sx_hash_algo , & operation -> hmac .hashctx , key_buffer ,
33+ sx_status = mac_create_hmac (sx_hash_algo , & operation -> hmac .hashctx , key_buffer ,
3434 key_buffer_size , operation -> hmac .workmem , sizeof (operation -> hmac .workmem ));
35- if ( status != SX_OK ) {
36- return silex_statuscodes_to_psa (status );
35+ if ( sx_status != SX_OK ) {
36+ return silex_statuscodes_to_psa (sx_status );
3737 }
3838
3939 operation -> bytes_left_for_next_block = sx_hash_get_alg_blocksz (sx_hash_algo );
@@ -44,7 +44,7 @@ psa_status_t cracen_hmac_setup(cracen_mac_operation_t *operation,
4444psa_status_t cracen_hmac_update (cracen_mac_operation_t * operation , const uint8_t * input ,
4545 size_t input_length )
4646{
47- int status ;
47+ int sx_status ;
4848 size_t block_size ;
4949 size_t input_chunk_length = 0 ;
5050 size_t remaining_bytes = 0 ;
@@ -53,7 +53,7 @@ psa_status_t cracen_hmac_update(cracen_mac_operation_t *operation, const uint8_t
5353 /* As the block size is needed several times we compute it once here */
5454 psa_status_t psa_status = hash_get_algo (PSA_ALG_GET_HASH (operation -> alg ), & sx_hash_algo );
5555
56- if (psa_status ) {
56+ if (psa_status != PSA_SUCCESS ) {
5757 return psa_status ;
5858 }
5959 block_size = sx_hash_get_alg_blocksz (sx_hash_algo );
@@ -72,10 +72,10 @@ psa_status_t cracen_hmac_update(cracen_mac_operation_t *operation, const uint8_t
7272 }
7373
7474 /* Feed the data that are currently in the input buffer to the driver */
75- status = sx_hash_feed (& operation -> hmac .hashctx , operation -> input_buffer ,
75+ sx_status = sx_hash_feed (& operation -> hmac .hashctx , operation -> input_buffer ,
7676 (block_size - operation -> bytes_left_for_next_block ));
77- if (status != SX_OK ) {
78- return silex_statuscodes_to_psa (status );
77+ if (sx_status != SX_OK ) {
78+ return silex_statuscodes_to_psa (sx_status );
7979 }
8080
8181 /* Add fill up the next block and add as many full blocks as possible by
@@ -86,19 +86,19 @@ psa_status_t cracen_hmac_update(cracen_mac_operation_t *operation, const uint8_t
8686 remaining_bytes = input_length - input_chunk_length ;
8787
8888 /* forward the data to the driver */
89- status = sx_hash_feed (& operation -> hmac .hashctx , input , input_chunk_length );
90- if (status != SX_OK ) {
91- return silex_statuscodes_to_psa (status );
89+ sx_status = sx_hash_feed (& operation -> hmac .hashctx , input , input_chunk_length );
90+ if (sx_status != SX_OK ) {
91+ return silex_statuscodes_to_psa (sx_status );
9292 }
9393
94- status = sx_hash_save_state (& operation -> hmac .hashctx );
95- if (status != SX_OK ) {
96- return silex_statuscodes_to_psa (status );
94+ sx_status = sx_hash_save_state (& operation -> hmac .hashctx );
95+ if (sx_status != SX_OK ) {
96+ return silex_statuscodes_to_psa (sx_status );
9797 }
9898
99- status = sx_hash_wait (& operation -> hmac .hashctx );
100- if (status != SX_OK ) {
101- return silex_statuscodes_to_psa (status );
99+ sx_status = sx_hash_wait (& operation -> hmac .hashctx );
100+ if (sx_status != SX_OK ) {
101+ return silex_statuscodes_to_psa (sx_status );
102102 }
103103
104104 /* Input buffer was processed, reset the bytes for the next block and
@@ -118,33 +118,33 @@ psa_status_t cracen_hmac_update(cracen_mac_operation_t *operation, const uint8_t
118118
119119psa_status_t cracen_hmac_finish (cracen_mac_operation_t * operation )
120120{
121- int status ;
121+ int sx_status ;
122122 size_t block_size , digestsz ;
123123 const struct sxhashalg * sx_hash_algo = NULL ;
124124
125- status = hash_get_algo (PSA_ALG_GET_HASH (operation -> alg ), & sx_hash_algo );
126- if (status != SX_OK ) {
127- return silex_statuscodes_to_psa (status );
125+ sx_status = hash_get_algo (PSA_ALG_GET_HASH (operation -> alg ), & sx_hash_algo );
126+ if (sx_status != SX_OK ) {
127+ return silex_statuscodes_to_psa (sx_status );
128128 }
129129
130130 digestsz = sx_hash_get_alg_digestsz (sx_hash_algo );
131131 block_size = sx_hash_get_alg_blocksz (sx_hash_algo );
132132
133- status = sx_hash_resume_state (& operation -> hmac .hashctx );
134- if (status != SX_OK ) {
135- return silex_statuscodes_to_psa (status );
133+ sx_status = sx_hash_resume_state (& operation -> hmac .hashctx );
134+ if (sx_status != SX_OK ) {
135+ return silex_statuscodes_to_psa (sx_status );
136136 }
137137
138138 /* Process the data that are left in the input buffer. */
139- status = sx_hash_feed (& operation -> hmac .hashctx , operation -> input_buffer ,
139+ sx_status = sx_hash_feed (& operation -> hmac .hashctx , operation -> input_buffer ,
140140 block_size - operation -> bytes_left_for_next_block );
141- if (status != SX_OK ) {
142- return silex_statuscodes_to_psa (status );
141+ if (sx_status != SX_OK ) {
142+ return silex_statuscodes_to_psa (sx_status );
143143 }
144144
145145 /* Generate the MAC. */
146- status = hmac_produce (& operation -> hmac .hashctx , sx_hash_algo , operation -> input_buffer ,
146+ sx_status = hmac_produce (& operation -> hmac .hashctx , sx_hash_algo , operation -> input_buffer ,
147147 sizeof (operation -> input_buffer ), operation -> hmac .workmem );
148148
149- return silex_statuscodes_to_psa (status );
149+ return silex_statuscodes_to_psa (sx_status );
150150}
0 commit comments