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 
10 #pragma once
11 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include "psa/algorithm.h"
29 
33 #define PSA_ALG_CATEGORY_HASH ((psa_algorithm_t)0x02000000)
34 
38 #define PSA_ALG_HASH_MASK ((psa_algorithm_t)0x000000ff)
39 
48 #define PSA_ALG_IS_HASH(alg) (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_HASH)
49 
70 #define PSA_ALG_GET_HASH(alg) \
71  (((alg) & PSA_ALG_HASH_MASK) == \
72  0 ? ((psa_algorithm_t)0) : PSA_ALG_CATEGORY_HASH | ((alg) & PSA_ALG_HASH_MASK))
73 
79 #define PSA_ALG_HMAC_GET_HASH(hmac_alg) \
80  (PSA_ALG_CATEGORY_HASH | ((hmac_alg) & PSA_ALG_HASH_MASK))
81 
91 #define PSA_ALG_MD2 ((psa_algorithm_t)0x02000001)
92 
102 #define PSA_ALG_MD4 ((psa_algorithm_t)0x02000002)
103 
113 #define PSA_ALG_MD5 ((psa_algorithm_t)0x02000003)
114 
122 #define PSA_ALG_RIPEMD160 ((psa_algorithm_t)0x02000004)
123 
133 #define PSA_ALG_SHA_1 ((psa_algorithm_t)0x02000005)
134 
141 #define PSA_ALG_SHA_224 ((psa_algorithm_t)0x02000008)
149 #define PSA_ALG_SHA_256 ((psa_algorithm_t)0x02000009)
157 #define PSA_ALG_SHA_384 ((psa_algorithm_t)0x0200000a)
165 #define PSA_ALG_SHA_512 ((psa_algorithm_t)0x0200000b)
173 #define PSA_ALG_SHA_512_224 ((psa_algorithm_t)0x0200000c)
181 #define PSA_ALG_SHA_512_256 ((psa_algorithm_t)0x0200000d)
189 #define PSA_ALG_SHA3_224 ((psa_algorithm_t)0x02000010)
196 #define PSA_ALG_SHA3_256 ((psa_algorithm_t)0x02000011)
203 #define PSA_ALG_SHA3_384 ((psa_algorithm_t)0x02000012)
210 #define PSA_ALG_SHA3_512 ((psa_algorithm_t)0x02000013)
222 #define PSA_ALG_SM3 ((psa_algorithm_t)0x02000014)
235 #define PSA_ALG_SHAKE256_512 ((psa_algorithm_t)0x02000015)
236 
237 #ifdef __cplusplus
238 }
239 #endif
240 
Algorithm definitions for the PSA Crypto API.