nRF Connect SDK API 3.4.99
Loading...
Searching...
No Matches

◆ cracen_sw_ctr_xor()

psa_status_t cracen_sw_ctr_xor ( struct sxblkcipher * blkciph,
const struct sxkeyref * key,
uint8_t * counter,
size_t counter_start_pos,
uint8_t * keystream,
size_t * keystream_offset,
const uint8_t * input,
uint8_t * output,
size_t length )

#include <cracen_sw_common.h>

AES-CTR encryption or decryption of a byte stream.

Uses up the buffered keystream block first, then runs whole blocks with up to CRACEN_SW_AES_BATCH_BLOCKS blocks per CRACEN job, and buffers the keystream of a final partial block for the next call. The counter wraps modulo the size of its field. CRACEN must be reserved by the caller, as for cracen_sw_aes_primitive().

Parameters
blkciphBlock cipher struct.
keyThe AES key reference.
counterCounter block for the next keystream block, advanced as used.
counter_start_posIndex of the first counter byte in counter.
keystreamBuffered keystream block (16 bytes).
keystream_offsetBytes of keystream already used, 16 if none is left.
inputInput.
outputOutput, may be the same as input.
lengthNumber of bytes.
Return values
psa_status_tPSA_SUCCESS on success, error code otherwise.