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_KEY_DERIVATION_ALGORITHM_H
23 #define PSA_CRYPTO_PSA_KEY_DERIVATION_ALGORITHM_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include "psa/algorithm.h"
30 
34 #define PSA_ALG_CATEGORY_KEY_DERIVATION ((psa_algorithm_t)0x08000000)
35 
44 #define PSA_ALG_IS_KEY_DERIVATION(alg) \
45  (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_KEY_DERIVATION)
46 
59 #define PSA_ALG_IS_KEY_DERIVATION_STRETCHING(alg) \
60  (((alg) & 0x7f800000) == 0x08800000)
61 
73 #define PSA_ALG_IS_HKDF(alg) \
74  (((alg) & ~0x000000ff) == 0x08000100)
75 
84 #define PSA_ALG_IS_HKDF_EXTRACT(alg) \
85  (((alg) & ~0x000000ff) == 0x08000400)
86 
95 #define PSA_ALG_IS_HKDF_EXPAND(alg) \
96  (((alg) & ~0x000000ff) == 0x08000500)
97 
106 #define PSA_ALG_IS_TLS12_PRF(alg) \
107  (((alg) & ~0x000000ff) == 0x08000200)
108 
117 #define PSA_ALG_IS_TLS12_PSK_TO_MS(alg) \
118  (((alg) & ~0x000000ff) == 0x08000300)
119 
128 #define PSA_ALG_IS_PBKDF2_HMAC(alg) \
129  (((alg) & ~0x000000ff) == 0x08800100)
130 
160 #define PSA_ALG_HKDF(hash_alg) ((psa_algorithm_t)(0x08000100 | ((hash_alg) & 0x000000ff)))
161 
187 #define PSA_ALG_HKDF_EXTRACT(hash_alg) ((psa_algorithm_t)(0x08000400 | ((hash_alg) & 0x000000ff)))
188 
213 #define PSA_ALG_HKDF_EXPAND(hash_alg) ((psa_algorithm_t)(0x08000500 | ((hash_alg) & 0x000000ff)))
214 
247 #define PSA_ALG_TLS12_PRF(hash_alg) ((psa_algorithm_t)(0x08000200 | ((hash_alg) & 0x000000ff)))
248 
277 #define PSA_ALG_TLS12_PSK_TO_MS(hash_alg) \
278  ((psa_algorithm_t)(0x08000300 | ((hash_alg) & 0x000000ff)))
279 
314 #define PSA_ALG_PBKDF2_HMAC(hash_alg) \
315  ((psa_algorithm_t)(0x08800100 | ((hash_alg) & 0x000000ff)))
316 
335 #define PSA_ALG_PBKDF2_AES_CMAC_PRF_128 ((psa_algorithm_t)0x08800200)
336 
337 #ifdef __cplusplus
338 }
339 #endif
340 
341 #endif /* PSA_CRYPTO_PSA_KEY_DERIVATION_ALGORITHM_H */
Algorithm definitions for the PSA Crypto API.