Loading...
Searching...
No Matches
sizes.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 TU Dresden
3 * SPDX-FileCopyrightText: 2021 HAW Hamburg
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#include "kernel_defines.h"
27#include "psa/key/type.h"
28
41#define PSA_BLOCK_CIPHER_BLOCK_LENGTH(type) \
42 (1u << (((type) >> 8) & 7))
43
49#define PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE /* implementation-defined value */
50
77#define PSA_CIPHER_IV_LENGTH(key_type, alg) \
78 ((PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) > 1 && \
79 ((alg) == PSA_ALG_CBC_NO_PADDING)) ? 16 : \
80 (key_type == PSA_KEY_TYPE_CHACHA20) ? 12 : 0)
81
91#define PSA_CIPHER_IV_MAX_SIZE /* implementation-defined value */
92
111#define PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input_length) \
112 (input_length + PSA_CIPHER_IV_LENGTH(key_type, alg))
113
125#define PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(input_length) \
126 (PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(PSA_KEY_TYPE_AES, PSA_ALG_CBC_NO_PADDING, input_length))
127
146#define PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_length) \
147 (input_length - PSA_CIPHER_IV_LENGTH(key_type, alg))
148
160#define PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(input_length) \
161 (input_length)
162
182#define PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input_length) \
183/* implementation-defined value */
184
197#define PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(input_length) \
198/* implementation-defined value */
199
217#define PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg) \
218/* implementation-defined value */
219
229#define PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE /* implementation-defined value */
230
231#ifdef __cplusplus
232}
233#endif
234
Cipher algorithm definitions for the PSA Crypto API.
Common macros and compiler attributes/pragmas configuration.
Key type definitions for the PSA Crypto API.