@@ -933,8 +933,20 @@ enum TPMA_CC_mask {
933933 TPMA_CC_V = 0x20000000 ,
934934};
935935
936+ /* TPM 2.0 Library Spec Part 2: bitfield returned from
937+ * TPM2_GetCapability(TPM_CAP_TPM_PROPERTIES, TPM_PT_MODES)
938+ * indicating FIPS compliance level. Bit 0 (FIPS_140_2) is defined
939+ * since v1.38; bit 1 (FIPS_140_3) was added in v1.83. Bits 2..31
940+ * are reserved. Decoded unconditionally so any host build can
941+ * interpret either flag from any TPM. */
942+ typedef UINT32 TPMA_MODES ;
943+ enum TPMA_MODES_mask {
944+ TPMA_MODES_FIPS_140_2 = 0x00000001 ,
945+ TPMA_MODES_FIPS_140_3 = 0x00000002 ,
946+ };
947+
936948#ifdef WOLFTPM_V185
937- /* v185 rc4 Part 2 Sec.8.13 Table 46 — bitfield returned from
949+ /* v185 rc4 Part 2 Sec.8.13 Table 46 - bitfield returned from
938950 * TPM2_GetCapability(TPM_CAP_TPM_PROPERTIES, TPM_PT_ML_PARAMETER_SETS)
939951 * indicating which ML-KEM/ML-DSA parameter sets the TPM supports. */
940952typedef UINT32 TPMA_ML_PARAMETER_SET ;
@@ -4329,6 +4341,18 @@ typedef enum {
43294341WOLFTPM_API UINT16 TPM2_GetVendorID (void );
43304342
43314343
4344+ /*!
4345+ \brief Returns a human-readable FIPS mode string from FIPS capability
4346+ bits: "140-3" when fips140_3 is set, "140-2" when fips140_2 is set,
4347+ otherwise "none". Used for capability reporting in examples and
4348+ tools.
4349+ \return Non-NULL pointer to a static string. Never NULL.
4350+ \param fips140_3 non-zero if the TPM reports FIPS 140-3 mode
4351+ \param fips140_2 non-zero if the TPM reports FIPS 140-2 mode
4352+ */
4353+ WOLFTPM_API const char * TPM2_GetCapsFipsStr (int fips140_3 , int fips140_2 );
4354+
4355+
43324356/*!
43334357 \ingroup TPM2_Proprietary
43344358 \brief Forcefully zero a memory region. Unlike memset, this call is not
0 commit comments