Loading...
Searching...
No Matches
algorithm.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 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
22#ifndef PSA_CRYPTO_PSA_AEAD_ALGORITHM_H
23#define PSA_CRYPTO_PSA_AEAD_ALGORITHM_H
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#include "psa/algorithm.h"
30
34#define PSA_ALG_CATEGORY_AEAD ((psa_algorithm_t)0x05000000)
35
45#define PSA_ALG_IS_AEAD(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_AEAD)
46
55#define PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) (((alg) & 0x7f400000) == 0x05400000)
56
98#define PSA_ALG_CCM ((psa_algorithm_t)0x05500100)
99
125#define PSA_ALG_GCM ((psa_algorithm_t)0x05500200)
126
154#define PSA_ALG_CHACHA20_POLY1305 ((psa_algorithm_t)0x05100500)
155
178#define PSA_ALG_AEAD_WITH_SHORTENED_TAG(aead_alg, tag_length) \
179 ((psa_algorithm_t)(((aead_alg) & ~0x003f0000) | (((tag_length) & 0x3f) << 16)))
180
191#define PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(aead_alg) \
192 ((((aead_alg) & ~0x003f0000) == 0x05400100) ? PSA_ALG_CCM : \
193 (((aead_alg) & ~0x003f0000) == 0x05400200) ? PSA_ALG_GCM : \
194 (((aead_alg) & ~0x003f0000) == 0x05000500) ? PSA_ALG_CHACHA20_POLY1305 : \
195 PSA_ALG_NONE)
196
221#define PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(aead_alg, min_tag_length) \
222 /* specification-defined value */
223
224#ifdef __cplusplus
225}
226#endif
227
228#endif /* PSA_CRYPTO_PSA_AEAD_ALGORITHM_H */
Algorithm definitions for the PSA Crypto API.