Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
type.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_TYPE_H
23
#define PSA_CRYPTO_PSA_KEY_TYPE_H
24
25
#ifdef __cplusplus
26
extern
"C"
{
27
#endif
28
29
#include <stdint.h>
30
45
typedef
uint16_t
psa_key_type_t
;
46
57
typedef
uint8_t
psa_ecc_family_t
;
58
69
typedef
uint8_t
psa_dh_family_t
;
70
76
#define PSA_KEY_TYPE_NONE ((psa_key_type_t)0x0000)
77
86
#define PSA_KEY_TYPE_VENDOR_FLAG ((psa_key_type_t)0x8000)
87
91
#define PSA_KEY_TYPE_CATEGORY_MASK ((psa_key_type_t)0x7000)
92
96
#define PSA_KEY_TYPE_CATEGORY_RAW ((psa_key_type_t)0x1000)
97
101
#define PSA_KEY_TYPE_CATEGORY_SYMMETRIC ((psa_key_type_t)0x2000)
102
106
#define PSA_KEY_TYPE_CATEGORY_PUBLIC_KEY ((psa_key_type_t)0x4000)
107
111
#define PSA_KEY_TYPE_CATEGORY_KEY_PAIR ((psa_key_type_t)0x7000)
112
116
#define PSA_KEY_TYPE_CATEGORY_FLAG_PAIR ((psa_key_type_t)0x3000)
117
124
#define PSA_KEY_TYPE_IS_UNSTRUCTURED(type) \
125
(((type) & 0x7000) == 0x1000 || ((type) & 0x7000) == 0x2000)
126
132
#define PSA_KEY_TYPE_IS_ASYMMETRIC(type) \
133
(((type) & 0x4000) == 0x4000)
134
140
#define PSA_KEY_TYPE_IS_PUBLIC_KEY(type) \
141
(((type) & 0x7000) == 0x4000)
142
148
#define PSA_KEY_TYPE_IS_KEY_PAIR(type) \
149
(((type) & 0x7000) == 0x7000)
150
165
#define PSA_KEY_TYPE_RAW_DATA ((psa_key_type_t)0x1001)
166
189
#define PSA_KEY_TYPE_HMAC ((psa_key_type_t)0x1100)
190
210
#define PSA_KEY_TYPE_DERIVE ((psa_key_type_t)0x1200)
211
235
#define PSA_KEY_TYPE_PASSWORD ((psa_key_type_t)0x1203)
236
247
#define PSA_KEY_TYPE_PASSWORD_HASH ((psa_key_type_t)0x1205)
248
259
#define PSA_KEY_TYPE_PEPPER ((psa_key_type_t)0x1206)
260
291
#define PSA_KEY_TYPE_AES ((psa_key_type_t)0x2400)
292
323
#define PSA_KEY_TYPE_ARIA ((psa_key_type_t)0x2406)
324
352
#define PSA_KEY_TYPE_DES ((psa_key_type_t)0x2301)
353
386
#define PSA_KEY_TYPE_CAMELLIA ((psa_key_type_t)0x2403)
387
415
#define PSA_KEY_TYPE_SM4 ((psa_key_type_t)0x2405)
416
428
#define PSA_KEY_TYPE_ARC4 ((psa_key_type_t)0x2002)
429
445
#define PSA_KEY_TYPE_CHACHA20 ((psa_key_type_t)0x2004)
446
460
#define PSA_KEY_TYPE_RSA_KEY_PAIR ((psa_key_type_t)0x7001)
461
475
#define PSA_KEY_TYPE_RSA_PUBLIC_KEY ((psa_key_type_t)0x4001)
476
482
#define PSA_KEY_TYPE_IS_RSA(type) \
483
(PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) == 0x4001)
484
488
#define PSA_KEY_TYPE_ECC_KEY_PAIR_BASE ((psa_key_type_t)0x7100)
489
505
#define PSA_KEY_TYPE_ECC_KEY_PAIR(curve) \
506
(PSA_KEY_TYPE_ECC_KEY_PAIR_BASE | (curve))
507
511
#define PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE ((psa_key_type_t)0x4100)
512
516
#define PSA_KEY_TYPE_ECC_CURVE_MASK ((psa_key_type_t)0x00ff)
517
533
#define PSA_KEY_TYPE_ECC_PUBLIC_KEY(curve) \
534
(PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE | (curve))
535
553
#define PSA_ECC_FAMILY_SECP_K1 ((psa_ecc_family_t)0x17)
554
573
#define PSA_ECC_FAMILY_SECP_R1 ((psa_ecc_family_t)0x12)
574
590
#define PSA_ECC_FAMILY_SECP_R2 ((psa_ecc_family_t)0x1b)
591
614
#define PSA_ECC_FAMILY_SECT_K1 ((psa_ecc_family_t)0x27)
615
637
#define PSA_ECC_FAMILY_SECT_R1 ((psa_ecc_family_t)0x22)
638
656
#define PSA_ECC_FAMILY_SECT_R2 ((psa_ecc_family_t)0x2b)
657
682
#define PSA_ECC_FAMILY_BRAINPOOL_P_R1 ((psa_ecc_family_t)0x30)
683
701
#define PSA_ECC_FAMILY_FRP ((psa_ecc_family_t)0x33)
702
718
#define PSA_ECC_FAMILY_MONTGOMERY ((psa_ecc_family_t)0x41)
719
737
#define PSA_ECC_FAMILY_TWISTED_EDWARDS ((psa_ecc_family_t)0x42)
738
744
#define PSA_KEY_TYPE_IS_ECC(type) \
745
((PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) & 0xff00) == 0x4100)
746
752
#define PSA_KEY_TYPE_IS_ECC_KEY_PAIR(type) \
753
(((type) & 0xff00) == 0x7100)
754
760
#define PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY(type) \
761
(((type) & 0xff00) == 0x4100)
762
772
#define PSA_KEY_TYPE_ECC_GET_FAMILY(type) \
773
((psa_ecc_family_t)((type) & 0x00ff))
774
784
#define PSA_KEY_TYPE_DH_KEY_PAIR(group) \
785
((psa_key_type_t)(0x7200 | (group)))
786
798
#define PSA_KEY_TYPE_DH_PUBLIC_KEY(group) \
799
((psa_key_type_t)(0x4200 | (group)))
800
813
#define PSA_DH_FAMILY_RFC7919 ((psa_dh_family_t)0x03)
814
825
#define PSA_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY(type) \
826
((psa_key_type_t)((type) | 0x3000))
827
837
#define PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) \
838
((psa_key_type_t)((type) & ~0x3000))
839
845
#define PSA_KEY_TYPE_IS_DH(type) \
846
((PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) & 0xff00) == 0x4200)
847
853
#define PSA_KEY_TYPE_IS_DH_KEY_PAIR(type) \
854
(((type) & 0xff00) == 0x7200)
855
861
#define PSA_KEY_TYPE_IS_DH_PUBLIC_KEY(type) \
862
(((type) & 0xff00) == 0x4200)
863
873
#define PSA_KEY_TYPE_DH_GET_FAMILY(type) \
874
((psa_dh_family_t)((type) & 0x00ff))
875
876
#ifdef __cplusplus
877
}
878
#endif
879
880
#endif
/* PSA_CRYPTO_PSA_KEY_TYPE_H */
psa_key_type_t
uint16_t psa_key_type_t
Encoding of a key type.
Definition
type.h:45
psa_ecc_family_t
uint8_t psa_ecc_family_t
The type of PSA elliptic curve family identifiers.
Definition
type.h:57
psa_dh_family_t
uint8_t psa_dh_family_t
The type of PSA finite-field Diffie-Hellman group family identifiers.
Definition
type.h:69
Generated on Sat Dec 21 2024 20:58:04 by
1.9.8