Skip to content

Commit 6388241

Browse files
committed
Fix PQC definitions and command codes for v185
1 parent d830bca commit 6388241

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/tpm2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6640,12 +6640,14 @@ const char* TPM2_GetAlgName(TPM_ALG_ID alg)
66406640
return "AES-CFB";
66416641
case TPM_ALG_ECB:
66426642
return "AES-ECB";
6643+
#ifdef WOLFTPM_V185
66436644
case TPM_ALG_MLKEM:
66446645
return "ML-KEM";
66456646
case TPM_ALG_MLDSA:
66466647
return "ML-DSA";
66476648
case TPM_ALG_HASH_MLDSA:
66486649
return "HashML-DSA";
6650+
#endif
66496651
default:
66506652
break;
66516653
}

wolftpm/tpm2.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ typedef enum {
117117
TPM_ALG_CBC = 0x0042,
118118
TPM_ALG_CFB = 0x0043,
119119
TPM_ALG_ECB = 0x0044,
120+
#ifdef WOLFTPM_V185
120121
/* Post-Quantum Algorithms - TPM 2.0 Library v185 */
121122
TPM_ALG_MLKEM = 0x00A0,
122123
TPM_ALG_MLDSA = 0x00A1,
123124
TPM_ALG_HASH_MLDSA = 0x00A2,
125+
#endif
124126
} TPM_ALG_ID_T;
125127
typedef UINT16 TPM_ALG_ID;
126128

@@ -137,6 +139,7 @@ typedef enum {
137139
} TPM_ECC_CURVE_T;
138140
typedef UINT16 TPM_ECC_CURVE;
139141

142+
#ifdef WOLFTPM_V185
140143
/* ML-KEM Parameter Sets (TCG Algorithm Registry v2.0) */
141144
typedef UINT16 TPMI_MLKEM_PARAMETER_SET;
142145
#define TPM_MLKEM_NONE 0x0000
@@ -150,6 +153,7 @@ typedef UINT16 TPMI_MLDSA_PARAMETER_SET;
150153
#define TPM_MLDSA_44 0x0001
151154
#define TPM_MLDSA_65 0x0002
152155
#define TPM_MLDSA_87 0x0003
156+
#endif /* WOLFTPM_V185 */
153157

154158
/* Command Codes */
155159
typedef enum {
@@ -266,6 +270,8 @@ typedef enum {
266270
TPM_CC_CreateLoaded = 0x00000191,
267271
TPM_CC_PolicyAuthorizeNV = 0x00000192,
268272
TPM_CC_EncryptDecrypt2 = 0x00000193,
273+
#ifdef WOLFTPM_V185
274+
/* Post-Quantum Cryptography Commands - TPM 2.0 Library v185 */
269275
TPM_CC_VerifySequenceComplete = 0x000001A3,
270276
TPM_CC_SignSequenceComplete = 0x000001A4,
271277
TPM_CC_VerifyDigestSignature = 0x000001A5,
@@ -275,6 +281,9 @@ typedef enum {
275281
TPM_CC_VerifySequenceStart = 0x000001A9,
276282
TPM_CC_SignSequenceStart = 0x000001AA,
277283
TPM_CC_LAST = TPM_CC_SignSequenceStart,
284+
#else
285+
TPM_CC_LAST = TPM_CC_EncryptDecrypt2,
286+
#endif
278287

279288
CC_VEND = 0x20000000,
280289
TPM_CC_Vendor_TCG_Test = CC_VEND + 0x0000,

0 commit comments

Comments
 (0)