Loading...
Searching...
No Matches
sizes.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 TU Dresden
3 * Copyright (C) 2021 HAW Hamburg
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
10#pragma once
11
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#include "kernel_defines.h"
30#include "psa/key/type.h"
31
44#define PSA_BLOCK_CIPHER_BLOCK_LENGTH(type) \
45 (1u << (((type) >> 8) & 7))
46
52#define PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE /* implementation-defined value */
53
80#define PSA_CIPHER_IV_LENGTH(key_type, alg) \
81 ((PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) > 1 && \
82 ((alg) == PSA_ALG_CBC_NO_PADDING)) ? 16 : \
83 (key_type == PSA_KEY_TYPE_CHACHA20) ? 12 : 0)
84
94#define PSA_CIPHER_IV_MAX_SIZE /* implementation-defined value */
95
114#define PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input_length) \
115 (input_length + PSA_CIPHER_IV_LENGTH(key_type, alg))
116
128#define PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(input_length) \
129 (PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(PSA_KEY_TYPE_AES, PSA_ALG_CBC_NO_PADDING, input_length))
130
149#define PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_length) \
150 (input_length - PSA_CIPHER_IV_LENGTH(key_type, alg))
151
163#define PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(input_length) \
164 (input_length)
165
185#define PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input_length) \
186/* implementation-defined value */
187
200#define PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(input_length) \
201/* implementation-defined value */
202
220#define PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg) \
221/* implementation-defined value */
222
232#define PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE /* implementation-defined value */
233
234#ifdef __cplusplus
235}
236#endif
237
Cipher algorithm definitions for the PSA Crypto API.
Common macros and compiler attributes/pragmas configuration.
Key type definitions for the PSA Crypto API.