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_MAC_ALGORITHM_H
23#define PSA_CRYPTO_PSA_MAC_ALGORITHM_H
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#include "psa/algorithm.h"
30#include "psa/hash/algorithm.h"
31
35#define PSA_ALG_CATEGORY_MAC ((psa_algorithm_t)0x03000000)
36
40#define PSA_ALG_HMAC_BASE (0x03800000)
41
50#define PSA_ALG_IS_MAC(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_MAC)
51
62#define PSA_ALG_IS_HMAC(alg) (((alg) & 0x7fc0ff00) == 0x03800000)
63
72#define PSA_ALG_IS_BLOCK_CIPHER_MAC(alg) (((alg) & 0x7fc00000) == 0x03c00000)
73
91#define PSA_ALG_HMAC(hash_alg) \
92 ((psa_algorithm_t)(PSA_ALG_HMAC_BASE | ((hash_alg) & PSA_ALG_HASH_MASK)))
93
115#define PSA_ALG_CBC_MAC ((psa_algorithm_t)0x03c00100)
116
134#define PSA_ALG_CMAC ((psa_algorithm_t)0x03c00200)
135
169#define PSA_ALG_TRUNCATED_MAC(mac_alg, mac_length) \
170 ((psa_algorithm_t)(((mac_alg) & ~0x003f0000) | (((mac_length) & 0x3f) << 16)))
171
187#define PSA_ALG_FULL_LENGTH_MAC(mac_alg) \
188 ((psa_algorithm_t)((mac_alg) & ~0x003f0000))
189
218#define PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(mac_alg, min_mac_length) \
219 /* specification-defined value */
220
221#ifdef __cplusplus
222}
223#endif
224
225#endif /* PSA_CRYPTO_PSA_MAC_ALGORITHM_H */
Algorithm definitions for the PSA Crypto API.
Hash algorithm definitions for the PSA Crypto API.