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_AGREEMENT_ALGORITHM_H
23 #define PSA_CRYPTO_PSA_KEY_AGREEMENT_ALGORITHM_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include "psa/algorithm.h"
30 
34 #define PSA_ALG_CATEGORY_KEY_AGREEMENT ((psa_algorithm_t)0x09000000)
35 
44 #define PSA_ALG_IS_KEY_AGREEMENT(alg) \
45  (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_KEY_AGREEMENT)
46 
59 #define PSA_ALG_KEY_AGREEMENT_GET_BASE(alg) \
60  ((psa_algorithm_t)((alg) & 0xffff0000))
61 
74 #define PSA_ALG_KEY_AGREEMENT_GET_KDF(alg) \
75  ((psa_algorithm_t)((alg) & 0xfe00ffff))
76 
93 #define PSA_ALG_IS_RAW_KEY_AGREEMENT(alg) \
94  (((alg) & 0x7f00ffff) == 0x09000000)
95 
107 #define PSA_ALG_IS_FFDH(alg) \
108  (((alg) & 0x7fff0000) == 0x09010000)
109 
121 #define PSA_ALG_IS_ECDH(alg) \
122  (((alg) & 0x7fff0000) == 0x09020000)
123 
154 #define PSA_ALG_FFDH ((psa_algorithm_t)0x09010000)
155 
223 #define PSA_ALG_ECDH ((psa_algorithm_t)0x09020000)
224 
247 #define PSA_ALG_KEY_AGREEMENT(ka_alg, kdf_alg) \
248  ((ka_alg) | (kdf_alg))
249 
250 #ifdef __cplusplus
251 }
252 #endif
253 
254 #endif /* PSA_CRYPTO_PSA_KEY_AGREEMENT_ALGORITHM_H */
Algorithm definitions for the PSA Crypto API.