Use of TPM 2.0 private keys for signatures via tpm plugin
[strongswan.git] / src / libtpmtss / tpm_tss_tss2_names.c
1 /*
2 * Copyright (C) 2016 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #include "tpm_tss_tss2_names.h"
17
18 #ifdef TSS_TSS2
19
20 #include <tpm20.h>
21
22 #ifndef TPM_ALG_ECMQV
23 #define TPM_ALG_ECMQV (TPM_ALG_ID)0x001D
24 #endif
25
26 #ifndef TPM_ALG_CAMELLIA
27 #define TPM_ALG_CAMELLIA (TPM_ALG_ID)0x0026
28 #endif
29
30 /**
31 * TPM 2.0 algorithm ID names
32 */
33 ENUM_BEGIN(tpm_alg_id_names, TPM_ALG_ERROR, TPM_ALG_RSA,
34 "ERROR",
35 "RSA"
36 );
37 ENUM_NEXT(tpm_alg_id_names, TPM_ALG_SHA1, TPM_ALG_KEYEDHASH, TPM_ALG_RSA,
38 "SHA1",
39 "HMAC",
40 "AES",
41 "MGF1",
42 "KEYEDHASH"
43 );
44 ENUM_NEXT(tpm_alg_id_names, TPM_ALG_XOR, TPM_ALG_SHA512, TPM_ALG_KEYEDHASH,
45 "XOR",
46 "SHA256",
47 "SHA384",
48 "SHA512"
49 );
50 ENUM_NEXT(tpm_alg_id_names, TPM_ALG_NULL, TPM_ALG_NULL, TPM_ALG_SHA512,
51 "NULL"
52 );
53 ENUM_NEXT(tpm_alg_id_names, TPM_ALG_SM3_256, TPM_ALG_ECMQV, TPM_ALG_NULL,
54 "SM3_256",
55 "SM4",
56 "RSASSA",
57 "RSAES",
58 "RSAPSS",
59 "OAEP",
60 "ECDSA",
61 "ECDH",
62 "SM2",
63 "ECSCHNORR",
64 "ECMQV"
65 );
66 ENUM_NEXT(tpm_alg_id_names, TPM_ALG_KDF1_SP800_56A, TPM_ALG_ECC, TPM_ALG_ECMQV,
67 "KDF1_SP800_56A",
68 "KDF2",
69 "KDF1_SP800_108",
70 "ECC"
71 );
72 ENUM_NEXT(tpm_alg_id_names, TPM_ALG_SYMCIPHER, TPM_ALG_CAMELLIA, TPM_ALG_ECC,
73 "SYMCIPHER",
74 "CAMELLIA"
75 );
76 ENUM_NEXT(tpm_alg_id_names, TPM_ALG_CTR, TPM_ALG_ECB, TPM_ALG_CAMELLIA,
77 "CTR",
78 "OFB",
79 "CBC",
80 "CFB",
81 "ECB"
82 );
83 ENUM_END(tpm_alg_id_names, TPM_ALG_ECB);
84
85 /**
86 * TPM 2.0 ECC curve names
87 */
88 ENUM_BEGIN(tpm_ecc_curve_names, TPM_ECC_NONE, TPM_ECC_NIST_P521,
89 "NONE",
90 "NIST_P192",
91 "NIST_P224",
92 "NIST_P256",
93 "NIST_P384",
94 "NIST_P521"
95 );
96 ENUM_NEXT(tpm_ecc_curve_names, TPM_ECC_BN_P256, TPM_ECC_BN_P638, TPM_ECC_NIST_P521,
97 "BN_P256",
98 "BN_P638"
99 );
100 ENUM_NEXT(tpm_ecc_curve_names, TPM_ECC_SM2_P256, TPM_ECC_SM2_P256, TPM_ECC_BN_P638,
101 "SM2_P256"
102 );
103 ENUM_END(tpm_ecc_curve_names, TPM_ECC_SM2_P256);
104
105 #else /* TSS_TSS2 */
106
107 /**
108 * TPM 2.0 algorithm ID names
109 */
110 ENUM(tpm_alg_id_names, 0, 0,
111 "ERROR"
112 );
113
114 /**
115 * TPM 2.0 ECC curve names
116 */
117 ENUM(tpm_ecc_curve_names, 0, 0,
118 "NONE"
119 );
120
121 #endif /* TSS_TSS2 */
122
123