Loading...
Searching...
No Matches
crypto_values.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 HAW Hamburg
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
25#ifndef PSA_CRYPTO_PSA_CRYPTO_VALUES_H
26#define PSA_CRYPTO_PSA_CRYPTO_VALUES_H
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include "crypto_types.h"
33
37#define PSA_ALG_CATEGORY_MASK ((psa_algorithm_t)0x7f000000)
38
42#define PSA_ALG_CATEGORY_HASH ((psa_algorithm_t)0x02000000)
46#define PSA_ALG_CATEGORY_MAC ((psa_algorithm_t)0x03000000)
50#define PSA_ALG_CATEGORY_CIPHER ((psa_algorithm_t)0x04000000)
54#define PSA_ALG_CATEGORY_AEAD ((psa_algorithm_t)0x05000000)
58#define PSA_ALG_CATEGORY_SIGN ((psa_algorithm_t)0x06000000)
62#define PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION ((psa_algorithm_t)0x07000000)
66#define PSA_ALG_CATEGORY_KEY_DERIVATION ((psa_algorithm_t)0x08000000)
70#define PSA_ALG_CATEGORY_KEY_AGREEMENT ((psa_algorithm_t)0x09000000)
71
96#define PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(aead_alg, min_tag_length) \
97 /* specification-defined value */
98
109#define PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(aead_alg) \
110 ((((aead_alg) & ~0x003f0000) == 0x05400100) ? PSA_ALG_CCM : \
111 (((aead_alg) & ~0x003f0000) == 0x05400200) ? PSA_ALG_GCM : \
112 (((aead_alg) & ~0x003f0000) == 0x05000500) ? PSA_ALG_CHACHA20_POLY1305 : \
113 PSA_ALG_NONE)
114
137#define PSA_ALG_AEAD_WITH_SHORTENED_TAG(aead_alg, tag_length) \
138 ((psa_algorithm_t)(((aead_alg) & ~0x003f0000) | (((tag_length) & 0x3f) << 16)))
139
182#define PSA_ALG_ANY_HASH ((psa_algorithm_t)0x020000ff)
183
212#define PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(mac_alg, min_mac_length) \
213 /* specification-defined value */
214
256#define PSA_ALG_DETERMINISTIC_ECDSA(hash_alg) \
257 ((psa_algorithm_t)(0x06000700 | ((hash_alg) & 0x000000ff)))
258
274#define PSA_ALG_FULL_LENGTH_MAC(mac_alg) \
275 ((psa_algorithm_t)((mac_alg) & ~0x003f0000))
276
306#define PSA_ALG_HKDF(hash_alg) \
307 ((psa_algorithm_t)(0x08000100 | ((hash_alg) & 0x000000ff)))
308
329#define PSA_ALG_GET_HASH(alg) \
330 (((alg) & PSA_ALG_HASH_MASK) == \
331 0 ? ((psa_algorithm_t)0) : PSA_ALG_CATEGORY_HASH | ((alg) & PSA_ALG_HASH_MASK))
332
336#define PSA_ALG_HMAC_BASE (0x03800000)
337
355#define PSA_ALG_HMAC(hash_alg) \
356 ((psa_algorithm_t)(PSA_ALG_HMAC_BASE | ((hash_alg) & PSA_ALG_HASH_MASK)))
357
366#define PSA_ALG_IS_CIPHER(alg) \
367 (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_CIPHER)
368
378#define PSA_ALG_IS_AEAD(alg) \
379 (((alg) & PSA_ALG_CATEGORY_MASK) == 0x05000000)
380
389#define PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) \
390 (((alg) & 0x7f400000) == 0x05400000)
391
401#define PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg) \
402 (((alg) & PSA_ALG_CATEGORY_MASK) == 0x07000000)
403
412#define PSA_ALG_IS_BLOCK_CIPHER_MAC(alg) \
413 (((alg) & 0x7fc00000) == 0x03c00000)
414
425#define PSA_ALG_IS_DETERMINISTIC_ECDSA(alg) \
426 (((alg) & ~0x000000ff) == 0x06000700)
427
439#define PSA_ALG_IS_ECDH(alg) \
440 (((alg) & 0x7fff0000) == 0x09020000)
441
453#define PSA_ALG_IS_FFDH(alg) \
454 (((alg) & 0x7fff0000) == 0x09010000)
455
464#define PSA_ALG_IS_ECDSA(alg) \
465 (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_SIGN)
466
475#define PSA_ALG_IS_HASH(alg) \
476 (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_HASH)
477
483#define PSA_ALG_HMAC_GET_HASH(hmac_alg) \
484 (PSA_ALG_CATEGORY_HASH | ((hmac_alg) & PSA_ALG_HASH_MASK))
485
494#define PSA_ALG_IS_HASH_EDDSA(alg) \
495 (((alg) & ~0x000000ff) == 0x06000900)
496
529#define PSA_ALG_IS_HASH_AND_SIGN(alg) \
530 (PSA_ALG_IS_SIGN_HASH(alg) && \
531 ((alg) & PSA_ALG_HASH_MASK) != 0)
532
544#define PSA_ALG_IS_HKDF(alg) \
545 (((alg) & ~0x000000ff) == 0x08000100)
546
557#define PSA_ALG_IS_HMAC(alg) \
558 (((alg) & 0x7fc0ff00) == 0x03800000)
559
568#define PSA_ALG_IS_KEY_AGREEMENT(alg) \
569 (((alg) & 0x7f000000) == 0x09000000)
570
579#define PSA_ALG_IS_KEY_DERIVATION(alg) \
580 (((alg) & 0x7f000000) == 0x08000000)
581
594#define PSA_ALG_IS_KEY_DERIVATION_STRETCHING(alg) \
595 (((alg) & 0x7f800000) == 0x08800000)
596
605#define PSA_ALG_IS_MAC(alg) \
606 (((alg) & 0x7f000000) == 0x03000000)
607
616#define PSA_ALG_IS_PBKDF2_HMAC(alg) \
617 (((alg) & ~0x000000ff) == 0x08800100)
618
629#define PSA_ALG_IS_RANDOMIZED_ECDSA(alg) \
630 (((alg) & ~0x000000ff) == 0x06000600)
631
648#define PSA_ALG_IS_RAW_KEY_AGREEMENT(alg) \
649 (((alg) & 0x7f00ffff) == 0x09000000)
650
659#define PSA_ALG_IS_RSA_OAEP(alg) \
660 (((alg) & ~0x000000ff) == 0x07000300)
661
670#define PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) \
671 (((alg) & ~0x000000ff) == 0x06000200)
672
684#define PSA_ALG_IS_RSA_PSS(alg) \
685 (((alg) & ~0x000000ff) == 0x06000300)
686
701#define PSA_ALG_IS_RSA_PSS_ANY_SALT(alg) \
702 (((alg) & ~0x000000ff) == 0x06001300)
703
718#define PSA_ALG_IS_RSA_PSS_STANDARD_SALT(alg) \
719 (((alg) & ~0x000000ff) == 0x06000300)
720
730#define PSA_ALG_IS_SIGN(alg) \
731 (((alg) & 0x7f000000) == 0x06000000)
732
748#define PSA_ALG_IS_SIGN_HASH(alg) \
749 (PSA_ALG_IS_RSA_PSS(alg) || PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) || \
750 PSA_ALG_IS_ECDSA(alg) || PSA_ALG_IS_HASH_EDDSA(alg))
751
763#define PSA_ALG_IS_SIGN_MESSAGE(alg) \
764 (PSA_ALG_IS_SIGN_HASH(alg) || (alg) == PSA_ALG_PURE_EDDSA)
765
777#define PSA_ALG_IS_STREAM_CIPHER(alg) \
778 (((alg) & 0x7f800000) == 0x04800000)
779
788#define PSA_ALG_IS_TLS12_PRF(alg) \
789 (((alg) & ~0x000000ff) == 0x08000200)
790
799#define PSA_ALG_IS_TLS12_PSK_TO_MS(alg) \
800 (((alg) & ~0x000000ff) == 0x08000300)
801
816#define PSA_ALG_IS_WILDCARD(alg) \
817 (PSA_ALG_GET_HASH(alg) == PSA_ALG_HASH_ANY)
818
841#define PSA_ALG_KEY_AGREEMENT(ka_alg, kdf_alg) \
842 ((ka_alg) | (kdf_alg))
843
856#define PSA_ALG_KEY_AGREEMENT_GET_BASE(alg) \
857 ((psa_algorithm_t)((alg) & 0xffff0000))
858
871#define PSA_ALG_KEY_AGREEMENT_GET_KDF(alg) \
872 ((psa_algorithm_t)((alg) & 0xfe00ffff))
873
879#define PSA_ALG_NONE ((psa_algorithm_t)0)
880
884#define PSA_ALG_HASH_MASK ((psa_algorithm_t)0x000000ff)
885
895#define PSA_ALG_MD2 ((psa_algorithm_t)0x02000001)
896
906#define PSA_ALG_MD4 ((psa_algorithm_t)0x02000002)
907
917#define PSA_ALG_MD5 ((psa_algorithm_t)0x02000003)
918
926#define PSA_ALG_RIPEMD160 ((psa_algorithm_t)0x02000004)
927
937#define PSA_ALG_SHA_1 ((psa_algorithm_t)0x02000005)
938
945#define PSA_ALG_SHA_224 ((psa_algorithm_t)0x02000008)
953#define PSA_ALG_SHA_256 ((psa_algorithm_t)0x02000009)
961#define PSA_ALG_SHA_384 ((psa_algorithm_t)0x0200000a)
969#define PSA_ALG_SHA_512 ((psa_algorithm_t)0x0200000b)
977#define PSA_ALG_SHA_512_224 ((psa_algorithm_t)0x0200000c)
985#define PSA_ALG_SHA_512_256 ((psa_algorithm_t)0x0200000d)
993#define PSA_ALG_SHA3_224 ((psa_algorithm_t)0x02000010)
1000#define PSA_ALG_SHA3_256 ((psa_algorithm_t)0x02000011)
1007#define PSA_ALG_SHA3_384 ((psa_algorithm_t)0x02000012)
1014#define PSA_ALG_SHA3_512 ((psa_algorithm_t)0x02000013)
1026#define PSA_ALG_SM3 ((psa_algorithm_t)0x02000014)
1039#define PSA_ALG_SHAKE256_512 ((psa_algorithm_t)0x02000015)
1040
1062#define PSA_ALG_CBC_MAC ((psa_algorithm_t)0x03c00100)
1063
1081#define PSA_ALG_CMAC ((psa_algorithm_t)0x03c00200)
1082
1106#define PSA_ALG_CBC_NO_PADDING ((psa_algorithm_t)0x04404000)
1107
1131#define PSA_ALG_CBC_PKCS7 ((psa_algorithm_t)0x04404100)
1132
1164#define PSA_ALG_ECB_NO_PADDING ((psa_algorithm_t)0x04404400)
1165
1192#define PSA_ALG_XTS ((psa_algorithm_t)0x0440ff00)
1193
1245#define PSA_ALG_CTR ((psa_algorithm_t)0x04c01000)
1246
1276#define PSA_ALG_CFB ((psa_algorithm_t)0x04c01100)
1277
1300#define PSA_ALG_OFB ((psa_algorithm_t)0x04c01200)
1301
1358#define PSA_ALG_STREAM_CIPHER ((psa_algorithm_t)0x04800100)
1359
1387#define PSA_ALG_CHACHA20_POLY1305 ((psa_algorithm_t)0x05100500)
1388
1430#define PSA_ALG_CCM ((psa_algorithm_t)0x05500100)
1431
1457#define PSA_ALG_GCM ((psa_algorithm_t)0x05500200)
1458
1477#define PSA_ALG_PBKDF2_AES_CMAC_PRF_128 ((psa_algorithm_t)0x08800200)
1478
1513#define PSA_ALG_PBKDF2_HMAC(hash_alg) \
1514 ((psa_algorithm_t)(0x08800100 | ((hash_alg) & 0x000000ff)))
1515
1538#define PSA_ALG_RSA_PKCS1V15_SIGN_RAW ((psa_algorithm_t)0x06000200)
1539
1543#define PSA_ALG_ECDSA_BASE ((psa_algorithm_t)0x06000600)
1544
1580#define PSA_ALG_PURE_EDDSA ((psa_algorithm_t)0x06000800)
1581
1631#define PSA_ALG_ECDSA(hash_alg) \
1632 (PSA_ALG_ECDSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
1633
1661#define PSA_ALG_ECDSA_ANY PSA_ALG_ECDSA_BASE
1662
1690#define PSA_ALG_ED25519PH ((psa_algorithm_t)0x0600090B)
1691
1720#define PSA_ALG_ED448PH ((psa_algorithm_t)0x06000915)
1721
1733#define PSA_ALG_RSA_PKCS1V15_CRYPT ((psa_algorithm_t)0x07000200)
1734
1765#define PSA_ALG_FFDH ((psa_algorithm_t)0x09010000)
1766
1834#define PSA_ALG_ECDH ((psa_algorithm_t)0x09020000)
1835
1858#define PSA_ALG_RSA_OAEP(hash_alg) \
1859 ((psa_algorithm_t)(0x07000300 | ((hash_alg) & 0x000000ff)))
1860
1886#define PSA_ALG_RSA_PKCS1V15_SIGN(hash_alg) \
1887 ((psa_algorithm_t)(0x06000200 | ((hash_alg) & 0x000000ff)))
1888
1918#define PSA_ALG_RSA_PSS(hash_alg) \
1919 ((psa_algorithm_t)(0x06000300 | ((hash_alg) & 0x000000ff)))
1920
1951#define PSA_ALG_RSA_PSS_ANY_SALT(hash_alg) \
1952 ((psa_algorithm_t)(0x06001300 | ((hash_alg) & 0x000000ff)))
1953
1986#define PSA_ALG_TLS12_PRF(hash_alg) \
1987 ((psa_algorithm_t)(0x08000200 | ((hash_alg) & 0x000000ff)))
1988
2017#define PSA_ALG_TLS12_PSK_TO_MS(hash_alg) \
2018 ((psa_algorithm_t)(0x08000300 | ((hash_alg) & 0x000000ff)))
2019
2053#define PSA_ALG_TRUNCATED_MAC(mac_alg, mac_length) \
2054 ((psa_algorithm_t)(((mac_alg) & ~0x003f0000) | (((mac_length) & 0x3f) << 16)))
2055
2068#define PSA_DH_FAMILY_RFC7919 ((psa_dh_family_t)0x03)
2069
2094#define PSA_ECC_FAMILY_BRAINPOOL_P_R1 ((psa_ecc_family_t)0x30)
2095
2113#define PSA_ECC_FAMILY_FRP ((psa_ecc_family_t)0x33)
2114
2130#define PSA_ECC_FAMILY_MONTGOMERY ((psa_ecc_family_t)0x41)
2131
2149#define PSA_ECC_FAMILY_SECP_K1 ((psa_ecc_family_t)0x17)
2150
2169#define PSA_ECC_FAMILY_SECP_R1 ((psa_ecc_family_t)0x12)
2170
2186#define PSA_ECC_FAMILY_SECP_R2 ((psa_ecc_family_t)0x1b)
2187
2210#define PSA_ECC_FAMILY_SECT_K1 ((psa_ecc_family_t)0x27)
2211
2233#define PSA_ECC_FAMILY_SECT_R1 ((psa_ecc_family_t)0x22)
2234
2252#define PSA_ECC_FAMILY_SECT_R2 ((psa_ecc_family_t)0x2b)
2253
2271#define PSA_ECC_FAMILY_TWISTED_EDWARDS ((psa_ecc_family_t)0x42)
2272
2279#define PSA_KEY_DERIVATION_INPUT_CONTEXT /* implementation-defined value */
2280
2286#define PSA_KEY_DERIVATION_INPUT_COST /* implementation-defined value */
2287
2294#define PSA_KEY_DERIVATION_INPUT_INFO /* implementation-defined value */
2295
2302#define PSA_KEY_DERIVATION_INPUT_LABEL /* implementation-defined value */
2303
2316#define PSA_KEY_DERIVATION_INPUT_PASSWORD /* implementation-defined value */
2317
2324#define PSA_KEY_DERIVATION_INPUT_SALT /* implementation-defined value */
2325
2337#define PSA_KEY_DERIVATION_INPUT_SECRET /* implementation-defined value */
2338
2345#define PSA_KEY_DERIVATION_INPUT_SEED /* implementation-defined value */
2346
2354#define PSA_KEY_DERIVATION_UNLIMITED_CAPACITY \
2355/* implementation-defined value */
2356
2363#define PSA_KEY_ID_NULL ((psa_key_id_t)0)
2364
2368#define PSA_KEY_ID_USER_MAX ((psa_key_id_t)0x3fffffff)
2369
2373#define PSA_KEY_ID_USER_MIN ((psa_key_id_t)0x00000001)
2374
2378#define PSA_KEY_ID_VENDOR_MAX ((psa_key_id_t)0x7fffffff)
2379
2383#define PSA_KEY_ID_VENDOR_MIN ((psa_key_id_t)0x40000000)
2384
2393#define PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(persistence, location) \
2394 ((location) << 8 | (persistence))
2395
2401#define PSA_KEY_LIFETIME_GET_LOCATION(lifetime) \
2402 ((psa_key_location_t)((lifetime) >> 8))
2403
2409#define PSA_KEY_LIFETIME_GET_PERSISTENCE(lifetime) \
2410 ((psa_key_persistence_t)((lifetime) & 0x000000ff))
2411
2427#define PSA_KEY_LIFETIME_IS_VOLATILE(lifetime) \
2428 (PSA_KEY_LIFETIME_GET_PERSISTENCE(lifetime) == PSA_KEY_PERSISTENCE_VOLATILE)
2429
2443#define PSA_KEY_LIFETIME_PERSISTENT ((psa_key_lifetime_t)0x00000001)
2444
2456#define PSA_KEY_LIFETIME_VOLATILE ((psa_key_lifetime_t)0x00000000)
2457
2466#define PSA_KEY_LOCATION_LOCAL_STORAGE ((psa_key_location_t)0x000000)
2467
2479#define PSA_KEY_LOCATION_PRIMARY_SECURE_ELEMENT ((psa_key_location_t)0x000001)
2480
2484#define PSA_KEY_LOCATION_VENDOR_FLAG ((psa_key_location_t)0x800000)
2485
2489#define PSA_KEY_LOCATION_SE_MIN (PSA_KEY_LOCATION_VENDOR_FLAG)
2490
2494#define PSA_KEY_LOCATION_SE_MAX ((psa_key_location_t)0x8000ff)
2495
2501#define PSA_KEY_PERSISTENCE_DEFAULT ((psa_key_persistence_t)0x01)
2502
2508#define PSA_KEY_PERSISTENCE_READ_ONLY ((psa_key_persistence_t)0xff)
2509
2515#define PSA_KEY_PERSISTENCE_VOLATILE ((psa_key_persistence_t)0x00)
2516
2525#define PSA_KEY_TYPE_VENDOR_FLAG ((psa_key_type_t)0x8000)
2526
2530#define PSA_KEY_TYPE_CATEGORY_MASK ((psa_key_type_t)0x7000)
2531
2535#define PSA_KEY_TYPE_CATEGORY_RAW ((psa_key_type_t)0x1000)
2536
2540#define PSA_KEY_TYPE_CATEGORY_SYMMETRIC ((psa_key_type_t)0x2000)
2541
2545#define PSA_KEY_TYPE_CATEGORY_PUBLIC_KEY ((psa_key_type_t)0x4000)
2546
2550#define PSA_KEY_TYPE_CATEGORY_KEY_PAIR ((psa_key_type_t)0x7000)
2551
2555#define PSA_KEY_TYPE_CATEGORY_FLAG_PAIR ((psa_key_type_t)0x3000)
2556
2587#define PSA_KEY_TYPE_AES ((psa_key_type_t)0x2400)
2588
2600#define PSA_KEY_TYPE_ARC4 ((psa_key_type_t)0x2002)
2601
2632#define PSA_KEY_TYPE_ARIA ((psa_key_type_t)0x2406)
2633
2666#define PSA_KEY_TYPE_CAMELLIA ((psa_key_type_t)0x2403)
2667
2683#define PSA_KEY_TYPE_CHACHA20 ((psa_key_type_t)0x2004)
2684
2704#define PSA_KEY_TYPE_DERIVE ((psa_key_type_t)0x1200)
2705
2733#define PSA_KEY_TYPE_DES ((psa_key_type_t)0x2301)
2734
2744#define PSA_KEY_TYPE_DH_GET_FAMILY(type) \
2745 ((psa_dh_family_t)((type) & 0x00ff))
2746
2756#define PSA_KEY_TYPE_DH_KEY_PAIR(group) \
2757 ((psa_key_type_t)(0x7200 | (group)))
2758
2770#define PSA_KEY_TYPE_DH_PUBLIC_KEY(group) \
2771 ((psa_key_type_t)(0x4200 | (group)))
2772
2782#define PSA_KEY_TYPE_ECC_GET_FAMILY(type) \
2783 ((psa_ecc_family_t)((type) & 0x00ff))
2784
2788#define PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE ((psa_key_type_t)0x4100)
2789
2793#define PSA_KEY_TYPE_ECC_KEY_PAIR_BASE ((psa_key_type_t)0x7100)
2794
2798#define PSA_KEY_TYPE_ECC_CURVE_MASK ((psa_key_type_t)0x00ff)
2799
2815#define PSA_KEY_TYPE_ECC_KEY_PAIR(curve) \
2816 (PSA_KEY_TYPE_ECC_KEY_PAIR_BASE | (curve))
2817
2833#define PSA_KEY_TYPE_ECC_PUBLIC_KEY(curve) \
2834 (PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE | (curve))
2835
2839#define PSA_KEY_TYPE_ECC_PUBLIC_KEY(curve) \
2840 (PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE | (curve))
2841
2847#define PSA_KEY_TYPE_IS_ECC(type) \
2848 ((PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) & 0xff00) == 0x4100)
2849
2855#define PSA_KEY_TYPE_IS_ECC_KEY_PAIR(type) \
2856 (((type) & 0xff00) == 0x7100)
2857
2863#define PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY(type) \
2864 (((type) & 0xff00) == 0x4100)
2865
2875#define PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) \
2876 ((psa_key_type_t)((type) & ~0x3000))
2877
2900#define PSA_KEY_TYPE_HMAC ((psa_key_type_t)0x1100)
2901
2907#define PSA_KEY_TYPE_IS_ASYMMETRIC(type) \
2908 (((type) & 0x4000) == 0x4000)
2909
2915#define PSA_KEY_TYPE_IS_DH(type) \
2916 ((PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) & 0xff00) == 0x4200)
2917
2923#define PSA_KEY_TYPE_IS_DH_KEY_PAIR(type) \
2924 (((type) & 0xff00) == 0x7200)
2925
2931#define PSA_KEY_TYPE_IS_DH_PUBLIC_KEY(type) \
2932 (((type) & 0xff00) == 0x4200)
2933
2939#define PSA_KEY_TYPE_IS_KEY_PAIR(type) \
2940 (((type) & 0x7000) == 0x7000)
2941
2948#define PSA_KEY_TYPE_IS_PUBLIC_KEY(type) \
2949 (((type) & 0x7000) == 0x4000)
2950
2956#define PSA_KEY_TYPE_IS_RSA(type) \
2957 (PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) == 0x4001)
2958
2965#define PSA_KEY_TYPE_IS_UNSTRUCTURED(type) \
2966 (((type) & 0x7000) == 0x1000 || ((type) & 0x7000) == 0x2000)
2967
2978#define PSA_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY(type) \
2979 ((psa_key_type_t)((type) | 0x3000))
2980
2986#define PSA_KEY_TYPE_NONE ((psa_key_type_t)0x0000)
2987
3011#define PSA_KEY_TYPE_PASSWORD ((psa_key_type_t)0x1203)
3012
3023#define PSA_KEY_TYPE_PASSWORD_HASH ((psa_key_type_t)0x1205)
3024
3035#define PSA_KEY_TYPE_PEPPER ((psa_key_type_t)0x1206)
3036
3051#define PSA_KEY_TYPE_RAW_DATA ((psa_key_type_t)0x1001)
3052
3066#define PSA_KEY_TYPE_RSA_KEY_PAIR ((psa_key_type_t)0x7001)
3067
3081#define PSA_KEY_TYPE_RSA_PUBLIC_KEY ((psa_key_type_t)0x4001)
3082
3110#define PSA_KEY_TYPE_SM4 ((psa_key_type_t)0x2405)
3111
3133#define PSA_KEY_USAGE_CACHE ((psa_key_usage_t)0x00000004)
3134
3148#define PSA_KEY_USAGE_COPY ((psa_key_usage_t)0x00000002)
3149
3165#define PSA_KEY_USAGE_DECRYPT ((psa_key_usage_t)0x00000200)
3166
3182#define PSA_KEY_USAGE_DERIVE ((psa_key_usage_t)0x00004000)
3183
3199#define PSA_KEY_USAGE_ENCRYPT ((psa_key_usage_t)0x00000100)
3200
3216#define PSA_KEY_USAGE_EXPORT ((psa_key_usage_t)0x00000001)
3217
3233#define PSA_KEY_USAGE_SIGN_HASH ((psa_key_usage_t)0x00001000)
3234
3247#define PSA_KEY_USAGE_SIGN_MESSAGE ((psa_key_usage_t)0x00000400)
3248
3262#define PSA_KEY_USAGE_VERIFY_DERIVATION ((psa_key_usage_t)0x00008000)
3263
3279#define PSA_KEY_USAGE_VERIFY_HASH ((psa_key_usage_t)0x00002000)
3280
3293#define PSA_KEY_USAGE_VERIFY_MESSAGE ((psa_key_usage_t)0x00000800)
3294
3304#define PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE \
3305/* implementation-defined value */
3306
3323#define PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(key_type, key_bits) \
3324/* implementation-defined value */
3325
3337#define PSA_SIGNATURE_MAX_SIZE /* implementation-defined value */
3338
3355#define PSA_TLS12_PSK_TO_MS_PSK_MAX_SIZE /* implementation-defined value */
3356
3357#ifdef __cplusplus
3358}
3359#endif
3360
3361#endif /* PSA_CRYPTO_PSA_CRYPTO_VALUES_H */
Type definitions for PSA Crypto.