File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
subsys/nrf_security/src/drivers/cracen/cracen_sw/src Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change 21
21
#include <cracen_sw_common.h>
22
22
#include "cracen_sw_aes_ctr.h"
23
23
24
- /* AES CTR mode counter field is the rightmost 32 bits (4 bytes) of the 16-byte block */
24
+ /* AES CTR mode counter field is the entire 16-byte block */
25
25
#define AES_BLOCK_LAST_BYTE_INDEX (SX_BLKCIPHER_AES_BLK_SZ - 1)
26
- #define AES_CTR_COUNTER_START_BYTE (SX_BLKCIPHER_AES_BLK_SZ - 4)
26
+ #define AES_CTR_COUNTER_START_BYTE 0
27
27
28
- /* Increments the counter by one block */
29
28
static void increment_counter (uint8_t * ctr )
30
29
{
31
- /* CTR mode increments the rightmost 32 bits in big-endian */
32
30
for (int i = AES_BLOCK_LAST_BYTE_INDEX ; i >= AES_CTR_COUNTER_START_BYTE ; i -- ) {
33
31
if (++ ctr [i ] != 0 ) {
34
32
break ;
You can’t perform that action at this time.
0 commit comments