Loading...
Searching...
No Matches
algorithm.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 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 "psa/algorithm.h"
26#include "psa/hash/algorithm.h"
27
31#define PSA_ALG_CATEGORY_MAC ((psa_algorithm_t)0x03000000)
32
36#define PSA_ALG_HMAC_BASE (0x03800000)
37
46#define PSA_ALG_IS_MAC(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_MAC)
47
58#define PSA_ALG_IS_HMAC(alg) (((alg) & 0x7fc0ff00) == 0x03800000)
59
68#define PSA_ALG_IS_BLOCK_CIPHER_MAC(alg) (((alg) & 0x7fc00000) == 0x03c00000)
69
87#define PSA_ALG_HMAC(hash_alg) \
88 ((psa_algorithm_t)(PSA_ALG_HMAC_BASE | ((hash_alg) & PSA_ALG_HASH_MASK)))
89
111#define PSA_ALG_CBC_MAC ((psa_algorithm_t)0x03c00100)
112
130#define PSA_ALG_CMAC ((psa_algorithm_t)0x03c00200)
131
165#define PSA_ALG_TRUNCATED_MAC(mac_alg, mac_length) \
166 ((psa_algorithm_t)(((mac_alg) & ~0x003f0000) | (((mac_length) & 0x3f) << 16)))
167
183#define PSA_ALG_FULL_LENGTH_MAC(mac_alg) \
184 ((psa_algorithm_t)((mac_alg) & ~0x003f0000))
185
214#define PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(mac_alg, min_mac_length) \
215 /* specification-defined value */
216
217#ifdef __cplusplus
218}
219#endif
220
Algorithm definitions for the PSA Crypto API.
Hash algorithm definitions for the PSA Crypto API.