nRF Connect SDK API 3.4.99
Loading...
Searching...
No Matches
cracen_sw_common.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
16
17#ifndef CRACEN_SW_COMMON_H
18#define CRACEN_SW_COMMON_H
19
20#include <stddef.h>
21#include <stdint.h>
22#include <stdbool.h>
23#include <psa/crypto.h>
24#include <sxsymcrypt/keyref.h>
25
29#define CRACEN_SW_AES_BATCH_BLOCKS 8
30
47psa_status_t cracen_sw_aes_ecb_encrypt(struct sxblkcipher *blkciph, const struct sxkeyref *key,
48 const uint8_t *input, size_t input_length, uint8_t *output,
49 size_t output_size, size_t *output_length);
50
66psa_status_t cracen_sw_aes_ecb_decrypt(struct sxblkcipher *blkciph, const struct sxkeyref *key,
67 const uint8_t *input, size_t input_length, uint8_t *output,
68 size_t output_size, size_t *output_length);
69
84psa_status_t cracen_sw_aes_primitive(struct sxblkcipher *blkciph, const struct sxkeyref *key,
85 const uint8_t *input, uint8_t *output);
86
107psa_status_t cracen_sw_ctr_xor(struct sxblkcipher *blkciph, const struct sxkeyref *key,
108 uint8_t *counter, size_t counter_start_pos, uint8_t *keystream,
109 size_t *keystream_offset, const uint8_t *input, uint8_t *output,
110 size_t length);
111
131psa_status_t cracen_sw_cbc_mac_update(struct sxblkcipher *blkciph, const struct sxkeyref *key,
132 uint8_t *mac_state, uint8_t *partial, size_t *partial_len,
133 const uint8_t *input, size_t length, bool keep_last);
134
146psa_status_t cracen_sw_increment_counter_be(uint8_t *ctr_buf, size_t ctr_buf_size,
147 size_t start_pos);
148
158void cracen_sw_encode_value_be(uint8_t *buffer, size_t buffer_size, size_t value,
159 size_t value_size);
160
162
163#endif /* CRACEN_SW_COMMON_H */
psa_status_t cracen_sw_increment_counter_be(uint8_t *ctr_buf, size_t ctr_buf_size, size_t start_pos)
Increment counter value stored as a big endian buffer.
psa_status_t cracen_sw_aes_ecb_decrypt(struct sxblkcipher *blkciph, const struct sxkeyref *key, const uint8_t *input, size_t input_length, uint8_t *output, size_t output_size, size_t *output_length)
Decrypt a single AES block using ECB mode.
void cracen_sw_encode_value_be(uint8_t *buffer, size_t buffer_size, size_t value, size_t value_size)
Encode value as big-endian, right-aligned in buffer.
psa_status_t cracen_sw_aes_ecb_encrypt(struct sxblkcipher *blkciph, const struct sxkeyref *key, const uint8_t *input, size_t input_length, uint8_t *output, size_t output_size, size_t *output_length)
Encrypt a single AES block using ECB mode.
psa_status_t cracen_sw_cbc_mac_update(struct sxblkcipher *blkciph, const struct sxkeyref *key, uint8_t *mac_state, uint8_t *partial, size_t *partial_len, const uint8_t *input, size_t length, bool keep_last)
CBC-MAC over a byte stream.
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)
AES-CTR encryption or decryption of a byte stream.
psa_status_t cracen_sw_aes_primitive(struct sxblkcipher *blkciph, const struct sxkeyref *key, const uint8_t *input, uint8_t *output)
Perform a single AES block encryption operation.