Skip to content

Commit

Permalink
nrf_security: cracen: Fix hmac block buffering calculation
Browse files Browse the repository at this point in the history
Fix the hmac block buffering such that it works for all input sizes.

Signed-off-by: Markus Rekdal <[email protected]>
  • Loading branch information
nordic-mare authored and nordicjm committed Aug 14, 2024
1 parent 08aeb54 commit e7d7c68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/nrf_security/src/drivers/cracen/cracenpsa/src/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ static psa_status_t cracen_hmac_update(cracen_mac_operation_t *operation, const
* adding as many input bytes as needed to get to be block aligned
*/
input_chunk_length = operation->bytes_left_for_next_block;
input_chunk_length += (input_length - input_chunk_length) & ~(block_size - 1);
input_chunk_length += ROUND_DOWN((input_length - input_chunk_length), block_size);
remaining_bytes = input_length - input_chunk_length;

/* forward the data to the driver */
Expand Down

0 comments on commit e7d7c68

Please sign in to comment.