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 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #include "psa/algorithm.h"
26 
30 #define PSA_ALG_CATEGORY_HASH ((psa_algorithm_t)0x02000000)
31 
35 #define PSA_ALG_HASH_MASK ((psa_algorithm_t)0x000000ff)
36 
45 #define PSA_ALG_IS_HASH(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_HASH)
46 
67 #define PSA_ALG_GET_HASH(alg) \
68  (((alg) & PSA_ALG_HASH_MASK) == \
69  0 ? ((psa_algorithm_t)0) : PSA_ALG_CATEGORY_HASH | ((alg) & PSA_ALG_HASH_MASK))
70 
76 #define PSA_ALG_HMAC_GET_HASH(hmac_alg) \
77  (PSA_ALG_CATEGORY_HASH | ((hmac_alg) & PSA_ALG_HASH_MASK))
78 
88 #define PSA_ALG_MD2 ((psa_algorithm_t)0x02000001)
89 
99 #define PSA_ALG_MD4 ((psa_algorithm_t)0x02000002)
100 
110 #define PSA_ALG_MD5 ((psa_algorithm_t)0x02000003)
111 
119 #define PSA_ALG_RIPEMD160 ((psa_algorithm_t)0x02000004)
120 
130 #define PSA_ALG_SHA_1 ((psa_algorithm_t)0x02000005)
131 
138 #define PSA_ALG_SHA_224 ((psa_algorithm_t)0x02000008)
146 #define PSA_ALG_SHA_256 ((psa_algorithm_t)0x02000009)
154 #define PSA_ALG_SHA_384 ((psa_algorithm_t)0x0200000a)
162 #define PSA_ALG_SHA_512 ((psa_algorithm_t)0x0200000b)
170 #define PSA_ALG_SHA_512_224 ((psa_algorithm_t)0x0200000c)
178 #define PSA_ALG_SHA_512_256 ((psa_algorithm_t)0x0200000d)
186 #define PSA_ALG_SHA3_224 ((psa_algorithm_t)0x02000010)
193 #define PSA_ALG_SHA3_256 ((psa_algorithm_t)0x02000011)
200 #define PSA_ALG_SHA3_384 ((psa_algorithm_t)0x02000012)
207 #define PSA_ALG_SHA3_512 ((psa_algorithm_t)0x02000013)
219 #define PSA_ALG_SM3 ((psa_algorithm_t)0x02000014)
232 #define PSA_ALG_SHAKE256_512 ((psa_algorithm_t)0x02000015)
233 
234 #ifdef __cplusplus
235 }
236 #endif
237 
Algorithm definitions for the PSA Crypto API.