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_KEY_DERIVATION ((psa_algorithm_t)0x08000000)
31 
40 #define PSA_ALG_IS_KEY_DERIVATION(alg) \
41  (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_KEY_DERIVATION)
42 
55 #define PSA_ALG_IS_KEY_DERIVATION_STRETCHING(alg) \
56  (((alg) & 0x7f800000) == 0x08800000)
57 
69 #define PSA_ALG_IS_HKDF(alg) \
70  (((alg) & ~0x000000ff) == 0x08000100)
71 
80 #define PSA_ALG_IS_HKDF_EXTRACT(alg) \
81  (((alg) & ~0x000000ff) == 0x08000400)
82 
91 #define PSA_ALG_IS_HKDF_EXPAND(alg) \
92  (((alg) & ~0x000000ff) == 0x08000500)
93 
102 #define PSA_ALG_IS_TLS12_PRF(alg) \
103  (((alg) & ~0x000000ff) == 0x08000200)
104 
113 #define PSA_ALG_IS_TLS12_PSK_TO_MS(alg) \
114  (((alg) & ~0x000000ff) == 0x08000300)
115 
124 #define PSA_ALG_IS_PBKDF2_HMAC(alg) \
125  (((alg) & ~0x000000ff) == 0x08800100)
126 
156 #define PSA_ALG_HKDF(hash_alg) ((psa_algorithm_t)(0x08000100 | ((hash_alg) & 0x000000ff)))
157 
183 #define PSA_ALG_HKDF_EXTRACT(hash_alg) ((psa_algorithm_t)(0x08000400 | ((hash_alg) & 0x000000ff)))
184 
209 #define PSA_ALG_HKDF_EXPAND(hash_alg) ((psa_algorithm_t)(0x08000500 | ((hash_alg) & 0x000000ff)))
210 
243 #define PSA_ALG_TLS12_PRF(hash_alg) ((psa_algorithm_t)(0x08000200 | ((hash_alg) & 0x000000ff)))
244 
273 #define PSA_ALG_TLS12_PSK_TO_MS(hash_alg) \
274  ((psa_algorithm_t)(0x08000300 | ((hash_alg) & 0x000000ff)))
275 
310 #define PSA_ALG_PBKDF2_HMAC(hash_alg) \
311  ((psa_algorithm_t)(0x08800100 | ((hash_alg) & 0x000000ff)))
312 
331 #define PSA_ALG_PBKDF2_AES_CMAC_PRF_128 ((psa_algorithm_t)0x08800200)
332 
333 #ifdef __cplusplus
334 }
335 #endif
336 
Algorithm definitions for the PSA Crypto API.