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_HASH_ALGORITHM_H
23 #define PSA_CRYPTO_PSA_HASH_ALGORITHM_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include "psa/algorithm.h"
30 
34 #define PSA_ALG_CATEGORY_HASH ((psa_algorithm_t)0x02000000)
35 
39 #define PSA_ALG_HASH_MASK ((psa_algorithm_t)0x000000ff)
40 
49 #define PSA_ALG_IS_HASH(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_HASH)
50 
71 #define PSA_ALG_GET_HASH(alg) \
72  (((alg) & PSA_ALG_HASH_MASK) == \
73  0 ? ((psa_algorithm_t)0) : PSA_ALG_CATEGORY_HASH | ((alg) & PSA_ALG_HASH_MASK))
74 
80 #define PSA_ALG_HMAC_GET_HASH(hmac_alg) \
81  (PSA_ALG_CATEGORY_HASH | ((hmac_alg) & PSA_ALG_HASH_MASK))
82 
92 #define PSA_ALG_MD2 ((psa_algorithm_t)0x02000001)
93 
103 #define PSA_ALG_MD4 ((psa_algorithm_t)0x02000002)
104 
114 #define PSA_ALG_MD5 ((psa_algorithm_t)0x02000003)
115 
123 #define PSA_ALG_RIPEMD160 ((psa_algorithm_t)0x02000004)
124 
134 #define PSA_ALG_SHA_1 ((psa_algorithm_t)0x02000005)
135 
142 #define PSA_ALG_SHA_224 ((psa_algorithm_t)0x02000008)
150 #define PSA_ALG_SHA_256 ((psa_algorithm_t)0x02000009)
158 #define PSA_ALG_SHA_384 ((psa_algorithm_t)0x0200000a)
166 #define PSA_ALG_SHA_512 ((psa_algorithm_t)0x0200000b)
174 #define PSA_ALG_SHA_512_224 ((psa_algorithm_t)0x0200000c)
182 #define PSA_ALG_SHA_512_256 ((psa_algorithm_t)0x0200000d)
190 #define PSA_ALG_SHA3_224 ((psa_algorithm_t)0x02000010)
197 #define PSA_ALG_SHA3_256 ((psa_algorithm_t)0x02000011)
204 #define PSA_ALG_SHA3_384 ((psa_algorithm_t)0x02000012)
211 #define PSA_ALG_SHA3_512 ((psa_algorithm_t)0x02000013)
223 #define PSA_ALG_SM3 ((psa_algorithm_t)0x02000014)
236 #define PSA_ALG_SHAKE256_512 ((psa_algorithm_t)0x02000015)
237 
238 #ifdef __cplusplus
239 }
240 #endif
241 
242 #endif /* PSA_CRYPTO_PSA_HASH_ALGORITHM_H */
Algorithm definitions for the PSA Crypto API.