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_KEY_DERIVATION ((psa_algorithm_t)0x08000000)
34 
43 #define PSA_ALG_IS_KEY_DERIVATION(alg) \
44  (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_KEY_DERIVATION)
45 
58 #define PSA_ALG_IS_KEY_DERIVATION_STRETCHING(alg) \
59  (((alg) & 0x7f800000) == 0x08800000)
60 
72 #define PSA_ALG_IS_HKDF(alg) \
73  (((alg) & ~0x000000ff) == 0x08000100)
74 
83 #define PSA_ALG_IS_HKDF_EXTRACT(alg) \
84  (((alg) & ~0x000000ff) == 0x08000400)
85 
94 #define PSA_ALG_IS_HKDF_EXPAND(alg) \
95  (((alg) & ~0x000000ff) == 0x08000500)
96 
105 #define PSA_ALG_IS_TLS12_PRF(alg) \
106  (((alg) & ~0x000000ff) == 0x08000200)
107 
116 #define PSA_ALG_IS_TLS12_PSK_TO_MS(alg) \
117  (((alg) & ~0x000000ff) == 0x08000300)
118 
127 #define PSA_ALG_IS_PBKDF2_HMAC(alg) \
128  (((alg) & ~0x000000ff) == 0x08800100)
129 
159 #define PSA_ALG_HKDF(hash_alg) ((psa_algorithm_t)(0x08000100 | ((hash_alg) & 0x000000ff)))
160 
186 #define PSA_ALG_HKDF_EXTRACT(hash_alg) ((psa_algorithm_t)(0x08000400 | ((hash_alg) & 0x000000ff)))
187 
212 #define PSA_ALG_HKDF_EXPAND(hash_alg) ((psa_algorithm_t)(0x08000500 | ((hash_alg) & 0x000000ff)))
213 
246 #define PSA_ALG_TLS12_PRF(hash_alg) ((psa_algorithm_t)(0x08000200 | ((hash_alg) & 0x000000ff)))
247 
276 #define PSA_ALG_TLS12_PSK_TO_MS(hash_alg) \
277  ((psa_algorithm_t)(0x08000300 | ((hash_alg) & 0x000000ff)))
278 
313 #define PSA_ALG_PBKDF2_HMAC(hash_alg) \
314  ((psa_algorithm_t)(0x08800100 | ((hash_alg) & 0x000000ff)))
315 
334 #define PSA_ALG_PBKDF2_AES_CMAC_PRF_128 ((psa_algorithm_t)0x08800200)
335 
336 #ifdef __cplusplus
337 }
338 #endif
339 
Algorithm definitions for the PSA Crypto API.