diff --git a/TPMCmd/Platform/include/prototypes/platform_public_interface.h b/TPMCmd/Platform/include/prototypes/platform_public_interface.h index 7138067..5335302 100644 --- a/TPMCmd/Platform/include/prototypes/platform_public_interface.h +++ b/TPMCmd/Platform/include/prototypes/platform_public_interface.h @@ -144,4 +144,4 @@ LIB_EXPORT void _plat__RunCommand( unsigned char** response // IN/OUT: response buffer ); -#endif // _PLATFORM_PUBLIC_INTERFACE_H_ \ No newline at end of file +#endif // _PLATFORM_PUBLIC_INTERFACE_H_ diff --git a/TPMCmd/Platform/src/Cancel.c b/TPMCmd/Platform/src/Cancel.c index 209bef5..4ce0d61 100644 --- a/TPMCmd/Platform/src/Cancel.c +++ b/TPMCmd/Platform/src/Cancel.c @@ -33,4 +33,4 @@ LIB_EXPORT void _plat__ClearCancel(void) { s_isCanceled = FALSE; return; -} \ No newline at end of file +} diff --git a/TPMCmd/Platform/src/DebugHelpers.c b/TPMCmd/Platform/src/DebugHelpers.c index 6e1a034..a1ac330 100644 --- a/TPMCmd/Platform/src/DebugHelpers.c +++ b/TPMCmd/Platform/src/DebugHelpers.c @@ -11,81 +11,6 @@ #include #include "Platform.h" -#if CERTIFYX509_DEBUG - -const char* debugFileName = "DebugFile.txt"; - -//*** fileOpen() -// This exists to allow use of the 'safe' version of fopen() with a MS runtime. -static FILE* fileOpen(const char* fn, const char* mode) -{ - FILE* f; -# if defined _MSC_VER - if(fopen_s(&f, fn, mode) != 0) - f = NULL; -# else - f = fopen(fn, mode); -# endif - return f; -} - -//*** DebugFileInit() -// This function initializes the file containing the debug data with the time of the -// file creation. -// Return Type: int -// 0 success -// != 0 error -int DebugFileInit(void) -{ - FILE* f = NULL; - time_t t = time(NULL); -// -// Get current date and time. -# if defined _MSC_VER - char timeString[100]; - ctime_s(timeString, (size_t)sizeof(timeString), &t); -# else - char* timeString; - timeString = ctime(&t); -# endif - // Try to open the debug file - f = fileOpen(debugFileName, "w"); - if(f) - { - // Initialize the contents with the time. - fprintf(f, "%s\n", timeString); - fclose(f); - return 0; - } - return -1; -} - -//*** DebugDumpBuffer() -void DebugDumpBuffer(int size, unsigned char* buf, const char* identifier) -{ - int i; - // - FILE* f = fileOpen(debugFileName, "a"); - if(!f) - return; - if(identifier) - fprintf(f, "%s\n", identifier); - if(buf) - { - for(i = 0; i < size; i++) - { - if(((i % 16) == 0) && (i)) - fprintf(f, "\n"); - fprintf(f, " %02X", buf[i]); - } - if((size % 16) != 0) - fprintf(f, "\n"); - } - fclose(f); -} - -#endif // CERTIFYX509_DEBUG - #if ENABLE_TPM_DEBUG_PRINT LIB_EXPORT void _plat_debug_print(const char* str) diff --git a/TPMCmd/Platform/src/Entropy.c b/TPMCmd/Platform/src/Entropy.c index 5454940..bf52878 100644 --- a/TPMCmd/Platform/src/Entropy.c +++ b/TPMCmd/Platform/src/Entropy.c @@ -112,4 +112,4 @@ LIB_EXPORT int32_t _plat__GetEntropy(unsigned char* entropy, // output buffer } } return ret; -} \ No newline at end of file +} diff --git a/TPMCmd/Platform/src/LocalityPlat.c b/TPMCmd/Platform/src/LocalityPlat.c index 795ccef..e239ed6 100644 --- a/TPMCmd/Platform/src/LocalityPlat.c +++ b/TPMCmd/Platform/src/LocalityPlat.c @@ -20,4 +20,4 @@ LIB_EXPORT void _plat__LocalitySet(unsigned char locality) locality = 0; s_locality = locality; return; -} \ No newline at end of file +} diff --git a/TPMCmd/Platform/src/NVMem.c b/TPMCmd/Platform/src/NVMem.c index c381ea9..c519cf9 100644 --- a/TPMCmd/Platform/src/NVMem.c +++ b/TPMCmd/Platform/src/NVMem.c @@ -79,7 +79,7 @@ static long NvFileSize(int leaveAt) { case SEEK_SET: filePos = 0; - // [[fallthrough]]; + FALLTHROUGH; case SEEK_CUR: fseek(s_NvFile, filePos, SEEK_SET); break; diff --git a/TPMCmd/Platform/src/PPPlat.c b/TPMCmd/Platform/src/PPPlat.c index a0e13a9..ce8929e 100644 --- a/TPMCmd/Platform/src/PPPlat.c +++ b/TPMCmd/Platform/src/PPPlat.c @@ -33,4 +33,4 @@ LIB_EXPORT void _plat__Signal_PhysicalPresenceOff(void) { s_physicalPresence = FALSE; return; -} \ No newline at end of file +} diff --git a/TPMCmd/Platform/src/PowerPlat.c b/TPMCmd/Platform/src/PowerPlat.c index aaa9175..16664e6 100644 --- a/TPMCmd/Platform/src/PowerPlat.c +++ b/TPMCmd/Platform/src/PowerPlat.c @@ -67,4 +67,4 @@ LIB_EXPORT void _plat__Signal_PowerOff(void) #endif return; -} \ No newline at end of file +} diff --git a/TPMCmd/Platform/src/RunCommand.c b/TPMCmd/Platform/src/RunCommand.c index 8c9c593..d8198e6 100644 --- a/TPMCmd/Platform/src/RunCommand.c +++ b/TPMCmd/Platform/src/RunCommand.c @@ -45,7 +45,7 @@ LIB_EXPORT void _plat__RunCommand( #if ALLOW_FORCE_FAILURE_MODE if(_plat_internal_IsForceFailureMode()) { - _plat__Fail(__FUNCTION__, __LINE__, 0xFFFFFFFFFFFFFFFF, FATAL_ERROR_FORCED); + _plat__Fail(__func__, __LINE__, 0xFFFFFFFFFFFFFFFF, FATAL_ERROR_FORCED); } #endif diff --git a/TPMCmd/Platform/src/Unique.c b/TPMCmd/Platform/src/Unique.c index 000be3b..5efdcdc 100644 --- a/TPMCmd/Platform/src/Unique.c +++ b/TPMCmd/Platform/src/Unique.c @@ -45,4 +45,4 @@ LIB_EXPORT uint32_t _plat__GetUnique(uint32_t which, // which vendor value to r return retVal; } -#endif \ No newline at end of file +#endif diff --git a/TPMCmd/Simulator/src/TPMCmdp.c b/TPMCmd/Simulator/src/TPMCmdp.c index 11fe09f..c06f97c 100644 --- a/TPMCmd/Simulator/src/TPMCmdp.c +++ b/TPMCmd/Simulator/src/TPMCmdp.c @@ -240,4 +240,4 @@ void _rpc__SetTpmFirmwareSvn(uint16_t svn) #if SIMULATION _plat__SetTpmFirmwareSvn(svn); #endif -} \ No newline at end of file +} diff --git a/TPMCmd/TpmConfiguration/TpmConfiguration/TpmBuildSwitches.h b/TPMCmd/TpmConfiguration/TpmConfiguration/TpmBuildSwitches.h index b0d4811..0bba6bc 100644 --- a/TPMCmd/TpmConfiguration/TpmConfiguration/TpmBuildSwitches.h +++ b/TPMCmd/TpmConfiguration/TpmConfiguration/TpmBuildSwitches.h @@ -71,9 +71,6 @@ // has been added someplace (preferably, somewhere in CryptRand.c) #define DRBG_DEBUG_PRINT (NO * DEBUG) -// This define is used to control the debug for the CertifyX509 command. -#define CERTIFYX509_DEBUG (NO * DEBUG) - // This provides fixed seeding of the RNG when doing debug on a simulator. This // should allow consistent results on test runs as long as the input parameters // to the functions remains the same. diff --git a/TPMCmd/TpmConfiguration/TpmConfiguration/TpmProfile_CommandList.h b/TPMCmd/TpmConfiguration/TpmConfiguration/TpmProfile_CommandList.h index 854e875..daf0d72 100644 --- a/TPMCmd/TpmConfiguration/TpmConfiguration/TpmProfile_CommandList.h +++ b/TPMCmd/TpmConfiguration/TpmConfiguration/TpmProfile_CommandList.h @@ -35,12 +35,6 @@ #define CC_FieldUpgradeStart CC_NO #define CC_FirmwareRead CC_NO -// A prototype of CertifyX509 is provided here for informative purposes only. -// While all of the TPM reference implementation is provided "AS IS" without any -// warranty, the current design and implementation of CertifyX509 are considered -// to be especially unsuitable for product use. -#define CC_CertifyX509 CC_NO - // Normal commands: #define CC_ACT_SetTimeout (CC_YES && ACT_SUPPORT) diff --git a/TPMCmd/TpmConfiguration/TpmConfiguration/TpmProfile_Common.h b/TPMCmd/TpmConfiguration/TpmConfiguration/TpmProfile_Common.h index 793a454..052c6a7 100644 --- a/TPMCmd/TpmConfiguration/TpmConfiguration/TpmProfile_Common.h +++ b/TPMCmd/TpmConfiguration/TpmConfiguration/TpmProfile_Common.h @@ -165,7 +165,7 @@ #define RH_ACT_7 ( NO * ACT_SUPPORT) #define RH_ACT_8 ( NO * ACT_SUPPORT) #define RH_ACT_9 ( NO * ACT_SUPPORT) -#define RH_ACT_A (YES * ACT_SUPPORT) +#define RH_ACT_A ( NO * ACT_SUPPORT) #define RH_ACT_B ( NO * ACT_SUPPORT) #define RH_ACT_C ( NO * ACT_SUPPORT) #define RH_ACT_D ( NO * ACT_SUPPORT) diff --git a/TPMCmd/TpmConfiguration/TpmConfiguration/TpmProfile_Misc.h b/TPMCmd/TpmConfiguration/TpmConfiguration/TpmProfile_Misc.h index d4178ae..1b3884c 100644 --- a/TPMCmd/TpmConfiguration/TpmConfiguration/TpmProfile_Misc.h +++ b/TPMCmd/TpmConfiguration/TpmConfiguration/TpmProfile_Misc.h @@ -44,8 +44,6 @@ #define RAM_INDEX_SPACE 512 #define ENABLE_PCR_NO_INCREMENT YES -#define SIZE_OF_X509_SERIAL_NUMBER 20 - // amount of space the platform can provide in PERSISTENT_DATA during // manufacture #define PERSISTENT_DATA_PLATFORM_SPACE 16 diff --git a/TPMCmd/TpmConfiguration/TpmConfiguration/VendorCommands/VendorCommandList.h b/TPMCmd/TpmConfiguration/TpmConfiguration/VendorCommands/VendorCommandList.h index def152e..79ed7d3 100644 --- a/TPMCmd/TpmConfiguration/TpmConfiguration/VendorCommands/VendorCommandList.h +++ b/TPMCmd/TpmConfiguration/TpmConfiguration/VendorCommands/VendorCommandList.h @@ -17,4 +17,4 @@ #else // nothing #endif -// and command attributes must be defined in TpmProfile_CommandList_AttributeData.inl \ No newline at end of file +// and command attributes must be defined in TpmProfile_CommandList_AttributeData.inl diff --git a/TPMCmd/TpmConfiguration/TpmVendorCommandHandlers/Vendor_TCG_Test.c b/TPMCmd/TpmConfiguration/TpmVendorCommandHandlers/Vendor_TCG_Test.c index 5019a34..a637fd4 100644 --- a/TPMCmd/TpmConfiguration/TpmVendorCommandHandlers/Vendor_TCG_Test.c +++ b/TPMCmd/TpmConfiguration/TpmVendorCommandHandlers/Vendor_TCG_Test.c @@ -14,4 +14,4 @@ TPM2_Vendor_TCG_Test(Vendor_TCG_Test_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_Vendor_TCG_Test \ No newline at end of file +#endif // CC_Vendor_TCG_Test diff --git a/TPMCmd/tpm/cryptolibs/Ossl/include/Ossl/BnToOsslMath.h b/TPMCmd/tpm/cryptolibs/Ossl/include/Ossl/BnToOsslMath.h index 54ed66e..ac157b2 100644 --- a/TPMCmd/tpm/cryptolibs/Ossl/include/Ossl/BnToOsslMath.h +++ b/TPMCmd/tpm/cryptolibs/Ossl/include/Ossl/BnToOsslMath.h @@ -17,7 +17,7 @@ #include #include -#if OPENSSL_VERSION_NUMBER >= 0x30600000L +#if OPENSSL_VERSION_NUMBER >= 0x30700000L // Check the bignum_st definition against the one below and either update the // version check or provide the new definition for this version. # error Untested OpenSSL version diff --git a/TPMCmd/tpm/cryptolibs/TpmBigNum/BnConvert.c b/TPMCmd/tpm/cryptolibs/TpmBigNum/BnConvert.c index 1451dfa..550d2d0 100644 --- a/TPMCmd/tpm/cryptolibs/TpmBigNum/BnConvert.c +++ b/TPMCmd/tpm/cryptolibs/TpmBigNum/BnConvert.c @@ -202,4 +202,4 @@ LIB_EXPORT BOOL BnPointToBytes( return result; } -#endif // ALG_ECC \ No newline at end of file +#endif // ALG_ECC diff --git a/TPMCmd/tpm/cryptolibs/TpmBigNum/BnMemory.c b/TPMCmd/tpm/cryptolibs/TpmBigNum/BnMemory.c index 25a849e..17652f8 100644 --- a/TPMCmd/tpm/cryptolibs/TpmBigNum/BnMemory.c +++ b/TPMCmd/tpm/cryptolibs/TpmBigNum/BnMemory.c @@ -129,4 +129,4 @@ LIB_EXPORT bn_point_t* BnInitializePoint( return p; } -#endif // ALG_ECC \ No newline at end of file +#endif // ALG_ECC diff --git a/TPMCmd/tpm/cryptolibs/TpmBigNum/TpmBigNum.h b/TPMCmd/tpm/cryptolibs/TpmBigNum/TpmBigNum.h index 454ad0a..f50ae74 100644 --- a/TPMCmd/tpm/cryptolibs/TpmBigNum/TpmBigNum.h +++ b/TPMCmd/tpm/cryptolibs/TpmBigNum/TpmBigNum.h @@ -14,4 +14,4 @@ #include "BnMemory_fp.h" #include "BnMath_fp.h" #include "BnUtil_fp.h" -#include \ No newline at end of file +#include diff --git a/TPMCmd/tpm/cryptolibs/TpmBigNum/include/BnValues.h b/TPMCmd/tpm/cryptolibs/TpmBigNum/include/BnValues.h index f3da08e..ddbfb82 100644 --- a/TPMCmd/tpm/cryptolibs/TpmBigNum/include/BnValues.h +++ b/TPMCmd/tpm/cryptolibs/TpmBigNum/include/BnValues.h @@ -315,4 +315,4 @@ TPM_INLINE TPM_ECC_CURVE BnCurveGetCurveId(const TPMBN_ECC_CURVE_CONSTANTS* C) #endif -#endif // _BN_NUMBERS_H \ No newline at end of file +#endif // _BN_NUMBERS_H diff --git a/TPMCmd/tpm/include/platform_interface/prototypes/platform_failure_mode_fp.h b/TPMCmd/tpm/include/platform_interface/prototypes/platform_failure_mode_fp.h index 5cb1b19..5e65594 100644 --- a/TPMCmd/tpm/include/platform_interface/prototypes/platform_failure_mode_fp.h +++ b/TPMCmd/tpm/include/platform_interface/prototypes/platform_failure_mode_fp.h @@ -43,4 +43,4 @@ LIB_EXPORT const char* _plat__GetFailureFunctionName(void); LIB_EXPORT uint32_t _plat__GetFailureLine(void); #endif -#endif // _PLATFORM_FAILURE_MODE_FP_H_ \ No newline at end of file +#endif // _PLATFORM_FAILURE_MODE_FP_H_ diff --git a/TPMCmd/tpm/include/platform_interface/prototypes/platform_init_fp.h b/TPMCmd/tpm/include/platform_interface/prototypes/platform_init_fp.h index 59f7507..ce8ce9c 100644 --- a/TPMCmd/tpm/include/platform_interface/prototypes/platform_init_fp.h +++ b/TPMCmd/tpm/include/platform_interface/prototypes/platform_init_fp.h @@ -15,4 +15,4 @@ LIB_EXPORT void _plat__StartTpmInit(void); // this will not be called LIB_EXPORT void _plat__EndOkTpmInit(void); -#endif // _PLATFORM_INIT_FP_H_ \ No newline at end of file +#endif // _PLATFORM_INIT_FP_H_ diff --git a/TPMCmd/tpm/include/platform_interface/tpm_to_platform_interface.h b/TPMCmd/tpm/include/platform_interface/tpm_to_platform_interface.h index dd1b5d6..d80a759 100644 --- a/TPMCmd/tpm/include/platform_interface/tpm_to_platform_interface.h +++ b/TPMCmd/tpm/include/platform_interface/tpm_to_platform_interface.h @@ -79,19 +79,6 @@ LIB_EXPORT void _plat__ClockRateAdjust(_plat__ClockAdjustStep adjustment); //** From DebugHelpers.c -#if CERTIFYX509_DEBUG - -//*** DebugFileInit() -// This function opens the file used to hold the debug data. -// Return Type: int -// 0 success -// != 0 error -int DebugFileInit(void); - -//*** DebugDumpBuffer() -void DebugDumpBuffer(int size, unsigned char* buf, const char* identifier); -#endif // CERTIFYX509_DEBUG - //** From Entropy.c //*** _plat__GetEntropy() @@ -216,7 +203,7 @@ LIB_EXPORT int _plat__NvCommit(void); //***_plat__TearDown // notify platform that TPM_TearDown was called so platform can cleanup or // zeroize anything in the Platform. This should zeroize NV as well. -LIB_EXPORT void _plat__TearDown(); +LIB_EXPORT void _plat__TearDown(void); //** From PlatformACT.c diff --git a/TPMCmd/tpm/include/private/CommandAttributeData.h b/TPMCmd/tpm/include/private/CommandAttributeData.h index db8a4b1..d700a92 100644 --- a/TPMCmd/tpm/include/private/CommandAttributeData.h +++ b/TPMCmd/tpm/include/private/CommandAttributeData.h @@ -356,9 +356,6 @@ const TPMA_CC s_ccAttr [] = { #if CC_Policy_AC_SendSelect TPMA_CC_INITIALIZER(0x0196, 0, 0, 0, 0, 1, 0, 0, 0), #endif -#if CC_CertifyX509 - TPMA_CC_INITIALIZER(0x0197, 0, 0, 0, 0, 2, 0, 0, 0), -#endif #if CC_ACT_SetTimeout TPMA_CC_INITIALIZER(0x0198, 0, 0, 0, 0, 1, 0, 0, 0), #endif @@ -860,10 +857,6 @@ const COMMAND_ATTRIBUTES s_commandAttributes [] = { (COMMAND_ATTRIBUTES)(CC_Policy_AC_SendSelect * // 0x0196 (DECRYPT_2+ALLOW_TRIAL)), #endif -#if CC_CertifyX509 - (COMMAND_ATTRIBUTES)(CC_CertifyX509 * // 0x0197 - (DECRYPT_2+HANDLE_1_ADMIN+HANDLE_2_USER+ENCRYPT_2)), -#endif #if CC_ACT_SetTimeout (COMMAND_ATTRIBUTES)(CC_ACT_SetTimeout * // 0x0198 (HANDLE_1_USER)), diff --git a/TPMCmd/tpm/include/private/CommandDispatchData.h b/TPMCmd/tpm/include/private/CommandDispatchData.h index 81a3605..0765c52 100644 --- a/TPMCmd/tpm/include/private/CommandDispatchData.h +++ b/TPMCmd/tpm/include/private/CommandDispatchData.h @@ -2164,53 +2164,6 @@ GetTime_COMMAND_DESCRIPTOR_t _GetTimeData = { #define _GetTimeDataAddress 0 #endif // CC_GetTime -#if CC_CertifyX509 -#include "CertifyX509_fp.h" - -typedef TPM_RC (CertifyX509_Entry)( - CertifyX509_In* in, - CertifyX509_Out* out -); - - -typedef const struct -{ - CertifyX509_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[6]; - BYTE types[10]; -} CertifyX509_COMMAND_DESCRIPTOR_t; - -CertifyX509_COMMAND_DESCRIPTOR_t _CertifyX509Data = { - /* entry */ &TPM2_CertifyX509, - /* inSize */ (UINT16)(sizeof(CertifyX509_In)), - /* outSize */ (UINT16)(sizeof(CertifyX509_Out)), - /* offsetOfTypes */ offsetof(CertifyX509_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(CertifyX509_In, signHandle)), - (UINT16)(offsetof(CertifyX509_In, reserved)), - (UINT16)(offsetof(CertifyX509_In, inScheme)), - (UINT16)(offsetof(CertifyX509_In, partialCertificate)), - (UINT16)(offsetof(CertifyX509_Out, tbsDigest)), - (UINT16)(offsetof(CertifyX509_Out, signature))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPM2B_DATA_P_UNMARSHAL, - TPMT_SIG_SCHEME_P_UNMARSHAL + ADD_FLAG, - TPM2B_MAX_BUFFER_P_UNMARSHAL, - END_OF_LIST, - TPM2B_MAX_BUFFER_P_MARSHAL, - TPM2B_DIGEST_P_MARSHAL, - TPMT_SIGNATURE_P_MARSHAL, - END_OF_LIST} -}; - -#define _CertifyX509DataAddress (&_CertifyX509Data) -#else -#define _CertifyX509DataAddress 0 -#endif // CC_CertifyX509 - #if CC_Commit #include "Commit_fp.h" @@ -5551,9 +5504,6 @@ COMMAND_DESCRIPTOR_t* s_CommandDataArray[] = { #if CC_Policy_AC_SendSelect (COMMAND_DESCRIPTOR_t*)_Policy_AC_SendSelectDataAddress, #endif // CC_Policy_AC_SendSelect -#if CC_CertifyX509 - (COMMAND_DESCRIPTOR_t*)_CertifyX509DataAddress, -#endif // CC_CertifyX509 #if CC_ACT_SetTimeout (COMMAND_DESCRIPTOR_t*)_ACT_SetTimeoutDataAddress, #endif // CC_ACT_SetTimeout diff --git a/TPMCmd/tpm/include/private/CryptSym.h b/TPMCmd/tpm/include/private/CryptSym.h index bd78ae2..8f4f75c 100644 --- a/TPMCmd/tpm/include/private/CryptSym.h +++ b/TPMCmd/tpm/include/private/CryptSym.h @@ -72,4 +72,4 @@ typedef union tpmCryptKeySchedule_t decrypt = (TpmCryptSetSymKeyCall_t)TpmCryptDecrypt##ALG; \ break; -#endif // CRYPT_SYM_H \ No newline at end of file +#endif // CRYPT_SYM_H diff --git a/TPMCmd/tpm/include/private/NV.h b/TPMCmd/tpm/include/private/NV.h index 3b71f07..ca86b1f 100644 --- a/TPMCmd/tpm/include/private/NV.h +++ b/TPMCmd/tpm/include/private/NV.h @@ -113,4 +113,4 @@ typedef UINT32 NV_LIST_TERMINATOR[3]; // possibly a combination of UT_NV and UT_ORDERLY. #define SET_NV_UPDATE(type) g_updateNV |= (type) -#endif // _NV_H_ \ No newline at end of file +#endif // _NV_H_ diff --git a/TPMCmd/tpm/include/private/OIDs.h b/TPMCmd/tpm/include/private/OIDs.h index 072de17..e20fcf8 100644 --- a/TPMCmd/tpm/include/private/OIDs.h +++ b/TPMCmd/tpm/include/private/OIDs.h @@ -1,4 +1,3 @@ - #ifndef _OIDS_H_ #define _OIDS_H_ @@ -7,223 +6,198 @@ // OID size to be determined by looking at octet[1] of the OID (total size is // OID[1] + 2). -// These macros allow OIDs to be defined (or not) depending on whether the associated -// hash algorithm is implemented. -// NOTE: When one of these macros is used, the NAME needs '_" on each side. The -// exception is when the macro is used for the hash OID when only a single '_' is -// used. -#ifndef ALG_SHA1 -# define ALG_SHA1 NO -#endif -#if ALG_SHA1 -# define SHA1_OID(NAME) MAKE_OID(NAME##SHA1) -#else -# define SHA1_OID(NAME) -#endif -#ifndef ALG_SHA256 -# define ALG_SHA256 NO -#endif -#if ALG_SHA256 -# define SHA256_OID(NAME) MAKE_OID(NAME##SHA256) -#else -# define SHA256_OID(NAME) -#endif -#ifndef ALG_SHA384 -# define ALG_SHA384 NO -#endif -#if ALG_SHA384 -# define SHA384_OID(NAME) MAKE_OID(NAME##SHA384) -#else -# define SHA384_OID(NAME) -#endif -#ifndef ALG_SHA512 -# define ALG_SHA512 NO -#endif -#if ALG_SHA512 -# define SHA512_OID(NAME) MAKE_OID(NAME##SHA512) -#else -# define SHA512_OID(NAME) -#endif -#ifndef ALG_SM3_256 -# define ALG_SM3_256 NO -#endif -#if ALG_SM3_256 -# define SM3_256_OID(NAME) MAKE_OID(NAME##SM3_256) -#else -# define SM3_256_OID(NAME) -#endif -#ifndef ALG_SHA3_256 -# define ALG_SHA3_256 NO -#endif -#if ALG_SHA3_256 -# define SHA3_256_OID(NAME) MAKE_OID(NAME##SHA3_256) -#else -# define SHA3_256_OID(NAME) -#endif -#ifndef ALG_SHA3_384 -# define ALG_SHA3_384 NO -#endif -#if ALG_SHA3_384 -# define SHA3_384_OID(NAME) MAKE_OID(NAME##SHA3_384) -#else -# define SHA3_384_OID(NAME) -#endif -#ifndef ALG_SHA3_512 -# define ALG_SHA3_512 NO -#endif -#if ALG_SHA3_512 -# define SHA3_512_OID(NAME) MAKE_OID(NAME##SHA3_512) -#else -# define SHA3_512_OID(NAME) -#endif +#define ANSI_X962 0x2A, 0x86, 0x48, 0xCE, 0x3D // 1.2.840.10045 -// These are encoded to take one additional byte of algorithm selector -#define NIST_HASH 0x06, 0x09, 0x60, 0x86, 0x48, 1, 101, 3, 4, 2 -#define NIST_SIG 0x06, 0x09, 0x60, 0x86, 0x48, 1, 101, 3, 4, 3 +// Encoded to take two additional bytes +#define SM_SCHEME 0x06, 0x08, 0x2A, 0x81, 0x1C, 0xCF, 0x55, 1 // 1.2.156.10197.1 +#define NIST_ALG 0x06, 0x09, 0x60, 0x86, 0x48, 1, 101, 3, 4 // 2.16.840.1.101.3.4 +// Encoded to take one additional byte +#define NIST_HASH NIST_ALG, 2 // 2.16.840.1.101.3.4.2 +#define NIST_SIG NIST_ALG, 3 // 2.16.840.1.101.3.4.3 +#define ECDSA_SHA2 0x06, 0x08, ANSI_X962, 4, 3 // 1.2.840.10045.4.3 +#define PRIME_CURVES 0x06, 0x08, ANSI_X962, 3, 1 // 1.2.840.10045.3.1 +#define CERTICOM_CURVES 0x06, 0x05, 0x2B, 0x81, 0x04, 0 // 1.3.132.0 +#define PKCS1_ALG \ + 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 1, 1 // 1.2.840.113549.1.1 // These hash OIDs used in a lot of places. -#define OID_SHA1_VALUE 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A -SHA1_OID(_); // Expands to: - // MAKE_OID(_SHA1) - // which expands to: - // EXTERN const BYTE OID_SHA1[] INITIALIZER({OID_SHA1_VALUE}) - // which, depending on the setting of EXTERN and - // INITIALIZER, expands to either: - // extern const BYTE OID_SHA1[] - // or - // const BYTE OID_SHA1[] = {OID_SHA1_VALUE} - // which is: - // const BYTE OID_SHA1[] = {0x06, 0x05, 0x2B, 0x0E, - // 0x03, 0x02, 0x1A} - -#define OID_SHA256_VALUE NIST_HASH, 1 -SHA256_OID(_); +#define OID_SHA1_VALUE 0x06, 0x05, 0x2B, 14, 3, 2, 26 // 1.3.14.3.2.26 +#if ALG_SHA1 +MAKE_OID(_SHA1); +// Expands to: +// EXTERN const BYTE OID_SHA1[] INITIALIZER({OID_SHA1_VALUE}) +// which, depending on the setting of EXTERN and INITIALIZER, expands to either: +// extern const BYTE OID_SHA1[] +// or +// const BYTE OID_SHA1[] = {OID_SHA1_VALUE} +// which is: +// const BYTE OID_SHA1[] = {0x06, 0x05, 0x2B, 0x0E, ...} +#endif // ALG_SHA1 + +#define OID_SHA256_VALUE NIST_HASH, 1 // 2.16.840.1.101.3.4.2.1 +#if ALG_SHA256 +MAKE_OID(_SHA256); +#endif // ALG_SHA256 -#define OID_SHA384_VALUE NIST_HASH, 2 -SHA384_OID(_); +#define OID_SHA384_VALUE NIST_HASH, 2 // 2.16.840.1.101.3.4.2.2 +#if ALG_SHA384 +MAKE_OID(_SHA384); +#endif // ALG_SHA384 -#define OID_SHA512_VALUE NIST_HASH, 3 -SHA512_OID(_); +#define OID_SHA512_VALUE NIST_HASH, 3 // 2.16.840.1.101.3.4.2.3 +#if ALG_SHA512 +MAKE_OID(_SHA512); +#endif // ALG_SHA512 -#define OID_SM3_256_VALUE 0x06, 0x08, 0x2A, 0x81, 0x1C, 0xCF, 0x55, 0x01, 0x83, 0x11 -SM3_256_OID(_); // (1.2.156.10197.1.401) +#define OID_SM3_256_VALUE SM_SCHEME, 0x83, 0x11 // 1.2.156.10197.1.401 +#if ALG_SM3_256 +MAKE_OID(_SM3_256); +#endif // ALG_SM3_256 -#define OID_SHA3_256_VALUE NIST_HASH, 8 -SHA3_256_OID(_); +#define OID_SHA3_256_VALUE NIST_HASH, 8 // 2.16.840.1.101.3.4.2.8 +#if ALG_SHA3_256 +MAKE_OID(_SHA3_256); +#endif // ALG_SHA3_256 -#define OID_SHA3_384_VALUE NIST_HASH, 9 -SHA3_384_OID(_); +#define OID_SHA3_384_VALUE NIST_HASH, 9 // 2.16.840.1.101.3.4.2.9 +#if ALG_SHA3_384 +MAKE_OID(_SHA3_384); +#endif // ALG_SHA3_384 -#define OID_SHA3_512_VALUE NIST_HASH, 10 -SHA3_512_OID(_); +#define OID_SHA3_512_VALUE NIST_HASH, 10 // 2.16.840.1.101.3.4.2.10 +#if ALG_SHA3_512 +MAKE_OID(_SHA3_512); +#endif // ALG_SHA3_512 // These are used for RSA-PSS #if ALG_RSA -# define OID_MGF1_VALUE \ - 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x08 +# define OID_MGF1_VALUE PKCS1_ALG, 8 // 1.2.840.113549.1.1.8 MAKE_OID(_MGF1); -# define OID_RSAPSS_VALUE \ - 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0A +# define OID_RSAPSS_VALUE PKCS1_ALG, 10 // 1.2.840.113549.1.1.10 MAKE_OID(_RSAPSS); // This is the OID to designate the public part of an RSA key. -# define OID_PKCS1_PUB_VALUE \ - 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01 +# define OID_PKCS1_PUB_VALUE PKCS1_ALG, 1 // 1.2.840.113549.1.1.1 MAKE_OID(_PKCS1_PUB); // These are used for RSA PKCS1 signature Algorithms -# define OID_PKCS1_SHA1_VALUE \ - 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05 -SHA1_OID(_PKCS1_); // (1.2.840.113549.1.1.5) - -# define OID_PKCS1_SHA256_VALUE \ - 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B -SHA256_OID(_PKCS1_); // (1.2.840.113549.1.1.11) - -# define OID_PKCS1_SHA384_VALUE \ - 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0C -SHA384_OID(_PKCS1_); // (1.2.840.113549.1.1.12) - -# define OID_PKCS1_SHA512_VALUE \ - 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0D -SHA512_OID(_PKCS1_); //(1.2.840.113549.1.1.13) - -# define OID_PKCS1_SM3_256_VALUE \ - 0x06, 0x08, 0x2A, 0x81, 0x1C, 0xCF, 0x55, 0x01, 0x83, 0x78 -SM3_256_OID(_PKCS1_); // 1.2.156.10197.1.504 - -# define OID_PKCS1_SHA3_256_VALUE NIST_SIG, 14 -SHA3_256_OID(_PKCS1_); -# define OID_PKCS1_SHA3_384_VALUE NIST_SIG, 15 -SHA3_384_OID(_PKCS1_); -# define OID_PKCS1_SHA3_512_VALUE NIST_SIG, 16 -SHA3_512_OID(_PKCS1_); +# define OID_PKCS1_SHA1_VALUE PKCS1_ALG, 5 // 1.2.840.113549.1.1.5 +# if ALG_SHA1 +MAKE_OID(_PKCS1_SHA1); +# endif // ALG_SHA1 + +# define OID_PKCS1_SHA256_VALUE PKCS1_ALG, 11 // 1.2.840.113549.1.1.11 +# if ALG_SHA256 +MAKE_OID(_PKCS1_SHA256); +# endif // ALG_SHA256 + +# define OID_PKCS1_SHA384_VALUE PKCS1_ALG, 12 // 1.2.840.113549.1.1.12 +# if ALG_SHA384 +MAKE_OID(_PKCS1_SHA384); +# endif // ALG_SHA384 + +# define OID_PKCS1_SHA512_VALUE PKCS1_ALG, 13 // 1.2.840.113549.1.1.13 +# if ALG_SHA512 +MAKE_OID(_PKCS1_SHA512); +# endif // ALG_SHA512 + +# define OID_PKCS1_SM3_256_VALUE SM_SCHEME, 0x83, 0x78 // 1.2.156.10197.1.504 +# if ALG_SM3_256 +MAKE_OID(_PKCS1_SM3_256); +# endif // ALG_SM3_256 + +# define OID_PKCS1_SHA3_256_VALUE NIST_SIG, 14 // 2.16.840.1.101.3.4.3.14 +# if ALG_SHA3_256 +MAKE_OID(_PKCS1_SHA3_256); +# endif // ALG_SHA3_256 + +# define OID_PKCS1_SHA3_384_VALUE NIST_SIG, 15 // 2.16.840.1.101.3.4.3.15 +# if ALG_SHA3_384 +MAKE_OID(_PKCS1_SHA3_384); +# endif // ALG_SHA3_384 + +# define OID_PKCS1_SHA3_512_VALUE NIST_SIG, 16 // 2.16.840.1.101.3.4.3.16 +# if ALG_SHA3_512 +MAKE_OID(_PKCS1_SHA3_512); +# endif // ALG_SHA3_512 #endif // ALG_RSA #if ALG_ECDSA -# define OID_ECDSA_SHA1_VALUE 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x01 -SHA1_OID(_ECDSA_); // (1.2.840.10045.4.1) SHA1 digest signed by an ECDSA key. - -# define OID_ECDSA_SHA256_VALUE \ - 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02 -SHA256_OID(_ECDSA_); // (1.2.840.10045.4.3.2) SHA256 digest signed by an ECDSA key. - -# define OID_ECDSA_SHA384_VALUE \ - 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x03 -SHA384_OID(_ECDSA_); // (1.2.840.10045.4.3.3) SHA384 digest signed by an ECDSA key. - -# define OID_ECDSA_SHA512_VALUE \ - 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x04 -SHA512_OID(_ECDSA_); // (1.2.840.10045.4.3.4) SHA512 digest signed by an ECDSA key. - -# define OID_ECDSA_SM3_256_VALUE \ - 0x06, 0x08, 0x2A, 0x81, 0x1C, 0xCF, 0x55, 0x01, 0x83, 0x75 -SM3_256_OID(_ECDSA_); // 1.2.156.10197.1.501 - -# define OID_ECDSA_SHA3_256_VALUE NIST_SIG, 10 -SHA3_256_OID(_ECDSA_); -# define OID_ECDSA_SHA3_384_VALUE NIST_SIG, 11 -SHA3_384_OID(_ECDSA_); -# define OID_ECDSA_SHA3_512_VALUE NIST_SIG, 12 -SHA3_512_OID(_ECDSA_); +# define OID_ECDSA_SHA1_VALUE 0x06, 0x07, ANSI_X962, 4, 1 // 1.2.840.10045.4.1 +# if ALG_SHA1 +MAKE_OID(_ECDSA_SHA1); +# endif // ALG_SHA1 + +# define OID_ECDSA_SHA256_VALUE ECDSA_SHA2, 2 // 1.2.840.10045.4.3.2 +# if ALG_SHA256 +MAKE_OID(_ECDSA_SHA256); +# endif // ALG_SHA256 + +# define OID_ECDSA_SHA384_VALUE ECDSA_SHA2, 3 // 1.2.840.10045.4.3.3 +# if ALG_SHA384 +MAKE_OID(_ECDSA_SHA384); +# endif // ALG_SHA384 + +# define OID_ECDSA_SHA512_VALUE ECDSA_SHA2, 4 // 1.2.840.10045.4.3.4 +# if ALG_SHA512 +MAKE_OID(_ECDSA_SHA512); +# endif // ALG_SHA512 + +# define OID_ECDSA_SM3_256_VALUE SM_SCHEME, 0x83, 0x75 // 1.2.156.10197.1.501 +# if ALG_SM3_256 +MAKE_OID(_ECDSA_SM3_256); +# endif // ALG_SM3_256 + +# define OID_ECDSA_SHA3_256_VALUE NIST_SIG, 10 // 2.16.840.1.101.3.4.3.10 +# if ALG_SHA3_256 +MAKE_OID(_ECDSA_SHA3_256); +# endif // ALG_SHA3_256 + +# define OID_ECDSA_SHA3_384_VALUE NIST_SIG, 11 // 2.16.840.1.101.3.4.3.11 +# if ALG_SHA3_384 +MAKE_OID(_ECDSA_SHA3_384); +# endif // ALG_SHA3_384 + +# define OID_ECDSA_SHA3_512_VALUE NIST_SIG, 12 // 2.16.840.1.101.3.4.3.12 +# if ALG_SHA3_512 +MAKE_OID(_ECDSA_SHA3_512); +# endif // ALG_SHA3_512 #endif // ALG_ECDSA #if ALG_ECC -# define OID_ECC_PUBLIC_VALUE 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01 +# define OID_ECC_PUBLIC_VALUE 0x06, 0x07, ANSI_X962, 2, 1 // 1.2.840.10045.2.1 MAKE_OID(_ECC_PUBLIC); -# define OID_ECC_NIST_P192_VALUE \ - 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x01 +# define OID_ECC_NIST_P192_VALUE PRIME_CURVES, 1 // 1.2.840.10045.3.1.1 # if ECC_NIST_P192 -MAKE_OID(_ECC_NIST_P192); // (1.2.840.10045.3.1.1) 'nistP192' -# endif // ECC_NIST_P192 +MAKE_OID(_ECC_NIST_P192); +# endif // ECC_NIST_P192 -# define OID_ECC_NIST_P224_VALUE 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x21 +# define OID_ECC_NIST_P224_VALUE CERTICOM_CURVES, 33 // 1.3.132.0.33 # if ECC_NIST_P224 -MAKE_OID(_ECC_NIST_P224); // (1.3.132.0.33) 'nistP224' -# endif // ECC_NIST_P224 +MAKE_OID(_ECC_NIST_P224); +# endif // ECC_NIST_P224 -# define OID_ECC_NIST_P256_VALUE \ - 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07 +# define OID_ECC_NIST_P256_VALUE PRIME_CURVES, 7 // 1.2.840.10045.3.1.7 # if ECC_NIST_P256 -MAKE_OID(_ECC_NIST_P256); // (1.2.840.10045.3.1.7) 'nistP256' -# endif // ECC_NIST_P256 +MAKE_OID(_ECC_NIST_P256); +# endif // ECC_NIST_P256 -# define OID_ECC_NIST_P384_VALUE 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x22 +# define OID_ECC_NIST_P384_VALUE CERTICOM_CURVES, 34 // 1.3.132.0.34 # if ECC_NIST_P384 -MAKE_OID(_ECC_NIST_P384); // (1.3.132.0.34) 'nistP384' -# endif // ECC_NIST_P384 +MAKE_OID(_ECC_NIST_P384); +# endif // ECC_NIST_P384 -# define OID_ECC_NIST_P521_VALUE 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x23 +# define OID_ECC_NIST_P521_VALUE CERTICOM_CURVES, 35 // 1.3.132.0.35 # if ECC_NIST_P521 -MAKE_OID(_ECC_NIST_P521); // (1.3.132.0.35) 'nistP521' -# endif // ECC_NIST_P521 +MAKE_OID(_ECC_NIST_P521); +# endif // ECC_NIST_P521 // No OIDs defined for these anonymous curves # define OID_ECC_BN_P256_VALUE 0x00 @@ -236,11 +210,10 @@ MAKE_OID(_ECC_BN_P256); MAKE_OID(_ECC_BN_P638); # endif // ECC_BN_P638 -# define OID_ECC_SM2_P256_VALUE \ - 0x06, 0x08, 0x2A, 0x81, 0x1C, 0xCF, 0x55, 0x01, 0x82, 0x2D +# define OID_ECC_SM2_P256_VALUE SM_SCHEME, 0x82, 0x2D // 1.2.156.10197.1.301 # if ECC_SM2_P256 -MAKE_OID(_ECC_SM2_P256); // Don't know where I found this OID. It needs checking -# endif // ECC_SM2_P256 +MAKE_OID(_ECC_SM2_P256); +# endif // ECC_SM2_P256 # if ECC_BN_P256 # define OID_ECC_BN_P256 NULL diff --git a/TPMCmd/tpm/include/private/PRNG_TestVectors.h b/TPMCmd/tpm/include/private/PRNG_TestVectors.h index 88730ed..726be3b 100644 --- a/TPMCmd/tpm/include/private/PRNG_TestVectors.h +++ b/TPMCmd/tpm/include/private/PRNG_TestVectors.h @@ -94,4 +94,4 @@ ReturnedBits = b61850decfd7106d44769a8e6e8c1ad4 #endif -#endif // _MSBN_DRBG_TEST_VECTORS_H \ No newline at end of file +#endif // _MSBN_DRBG_TEST_VECTORS_H diff --git a/TPMCmd/tpm/include/private/SelfTest.h b/TPMCmd/tpm/include/private/SelfTest.h index 9ba5427..1ca6579 100644 --- a/TPMCmd/tpm/include/private/SelfTest.h +++ b/TPMCmd/tpm/include/private/SelfTest.h @@ -67,4 +67,4 @@ typedef struct SYMMETRIC_TEST_VECTOR # define DEFAULT_TEST_HASH_BLOCK_SIZE SHA1_BLOCK_SIZE #endif -#endif // _SELF_TEST_H_ \ No newline at end of file +#endif // _SELF_TEST_H_ diff --git a/TPMCmd/tpm/include/private/TpmASN1.h b/TPMCmd/tpm/include/private/TpmASN1.h deleted file mode 100644 index 0818ca0..0000000 --- a/TPMCmd/tpm/include/private/TpmASN1.h +++ /dev/null @@ -1,96 +0,0 @@ -//** Introduction -// This file contains the macro and structure definitions for the X509 commands and -// functions. - -#ifndef _TPMASN1_H_ -#define _TPMASN1_H_ - -//** Includes - -#include "Tpm.h" -#include "OIDs.h" - -//** Defined Constants -//*** ASN.1 Universal Types (Class 00b) -#define ASN1_EOC 0x00 -#define ASN1_BOOLEAN 0x01 -#define ASN1_INTEGER 0x02 -#define ASN1_BITSTRING 0x03 -#define ASN1_OCTET_STRING 0x04 -#define ASN1_NULL 0x05 -#define ASN1_OBJECT_IDENTIFIER 0x06 -#define ASN1_OBJECT_DESCRIPTOR 0x07 -#define ASN1_EXTERNAL 0x08 -#define ASN1_REAL 0x09 -#define ASN1_ENUMERATED 0x0A -#define ASN1_EMBEDDED 0x0B -#define ASN1_UTF8String 0x0C -#define ASN1_RELATIVE_OID 0x0D -#define ASN1_SEQUENCE 0x10 // Primitive + Constructed + 0x10 -#define ASN1_SET 0x11 // Primitive + Constructed + 0x11 -#define ASN1_NumericString 0x12 -#define ASN1_PrintableString 0x13 -#define ASN1_T61String 0x14 -#define ASN1_VideoString 0x15 -#define ASN1_IA5String 0x16 -#define ASN1_UTCTime 0x17 -#define ASN1_GeneralizeTime 0x18 -#define ASN1_VisibleString 0x1A -#define ASN1_GeneralString 0x1B -#define ASN1_UniversalString 0x1C -#define ASN1_CHARACTER STRING 0x1D -#define ASN1_BMPString 0x1E -#define ASN1_CONSTRUCTED 0x20 - -#define ASN1_APPLICAIION_SPECIFIC 0xA0 - -#define ASN1_CONSTRUCTED_SEQUENCE (ASN1_SEQUENCE + ASN1_CONSTRUCTED) - -#define MAX_DEPTH 10 // maximum push depth for marshaling context. - -//** Macros - -//*** Unmarshaling Macros -#ifndef GOTO_ERROR_UNLESS -# error missing GOTO_ERROR_UNLESS definition -#endif - -// Checks the validity of the size making sure that there is no wrap around -#define CHECK_SIZE(context, length) \ - GOTO_ERROR_UNLESS((((length) + (context)->offset) >= (context)->offset) \ - && (((length) + (context)->offset) <= (context)->size)) -#define NEXT_OCTET(context) ((context)->buffer[(context)->offset++]) -#define PEEK_NEXT(context) ((context)->buffer[(context)->offset]) - -//*** Marshaling Macros - -// Marshaling works in reverse order. The offset is set to the top of the buffer and, -// as the buffer is filled, 'offset' counts down to zero. When the full thing is -// encoded it can be moved to the top of the buffer. This happens when the last -// context is closed. - -#define CHECK_SPACE(context, length) GOTO_ERROR_UNLESS(context->offset > length) - -//** Structures - -typedef struct ASN1UnmarshalContext -{ - BYTE* buffer; // pointer to the buffer - INT16 size; // size of the buffer (a negative number indicates - // a parsing failure). - INT16 offset; // current offset into the buffer (a negative number - // indicates a parsing failure). Not used - BYTE tag; // The last unmarshaled tag -} ASN1UnmarshalContext; - -typedef struct ASN1MarshalContext -{ - BYTE* buffer; // pointer to the start of the buffer - INT16 offset; // place on the top where the last entry was added - // items are added from the bottom up. - INT16 end; // the end offset of the current value - INT16 depth; // how many pushed end values. - INT16 ends[MAX_DEPTH]; -} ASN1MarshalContext; - -#endif // _TPMASN1_H_ diff --git a/TPMCmd/tpm/include/private/X509.h b/TPMCmd/tpm/include/private/X509.h deleted file mode 100644 index 4168f1d..0000000 --- a/TPMCmd/tpm/include/private/X509.h +++ /dev/null @@ -1,98 +0,0 @@ -//** Introduction -// This file contains the macro and structure definitions for the X509 commands and -// functions. - -#ifndef _X509_H_ -#define _X509_H_ - -//** Includes - -#include "Tpm.h" -#include "TpmASN1.h" - -//** Defined Constants - -//*** X509 Application-specific types -#define X509_SELECTION 0xA0 -#define X509_ISSUER_UNIQUE_ID 0xA1 -#define X509_SUBJECT_UNIQUE_ID 0xA2 -#define X509_EXTENSIONS 0xA3 - -// These defines give the order in which values appear in the TBScertificate -// of an x.509 certificate. These values are used to index into an array of -// -#define ENCODED_SIZE_REF 0 -#define VERSION_REF (ENCODED_SIZE_REF + 1) -#define SERIAL_NUMBER_REF (VERSION_REF + 1) -#define SIGNATURE_REF (SERIAL_NUMBER_REF + 1) -#define ISSUER_REF (SIGNATURE_REF + 1) -#define VALIDITY_REF (ISSUER_REF + 1) -#define SUBJECT_KEY_REF (VALIDITY_REF + 1) -#define SUBJECT_PUBLIC_KEY_REF (SUBJECT_KEY_REF + 1) -#define EXTENSIONS_REF (SUBJECT_PUBLIC_KEY_REF + 1) -#define REF_COUNT (EXTENSIONS_REF + 1) - -//** Structures - -// Used to access the fields of a TBSsignature some of which are in the in_CertifyX509 -// structure and some of which are in the out_CertifyX509 structure. -typedef struct stringRef -{ - BYTE* buf; - INT16 len; -} stringRef; - -// This is defined to avoid bit by bit comparisons within a UINT32 -typedef union x509KeyUsageUnion -{ - TPMA_X509_KEY_USAGE x509; - UINT32 integer; -} x509KeyUsageUnion; - -//** Global X509 Constants -// These values are instanced by X509_spt.c and referenced by other X509-related -// files. - -// This is the DER-encoded value for the Key Usage OID (2.5.29.15). This is the -// full OID, not just the numeric value -#define OID_KEY_USAGE_EXTENSION_VALUE 0x06, 0x03, 0x55, 0x1D, 0x0F -MAKE_OID(_KEY_USAGE_EXTENSION); - -// This is the DER-encoded value for the TCG-defined TPMA_OBJECT OID -// (2.23.133.10.1.1.1) -#define OID_TCG_TPMA_OBJECT_VALUE 0x06, 0x07, 0x67, 0x81, 0x05, 0x0a, 0x01, 0x01, 0x01 -MAKE_OID(_TCG_TPMA_OBJECT); - -#ifdef _X509_SPT_ -// If a bit is SET in KEY_USAGE_SIGN is also SET in keyUsage then -// the associated key has to have 'sign' SET. -const x509KeyUsageUnion KEY_USAGE_SIGN = {TPMA_X509_KEY_USAGE_INITIALIZER( - /* bits_at_0 */ 0, - /* decipheronly */ 0, - /* encipheronly */ 0, - /* crlsign */ 1, - /* keycertsign */ 1, - /* keyagreement */ 0, - /* dataencipherment */ 0, - /* keyencipherment */ 0, - /* nonrepudiation */ 0, - /* digitalsignature */ 1)}; -// If a bit is SET in KEY_USAGE_DECRYPT is also SET in keyUsage then -// the associated key has to have 'decrypt' SET. -const x509KeyUsageUnion KEY_USAGE_DECRYPT = {TPMA_X509_KEY_USAGE_INITIALIZER( - /* bits_at_0 */ 0, - /* decipheronly */ 1, - /* encipheronly */ 1, - /* crlsign */ 0, - /* keycertsign */ 0, - /* keyagreement */ 1, - /* dataencipherment */ 1, - /* keyencipherment */ 1, - /* nonrepudiation */ 0, - /* digitalsignature */ 0)}; -#else -extern x509KeyUsageUnion KEY_USAGE_SIGN; -extern x509KeyUsageUnion KEY_USAGE_DECRYPT; -#endif - -#endif // _X509_H_ diff --git a/TPMCmd/tpm/include/private/prototypes/CertifyX509_fp.h b/TPMCmd/tpm/include/private/prototypes/CertifyX509_fp.h deleted file mode 100644 index 19c6577..0000000 --- a/TPMCmd/tpm/include/private/prototypes/CertifyX509_fp.h +++ /dev/null @@ -1,39 +0,0 @@ - -// FILE GENERATED BY TpmExtractCode: DO NOT EDIT - -#if CC_CertifyX509 // Command must be enabled - -# ifndef _TPM_INCLUDE_PRIVATE_PROTOTYPES_CERTIFYX509_FP_H_ -# define _TPM_INCLUDE_PRIVATE_PROTOTYPES_CERTIFYX509_FP_H_ - -// Input structure definition -typedef struct -{ - TPMI_DH_OBJECT objectHandle; - TPMI_DH_OBJECT signHandle; - TPM2B_DATA reserved; - TPMT_SIG_SCHEME inScheme; - TPM2B_MAX_BUFFER partialCertificate; -} CertifyX509_In; - -// Output structure definition -typedef struct -{ - TPM2B_MAX_BUFFER addedToCertificate; - TPM2B_DIGEST tbsDigest; - TPMT_SIGNATURE signature; -} CertifyX509_Out; - -// Response code modifiers -# define RC_CertifyX509_objectHandle (TPM_RC_H + TPM_RC_1) -# define RC_CertifyX509_signHandle (TPM_RC_H + TPM_RC_2) -# define RC_CertifyX509_reserved (TPM_RC_P + TPM_RC_1) -# define RC_CertifyX509_inScheme (TPM_RC_P + TPM_RC_2) -# define RC_CertifyX509_partialCertificate (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_CertifyX509(CertifyX509_In* in, CertifyX509_Out* out); - -# endif // _TPM_INCLUDE_PRIVATE_PROTOTYPES_CERTIFYX509_FP_H_ -#endif // CC_CertifyX509 diff --git a/TPMCmd/tpm/include/private/prototypes/CryptRsa_fp.h b/TPMCmd/tpm/include/private/prototypes/CryptRsa_fp.h index 7719eb9..e589657 100644 --- a/TPMCmd/tpm/include/private/prototypes/CryptRsa_fp.h +++ b/TPMCmd/tpm/include/private/prototypes/CryptRsa_fp.h @@ -12,9 +12,7 @@ BOOL CryptRsaInit(void); BOOL CryptRsaStartup(void); //*** CryptRsaPssSaltSize() -// This function computes the salt size used in PSS. It is broken out so that -// the X509 code can get the same value that is used by the encoding function in this -// module. +// This function computes the salt size used in PSS. INT16 CryptRsaPssSaltSize(INT16 hashSize, INT16 outSize); diff --git a/TPMCmd/tpm/include/private/prototypes/SecChannel_fp.h b/TPMCmd/tpm/include/private/prototypes/SecChannel_fp.h index e2ce8d1..8e878a6 100644 --- a/TPMCmd/tpm/include/private/prototypes/SecChannel_fp.h +++ b/TPMCmd/tpm/include/private/prototypes/SecChannel_fp.h @@ -36,4 +36,4 @@ BOOL IsSpdmSessionActive( tpmKeyName // OUT: the TPM key's name associated with the SPDM session ); -#endif // _SEC_CHANNEL_FP_H_ \ No newline at end of file +#endif // _SEC_CHANNEL_FP_H_ diff --git a/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_ECDAA_fp.h b/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_ECDAA_fp.h index cccbf3e..237a9ec 100644 --- a/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_ECDAA_fp.h +++ b/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_ECDAA_fp.h @@ -30,4 +30,4 @@ TPM_RC TpmEcc_SignEcdaa( ); #endif // ALG_ECC && ALG_ECDAA -#endif // _TPMECC_SIGNATURE_ECDAA_FP_H_ \ No newline at end of file +#endif // _TPMECC_SIGNATURE_ECDAA_FP_H_ diff --git a/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_ECDSA_fp.h b/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_ECDSA_fp.h index 4c31454..267b2a6 100644 --- a/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_ECDSA_fp.h +++ b/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_ECDSA_fp.h @@ -33,4 +33,4 @@ TpmEcc_ValidateSignatureEcdsa( ); #endif // ALG_ECC && ALG_ECDSA -#endif // _TPMECC_SIGNATURE_ECDSA_FP_H_ \ No newline at end of file +#endif // _TPMECC_SIGNATURE_ECDSA_FP_H_ diff --git a/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_SM2_fp.h b/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_SM2_fp.h index 41437da..e258120 100644 --- a/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_SM2_fp.h +++ b/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_SM2_fp.h @@ -32,4 +32,4 @@ TPM_RC TpmEcc_ValidateSignatureEcSm2( ); #endif // ALG_ECC && ALG_SM2 -#endif // _TPMECC_SIGNATURE_SM2_FP_H_ \ No newline at end of file +#endif // _TPMECC_SIGNATURE_SM2_FP_H_ diff --git a/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_Schnorr_fp.h b/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_Schnorr_fp.h index 782e845..1b9a140 100644 --- a/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_Schnorr_fp.h +++ b/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_Schnorr_fp.h @@ -27,4 +27,4 @@ TPM_RC TpmEcc_ValidateSignatureEcSchnorr( ); #endif // ALG_ECC && ALG_ECSCHNORR -#endif // _TPMECC_SIGNATURE_SCHNORR_FP_H_ \ No newline at end of file +#endif // _TPMECC_SIGNATURE_SCHNORR_FP_H_ diff --git a/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_Util_fp.h b/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_Util_fp.h index bc93e55..c821e5a 100644 --- a/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_Util_fp.h +++ b/TPMCmd/tpm/include/private/prototypes/TpmEcc_Signature_Util_fp.h @@ -24,4 +24,4 @@ TPM_RC TpmEcc_SchnorrCalculateS( ); #endif // ALG_ECC -#endif // _TPMECC_SIGNATURE_UTIL_FP_H_ \ No newline at end of file +#endif // _TPMECC_SIGNATURE_UTIL_FP_H_ diff --git a/TPMCmd/tpm/include/private/prototypes/TpmEcc_Util_fp.h b/TPMCmd/tpm/include/private/prototypes/TpmEcc_Util_fp.h index d82f181..d068bd2 100644 --- a/TPMCmd/tpm/include/private/prototypes/TpmEcc_Util_fp.h +++ b/TPMCmd/tpm/include/private/prototypes/TpmEcc_Util_fp.h @@ -26,4 +26,4 @@ LIB_EXPORT BOOL TpmEcc_PointTo2B( ); #endif // ALG_ECC -#endif // _TPMECC_UTIL_FP_H_ \ No newline at end of file +#endif // _TPMECC_UTIL_FP_H_ diff --git a/TPMCmd/tpm/include/private/prototypes/TpmMath_Debug_fp.h b/TPMCmd/tpm/include/private/prototypes/TpmMath_Debug_fp.h index 0d60b09..eb927a0 100644 --- a/TPMCmd/tpm/include/private/prototypes/TpmMath_Debug_fp.h +++ b/TPMCmd/tpm/include/private/prototypes/TpmMath_Debug_fp.h @@ -23,4 +23,4 @@ LIB_EXPORT Crypt_Int* TpmMath_Debug_FromHex( ); #endif // ALG_ECC or ALG_RSA -#endif //_TPMMATH_DEBUG_FP_H_ \ No newline at end of file +#endif //_TPMMATH_DEBUG_FP_H_ diff --git a/TPMCmd/tpm/include/private/prototypes/TpmMath_Util_fp.h b/TPMCmd/tpm/include/private/prototypes/TpmMath_Util_fp.h index 2eda00a..f50a06b 100644 --- a/TPMCmd/tpm/include/private/prototypes/TpmMath_Util_fp.h +++ b/TPMCmd/tpm/include/private/prototypes/TpmMath_Util_fp.h @@ -68,4 +68,4 @@ LIB_EXPORT BOOL TpmMath_GetRandomInRange( RAND_STATE* rand // IN: random engine ); -#endif //_TPM_MATH_FP_H_ \ No newline at end of file +#endif //_TPM_MATH_FP_H_ diff --git a/TPMCmd/tpm/include/private/prototypes/X509_ECC_fp.h b/TPMCmd/tpm/include/private/prototypes/X509_ECC_fp.h deleted file mode 100644 index 875369c..0000000 --- a/TPMCmd/tpm/include/private/prototypes/X509_ECC_fp.h +++ /dev/null @@ -1,36 +0,0 @@ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 11:00:49AM - */ - -#ifndef _X509_ECC_FP_H_ -#define _X509_ECC_FP_H_ - -//*** X509PushPoint() -// This seems like it might be used more than once so... -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509PushPoint(ASN1MarshalContext* ctx, TPMS_ECC_POINT* p); - -//*** X509AddSigningAlgorithmECC() -// This creates the singing algorithm data. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddSigningAlgorithmECC( - OBJECT* signKey, TPMT_SIG_SCHEME* scheme, ASN1MarshalContext* ctx); - -//*** X509AddPublicECC() -// This function will add the publicKey description to the DER data. If ctx is -// NULL, then no data is transferred and this function will indicate if the TPM -// has the values for DER-encoding of the public key. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddPublicECC(OBJECT* object, ASN1MarshalContext* ctx); - -#endif // _X509_ECC_FP_H_ diff --git a/TPMCmd/tpm/include/private/prototypes/X509_RSA_fp.h b/TPMCmd/tpm/include/private/prototypes/X509_RSA_fp.h deleted file mode 100644 index 7c85fbc..0000000 --- a/TPMCmd/tpm/include/private/prototypes/X509_RSA_fp.h +++ /dev/null @@ -1,31 +0,0 @@ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 11:00:49AM - */ - -#ifndef _X509_RSA_FP_H_ -#define _X509_RSA_FP_H_ - -#if ALG_RSA - -//*** X509AddSigningAlgorithmRSA() -// This creates the singing algorithm data. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddSigningAlgorithmRSA( - OBJECT* signKey, TPMT_SIG_SCHEME* scheme, ASN1MarshalContext* ctx); - -//*** X509AddPublicRSA() -// This function will add the publicKey description to the DER data. If fillPtr is -// NULL, then no data is transferred and this function will indicate if the TPM -// has the values for DER-encoding of the public key. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddPublicRSA(OBJECT* object, ASN1MarshalContext* ctx); -#endif // ALG_RSA - -#endif // _X509_RSA_FP_H_ diff --git a/TPMCmd/tpm/include/private/prototypes/X509_spt_fp.h b/TPMCmd/tpm/include/private/prototypes/X509_spt_fp.h deleted file mode 100644 index cc01512..0000000 --- a/TPMCmd/tpm/include/private/prototypes/X509_spt_fp.h +++ /dev/null @@ -1,71 +0,0 @@ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Nov 14, 2019 Time: 05:57:02PM - */ - -#ifndef _X509_SPT_FP_H_ -#define _X509_SPT_FP_H_ - -//*** X509FindExtensionByOID() -// This will search a list of X509 extensions to find an extension with the -// requested OID. If the extension is found, the output context ('ctx') is set up -// to point to the OID in the extension. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure (could be catastrophic) -BOOL X509FindExtensionByOID(ASN1UnmarshalContext* ctxIn, // IN: the context to search - ASN1UnmarshalContext* ctx, // OUT: the extension context - const BYTE* OID // IN: oid to search for -); - -//*** X509GetExtensionBits() -// This function will extract a bit field from an extension. If the extension doesn't -// contain a bit string, it will fail. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -UINT32 -X509GetExtensionBits(ASN1UnmarshalContext* ctx, UINT32* value); - -//***X509ProcessExtensions() -// This function is used to process the TPMA_OBJECT and KeyUsage extensions. It is not -// in the CertifyX509.c code because it makes the code harder to follow. -// Return Type: TPM_RC -// TPM_RCS_ATTRIBUTES the attributes of object are not consistent with -// the extension setting -// TPM_RC_VALUE problem parsing the extensions -TPM_RC -X509ProcessExtensions( - OBJECT* object, // IN: The object with the attributes to - // check - stringRef* extension // IN: The start and length of the extensions -); - -//*** X509AddSigningAlgorithm() -// This creates the singing algorithm data. -// Return Type: INT16 -// > 0 number of octets added -// <= 0 failure -INT16 -X509AddSigningAlgorithm( - ASN1MarshalContext* ctx, OBJECT* signKey, TPMT_SIG_SCHEME* scheme); - -//*** X509AddPublicKey() -// This function will add the publicKey description to the DER data. If fillPtr is -// NULL, then no data is transferred and this function will indicate if the TPM -// has the values for DER-encoding of the public key. -// Return Type: INT16 -// > 0 number of octets added -// == 0 failure -INT16 -X509AddPublicKey(ASN1MarshalContext* ctx, OBJECT* object); - -//*** X509PushAlgorithmIdentifierSequence() -// The function adds the algorithm identifier sequence. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509PushAlgorithmIdentifierSequence(ASN1MarshalContext* ctx, const BYTE* OID); - -#endif // _X509_SPT_FP_H_ diff --git a/TPMCmd/tpm/include/tpm_public/CompilerDependencies.h b/TPMCmd/tpm/include/tpm_public/CompilerDependencies.h index 634b140..a5e7fb8 100644 --- a/TPMCmd/tpm/include/tpm_public/CompilerDependencies.h +++ b/TPMCmd/tpm/include/tpm_public/CompilerDependencies.h @@ -21,6 +21,9 @@ #ifndef NORETURN # define NORETURN #endif +#ifndef FALLTHROUGH +# define FALLTHROUGH +#endif #ifndef LIB_EXPORT # define LIB_EXPORT #endif diff --git a/TPMCmd/tpm/include/tpm_public/CompilerDependencies_gcc.h b/TPMCmd/tpm/include/tpm_public/CompilerDependencies_gcc.h index 995ca6f..24022a9 100644 --- a/TPMCmd/tpm/include/tpm_public/CompilerDependencies_gcc.h +++ b/TPMCmd/tpm/include/tpm_public/CompilerDependencies_gcc.h @@ -36,6 +36,8 @@ #define NORETURN __attribute__((noreturn)) +#define FALLTHROUGH __attribute__((fallthrough)) + #define TPM_INLINE inline __attribute__((always_inline)) #ifdef __cplusplus diff --git a/TPMCmd/tpm/include/tpm_public/GpMacros.h b/TPMCmd/tpm/include/tpm_public/GpMacros.h index 4233eeb..61c3003 100644 --- a/TPMCmd/tpm/include/tpm_public/GpMacros.h +++ b/TPMCmd/tpm/include/tpm_public/GpMacros.h @@ -25,13 +25,6 @@ # define TPM_DO_SELF_TEST(alg) #endif // ENABLE_SELF_TESTS -//** For Failures -#if defined _POSIX_ -# define FUNCTION_NAME 0 -#else -# define FUNCTION_NAME __FUNCTION__ -#endif - // CODELOCATOR, if defined, returns a 64-bit vendor-defined value that indicates where // an event has occurred in the program. This is a placeholder in the // case it is not defined. @@ -41,7 +34,7 @@ // Use no Parens in this macro value because it is pasted into a function call below #if defined(FAIL_TRACE) && FAIL_TRACE != NO -# define FAILLOCATOR() FUNCTION_NAME, __LINE__, CODELOCATOR() +# define FAILLOCATOR() __func__, __LINE__, CODELOCATOR() #else // !FAIL_TRACE # define FAILLOCATOR() CODELOCATOR() #endif // FAIL_TRACE @@ -434,4 +427,4 @@ #include "tpm_public/TpmCalculatedAttributes.h" -#endif // GP_MACROS_H \ No newline at end of file +#endif // GP_MACROS_H diff --git a/TPMCmd/tpm/include/tpm_public/TpmCalculatedAttributes.h b/TPMCmd/tpm/include/tpm_public/TpmCalculatedAttributes.h index b0ec331..02fc4a2 100644 --- a/TPMCmd/tpm/include/tpm_public/TpmCalculatedAttributes.h +++ b/TPMCmd/tpm/include/tpm_public/TpmCalculatedAttributes.h @@ -153,4 +153,4 @@ // specific. It has to be the same size as the 'sequence' parameter of a TPMS_CONTEXT // and that is a UINT64. So, this is an invariant value #define CONTEXT_COUNTER UINT64 -#endif // _TPM_CALCULATED_ATTRIBUTES_H_ \ No newline at end of file +#endif // _TPM_CALCULATED_ATTRIBUTES_H_ diff --git a/TPMCmd/tpm/include/tpm_public/TpmTypes.h b/TPMCmd/tpm/include/tpm_public/TpmTypes.h index db16f39..7123b21 100644 --- a/TPMCmd/tpm/include/tpm_public/TpmTypes.h +++ b/TPMCmd/tpm/include/tpm_public/TpmTypes.h @@ -292,7 +292,6 @@ typedef UINT32 TPM_CC; #define TPM_CC_AC_GetCapability (TPM_CC)(0x00000194) #define TPM_CC_AC_Send (TPM_CC)(0x00000195) #define TPM_CC_Policy_AC_SendSelect (TPM_CC)(0x00000196) -#define TPM_CC_CertifyX509 (TPM_CC)(0x00000197) #define TPM_CC_ACT_SetTimeout (TPM_CC)(0x00000198) #define TPM_CC_ECC_Encrypt (TPM_CC)(0x00000199) #define TPM_CC_ECC_Decrypt (TPM_CC)(0x0000019A) @@ -432,7 +431,6 @@ typedef UINT32 TPM_CC; + CC_AC_GetCapability /* 0x00000194 */ \ + CC_AC_Send /* 0x00000195 */ \ + CC_Policy_AC_SendSelect /* 0x00000196 */ \ - + CC_CertifyX509 /* 0x00000197 */ \ + CC_ACT_SetTimeout /* 0x00000198 */ \ + CC_ECC_Encrypt /* 0x00000199 */ \ + CC_ECC_Decrypt /* 0x0000019A */ \ @@ -1193,48 +1191,6 @@ typedef UINT32 TPMA_MODES; fips_140_2, fips_140_3, fips_140_3_indicator, bits_at_4) \ (TPMA_MODES)((fips_140_2 << 0) + (fips_140_3 << 1) + (fips_140_3_indicator << 2)) -// Table "Definition of TPMA_X509_KEY_USAGE Bits" (Part 2: Structures) -#define TYPE_OF_TPMA_X509_KEY_USAGE UINT32 -#define TPMA_X509_KEY_USAGE_TO_UINT32(a) (*((UINT32*)&(a))) -#define UINT32_TO_TPMA_X509_KEY_USAGE(a) (*((TPMA_X509_KEY_USAGE*)&(a))) -#define TPMA_X509_KEY_USAGE_TO_BYTE_ARRAY(i, a) \ - UINT32_TO_BYTE_ARRAY((TPMA_X509_KEY_USAGE_TO_UINT32(i)), (a)) -#define BYTE_ARRAY_TO_TPMA_X509_KEY_USAGE(i, a) \ - { \ - UINT32 x = BYTE_ARRAY_TO_UINT32(a); \ - i = UINT32_TO_TPMA_X509_KEY_USAGE(x); \ - } -#define TPMA_X509_KEY_USAGE_ALLOWED_BITS (0xff800000) - -// This implements Table "Definition of TPMA_X509_KEY_USAGE Bits" (Part 2: Structures) using bit masking -typedef UINT32 TPMA_X509_KEY_USAGE; -#define TPMA_X509_KEY_USAGE_decipherOnly (TPMA_X509_KEY_USAGE)(1 << 23) -#define TPMA_X509_KEY_USAGE_encipherOnly (TPMA_X509_KEY_USAGE)(1 << 24) -#define TPMA_X509_KEY_USAGE_cRLSign (TPMA_X509_KEY_USAGE)(1 << 25) -#define TPMA_X509_KEY_USAGE_keyCertSign (TPMA_X509_KEY_USAGE)(1 << 26) -#define TPMA_X509_KEY_USAGE_keyAgreement (TPMA_X509_KEY_USAGE)(1 << 27) -#define TPMA_X509_KEY_USAGE_dataEncipherment (TPMA_X509_KEY_USAGE)(1 << 28) -#define TPMA_X509_KEY_USAGE_keyEncipherment (TPMA_X509_KEY_USAGE)(1 << 29) -#define TPMA_X509_KEY_USAGE_nonrepudiation (TPMA_X509_KEY_USAGE)(1 << 30) -#define TPMA_X509_KEY_USAGE_digitalSignature (TPMA_X509_KEY_USAGE)(1 << 31) - -// This is the initializer for a TPMA_X509_KEY_USAGE bit array. -#define TPMA_X509_KEY_USAGE_INITIALIZER(bits_at_0, \ - decipheronly, \ - encipheronly, \ - crlsign, \ - keycertsign, \ - keyagreement, \ - dataencipherment, \ - keyencipherment, \ - nonrepudiation, \ - digitalsignature) \ - (TPMA_X509_KEY_USAGE)((decipheronly << 23) + (encipheronly << 24) \ - + (crlsign << 25) + (keycertsign << 26) \ - + (keyagreement << 27) + (dataencipherment << 28) \ - + (keyencipherment << 29) + (nonrepudiation << 30) \ - + (digitalsignature << 31)) - // Table "Definition of TPMA_ACT Bits" (Part 2: Structures) #define TYPE_OF_TPMA_ACT UINT32 #define TPMA_ACT_TO_UINT32(a) (*((UINT32*)&(a))) diff --git a/TPMCmd/tpm/include/tpm_public/VerifyConfiguration.h b/TPMCmd/tpm/include/tpm_public/VerifyConfiguration.h index 705e303..c7ef498 100644 --- a/TPMCmd/tpm/include/tpm_public/VerifyConfiguration.h +++ b/TPMCmd/tpm/include/tpm_public/VerifyConfiguration.h @@ -18,7 +18,6 @@ MUST_BE_0_OR_1(DEBUG); MUST_BE_0_OR_1(SIMULATION); MUST_BE_0_OR_1(ENABLE_TPM_DEBUG_PRINT); MUST_BE_0_OR_1(DRBG_DEBUG_PRINT); -MUST_BE_0_OR_1(CERTIFYX509_DEBUG); MUST_BE_0_OR_1(USE_DEBUG_RNG); // RSA Debug Options @@ -75,7 +74,7 @@ MUST_BE_0_OR_1(VENDOR_PERMANENT_AUTH_ENABLED); #if !DEBUG # if USE_KEY_CACHE_FILE || USE_RSA_KEY_CACHE || DRBG_DEBUG_PRINT \ - || CERTIFYX509_DEBUG || USE_DEBUG_RNG || ENABLE_TPM_DEBUG_PRINT + || USE_DEBUG_RNG || ENABLE_TPM_DEBUG_PRINT # error using insecure options not in DEBUG mode. # endif #endif diff --git a/TPMCmd/tpm/src/CMakeLists.txt b/TPMCmd/tpm/src/CMakeLists.txt index e05cf32..4c2d06c 100644 --- a/TPMCmd/tpm/src/CMakeLists.txt +++ b/TPMCmd/tpm/src/CMakeLists.txt @@ -68,7 +68,6 @@ function(full_generate_tpm_sources) "command/Attestation/Attest_spt.c" "command/Attestation/Certify.c" "command/Attestation/CertifyCreation.c" - "command/Attestation/CertifyX509.c" "command/Attestation/GetCommandAuditDigest.c" "command/Attestation/GetSessionAuditDigest.c" "command/Attestation/GetTime.c" @@ -257,10 +256,6 @@ function(full_generate_tpm_sources) "support/TableMarshalData.c" "support/TpmFail.c" "support/TpmSizeChecks.c" - "X509/TpmASN1.c" - "X509/X509_ECC.c" - "X509/X509_RSA.c" - "X509/X509_spt.c" ) endfunction() diff --git a/TPMCmd/tpm/src/X509/TpmASN1.c b/TPMCmd/tpm/src/X509/TpmASN1.c deleted file mode 100644 index 9875ed8..0000000 --- a/TPMCmd/tpm/src/X509/TpmASN1.c +++ /dev/null @@ -1,426 +0,0 @@ -//** Includes -#include "Tpm.h" -#define _OIDS_ -#include "OIDs.h" -#include "TpmASN1.h" -#include "TpmASN1_fp.h" - -#if CC_CertifyX509 - -//** Unmarshaling Functions - -//*** ASN1UnmarshalContextInitialize() -// Function does standard initialization of a context. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -BOOL ASN1UnmarshalContextInitialize( - ASN1UnmarshalContext* ctx, INT16 size, BYTE* buffer) -{ - GOTO_ERROR_UNLESS(buffer != NULL); - GOTO_ERROR_UNLESS(size > 0); - ctx->buffer = buffer; - ctx->size = size; - ctx->offset = 0; - ctx->tag = 0xFF; - return TRUE; -Error: - return FALSE; -} - -//***ASN1DecodeLength() -// This function extracts the length of an element from 'buffer' starting at 'offset'. -// Return Type: UINT16 -// >=0 the extracted length -// <0 an error -INT16 -ASN1DecodeLength(ASN1UnmarshalContext* ctx) -{ - BYTE first; // Next octet in buffer - INT16 value; - // - GOTO_ERROR_UNLESS(ctx->offset < ctx->size); - first = NEXT_OCTET(ctx); - // If the number of octets of the entity is larger than 127, then the first octet - // is the number of octets in the length specifier. - if(first >= 0x80) - { - // Make sure that this length field is contained with the structure being - // parsed - CHECK_SIZE(ctx, (first & 0x7F)); - if(first == 0x82) - { - // Two octets of size - // get the next value - value = (INT16)NEXT_OCTET(ctx); - // Make sure that the result will fit in an INT16 - GOTO_ERROR_UNLESS(value < 0x0080); - // Shift up and add next octet - value = (value << 8) + NEXT_OCTET(ctx); - } - else if(first == 0x81) - value = NEXT_OCTET(ctx); - // Sizes larger than will fit in a INT16 are an error - else - goto Error; - } - else - value = first; - // Make sure that the size defined something within the current context - CHECK_SIZE(ctx, value); - return value; -Error: - ctx->size = -1; // Makes everything fail from now on. - return -1; -} - -//***ASN1NextTag() -// This function extracts the next type from 'buffer' starting at 'offset'. -// It advances 'offset' as it parses the type and the length of the type. It returns -// the length of the type. On return, the 'length' octets starting at 'offset' are the -// octets of the type. -// Return Type: UINT -// >=0 the number of octets in 'type' -// <0 an error -INT16 -ASN1NextTag(ASN1UnmarshalContext* ctx) -{ - // A tag to get? - GOTO_ERROR_UNLESS(ctx->offset < ctx->size); - // Get it - ctx->tag = NEXT_OCTET(ctx); - // Make sure that it is not an extended tag - GOTO_ERROR_UNLESS((ctx->tag & 0x1F) != 0x1F); - // Get the length field and return that - return ASN1DecodeLength(ctx); - -Error: - // Attempt to read beyond the end of the context or an illegal tag - ctx->size = -1; // Persistent failure - ctx->tag = 0xFF; - return -1; -} - -//*** ASN1GetBitStringValue() -// Try to parse a bit string of up to 32 bits from a value that is expected to be -// a bit string. The bit string is left justified so that the MSb of the input is -// the MSb of the returned value. -// If there is a general parsing error, the context->size is set to -1. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -BOOL ASN1GetBitStringValue(ASN1UnmarshalContext* ctx, UINT32* val) -{ - int shift; - INT16 length; - UINT32 value = 0; - int inputBits; - // - length = ASN1NextTag(ctx); - GOTO_ERROR_UNLESS(length >= 1); - GOTO_ERROR_UNLESS(ctx->tag == ASN1_BITSTRING); - // Get the shift value for the bit field (how many bits to lop off of the end) - shift = NEXT_OCTET(ctx); - length--; - // Get the number of bits in the input - inputBits = (8 * length) - shift; - // the shift count has to make sense - GOTO_ERROR_UNLESS((shift < 8) && ((length > 0) || (shift == 0))); - // if there are any bytes left - for(; length > 1; length--) - { - - // for all but the last octet, just shift and add the new octet - GOTO_ERROR_UNLESS((value & 0xFF000000) == 0); // can't loose significant bits - value = (value << 8) + NEXT_OCTET(ctx); - } - if(length == 1) - { - // for the last octet, just shift the accumulated value enough to - // accept the significant bits in the last octet and shift the last - // octet down - GOTO_ERROR_UNLESS(((value & (0xFF000000 << (8 - shift)))) == 0); - value = (value << (8 - shift)) + (NEXT_OCTET(ctx) >> shift); - } - // 'Left justify' the result - if(inputBits > 0) - value <<= (32 - inputBits); - *val = value; - return TRUE; -Error: - ctx->size = -1; - return FALSE; -} - -//******************************************************************* -//** Marshaling Functions -//******************************************************************* - -//*** Introduction -// Marshaling of an ASN.1 structure is accomplished from the bottom up. That is, -// the things that will be at the end of the structure are added last. To manage the -// collecting of the relative sizes, start a context for the outermost container, if -// there is one, and then placing items in from the bottom up. If the bottom-most -// item is also within a structure, create a nested context by calling -// ASN1StartMarshalingContext(). -// -// The context control structure contains a 'buffer' pointer, an 'offset', an 'end' -// and a stack. 'offset' is the offset from the start of the buffer of the last added -// byte. When 'offset' reaches 0, the buffer is full. 'offset' is a signed value so -// that, when it becomes negative, there is an overflow. Only two functions are -// allowed to move bytes into the buffer: ASN1PushByte() and ASN1PushBytes(). These -// functions make sure that no data is written beyond the end of the buffer. -// -// When a new context is started, the current value of 'end' is pushed -// on the stack and 'end' is set to 'offset. As bytes are added, offset gets smaller. -// At any time, the count of bytes in the current context is simply 'end' - 'offset'. -// -// Since starting a new context involves setting 'end' = 'offset', the number of bytes -// in the context starts at 0. The nominal way of ending a context is to use -// 'end' - 'offset' to set the length value, and then a tag is added to the buffer. -// Then the previous 'end' value is popped meaning that the context just ended -// becomes a member of the now current context. -// -// The nominal strategy for building a completed ASN.1 structure is to push everything -// into the buffer and then move everything to the start of the buffer. The move is -// simple as the size of the move is the initial 'end' value minus the final 'offset' -// value. The destination is 'buffer' and the source is 'buffer' + 'offset'. As Skippy -// would say "Easy peasy, Joe." -// -// It is not necessary to provide a buffer into which the data is placed. If no buffer -// is provided, then the marshaling process will return values needed for marshaling. -// On strategy for filling the buffer would be to execute the process for building -// the structure without using a buffer. This would return the overall size of the -// structure. Then that amount of data could be allocated for the buffer and the fill -// process executed again with the data going into the buffer. At the end, the data -// would be in its final resting place. - -//*** ASN1InitialializeMarshalContext() -// This creates a structure for handling marshaling of an ASN.1 formatted data -// structure. -void ASN1InitialializeMarshalContext( - ASN1MarshalContext* ctx, INT16 length, BYTE* buffer) -{ - ctx->buffer = buffer; - if(buffer) - ctx->offset = length; - else - ctx->offset = INT16_MAX; - ctx->end = ctx->offset; - ctx->depth = -1; -} - -//*** ASN1StartMarshalContext() -// This starts a new constructed element. It is constructed on 'top' of the value -// that was previously placed in the structure. -void ASN1StartMarshalContext(ASN1MarshalContext* ctx) -{ - pAssert_VOID_OK((ctx->depth + 1) < MAX_DEPTH); - ctx->depth++; - ctx->ends[ctx->depth] = ctx->end; - ctx->end = ctx->offset; -} - -//*** ASN1EndMarshalContext() -// This function restores the end pointer for an encapsulating structure. -// Return Type: INT16 -// > 0 the size of the encapsulated structure that was just ended -// <= 0 an error -INT16 -ASN1EndMarshalContext(ASN1MarshalContext* ctx) -{ - INT16 length; - pAssert_ZERO(ctx->depth >= 0); - length = ctx->end - ctx->offset; - ctx->end = ctx->ends[ctx->depth--]; - return length; -} - -//***ASN1EndEncapsulation() -// This function puts a tag and length in the buffer. In this function, an embedded -// BIT_STRING is assumed to be a collection of octets. To indicate that all bits -// are used, a byte of zero is prepended. If a raw bit-string is needed, a new -// function like ASN1PushInteger() would be needed. -// Return Type: INT16 -// > 0 number of octets in the encapsulation -// == 0 failure -UINT16 -ASN1EndEncapsulation(ASN1MarshalContext* ctx, BYTE tag) -{ - // only add a leading zero for an encapsulated BIT STRING - if(tag == ASN1_BITSTRING) - ASN1PushByte(ctx, 0); - ASN1PushTagAndLength(ctx, tag, ctx->end - ctx->offset); - return ASN1EndMarshalContext(ctx); -} - -//*** ASN1PushByte() -BOOL ASN1PushByte(ASN1MarshalContext* ctx, BYTE b) -{ - if(ctx->offset > 0) - { - ctx->offset -= 1; - if(ctx->buffer) - ctx->buffer[ctx->offset] = b; - return TRUE; - } - ctx->offset = -1; - return FALSE; -} - -//*** ASN1PushBytes() -// Push some raw bytes onto the buffer. 'count' cannot be zero. -// Return Type: IN16 -// > 0 count bytes -// == 0 failure unless count was zero -INT16 -ASN1PushBytes(ASN1MarshalContext* ctx, INT16 count, const BYTE* buffer) -{ - // make sure that count is not negative which would mess up the math; and that - // if there is a count, there is a buffer - GOTO_ERROR_UNLESS((count >= 0) && ((buffer != NULL) || (count == 0))); - // back up the offset to determine where the new octets will get pushed - ctx->offset -= count; - // can't go negative - GOTO_ERROR_UNLESS(ctx->offset >= 0); - // if there are buffers, move the data, otherwise, assume that this is just a - // test. - if(count && buffer && ctx->buffer) - MemoryCopy(&ctx->buffer[ctx->offset], buffer, count); - return count; -Error: - ctx->offset = -1; - return 0; -} - -//*** ASN1PushNull() -// Return Type: IN16 -// > 0 count bytes -// == 0 failure unless count was zero -INT16 -ASN1PushNull(ASN1MarshalContext* ctx) -{ - ASN1PushByte(ctx, 0); - ASN1PushByte(ctx, ASN1_NULL); - return (ctx->offset >= 0) ? 2 : 0; -} - -//*** ASN1PushLength() -// Push a length value. This will only handle length values that fit in an INT16. -// Return Type: UINT16 -// > 0 number of bytes added -// == 0 failure -INT16 -ASN1PushLength(ASN1MarshalContext* ctx, INT16 len) -{ - UINT16 start = ctx->offset; - GOTO_ERROR_UNLESS(len >= 0); - if(len <= 127) - ASN1PushByte(ctx, (BYTE)len); - else - { - ASN1PushByte(ctx, (BYTE)(len & 0xFF)); - len >>= 8; - if(len == 0) - ASN1PushByte(ctx, 0x81); - else - { - ASN1PushByte(ctx, (BYTE)(len)); - ASN1PushByte(ctx, 0x82); - } - } - goto Exit; -Error: - ctx->offset = -1; -Exit: - return (ctx->offset > 0) ? start - ctx->offset : 0; -} - -//*** ASN1PushTagAndLength() -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -ASN1PushTagAndLength(ASN1MarshalContext* ctx, BYTE tag, INT16 length) -{ - INT16 bytes; - bytes = ASN1PushLength(ctx, length); - bytes += (INT16)ASN1PushByte(ctx, tag); - return (ctx->offset < 0) ? 0 : bytes; -} - -//*** ASN1PushTaggedOctetString() -// This function will push a random octet string. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -ASN1PushTaggedOctetString( - ASN1MarshalContext* ctx, INT16 size, const BYTE* string, BYTE tag) -{ - ASN1PushBytes(ctx, size, string); - // PushTagAndLenght just tells how many octets it added so the total size of this - // element is the sum of those octets and input size. - size += ASN1PushTagAndLength(ctx, tag, size); - return size; -} - -//*** ASN1PushUINT() -// This function pushes an native-endian integer value. This just changes a -// native-endian integer into a big-endian byte string and calls ASN1PushInteger(). -// That function will remove leading zeros and make sure that the number is positive. -// Return Type: IN16 -// > 0 count bytes -// == 0 failure unless count was zero -INT16 -ASN1PushUINT(ASN1MarshalContext* ctx, UINT32 integer) -{ - BYTE marshaled[4]; - UINT32_TO_BYTE_ARRAY(integer, marshaled); - return ASN1PushInteger(ctx, 4, marshaled); -} - -//*** ASN1PushInteger -// Push a big-endian integer on the end of the buffer -// Return Type: UINT16 -// > 0 the number of bytes marshaled for the integer -// == 0 failure -INT16 -ASN1PushInteger(ASN1MarshalContext* ctx, // IN/OUT: buffer context - INT16 iLen, // IN: octets of the integer - BYTE* integer // IN: big-endian integer -) -{ - // no leading 0's - while((*integer == 0) && (--iLen > 0)) - integer++; - // Move the bytes to the buffer - ASN1PushBytes(ctx, iLen, integer); - // if needed, add a leading byte of 0 to make the number positive - if(*integer & 0x80) - iLen += (INT16)ASN1PushByte(ctx, 0); - // PushTagAndLenght just tells how many octets it added so the total size of this - // element is the sum of those octets and the adjusted input size. - iLen += ASN1PushTagAndLength(ctx, ASN1_INTEGER, iLen); - return iLen; -} - -//*** ASN1PushOID() -// This function is used to add an OID. An OID is 0x06 followed by a byte of size -// followed by size bytes. This is used to avoid having to do anything special in the -// definition of an OID. -// Return Type: UINT16 -// > 0 the number of bytes marshaled for the integer -// == 0 failure -INT16 -ASN1PushOID(ASN1MarshalContext* ctx, const BYTE* OID) -{ - if((*OID == ASN1_OBJECT_IDENTIFIER) && ((OID[1] & 0x80) == 0)) - { - return ASN1PushBytes(ctx, OID[1] + 2, OID); - } - ctx->offset = -1; - return 0; -} - -#endif // CC_CertifyX509 diff --git a/TPMCmd/tpm/src/X509/X509_ECC.c b/TPMCmd/tpm/src/X509/X509_ECC.c deleted file mode 100644 index c6a73ab..0000000 --- a/TPMCmd/tpm/src/X509/X509_ECC.c +++ /dev/null @@ -1,109 +0,0 @@ -//** Includes -#include "Tpm.h" -#include "X509.h" -#include "OIDs.h" -#include "TpmASN1_fp.h" -#include "X509_ECC_fp.h" -#include "X509_spt_fp.h" -#include "CryptHash_fp.h" - -#if ALG_ECC && CC_CertifyX509 - -//** Functions - -//*** X509PushPoint() -// This seems like it might be used more than once so... -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509PushPoint(ASN1MarshalContext* ctx, TPMS_ECC_POINT* p) -{ - // Push a bit string containing the public key. For now, push the x, and y - // coordinates of the public point, bottom up - ASN1StartMarshalContext(ctx); // BIT STRING - { - ASN1PushBytes(ctx, p->y.t.size, p->y.t.buffer); - ASN1PushBytes(ctx, p->x.t.size, p->x.t.buffer); - ASN1PushByte(ctx, 0x04); - } - return ASN1EndEncapsulation(ctx, ASN1_BITSTRING); // Ends BIT STRING -} - -//*** X509AddSigningAlgorithmECC() -// This creates the singing algorithm data. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddSigningAlgorithmECC( - OBJECT* signKey, TPMT_SIG_SCHEME* scheme, ASN1MarshalContext* ctx) -{ - PHASH_DEF hashDef = CryptGetHashDef(scheme->details.any.hashAlg); - // - NOT_REFERENCED(signKey); - // If the desired hashAlg definition wasn't found... - if(hashDef->hashAlg != scheme->details.any.hashAlg) - return 0; - - switch(scheme->scheme) - { -#if ALG_ECDSA - case TPM_ALG_ECDSA: - // Make sure that we have an OID for this hash and ECC - if((hashDef->ECDSA)[0] != ASN1_OBJECT_IDENTIFIER) - break; - // if this is just an implementation check, indicate that this - // combination is supported - if(!ctx) - return 1; - ASN1StartMarshalContext(ctx); - ASN1PushOID(ctx, hashDef->ECDSA); - return ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); -#endif // ALG_ECDSA - default: - break; - } - return 0; -} - -//*** X509AddPublicECC() -// This function will add the publicKey description to the DER data. If ctx is -// NULL, then no data is transferred and this function will indicate if the TPM -// has the values for DER-encoding of the public key. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddPublicECC(OBJECT* object, ASN1MarshalContext* ctx) -{ - const BYTE* curveOid = - CryptEccGetOID(object->publicArea.parameters.eccDetail.curveID); - if((curveOid == NULL) || (*curveOid != ASN1_OBJECT_IDENTIFIER)) - return 0; - // - // - // SEQUENCE (2 elem) 1st - // SEQUENCE (2 elem) 2nd - // OBJECT IDENTIFIER 1.2.840.10045.2.1 ecPublicKey (ANSI X9.62 public key type) - // OBJECT IDENTIFIER 1.2.840.10045.3.1.7 prime256v1 (ANSI X9.62 named curve) - // BIT STRING (520 bit) 000001001010000111010101010111001001101101000100000010... - // - // If this is a check to see if the key can be encoded, it can. - // Need to mark the end sequence - if(ctx == NULL) - return 1; - ASN1StartMarshalContext(ctx); // SEQUENCE (2 elem) 1st - { - X509PushPoint(ctx, &object->publicArea.unique.ecc); // BIT STRING - ASN1StartMarshalContext(ctx); // SEQUENCE (2 elem) 2nd - { - ASN1PushOID(ctx, curveOid); // curve dependent - ASN1PushOID(ctx, OID_ECC_PUBLIC); // (1.2.840.10045.2.1) - } - ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); // Ends SEQUENCE 2nd - } - return ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); // Ends SEQUENCE 1st -} - -#endif // #if ALG_ECC && CC_CertifyX509 diff --git a/TPMCmd/tpm/src/X509/X509_RSA.c b/TPMCmd/tpm/src/X509/X509_RSA.c deleted file mode 100644 index 309e3c5..0000000 --- a/TPMCmd/tpm/src/X509/X509_RSA.c +++ /dev/null @@ -1,196 +0,0 @@ -//** Includes -#include "Tpm.h" -#include "X509.h" -#include "TpmASN1_fp.h" -#include "X509_RSA_fp.h" -#include "X509_spt_fp.h" -#include "CryptHash_fp.h" -#include "CryptRsa_fp.h" - -//** Functions - -#if ALG_RSA && CC_CertifyX509 - -//*** X509AddSigningAlgorithmRSA() -// This creates the singing algorithm data. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddSigningAlgorithmRSA( - OBJECT* signKey, TPMT_SIG_SCHEME* scheme, ASN1MarshalContext* ctx) -{ - TPM_ALG_ID hashAlg = scheme->details.any.hashAlg; - PHASH_DEF hashDef = CryptGetHashDef(hashAlg); - // - NOT_REFERENCED(signKey); - // return failure if hash isn't implemented - if(hashDef->hashAlg != hashAlg) - return 0; - switch(scheme->scheme) - { - case TPM_ALG_RSASSA: - { - // if the hash is implemented but there is no PKCS1 OID defined - // then this is not a valid signing combination. - if(hashDef->PKCS1[0] != ASN1_OBJECT_IDENTIFIER) - break; - if(ctx == NULL) - return 1; - return X509PushAlgorithmIdentifierSequence(ctx, hashDef->PKCS1); - } - case TPM_ALG_RSAPSS: - // leave if this is just an implementation check - if(ctx == NULL) - return 1; - // In the case of SHA1, everything is default and RFC4055 says that - // implementations that do signature generation MUST omit the parameter - // when defaults are used. )-: - if(hashDef->hashAlg == TPM_ALG_SHA1) - { - return X509PushAlgorithmIdentifierSequence(ctx, OID_RSAPSS); - } - else - { - // Going to build something that looks like: - // SEQUENCE (2 elem) - // OBJECT IDENTIFIER 1.2.840.113549.1.1.10 rsaPSS (PKCS #1) - // SEQUENCE (3 elem) - // [0] (1 elem) - // SEQUENCE (2 elem) - // OBJECT IDENTIFIER 2.16.840.1.101.3.4.2.1 sha-256 - // NULL - // [1] (1 elem) - // SEQUENCE (2 elem) - // OBJECT IDENTIFIER 1.2.840.113549.1.1.8 pkcs1-MGF - // SEQUENCE (2 elem) - // OBJECT IDENTIFIER 2.16.840.1.101.3.4.2.1 sha-256 - // NULL - // [2] (1 elem) salt length - // INTEGER 32 - - // The indentation is just to keep track of where we are in the - // structure - ASN1StartMarshalContext(ctx); // SEQUENCE (2 elements) - { - ASN1StartMarshalContext(ctx); // SEQUENCE (3 elements) - { - // [2] (1 elem) salt length - // INTEGER 32 - ASN1StartMarshalContext(ctx); - { - INT16 saltSize = CryptRsaPssSaltSize( - (INT16)hashDef->digestSize, - (INT16)signKey->publicArea.unique.rsa.t.size); - ASN1PushUINT(ctx, saltSize); - } - ASN1EndEncapsulation(ctx, ASN1_APPLICAIION_SPECIFIC + 2); - - // Add the mask generation algorithm - // [1] (1 elem) - // SEQUENCE (2 elem) 1st - // OBJECT IDENTIFIER 1.2.840.113549.1.1.8 pkcs1-MGF - // SEQUENCE (2 elem) 2nd - // OBJECT IDENTIFIER 2.16.840.1.101.3.4.2.1 sha-256 - // NULL - ASN1StartMarshalContext(ctx); // mask context [1] (1 elem) - { - ASN1StartMarshalContext(ctx); // SEQUENCE (2 elem) 1st - // Handle the 2nd Sequence (sequence (object, null)) - { - // This adds a NULL, then an OID and a SEQUENCE - // wrapper. - X509PushAlgorithmIdentifierSequence(ctx, - hashDef->OID); - // add the pkcs1-MGF OID - ASN1PushOID(ctx, OID_MGF1); - } - // End outer sequence - ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); - } - // End the [1] - ASN1EndEncapsulation(ctx, ASN1_APPLICAIION_SPECIFIC + 1); - - // Add the hash algorithm - // [0] (1 elem) - // SEQUENCE (2 elem) (done by - // X509PushAlgorithmIdentifierSequence) - // OBJECT IDENTIFIER 2.16.840.1.101.3.4.2.1 sha-256 (NIST) - // NULL - ASN1StartMarshalContext(ctx); // [0] (1 elem) - { - X509PushAlgorithmIdentifierSequence(ctx, hashDef->OID); - } - ASN1EndEncapsulation(ctx, (ASN1_APPLICAIION_SPECIFIC + 0)); - } - // SEQUENCE (3 elements) end - ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); - - // RSA PSS OID - // OBJECT IDENTIFIER 1.2.840.113549.1.1.10 rsaPSS (PKCS #1) - ASN1PushOID(ctx, OID_RSAPSS); - } - // End Sequence (2 elements) - return ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); - } - default: - break; - } - return 0; -} - -//*** X509AddPublicRSA() -// This function will add the publicKey description to the DER data. If fillPtr is -// NULL, then no data is transferred and this function will indicate if the TPM -// has the values for DER-encoding of the public key. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddPublicRSA(OBJECT* object, ASN1MarshalContext* ctx) -{ - UINT32 exp = object->publicArea.parameters.rsaDetail.exponent; - // - /* - SEQUENCE (2 elem) 1st - SEQUENCE (2 elem) 2nd - OBJECT IDENTIFIER 1.2.840.113549.1.1.1 rsaEncryption (PKCS #1) - NULL - BIT STRING (1 elem) - SEQUENCE (2 elem) 3rd - INTEGER (2048 bit) 2197304513741227955725834199357401 - INTEGER 65537 -*/ - // If this is a check to see if the key can be encoded, it can. - // Need to mark the end sequence - if(ctx == NULL) - return 1; - ASN1StartMarshalContext(ctx); // SEQUENCE (2 elem) 1st - ASN1StartMarshalContext(ctx); // BIT STRING - ASN1StartMarshalContext(ctx); // SEQUENCE *(2 elem) 3rd - - // Get public exponent in big-endian byte order. - if(exp == 0) - exp = RSA_DEFAULT_PUBLIC_EXPONENT; - - // Push a 4 byte integer. This might get reduced if there are leading zeros or - // extended if the high order byte is negative. - ASN1PushUINT(ctx, exp); - // Push the public key as an integer - ASN1PushInteger(ctx, - object->publicArea.unique.rsa.t.size, - object->publicArea.unique.rsa.t.buffer); - // Embed this in a SEQUENCE tag and length in for the key, exponent sequence - ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); // SEQUENCE (3rd) - - // Embed this in a BIT STRING - ASN1EndEncapsulation(ctx, ASN1_BITSTRING); - - // Now add the formatted SEQUENCE for the RSA public key OID. This is a - // fully constructed value so it doesn't need to have a context started - X509PushAlgorithmIdentifierSequence(ctx, OID_PKCS1_PUB); - - return ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); -} - -#endif // ALG_RSA && CC_CertifyX509 diff --git a/TPMCmd/tpm/src/X509/X509_spt.c b/TPMCmd/tpm/src/X509/X509_spt.c deleted file mode 100644 index 6fc5850..0000000 --- a/TPMCmd/tpm/src/X509/X509_spt.c +++ /dev/null @@ -1,261 +0,0 @@ -//** Includes -#include "Tpm.h" -#include "TpmASN1.h" -#include "TpmASN1_fp.h" -#define _X509_SPT_ -#include "X509.h" -#include "X509_spt_fp.h" -#if ALG_RSA -# include "X509_RSA_fp.h" -#endif // ALG_RSA -#if ALG_ECC -# include "X509_ECC_fp.h" -#endif // ALG_ECC -#if ALG_SM2 -//# include "X509_SM2_fp.h" -#endif // ALG_RSA - -#if CC_CertifyX509 - -//** Unmarshaling Functions - -//*** X509FindExtensionByOID() -// This will search a list of X509 extensions to find an extension with the -// requested OID. If the extension is found, the output context ('ctx') is set up -// to point to the OID in the extension. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure (could be catastrophic) -BOOL X509FindExtensionByOID(ASN1UnmarshalContext* ctxIn, // IN: the context to search - ASN1UnmarshalContext* ctx, // OUT: the extension context - const BYTE* OID // IN: oid to search for -) -{ - INT16 length; - // - pAssert_BOOL(ctxIn != NULL); - // Make the search non-destructive of the input if ctx provided. Otherwise, use - // the provided context. - if(ctx == NULL) - ctx = ctxIn; - // if the provided search context is different from the context of the extension, - // then copy the search context to the search context. - else if(ctx != ctxIn) - *ctx = *ctxIn; - // Now, search in the extension context - for(; ctx->size > ctx->offset; ctx->offset += length) - { - GOTO_ERROR_UNLESS((length = ASN1NextTag(ctx)) >= 0); - // If this is not a constructed sequence, then it doesn't belong - // in the extensions. - GOTO_ERROR_UNLESS(ctx->tag == ASN1_CONSTRUCTED_SEQUENCE); - // Make sure that this entry could hold the OID - if(length >= OID_SIZE(OID)) - { - // See if this is a match for the provided object identifier. - if(MemoryEqual(OID, &(ctx->buffer[ctx->offset]), OID_SIZE(OID))) - { - // Return with ' ctx' set to point to the start of the OID with the size - // set to be the size of the SEQUENCE - ctx->buffer += ctx->offset; - ctx->offset = 0; - ctx->size = length; - return TRUE; - } - } - } - GOTO_ERROR_UNLESS(ctx->offset == ctx->size); - return FALSE; -Error: - ctxIn->size = -1; - ctx->size = -1; - return FALSE; -} - -//*** X509GetExtensionBits() -// This function will extract a bit field from an extension. If the extension doesn't -// contain a bit string, it will fail. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -UINT32 -X509GetExtensionBits(ASN1UnmarshalContext* ctx, UINT32* value) -{ - INT16 length; - // - while(((length = ASN1NextTag(ctx)) > 0) && (ctx->size > ctx->offset)) - { - // Since this is an extension, the extension value will be in an OCTET STRING - if(ctx->tag == ASN1_OCTET_STRING) - { - return ASN1GetBitStringValue(ctx, value); - } - ctx->offset += length; - } - ctx->size = -1; - return FALSE; -} - -//***X509ProcessExtensions() -// This function is used to process the TPMA_OBJECT and KeyUsage extensions. It is not -// in the CertifyX509.c code because it makes the code harder to follow. -// Return Type: TPM_RC -// TPM_RCS_ATTRIBUTES the attributes of object are not consistent with -// the extension setting -// TPM_RC_VALUE problem parsing the extensions -TPM_RC -X509ProcessExtensions( - OBJECT* object, // IN: The object with the attributes to - // check - stringRef* extension // IN: The start and length of the extensions -) -{ - ASN1UnmarshalContext ctx; - ASN1UnmarshalContext extensionCtx; - INT16 length; - UINT32 value; - TPMA_OBJECT attributes = object->publicArea.objectAttributes; - // - if(!ASN1UnmarshalContextInitialize(&ctx, extension->len, extension->buf) - || ((length = ASN1NextTag(&ctx)) < 0) || (ctx.tag != X509_EXTENSIONS)) - return TPM_RCS_VALUE; - if(((length = ASN1NextTag(&ctx)) < 0) || (ctx.tag != (ASN1_CONSTRUCTED_SEQUENCE))) - return TPM_RCS_VALUE; - - // Get the extension for the TPMA_OBJECT if there is one - if(X509FindExtensionByOID(&ctx, &extensionCtx, OID_TCG_TPMA_OBJECT) - && X509GetExtensionBits(&extensionCtx, &value)) - { - // If an keyAttributes extension was found, it must be exactly the same as the - // attributes of the object. - // NOTE: MemoryEqual() is used rather than a simple UINT32 compare to avoid - // type-punned pointer warning/error. - if(!MemoryEqual(&value, &attributes, sizeof(value))) - return TPM_RCS_ATTRIBUTES; - } - // Make sure the failure to find the value wasn't because of a fatal error - else if(extensionCtx.size < 0) - return TPM_RCS_VALUE; - - // Get the keyUsage extension. This one is required - if(X509FindExtensionByOID(&ctx, &extensionCtx, OID_KEY_USAGE_EXTENSION) - && X509GetExtensionBits(&extensionCtx, &value)) - { - x509KeyUsageUnion keyUsage; - BOOL badSign; - BOOL badDecrypt; - BOOL badFixedTPM; - BOOL badRestricted; - - // - keyUsage.integer = value; - - // see if any reserved bits are set - if(keyUsage.integer & ~(TPMA_X509_KEY_USAGE_ALLOWED_BITS)) - return TPM_RCS_RESERVED_BITS; - - // For KeyUsage: - // 1) 'sign' is SET if Key Usage includes signing - badSign = ((KEY_USAGE_SIGN.integer & keyUsage.integer) != 0) - && !IS_ATTRIBUTE(attributes, TPMA_OBJECT, sign); - // 2) 'decrypt' is SET if Key Usage includes decryption uses - badDecrypt = ((KEY_USAGE_DECRYPT.integer & keyUsage.integer) != 0) - && !IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt); - // 3) 'fixedTPM' is SET if Key Usage is non-repudiation - badFixedTPM = IS_ATTRIBUTE(keyUsage.x509, TPMA_X509_KEY_USAGE, nonrepudiation) - && !IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedTPM); - // 4)'restricted' is SET if Key Usage is for key encipherment. - badRestricted = - IS_ATTRIBUTE(keyUsage.x509, TPMA_X509_KEY_USAGE, keyEncipherment) - && !IS_ATTRIBUTE(attributes, TPMA_OBJECT, restricted); - if(badSign || badDecrypt || badFixedTPM || badRestricted) - return TPM_RCS_VALUE; - } - else - // The KeyUsage extension is required - return TPM_RCS_VALUE; - - return TPM_RC_SUCCESS; -} - -//** Marshaling Functions - -//*** X509AddSigningAlgorithm() -// This creates the singing algorithm data. -// Return Type: INT16 -// > 0 number of octets added -// <= 0 failure -INT16 -X509AddSigningAlgorithm( - ASN1MarshalContext* ctx, OBJECT* signKey, TPMT_SIG_SCHEME* scheme) -{ - switch(signKey->publicArea.type) - { -# if ALG_RSA - case TPM_ALG_RSA: - return X509AddSigningAlgorithmRSA(signKey, scheme, ctx); -# endif // ALG_RSA -# if ALG_ECC - case TPM_ALG_ECC: - return X509AddSigningAlgorithmECC(signKey, scheme, ctx); -# endif // ALG_ECC -# if ALG_SM2 - case TPM_ALG_SM2: - break; // no signing algorithm for SM2 yet -// return X509AddSigningAlgorithmSM2(signKey, scheme, ctx); -# endif // ALG_SM2 - default: - break; - } - return 0; -} - -//*** X509AddPublicKey() -// This function will add the publicKey description to the DER data. If fillPtr is -// NULL, then no data is transferred and this function will indicate if the TPM -// has the values for DER-encoding of the public key. -// Return Type: INT16 -// > 0 number of octets added -// == 0 failure -INT16 -X509AddPublicKey(ASN1MarshalContext* ctx, OBJECT* object) -{ - switch(object->publicArea.type) - { -# if ALG_RSA - case TPM_ALG_RSA: - return X509AddPublicRSA(object, ctx); -# endif -# if ALG_ECC - case TPM_ALG_ECC: - return X509AddPublicECC(object, ctx); -# endif -# if ALG_SM2 - case TPM_ALG_SM2: - break; -# endif - default: - break; - } - return FALSE; -} - -//*** X509PushAlgorithmIdentifierSequence() -// The function adds the algorithm identifier sequence. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509PushAlgorithmIdentifierSequence(ASN1MarshalContext* ctx, const BYTE* OID) -{ - // An algorithm ID sequence is: - // SEQUENCE - // OID - // NULL - ASN1StartMarshalContext(ctx); // hash algorithm - ASN1PushNull(ctx); - ASN1PushOID(ctx, OID); - return ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); -} - -#endif // CC_CertifyX509 diff --git a/TPMCmd/tpm/src/command/Asymmetric/ECC_Decrypt.c b/TPMCmd/tpm/src/command/Asymmetric/ECC_Decrypt.c index 2e0c39a..e850cee 100644 --- a/TPMCmd/tpm/src/command/Asymmetric/ECC_Decrypt.c +++ b/TPMCmd/tpm/src/command/Asymmetric/ECC_Decrypt.c @@ -33,4 +33,4 @@ TPM2_ECC_Decrypt(ECC_Decrypt_In* in, // IN: input parameter list key, &in->inScheme, &out->plainText, &in->C1.point, &in->C2, &in->C3); } -#endif // CC_ECC_Decrypt \ No newline at end of file +#endif // CC_ECC_Decrypt diff --git a/TPMCmd/tpm/src/command/Asymmetric/ECC_Encrypt.c b/TPMCmd/tpm/src/command/Asymmetric/ECC_Encrypt.c index 4f3c7d2..f59ccf0 100644 --- a/TPMCmd/tpm/src/command/Asymmetric/ECC_Encrypt.c +++ b/TPMCmd/tpm/src/command/Asymmetric/ECC_Encrypt.c @@ -26,4 +26,4 @@ TPM2_ECC_Encrypt(ECC_Encrypt_In* in, // IN: input parameter list pubKey, &in->inScheme, &in->plainText, &out->C1.point, &out->C2, &out->C3); } -#endif // CC_ECC_Encrypt \ No newline at end of file +#endif // CC_ECC_Encrypt diff --git a/TPMCmd/tpm/src/command/Asymmetric/ECC_Parameters.c b/TPMCmd/tpm/src/command/Asymmetric/ECC_Parameters.c index d233cd2..373a2f9 100644 --- a/TPMCmd/tpm/src/command/Asymmetric/ECC_Parameters.c +++ b/TPMCmd/tpm/src/command/Asymmetric/ECC_Parameters.c @@ -23,4 +23,4 @@ TPM2_ECC_Parameters(ECC_Parameters_In* in, // IN: input parameter list return TPM_RCS_VALUE + RC_ECC_Parameters_curveID; } -#endif // CC_ECC_Parameters \ No newline at end of file +#endif // CC_ECC_Parameters diff --git a/TPMCmd/tpm/src/command/Asymmetric/ECDH_KeyGen.c b/TPMCmd/tpm/src/command/Asymmetric/ECDH_KeyGen.c index 60c4be8..dda67ee 100644 --- a/TPMCmd/tpm/src/command/Asymmetric/ECDH_KeyGen.c +++ b/TPMCmd/tpm/src/command/Asymmetric/ECDH_KeyGen.c @@ -57,4 +57,4 @@ TPM2_ECDH_KeyGen(ECDH_KeyGen_In* in, // IN: input parameter list return result; } -#endif // CC_ECDH_KeyGen \ No newline at end of file +#endif // CC_ECDH_KeyGen diff --git a/TPMCmd/tpm/src/command/Asymmetric/ECDH_ZGen.c b/TPMCmd/tpm/src/command/Asymmetric/ECDH_ZGen.c index 443a5c3..b51161a 100644 --- a/TPMCmd/tpm/src/command/Asymmetric/ECDH_ZGen.c +++ b/TPMCmd/tpm/src/command/Asymmetric/ECDH_ZGen.c @@ -50,4 +50,4 @@ TPM2_ECDH_ZGen(ECDH_ZGen_In* in, // IN: input parameter list return result; } -#endif // CC_ECDH_ZGen \ No newline at end of file +#endif // CC_ECDH_ZGen diff --git a/TPMCmd/tpm/src/command/Asymmetric/EC_Ephemeral.c b/TPMCmd/tpm/src/command/Asymmetric/EC_Ephemeral.c index 5ff2245..c532613 100644 --- a/TPMCmd/tpm/src/command/Asymmetric/EC_Ephemeral.c +++ b/TPMCmd/tpm/src/command/Asymmetric/EC_Ephemeral.c @@ -35,4 +35,4 @@ TPM2_EC_Ephemeral(EC_Ephemeral_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_EC_Ephemeral \ No newline at end of file +#endif // CC_EC_Ephemeral diff --git a/TPMCmd/tpm/src/command/Asymmetric/RSA_Decrypt.c b/TPMCmd/tpm/src/command/Asymmetric/RSA_Decrypt.c index e1828b9..b5fa516 100644 --- a/TPMCmd/tpm/src/command/Asymmetric/RSA_Decrypt.c +++ b/TPMCmd/tpm/src/command/Asymmetric/RSA_Decrypt.c @@ -69,4 +69,4 @@ TPM2_RSA_Decrypt(RSA_Decrypt_In* in, // IN: input parameter list return result; } -#endif // CC_RSA_Decrypt \ No newline at end of file +#endif // CC_RSA_Decrypt diff --git a/TPMCmd/tpm/src/command/Asymmetric/RSA_Encrypt.c b/TPMCmd/tpm/src/command/Asymmetric/RSA_Encrypt.c index 19cb6b8..bd159f6 100644 --- a/TPMCmd/tpm/src/command/Asymmetric/RSA_Encrypt.c +++ b/TPMCmd/tpm/src/command/Asymmetric/RSA_Encrypt.c @@ -53,4 +53,4 @@ TPM2_RSA_Encrypt(RSA_Encrypt_In* in, // IN: input parameter list return result; } -#endif // CC_RSA_Encrypt \ No newline at end of file +#endif // CC_RSA_Encrypt diff --git a/TPMCmd/tpm/src/command/Asymmetric/ZGen_2Phase.c b/TPMCmd/tpm/src/command/Asymmetric/ZGen_2Phase.c index cfa368f..73a66d3 100644 --- a/TPMCmd/tpm/src/command/Asymmetric/ZGen_2Phase.c +++ b/TPMCmd/tpm/src/command/Asymmetric/ZGen_2Phase.c @@ -83,4 +83,4 @@ TPM2_ZGen_2Phase(ZGen_2Phase_In* in, // IN: input parameter list return result; } -#endif // CC_ZGen_2Phase \ No newline at end of file +#endif // CC_ZGen_2Phase diff --git a/TPMCmd/tpm/src/command/AttachedComponent/AC_GetCapability.c b/TPMCmd/tpm/src/command/AttachedComponent/AC_GetCapability.c index eb45640..b5999a2 100644 --- a/TPMCmd/tpm/src/command/AttachedComponent/AC_GetCapability.c +++ b/TPMCmd/tpm/src/command/AttachedComponent/AC_GetCapability.c @@ -19,4 +19,4 @@ TPM2_AC_GetCapability(AC_GetCapability_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_AC_GetCapability \ No newline at end of file +#endif // CC_AC_GetCapability diff --git a/TPMCmd/tpm/src/command/AttachedComponent/AC_Send.c b/TPMCmd/tpm/src/command/AttachedComponent/AC_Send.c index ed1b6ac..4dccc12 100644 --- a/TPMCmd/tpm/src/command/AttachedComponent/AC_Send.c +++ b/TPMCmd/tpm/src/command/AttachedComponent/AC_Send.c @@ -63,4 +63,4 @@ TPM2_AC_Send(AC_Send_In* in, // IN: input parameter list return AcSendObject(in->ac, object, &out->acDataOut); } -#endif // TPM_CC_AC_Send \ No newline at end of file +#endif // TPM_CC_AC_Send diff --git a/TPMCmd/tpm/src/command/AttachedComponent/Policy_AC_SendSelect.c b/TPMCmd/tpm/src/command/AttachedComponent/Policy_AC_SendSelect.c index 966c64e..7bd13c0 100644 --- a/TPMCmd/tpm/src/command/AttachedComponent/Policy_AC_SendSelect.c +++ b/TPMCmd/tpm/src/command/AttachedComponent/Policy_AC_SendSelect.c @@ -78,4 +78,4 @@ TPM2_Policy_AC_SendSelect(Policy_AC_SendSelect_In* in // IN: input parameter li return TPM_RC_SUCCESS; } -#endif // CC_Policy_AC_SendSelect \ No newline at end of file +#endif // CC_Policy_AC_SendSelect diff --git a/TPMCmd/tpm/src/command/Attestation/Attest_spt.c b/TPMCmd/tpm/src/command/Attestation/Attest_spt.c index da0efa4..ee995ce 100644 --- a/TPMCmd/tpm/src/command/Attestation/Attest_spt.c +++ b/TPMCmd/tpm/src/command/Attestation/Attest_spt.c @@ -166,4 +166,4 @@ BOOL IsSigningObject(OBJECT* object // IN: return ((object == NULL) || ((IS_ATTRIBUTE(object->publicArea.objectAttributes, TPMA_OBJECT, sign) && object->publicArea.type != TPM_ALG_SYMCIPHER))); -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/command/Attestation/Certify.c b/TPMCmd/tpm/src/command/Attestation/Certify.c index f879ade..2750fe2 100644 --- a/TPMCmd/tpm/src/command/Attestation/Certify.c +++ b/TPMCmd/tpm/src/command/Attestation/Certify.c @@ -60,4 +60,4 @@ TPM2_Certify(Certify_In* in, // IN: input parameter list &out->signature); } -#endif // CC_Certify \ No newline at end of file +#endif // CC_Certify diff --git a/TPMCmd/tpm/src/command/Attestation/CertifyCreation.c b/TPMCmd/tpm/src/command/Attestation/CertifyCreation.c index d44975f..85e3fd2 100644 --- a/TPMCmd/tpm/src/command/Attestation/CertifyCreation.c +++ b/TPMCmd/tpm/src/command/Attestation/CertifyCreation.c @@ -68,4 +68,4 @@ TPM2_CertifyCreation(CertifyCreation_In* in, // IN: input parameter list &out->signature); } -#endif // CC_CertifyCreation \ No newline at end of file +#endif // CC_CertifyCreation diff --git a/TPMCmd/tpm/src/command/Attestation/CertifyX509.c b/TPMCmd/tpm/src/command/Attestation/CertifyX509.c deleted file mode 100644 index 748f583..0000000 --- a/TPMCmd/tpm/src/command/Attestation/CertifyX509.c +++ /dev/null @@ -1,255 +0,0 @@ -#include "Tpm.h" -#include "CertifyX509_fp.h" -#include "X509.h" -#include "TpmASN1_fp.h" -#include "X509_spt_fp.h" -#include "Attest_spt_fp.h" -#if CERTIFYX509_DEBUG -// TODO_RENAME_INC_FOLDER:platform_interface refers to the TPM_CoreLib platform interface -# include -#endif - -#if CC_CertifyX509 // Conditional expansion of this file - -/*(See part 3 specification) -// Certify using an X509-formatted certificate -*/ -// return type: TPM_RC -// TPM_RC_ATTRIBUTES the attributes of 'objectHandle' are not compatible -// with the KeyUsage or TPMA_OBJECT values in the -// extensions fields -// TPM_RC_BINDING the public and private portions of the key are not -// properly bound. -// TPM_RC_HASH the hash algorithm in the scheme is not supported -// TPM_RC_KEY 'signHandle' does not reference a signing key; -// TPM_RC_SCHEME the scheme is not compatible with sign key type, -// or input scheme is not compatible with default -// scheme, or the chosen scheme is not a valid -// sign scheme -// TPM_RC_VALUE most likely a problem with the format of -// 'partialCertificate' -TPM_RC -TPM2_CertifyX509(CertifyX509_In* in, // IN: input parameter list - CertifyX509_Out* out // OUT: output parameter list -) -{ - TPM_RC result; - OBJECT* signKey = HandleToObject(in->signHandle); - OBJECT* object = HandleToObject(in->objectHandle); - HASH_STATE hash; - INT16 length; // length for a tagged element - ASN1UnmarshalContext ctx; - ASN1MarshalContext ctxOut; - pAssert_RC(object != NULL); - - // certTBS holds an array of pointers and lengths. Each entry references the - // corresponding value in a TBSCertificate structure. For example, the 1th - // element references the version number - stringRef certTBS[REF_COUNT] = {{0}}; -# define ALLOWED_SEQUENCES (SUBJECT_PUBLIC_KEY_REF - SIGNATURE_REF) - stringRef partial[ALLOWED_SEQUENCES] = {{0}}; - INT16 countOfSequences = 0; - INT16 i; - // -# if CERTIFYX509_DEBUG - DebugFileInit(); - DebugDumpBuffer(in->partialCertificate.t.size, - in->partialCertificate.t.buffer, - "partialCertificate"); -# endif - - // Input Validation - if(in->reserved.b.size != 0) - return TPM_RC_SIZE + RC_CertifyX509_reserved; - // signing key must be able to sign - if(!IsSigningObject(signKey)) - return TPM_RCS_KEY + RC_CertifyX509_signHandle; - // Pick a scheme for sign. If the input sign scheme is not compatible with - // the default scheme, return an error. - if(!CryptSelectSignScheme(signKey, &in->inScheme)) - return TPM_RCS_SCHEME + RC_CertifyX509_inScheme; - // Make sure that the public Key encoding is known - if(X509AddPublicKey(NULL, object) == 0) - return TPM_RCS_ASYMMETRIC + RC_CertifyX509_objectHandle; - // Unbundle 'partialCertificate'. - // Initialize the unmarshaling context - if(!ASN1UnmarshalContextInitialize( - &ctx, in->partialCertificate.t.size, in->partialCertificate.t.buffer)) - return TPM_RCS_VALUE + RC_CertifyX509_partialCertificate; - // Make sure that this is a constructed SEQUENCE - length = ASN1NextTag(&ctx); - // Must be a constructed SEQUENCE that uses all of the input parameter - if((ctx.tag != (ASN1_CONSTRUCTED_SEQUENCE)) - || ((ctx.offset + length) != in->partialCertificate.t.size)) - return TPM_RCS_SIZE + RC_CertifyX509_partialCertificate; - - // This scans through the contents of the outermost SEQUENCE. This would be the - // 'issuer', 'validity', 'subject', 'issuerUniqueID' (optional), - // 'subjectUniqueID' (optional), and 'extensions.' - while(ctx.offset < ctx.size) - { - INT16 startOfElement = ctx.offset; - // - // Read the next tag and length field. - length = ASN1NextTag(&ctx); - if(length < 0) - break; - if(ctx.tag == ASN1_CONSTRUCTED_SEQUENCE) - { - if(countOfSequences < ALLOWED_SEQUENCES) - { - partial[countOfSequences].buf = &ctx.buffer[startOfElement]; - ctx.offset += length; - partial[countOfSequences].len = (INT16)ctx.offset - startOfElement; - } - countOfSequences++; - if(countOfSequences > ALLOWED_SEQUENCES) - break; - } - else if(ctx.tag == X509_EXTENSIONS) - { - if(certTBS[EXTENSIONS_REF].len != 0) - return TPM_RCS_VALUE + RC_CertifyX509_partialCertificate; - certTBS[EXTENSIONS_REF].buf = &ctx.buffer[startOfElement]; - ctx.offset += length; - certTBS[EXTENSIONS_REF].len = (INT16)ctx.offset - startOfElement; - } - else - return TPM_RCS_VALUE + RC_CertifyX509_partialCertificate; - } - // Make sure that we used all of the data and found at least the required - // number of elements. - if((ctx.offset != ctx.size) || (countOfSequences < 3) || (countOfSequences > 4) - || (certTBS[EXTENSIONS_REF].buf == NULL)) - return TPM_RCS_VALUE + RC_CertifyX509_partialCertificate; - // Now that we know how many sequences there were, we can put them where they - // belong - for(i = 0; i < countOfSequences; i++) - certTBS[SUBJECT_KEY_REF - i] = partial[countOfSequences - 1 - i]; - - // If only three SEQUENCES, then the TPM needs to produce the signature algorithm. - // See if it can - if((countOfSequences == 3) - && (X509AddSigningAlgorithm(NULL, signKey, &in->inScheme) == 0)) - return TPM_RCS_SCHEME + RC_CertifyX509_signHandle; - - // Process the extensions - result = X509ProcessExtensions(object, &certTBS[EXTENSIONS_REF]); - if(result != TPM_RC_SUCCESS) - // If the extension has the TPMA_OBJECT extension and the attributes don't - // match, then the error code will be TPM_RCS_ATTRIBUTES. Otherwise, the error - // indicates a malformed partialCertificate. - return result - + ((result == TPM_RCS_ATTRIBUTES) ? RC_CertifyX509_objectHandle - : RC_CertifyX509_partialCertificate); - // Command Output - // Create the addedToCertificate values - - // Build the addedToCertificate from the bottom up. - // Initialize the context structure - ASN1InitialializeMarshalContext(&ctxOut, - sizeof(out->addedToCertificate.t.buffer), - out->addedToCertificate.t.buffer); - // Place a marker for the overall context - ASN1StartMarshalContext(&ctxOut); // SEQUENCE for addedToCertificate - - // Add the subject public key descriptor - certTBS[SUBJECT_PUBLIC_KEY_REF].len = X509AddPublicKey(&ctxOut, object); - certTBS[SUBJECT_PUBLIC_KEY_REF].buf = ctxOut.buffer + ctxOut.offset; - // If the caller didn't provide the algorithm identifier, create it - if(certTBS[SIGNATURE_REF].len == 0) - { - certTBS[SIGNATURE_REF].len = - X509AddSigningAlgorithm(&ctxOut, signKey, &in->inScheme); - certTBS[SIGNATURE_REF].buf = ctxOut.buffer + ctxOut.offset; - } - // Create the serial number value. Use the out->tbsDigest as scratch. - { - TPM2B* digest = &out->tbsDigest.b; - // - digest->size = (INT16)CryptHashStart(&hash, signKey->publicArea.nameAlg); - pAssert_RC(digest->size != 0); - - // The serial number size is the smaller of the digest and the vendor-defined - // value - digest->size = MIN(digest->size, SIZE_OF_X509_SERIAL_NUMBER); - // Add all the parts of the certificate other than the serial number - // and version number - for(i = SIGNATURE_REF; i < REF_COUNT; i++) - CryptDigestUpdate(&hash, certTBS[i].len, certTBS[i].buf); - // throw in the Name of the signing key... - CryptDigestUpdate2B(&hash, &signKey->name.b); - // ...and the Name of the signed key. - CryptDigestUpdate2B(&hash, &object->name.b); - // Done - CryptHashEnd2B(&hash, digest); - } - - // Add the serial number - certTBS[SERIAL_NUMBER_REF].len = - ASN1PushInteger(&ctxOut, out->tbsDigest.t.size, out->tbsDigest.t.buffer); - certTBS[SERIAL_NUMBER_REF].buf = ctxOut.buffer + ctxOut.offset; - - // Add the static version number - ASN1StartMarshalContext(&ctxOut); - ASN1PushUINT(&ctxOut, 2); - certTBS[VERSION_REF].len = - ASN1EndEncapsulation(&ctxOut, ASN1_APPLICAIION_SPECIFIC); - certTBS[VERSION_REF].buf = ctxOut.buffer + ctxOut.offset; - - // Create a fake tag and length for the TBS in the space used for - // 'addedToCertificate' - { - for(length = 0, i = 0; i < REF_COUNT; i++) - length += certTBS[i].len; - // Put a fake tag and length into the buffer for use in the tbsDigest - certTBS[ENCODED_SIZE_REF].len = - ASN1PushTagAndLength(&ctxOut, ASN1_CONSTRUCTED_SEQUENCE, length); - certTBS[ENCODED_SIZE_REF].buf = ctxOut.buffer + ctxOut.offset; - // Restore the buffer pointer to add back the number of octets used for the - // tag and length - ctxOut.offset += certTBS[ENCODED_SIZE_REF].len; - } - // sanity check - if(ctxOut.offset < 0) - return TPM_RC_FAILURE; - // Create the tbsDigest to sign - out->tbsDigest.t.size = CryptHashStart(&hash, in->inScheme.details.any.hashAlg); - for(i = 0; i < REF_COUNT; i++) - CryptDigestUpdate(&hash, certTBS[i].len, certTBS[i].buf); - CryptHashEnd2B(&hash, &out->tbsDigest.b); - -# if CERTIFYX509_DEBUG - { - BYTE fullTBS[4096]; - BYTE* fill = fullTBS; - int j; - for(j = 0; j < REF_COUNT; j++) - { - MemoryCopy(fill, certTBS[j].buf, certTBS[j].len); - fill += certTBS[j].len; - } - DebugDumpBuffer((int)(fill - &fullTBS[0]), fullTBS, "\nfull TBS"); - } -# endif - - // Finish up the processing of addedToCertificate - // Create the actual tag and length for the addedToCertificate structure - out->addedToCertificate.t.size = - ASN1EndEncapsulation(&ctxOut, ASN1_CONSTRUCTED_SEQUENCE); - // Now move all the addedToContext to the start of the buffer - MemoryCopy(out->addedToCertificate.t.buffer, - ctxOut.buffer + ctxOut.offset, - out->addedToCertificate.t.size); -# if CERTIFYX509_DEBUG - DebugDumpBuffer(out->addedToCertificate.t.size, - out->addedToCertificate.t.buffer, - "\naddedToCertificate"); -# endif - // only thing missing is the signature - result = CryptSign(signKey, &in->inScheme, &out->tbsDigest, &out->signature); - - return result; -} - -#endif // CC_CertifyX509 diff --git a/TPMCmd/tpm/src/command/Attestation/GetCommandAuditDigest.c b/TPMCmd/tpm/src/command/Attestation/GetCommandAuditDigest.c index 5bfb098..b0ec1e0 100644 --- a/TPMCmd/tpm/src/command/Attestation/GetCommandAuditDigest.c +++ b/TPMCmd/tpm/src/command/Attestation/GetCommandAuditDigest.c @@ -64,4 +64,4 @@ TPM2_GetCommandAuditDigest( return result; } -#endif // CC_GetCommandAuditDigest \ No newline at end of file +#endif // CC_GetCommandAuditDigest diff --git a/TPMCmd/tpm/src/command/Attestation/GetSessionAuditDigest.c b/TPMCmd/tpm/src/command/Attestation/GetSessionAuditDigest.c index 1af9a2c..7bbf34d 100644 --- a/TPMCmd/tpm/src/command/Attestation/GetSessionAuditDigest.c +++ b/TPMCmd/tpm/src/command/Attestation/GetSessionAuditDigest.c @@ -61,4 +61,4 @@ TPM2_GetSessionAuditDigest( &out->signature); } -#endif // CC_GetSessionAuditDigest \ No newline at end of file +#endif // CC_GetSessionAuditDigest diff --git a/TPMCmd/tpm/src/command/Attestation/GetTime.c b/TPMCmd/tpm/src/command/Attestation/GetTime.c index ca8cb02..ec7def9 100644 --- a/TPMCmd/tpm/src/command/Attestation/GetTime.c +++ b/TPMCmd/tpm/src/command/Attestation/GetTime.c @@ -56,4 +56,4 @@ TPM2_GetTime(GetTime_In* in, // IN: input parameter list return rc; } -#endif // CC_GetTime \ No newline at end of file +#endif // CC_GetTime diff --git a/TPMCmd/tpm/src/command/Attestation/Quote.c b/TPMCmd/tpm/src/command/Attestation/Quote.c index 1abf739..3d45117 100644 --- a/TPMCmd/tpm/src/command/Attestation/Quote.c +++ b/TPMCmd/tpm/src/command/Attestation/Quote.c @@ -70,4 +70,4 @@ TPM2_Quote(Quote_In* in, // IN: input parameter list return result; } -#endif // CC_Quote \ No newline at end of file +#endif // CC_Quote diff --git a/TPMCmd/tpm/src/command/Capability/GetCapability.c b/TPMCmd/tpm/src/command/Capability/GetCapability.c index 3fdd906..129f62a 100644 --- a/TPMCmd/tpm/src/command/Capability/GetCapability.c +++ b/TPMCmd/tpm/src/command/Capability/GetCapability.c @@ -149,4 +149,4 @@ TPM2_GetCapability(GetCapability_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_GetCapability \ No newline at end of file +#endif // CC_GetCapability diff --git a/TPMCmd/tpm/src/command/Capability/SetCapability.c b/TPMCmd/tpm/src/command/Capability/SetCapability.c index 0918363..9824f7a 100644 --- a/TPMCmd/tpm/src/command/Capability/SetCapability.c +++ b/TPMCmd/tpm/src/command/Capability/SetCapability.c @@ -20,4 +20,4 @@ TPM2_SetCapability(SetCapability_In* in // IN: input parameter list return TPM_RCS_VALUE + SetCapability_setCapabilityData; } -#endif // CC_SetCapability \ No newline at end of file +#endif // CC_SetCapability diff --git a/TPMCmd/tpm/src/command/Capability/TestParms.c b/TPMCmd/tpm/src/command/Capability/TestParms.c index 285fecb..1ed62af 100644 --- a/TPMCmd/tpm/src/command/Capability/TestParms.c +++ b/TPMCmd/tpm/src/command/Capability/TestParms.c @@ -18,4 +18,4 @@ TPM2_TestParms(TestParms_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_TestParms \ No newline at end of file +#endif // CC_TestParms diff --git a/TPMCmd/tpm/src/command/ClockTimer/ACT_SetTimeout.c b/TPMCmd/tpm/src/command/ClockTimer/ACT_SetTimeout.c index 690f507..6cfb6cb 100644 --- a/TPMCmd/tpm/src/command/ClockTimer/ACT_SetTimeout.c +++ b/TPMCmd/tpm/src/command/ClockTimer/ACT_SetTimeout.c @@ -28,4 +28,4 @@ TPM2_ACT_SetTimeout(ACT_SetTimeout_In* in // IN: input parameter list # endif // ACT_SUPPORT } -#endif // CC_ACT_SetTimeout \ No newline at end of file +#endif // CC_ACT_SetTimeout diff --git a/TPMCmd/tpm/src/command/ClockTimer/ClockRateAdjust.c b/TPMCmd/tpm/src/command/ClockTimer/ClockRateAdjust.c index f9eca78..72d4cd2 100644 --- a/TPMCmd/tpm/src/command/ClockTimer/ClockRateAdjust.c +++ b/TPMCmd/tpm/src/command/ClockTimer/ClockRateAdjust.c @@ -17,4 +17,4 @@ TPM2_ClockRateAdjust(ClockRateAdjust_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_ClockRateAdjust \ No newline at end of file +#endif // CC_ClockRateAdjust diff --git a/TPMCmd/tpm/src/command/ClockTimer/ClockSet.c b/TPMCmd/tpm/src/command/ClockTimer/ClockSet.c index cbef7df..99201ed 100644 --- a/TPMCmd/tpm/src/command/ClockTimer/ClockSet.c +++ b/TPMCmd/tpm/src/command/ClockTimer/ClockSet.c @@ -27,4 +27,4 @@ TPM2_ClockSet(ClockSet_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_ClockSet \ No newline at end of file +#endif // CC_ClockSet diff --git a/TPMCmd/tpm/src/command/ClockTimer/ReadClock.c b/TPMCmd/tpm/src/command/ClockTimer/ReadClock.c index a2308d2..dc16ca5 100644 --- a/TPMCmd/tpm/src/command/ClockTimer/ReadClock.c +++ b/TPMCmd/tpm/src/command/ClockTimer/ReadClock.c @@ -18,4 +18,4 @@ TPM2_ReadClock(ReadClock_Out* out // OUT: output parameter list return TPM_RC_SUCCESS; } -#endif // CC_ReadClock \ No newline at end of file +#endif // CC_ReadClock diff --git a/TPMCmd/tpm/src/command/CommandAudit/SetCommandCodeAuditStatus.c b/TPMCmd/tpm/src/command/CommandAudit/SetCommandCodeAuditStatus.c index 2b323c8..391b0e0 100644 --- a/TPMCmd/tpm/src/command/CommandAudit/SetCommandCodeAuditStatus.c +++ b/TPMCmd/tpm/src/command/CommandAudit/SetCommandCodeAuditStatus.c @@ -66,4 +66,4 @@ TPM2_SetCommandCodeAuditStatus( return TPM_RC_SUCCESS; } -#endif // CC_SetCommandCodeAuditStatus \ No newline at end of file +#endif // CC_SetCommandCodeAuditStatus diff --git a/TPMCmd/tpm/src/command/Context/ContextLoad.c b/TPMCmd/tpm/src/command/Context/ContextLoad.c index d945a30..da5eedd 100644 --- a/TPMCmd/tpm/src/command/Context/ContextLoad.c +++ b/TPMCmd/tpm/src/command/Context/ContextLoad.c @@ -166,4 +166,4 @@ TPM2_ContextLoad(ContextLoad_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_ContextLoad \ No newline at end of file +#endif // CC_ContextLoad diff --git a/TPMCmd/tpm/src/command/Context/ContextSave.c b/TPMCmd/tpm/src/command/Context/ContextSave.c index bf7cc31..06c869a 100644 --- a/TPMCmd/tpm/src/command/Context/ContextSave.c +++ b/TPMCmd/tpm/src/command/Context/ContextSave.c @@ -205,4 +205,4 @@ TPM2_ContextSave(ContextSave_In* in, // IN: input parameter list return result; } -#endif // CC_ContextSave \ No newline at end of file +#endif // CC_ContextSave diff --git a/TPMCmd/tpm/src/command/Context/Context_spt.c b/TPMCmd/tpm/src/command/Context/Context_spt.c index 4a6245d..7bcf1f6 100644 --- a/TPMCmd/tpm/src/command/Context/Context_spt.c +++ b/TPMCmd/tpm/src/command/Context/Context_spt.c @@ -228,4 +228,4 @@ void SequenceDataImport( // CryptHashImportState(hash, (EXPORT_HASH_STATE*)importHash); } -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/command/Context/EvictControl.c b/TPMCmd/tpm/src/command/Context/EvictControl.c index 9817aac..209b242 100644 --- a/TPMCmd/tpm/src/command/Context/EvictControl.c +++ b/TPMCmd/tpm/src/command/Context/EvictControl.c @@ -102,4 +102,4 @@ TPM2_EvictControl(EvictControl_In* in // IN: input parameter list return result; } -#endif // CC_EvictControl \ No newline at end of file +#endif // CC_EvictControl diff --git a/TPMCmd/tpm/src/command/Context/FlushContext.c b/TPMCmd/tpm/src/command/Context/FlushContext.c index cbc5a04..e45bcd8 100644 --- a/TPMCmd/tpm/src/command/Context/FlushContext.c +++ b/TPMCmd/tpm/src/command/Context/FlushContext.c @@ -48,4 +48,4 @@ TPM2_FlushContext(FlushContext_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_FlushContext \ No newline at end of file +#endif // CC_FlushContext diff --git a/TPMCmd/tpm/src/command/DA/DictionaryAttackLockReset.c b/TPMCmd/tpm/src/command/DA/DictionaryAttackLockReset.c index 170a2f8..b2ec6e2 100644 --- a/TPMCmd/tpm/src/command/DA/DictionaryAttackLockReset.c +++ b/TPMCmd/tpm/src/command/DA/DictionaryAttackLockReset.c @@ -30,4 +30,4 @@ TPM2_DictionaryAttackLockReset( return TPM_RC_SUCCESS; } -#endif // CC_DictionaryAttackLockReset \ No newline at end of file +#endif // CC_DictionaryAttackLockReset diff --git a/TPMCmd/tpm/src/command/DA/DictionaryAttackParameters.c b/TPMCmd/tpm/src/command/DA/DictionaryAttackParameters.c index 1a3c46c..526a91a 100644 --- a/TPMCmd/tpm/src/command/DA/DictionaryAttackParameters.c +++ b/TPMCmd/tpm/src/command/DA/DictionaryAttackParameters.c @@ -40,4 +40,4 @@ TPM2_DictionaryAttackParameters( return TPM_RC_SUCCESS; } -#endif // CC_DictionaryAttackParameters \ No newline at end of file +#endif // CC_DictionaryAttackParameters diff --git a/TPMCmd/tpm/src/command/Duplication/Duplicate.c b/TPMCmd/tpm/src/command/Duplication/Duplicate.c index 7bfd5b5..cde8bf0 100644 --- a/TPMCmd/tpm/src/command/Duplication/Duplicate.c +++ b/TPMCmd/tpm/src/command/Duplication/Duplicate.c @@ -127,4 +127,4 @@ TPM2_Duplicate(Duplicate_In* in, // IN: input parameter list return result; } -#endif // CC_Duplicate \ No newline at end of file +#endif // CC_Duplicate diff --git a/TPMCmd/tpm/src/command/Duplication/Import.c b/TPMCmd/tpm/src/command/Duplication/Import.c index f5bff45..89d71a1 100644 --- a/TPMCmd/tpm/src/command/Duplication/Import.c +++ b/TPMCmd/tpm/src/command/Duplication/Import.c @@ -182,4 +182,4 @@ TPM2_Import(Import_In* in, // IN: input parameter list return result; } -#endif // CC_Import \ No newline at end of file +#endif // CC_Import diff --git a/TPMCmd/tpm/src/command/Duplication/Rewrap.c b/TPMCmd/tpm/src/command/Duplication/Rewrap.c index 467d1fc..ab932b5 100644 --- a/TPMCmd/tpm/src/command/Duplication/Rewrap.c +++ b/TPMCmd/tpm/src/command/Duplication/Rewrap.c @@ -133,4 +133,4 @@ TPM2_Rewrap(Rewrap_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_Rewrap \ No newline at end of file +#endif // CC_Rewrap diff --git a/TPMCmd/tpm/src/command/EA/PolicyAuthValue.c b/TPMCmd/tpm/src/command/EA/PolicyAuthValue.c index 227e75d..5a4b66b 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyAuthValue.c +++ b/TPMCmd/tpm/src/command/EA/PolicyAuthValue.c @@ -44,4 +44,4 @@ TPM2_PolicyAuthValue(PolicyAuthValue_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyAuthValue \ No newline at end of file +#endif // CC_PolicyAuthValue diff --git a/TPMCmd/tpm/src/command/EA/PolicyAuthorizeNV.c b/TPMCmd/tpm/src/command/EA/PolicyAuthorizeNV.c index 4072cae..524b758 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyAuthorizeNV.c +++ b/TPMCmd/tpm/src/command/EA/PolicyAuthorizeNV.c @@ -84,4 +84,4 @@ TPM2_PolicyAuthorizeNV(PolicyAuthorizeNV_In* in) session); } -#endif // CC_PolicyAuthorize \ No newline at end of file +#endif // CC_PolicyAuthorize diff --git a/TPMCmd/tpm/src/command/EA/PolicyCapability.c b/TPMCmd/tpm/src/command/EA/PolicyCapability.c index 5f72bf1..1762990 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyCapability.c +++ b/TPMCmd/tpm/src/command/EA/PolicyCapability.c @@ -269,4 +269,4 @@ TPM2_PolicyCapability(PolicyCapability_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyCapability \ No newline at end of file +#endif // CC_PolicyCapability diff --git a/TPMCmd/tpm/src/command/EA/PolicyCommandCode.c b/TPMCmd/tpm/src/command/EA/PolicyCommandCode.c index 7beabf1..baeb824 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyCommandCode.c +++ b/TPMCmd/tpm/src/command/EA/PolicyCommandCode.c @@ -53,4 +53,4 @@ TPM2_PolicyCommandCode(PolicyCommandCode_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyCommandCode \ No newline at end of file +#endif // CC_PolicyCommandCode diff --git a/TPMCmd/tpm/src/command/EA/PolicyCounterTimer.c b/TPMCmd/tpm/src/command/EA/PolicyCounterTimer.c index 69e87ca..f4dca38 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyCounterTimer.c +++ b/TPMCmd/tpm/src/command/EA/PolicyCounterTimer.c @@ -94,4 +94,4 @@ TPM2_PolicyCounterTimer(PolicyCounterTimer_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyCounterTimer \ No newline at end of file +#endif // CC_PolicyCounterTimer diff --git a/TPMCmd/tpm/src/command/EA/PolicyCpHash.c b/TPMCmd/tpm/src/command/EA/PolicyCpHash.c index 942e085..4d5ce4a 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyCpHash.c +++ b/TPMCmd/tpm/src/command/EA/PolicyCpHash.c @@ -65,4 +65,4 @@ TPM2_PolicyCpHash(PolicyCpHash_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyCpHash \ No newline at end of file +#endif // CC_PolicyCpHash diff --git a/TPMCmd/tpm/src/command/EA/PolicyDuplicationSelect.c b/TPMCmd/tpm/src/command/EA/PolicyDuplicationSelect.c index 5abdec8..d77ffa1 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyDuplicationSelect.c +++ b/TPMCmd/tpm/src/command/EA/PolicyDuplicationSelect.c @@ -78,4 +78,4 @@ TPM2_PolicyDuplicationSelect( return TPM_RC_SUCCESS; } -#endif // CC_PolicyDuplicationSelect \ No newline at end of file +#endif // CC_PolicyDuplicationSelect diff --git a/TPMCmd/tpm/src/command/EA/PolicyGetDigest.c b/TPMCmd/tpm/src/command/EA/PolicyGetDigest.c index 0c4ba0b..19300e5 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyGetDigest.c +++ b/TPMCmd/tpm/src/command/EA/PolicyGetDigest.c @@ -24,4 +24,4 @@ TPM2_PolicyGetDigest(PolicyGetDigest_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyGetDigest \ No newline at end of file +#endif // CC_PolicyGetDigest diff --git a/TPMCmd/tpm/src/command/EA/PolicyLocality.c b/TPMCmd/tpm/src/command/EA/PolicyLocality.c index e991b14..fc029a2 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyLocality.c +++ b/TPMCmd/tpm/src/command/EA/PolicyLocality.c @@ -100,4 +100,4 @@ TPM2_PolicyLocality(PolicyLocality_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyLocality \ No newline at end of file +#endif // CC_PolicyLocality diff --git a/TPMCmd/tpm/src/command/EA/PolicyNV.c b/TPMCmd/tpm/src/command/EA/PolicyNV.c index b96752b..6b52363 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyNV.c +++ b/TPMCmd/tpm/src/command/EA/PolicyNV.c @@ -104,4 +104,4 @@ TPM2_PolicyNV(PolicyNV_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyNV \ No newline at end of file +#endif // CC_PolicyNV diff --git a/TPMCmd/tpm/src/command/EA/PolicyNameHash.c b/TPMCmd/tpm/src/command/EA/PolicyNameHash.c index 35c3a90..36f07c4 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyNameHash.c +++ b/TPMCmd/tpm/src/command/EA/PolicyNameHash.c @@ -60,4 +60,4 @@ TPM2_PolicyNameHash(PolicyNameHash_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyNameHash \ No newline at end of file +#endif // CC_PolicyNameHash diff --git a/TPMCmd/tpm/src/command/EA/PolicyNvWritten.c b/TPMCmd/tpm/src/command/EA/PolicyNvWritten.c index 99a5cfc..fb28533 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyNvWritten.c +++ b/TPMCmd/tpm/src/command/EA/PolicyNvWritten.c @@ -57,4 +57,4 @@ TPM2_PolicyNvWritten(PolicyNvWritten_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyNvWritten \ No newline at end of file +#endif // CC_PolicyNvWritten diff --git a/TPMCmd/tpm/src/command/EA/PolicyOR.c b/TPMCmd/tpm/src/command/EA/PolicyOR.c index ded1e59..671e779 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyOR.c +++ b/TPMCmd/tpm/src/command/EA/PolicyOR.c @@ -63,4 +63,4 @@ TPM2_PolicyOR(PolicyOR_In* in // IN: input parameter list return TPM_RCS_VALUE + RC_PolicyOR_pHashList; } -#endif // CC_PolicyOR \ No newline at end of file +#endif // CC_PolicyOR diff --git a/TPMCmd/tpm/src/command/EA/PolicyPCR.c b/TPMCmd/tpm/src/command/EA/PolicyPCR.c index c03bdcd..de90db0 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyPCR.c +++ b/TPMCmd/tpm/src/command/EA/PolicyPCR.c @@ -93,4 +93,4 @@ TPM2_PolicyPCR(PolicyPCR_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyPCR \ No newline at end of file +#endif // CC_PolicyPCR diff --git a/TPMCmd/tpm/src/command/EA/PolicyPassword.c b/TPMCmd/tpm/src/command/EA/PolicyPassword.c index 200a3c2..2766bd1 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyPassword.c +++ b/TPMCmd/tpm/src/command/EA/PolicyPassword.c @@ -44,4 +44,4 @@ TPM2_PolicyPassword(PolicyPassword_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyPassword \ No newline at end of file +#endif // CC_PolicyPassword diff --git a/TPMCmd/tpm/src/command/EA/PolicyPhysicalPresence.c b/TPMCmd/tpm/src/command/EA/PolicyPhysicalPresence.c index f38f795..7a22493 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyPhysicalPresence.c +++ b/TPMCmd/tpm/src/command/EA/PolicyPhysicalPresence.c @@ -41,4 +41,4 @@ TPM2_PolicyPhysicalPresence(PolicyPhysicalPresence_In* in // IN: input paramete return TPM_RC_SUCCESS; } -#endif // CC_PolicyPhysicalPresence \ No newline at end of file +#endif // CC_PolicyPhysicalPresence diff --git a/TPMCmd/tpm/src/command/EA/PolicySecret.c b/TPMCmd/tpm/src/command/EA/PolicySecret.c index 400aee1..af277fd 100644 --- a/TPMCmd/tpm/src/command/EA/PolicySecret.c +++ b/TPMCmd/tpm/src/command/EA/PolicySecret.c @@ -115,4 +115,4 @@ TPM2_PolicySecret(PolicySecret_In* in, // IN: input parameter list return result; } -#endif // CC_PolicySecret \ No newline at end of file +#endif // CC_PolicySecret diff --git a/TPMCmd/tpm/src/command/EA/PolicySigned.c b/TPMCmd/tpm/src/command/EA/PolicySigned.c index d3ece47..eb155e1 100644 --- a/TPMCmd/tpm/src/command/EA/PolicySigned.c +++ b/TPMCmd/tpm/src/command/EA/PolicySigned.c @@ -159,4 +159,4 @@ TPM2_PolicySigned(PolicySigned_In* in, // IN: input parameter list return result; } -#endif // CC_PolicySigned \ No newline at end of file +#endif // CC_PolicySigned diff --git a/TPMCmd/tpm/src/command/EA/PolicyTemplate.c b/TPMCmd/tpm/src/command/EA/PolicyTemplate.c index a73b48f..f86ff51 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyTemplate.c +++ b/TPMCmd/tpm/src/command/EA/PolicyTemplate.c @@ -63,4 +63,4 @@ TPM2_PolicyTemplate(PolicyTemplate_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyTemplateHash \ No newline at end of file +#endif // CC_PolicyTemplateHash diff --git a/TPMCmd/tpm/src/command/EA/PolicyTicket.c b/TPMCmd/tpm/src/command/EA/PolicyTicket.c index fe7b682..6ce0a99 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyTicket.c +++ b/TPMCmd/tpm/src/command/EA/PolicyTicket.c @@ -102,4 +102,4 @@ TPM2_PolicyTicket(PolicyTicket_In* in // IN: input parameter list session); } -#endif // CC_PolicyTicket \ No newline at end of file +#endif // CC_PolicyTicket diff --git a/TPMCmd/tpm/src/command/EA/PolicyTransportSPDM.c b/TPMCmd/tpm/src/command/EA/PolicyTransportSPDM.c index 312bdc9..1e1d714 100644 --- a/TPMCmd/tpm/src/command/EA/PolicyTransportSPDM.c +++ b/TPMCmd/tpm/src/command/EA/PolicyTransportSPDM.c @@ -134,4 +134,4 @@ TPM2_PolicyTransportSPDM(PolicyTransportSPDM_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyTransportSPDM \ No newline at end of file +#endif // CC_PolicyTransportSPDM diff --git a/TPMCmd/tpm/src/command/Ecdaa/Commit.c b/TPMCmd/tpm/src/command/Ecdaa/Commit.c index 3b08a56..137b679 100644 --- a/TPMCmd/tpm/src/command/Ecdaa/Commit.c +++ b/TPMCmd/tpm/src/command/Ecdaa/Commit.c @@ -133,4 +133,4 @@ TPM2_Commit(Commit_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_Commit \ No newline at end of file +#endif // CC_Commit diff --git a/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeData.c b/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeData.c index 7bdb35a..55f20d8 100644 --- a/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeData.c +++ b/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeData.c @@ -15,4 +15,4 @@ TPM2_FieldUpgradeData(FieldUpgradeData_In* in, // IN: input parameter list UNUSED_PARAMETER(out); return TPM_RC_SUCCESS; } -#endif \ No newline at end of file +#endif diff --git a/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeStart.c b/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeStart.c index 3aa2839..d751757 100644 --- a/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeStart.c +++ b/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeStart.c @@ -13,4 +13,4 @@ TPM2_FieldUpgradeStart(FieldUpgradeStart_In* in // IN: input parameter list UNUSED_PARAMETER(in); return TPM_RC_SUCCESS; } -#endif \ No newline at end of file +#endif diff --git a/TPMCmd/tpm/src/command/FieldUpgrade/FirmwareRead.c b/TPMCmd/tpm/src/command/FieldUpgrade/FirmwareRead.c index d9e182f..61dd24c 100644 --- a/TPMCmd/tpm/src/command/FieldUpgrade/FirmwareRead.c +++ b/TPMCmd/tpm/src/command/FieldUpgrade/FirmwareRead.c @@ -17,4 +17,4 @@ TPM2_FirmwareRead(FirmwareRead_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_FirmwareRead \ No newline at end of file +#endif // CC_FirmwareRead diff --git a/TPMCmd/tpm/src/command/HashHMAC/EventSequenceComplete.c b/TPMCmd/tpm/src/command/HashHMAC/EventSequenceComplete.c index 9c0b6c6..7e69be1 100644 --- a/TPMCmd/tpm/src/command/HashHMAC/EventSequenceComplete.c +++ b/TPMCmd/tpm/src/command/HashHMAC/EventSequenceComplete.c @@ -74,4 +74,4 @@ TPM2_EventSequenceComplete( return TPM_RC_SUCCESS; } -#endif // CC_EventSequenceComplete \ No newline at end of file +#endif // CC_EventSequenceComplete diff --git a/TPMCmd/tpm/src/command/HashHMAC/HMAC_Start.c b/TPMCmd/tpm/src/command/HashHMAC/HMAC_Start.c index 1c617e7..3a5d9a1 100644 --- a/TPMCmd/tpm/src/command/HashHMAC/HMAC_Start.c +++ b/TPMCmd/tpm/src/command/HashHMAC/HMAC_Start.c @@ -67,4 +67,4 @@ TPM2_HMAC_Start(HMAC_Start_In* in, // IN: input parameter list hashAlg, keyObject, &in->auth, &out->sequenceHandle); } -#endif // CC_HMAC_Start \ No newline at end of file +#endif // CC_HMAC_Start diff --git a/TPMCmd/tpm/src/command/HashHMAC/HashSequenceStart.c b/TPMCmd/tpm/src/command/HashHMAC/HashSequenceStart.c index 2b32c89..f0bd70d 100644 --- a/TPMCmd/tpm/src/command/HashHMAC/HashSequenceStart.c +++ b/TPMCmd/tpm/src/command/HashHMAC/HashSequenceStart.c @@ -25,4 +25,4 @@ TPM2_HashSequenceStart(HashSequenceStart_In* in, // IN: input parameter list return ObjectCreateHashSequence(in->hashAlg, &in->auth, &out->sequenceHandle); } -#endif // CC_HashSequenceStart \ No newline at end of file +#endif // CC_HashSequenceStart diff --git a/TPMCmd/tpm/src/command/HashHMAC/MAC_Start.c b/TPMCmd/tpm/src/command/HashHMAC/MAC_Start.c index 22cfd40..5f4ad9e 100644 --- a/TPMCmd/tpm/src/command/HashHMAC/MAC_Start.c +++ b/TPMCmd/tpm/src/command/HashHMAC/MAC_Start.c @@ -54,4 +54,4 @@ TPM2_MAC_Start(MAC_Start_In* in, // IN: input parameter list in->inScheme, keyObject, &in->auth, &out->sequenceHandle); } -#endif // CC_MAC_Start \ No newline at end of file +#endif // CC_MAC_Start diff --git a/TPMCmd/tpm/src/command/HashHMAC/SequenceComplete.c b/TPMCmd/tpm/src/command/HashHMAC/SequenceComplete.c index a8cac75..b204f08 100644 --- a/TPMCmd/tpm/src/command/HashHMAC/SequenceComplete.c +++ b/TPMCmd/tpm/src/command/HashHMAC/SequenceComplete.c @@ -97,4 +97,4 @@ TPM2_SequenceComplete(SequenceComplete_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_SequenceComplete \ No newline at end of file +#endif // CC_SequenceComplete diff --git a/TPMCmd/tpm/src/command/HashHMAC/SequenceUpdate.c b/TPMCmd/tpm/src/command/HashHMAC/SequenceUpdate.c index a63ffc8..c0ed2f9 100644 --- a/TPMCmd/tpm/src/command/HashHMAC/SequenceUpdate.c +++ b/TPMCmd/tpm/src/command/HashHMAC/SequenceUpdate.c @@ -69,4 +69,4 @@ TPM2_SequenceUpdate(SequenceUpdate_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_SequenceUpdate \ No newline at end of file +#endif // CC_SequenceUpdate diff --git a/TPMCmd/tpm/src/command/Hierarchy/ChangeEPS.c b/TPMCmd/tpm/src/command/Hierarchy/ChangeEPS.c index 4c8a572..556684f 100644 --- a/TPMCmd/tpm/src/command/Hierarchy/ChangeEPS.c +++ b/TPMCmd/tpm/src/command/Hierarchy/ChangeEPS.c @@ -57,4 +57,4 @@ TPM2_ChangeEPS(ChangeEPS_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_ChangeEPS \ No newline at end of file +#endif // CC_ChangeEPS diff --git a/TPMCmd/tpm/src/command/Hierarchy/ChangePPS.c b/TPMCmd/tpm/src/command/Hierarchy/ChangePPS.c index 16cc877..ddb85e4 100644 --- a/TPMCmd/tpm/src/command/Hierarchy/ChangePPS.c +++ b/TPMCmd/tpm/src/command/Hierarchy/ChangePPS.c @@ -58,4 +58,4 @@ TPM2_ChangePPS(ChangePPS_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_ChangePPS \ No newline at end of file +#endif // CC_ChangePPS diff --git a/TPMCmd/tpm/src/command/Hierarchy/Clear.c b/TPMCmd/tpm/src/command/Hierarchy/Clear.c index a09e6b9..4b9e3ca 100644 --- a/TPMCmd/tpm/src/command/Hierarchy/Clear.c +++ b/TPMCmd/tpm/src/command/Hierarchy/Clear.c @@ -86,4 +86,4 @@ TPM2_Clear(Clear_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_Clear \ No newline at end of file +#endif // CC_Clear diff --git a/TPMCmd/tpm/src/command/Hierarchy/ClearControl.c b/TPMCmd/tpm/src/command/Hierarchy/ClearControl.c index f30247b..6ac36c4 100644 --- a/TPMCmd/tpm/src/command/Hierarchy/ClearControl.c +++ b/TPMCmd/tpm/src/command/Hierarchy/ClearControl.c @@ -34,4 +34,4 @@ TPM2_ClearControl(ClearControl_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_ClearControl \ No newline at end of file +#endif // CC_ClearControl diff --git a/TPMCmd/tpm/src/command/Hierarchy/CreatePrimary.c b/TPMCmd/tpm/src/command/Hierarchy/CreatePrimary.c index bd149bf..4da518f 100644 --- a/TPMCmd/tpm/src/command/Hierarchy/CreatePrimary.c +++ b/TPMCmd/tpm/src/command/Hierarchy/CreatePrimary.c @@ -131,4 +131,4 @@ TPM2_CreatePrimary(CreatePrimary_In* in, // IN: input parameter list return result; } -#endif // CC_CreatePrimary \ No newline at end of file +#endif // CC_CreatePrimary diff --git a/TPMCmd/tpm/src/command/Hierarchy/HierarchyChangeAuth.c b/TPMCmd/tpm/src/command/Hierarchy/HierarchyChangeAuth.c index 112845f..2e7a558 100644 --- a/TPMCmd/tpm/src/command/Hierarchy/HierarchyChangeAuth.c +++ b/TPMCmd/tpm/src/command/Hierarchy/HierarchyChangeAuth.c @@ -53,4 +53,4 @@ TPM2_HierarchyChangeAuth(HierarchyChangeAuth_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_HierarchyChangeAuth \ No newline at end of file +#endif // CC_HierarchyChangeAuth diff --git a/TPMCmd/tpm/src/command/Hierarchy/HierarchyControl.c b/TPMCmd/tpm/src/command/Hierarchy/HierarchyControl.c index 54c1188..1f445be 100644 --- a/TPMCmd/tpm/src/command/Hierarchy/HierarchyControl.c +++ b/TPMCmd/tpm/src/command/Hierarchy/HierarchyControl.c @@ -105,4 +105,4 @@ TPM2_HierarchyControl(HierarchyControl_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_HierarchyControl \ No newline at end of file +#endif // CC_HierarchyControl diff --git a/TPMCmd/tpm/src/command/Hierarchy/SetPrimaryPolicy.c b/TPMCmd/tpm/src/command/Hierarchy/SetPrimaryPolicy.c index b7935f8..6311a93 100644 --- a/TPMCmd/tpm/src/command/Hierarchy/SetPrimaryPolicy.c +++ b/TPMCmd/tpm/src/command/Hierarchy/SetPrimaryPolicy.c @@ -75,4 +75,4 @@ TPM2_SetPrimaryPolicy(SetPrimaryPolicy_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_SetPrimaryPolicy \ No newline at end of file +#endif // CC_SetPrimaryPolicy diff --git a/TPMCmd/tpm/src/command/Misc/PP_Commands.c b/TPMCmd/tpm/src/command/Misc/PP_Commands.c index ecf98c6..5ec0649 100644 --- a/TPMCmd/tpm/src/command/Misc/PP_Commands.c +++ b/TPMCmd/tpm/src/command/Misc/PP_Commands.c @@ -42,4 +42,4 @@ TPM2_PP_Commands(PP_Commands_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PP_Commands \ No newline at end of file +#endif // CC_PP_Commands diff --git a/TPMCmd/tpm/src/command/Misc/SetAlgorithmSet.c b/TPMCmd/tpm/src/command/Misc/SetAlgorithmSet.c index 17dba44..d677d5d 100644 --- a/TPMCmd/tpm/src/command/Misc/SetAlgorithmSet.c +++ b/TPMCmd/tpm/src/command/Misc/SetAlgorithmSet.c @@ -24,4 +24,4 @@ TPM2_SetAlgorithmSet(SetAlgorithmSet_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_SetAlgorithmSet \ No newline at end of file +#endif // CC_SetAlgorithmSet diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_Certify.c b/TPMCmd/tpm/src/command/NVStorage/NV_Certify.c index ac7d93d..436f289 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_Certify.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_Certify.c @@ -110,4 +110,4 @@ TPM2_NV_Certify(NV_Certify_In* in, // IN: input parameter list &out->signature); } -#endif // CC_NV_Certify \ No newline at end of file +#endif // CC_NV_Certify diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_ChangeAuth.c b/TPMCmd/tpm/src/command/NVStorage/NV_ChangeAuth.c index 472b6a2..8c74939 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_ChangeAuth.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_ChangeAuth.c @@ -30,4 +30,4 @@ TPM2_NV_ChangeAuth(NV_ChangeAuth_In* in // IN: input parameter list return NvWriteIndexAuth(locator, &in->newAuth); } -#endif // CC_NV_ChangeAuth \ No newline at end of file +#endif // CC_NV_ChangeAuth diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_DefineSpace.c b/TPMCmd/tpm/src/command/NVStorage/NV_DefineSpace.c index 202f1c7..d12b5f5 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_DefineSpace.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_DefineSpace.c @@ -38,4 +38,4 @@ TPM2_NV_DefineSpace(NV_DefineSpace_In* in // IN: input parameter list RC_NV_DefineSpace_publicInfo); } -#endif // CC_NV_DefineSpace \ No newline at end of file +#endif // CC_NV_DefineSpace diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_DefineSpace2.c b/TPMCmd/tpm/src/command/NVStorage/NV_DefineSpace2.c index 74c7314..95a8679 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_DefineSpace2.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_DefineSpace2.c @@ -66,4 +66,4 @@ TPM2_NV_DefineSpace2(NV_DefineSpace2_In* in // IN: input parameter list RC_NV_DefineSpace2_publicInfo); } -#endif // CC_NV_DefineSpace \ No newline at end of file +#endif // CC_NV_DefineSpace diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_Extend.c b/TPMCmd/tpm/src/command/NVStorage/NV_Extend.c index 2869de9..b97a777 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_Extend.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_Extend.c @@ -75,4 +75,4 @@ TPM2_NV_Extend(NV_Extend_In* in // IN: input parameter list return NvWriteIndexData(nvIndex, 0, newDigest.t.size, newDigest.t.buffer); } -#endif // CC_NV_Extend \ No newline at end of file +#endif // CC_NV_Extend diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_GlobalWriteLock.c b/TPMCmd/tpm/src/command/NVStorage/NV_GlobalWriteLock.c index 0da06dd..ab8150a 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_GlobalWriteLock.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_GlobalWriteLock.c @@ -19,4 +19,4 @@ TPM2_NV_GlobalWriteLock(NV_GlobalWriteLock_In* in // IN: input parameter list return NvSetGlobalLock(); } -#endif // CC_NV_GlobalWriteLock \ No newline at end of file +#endif // CC_NV_GlobalWriteLock diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_Increment.c b/TPMCmd/tpm/src/command/NVStorage/NV_Increment.c index 69a4d21..2ef99db 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_Increment.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_Increment.c @@ -63,4 +63,4 @@ TPM2_NV_Increment(NV_Increment_In* in // IN: input parameter list return result; } -#endif // CC_NV_Increment \ No newline at end of file +#endif // CC_NV_Increment diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_Read.c b/TPMCmd/tpm/src/command/NVStorage/NV_Read.c index d0efdac..726d587 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_Read.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_Read.c @@ -66,4 +66,4 @@ TPM2_NV_Read(NV_Read_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_NV_Read \ No newline at end of file +#endif // CC_NV_Read diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_ReadLock.c b/TPMCmd/tpm/src/command/NVStorage/NV_ReadLock.c index 961c008..1d605b6 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_ReadLock.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_ReadLock.c @@ -57,4 +57,4 @@ TPM2_NV_ReadLock(NV_ReadLock_In* in // IN: input parameter list return NvWriteIndexAttributes(nvIndex->publicArea.nvIndex, locator, nvAttributes); } -#endif // CC_NV_ReadLock \ No newline at end of file +#endif // CC_NV_ReadLock diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_ReadPublic.c b/TPMCmd/tpm/src/command/NVStorage/NV_ReadPublic.c index 102c9ff..1824c5e 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_ReadPublic.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_ReadPublic.c @@ -37,4 +37,4 @@ TPM2_NV_ReadPublic(NV_ReadPublic_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_NV_ReadPublic \ No newline at end of file +#endif // CC_NV_ReadPublic diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_ReadPublic2.c b/TPMCmd/tpm/src/command/NVStorage/NV_ReadPublic2.c index e87493c..542fde2 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_ReadPublic2.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_ReadPublic2.c @@ -42,4 +42,4 @@ TPM2_NV_ReadPublic2(NV_ReadPublic2_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_NV_ReadPublic2 \ No newline at end of file +#endif // CC_NV_ReadPublic2 diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_SetBits.c b/TPMCmd/tpm/src/command/NVStorage/NV_SetBits.c index 74df418..c89b5d6 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_SetBits.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_SetBits.c @@ -57,4 +57,4 @@ TPM2_NV_SetBits(NV_SetBits_In* in // IN: input parameter list return NvWriteUINT64Data(nvIndex, newValue); } -#endif // CC_NV_SetBits \ No newline at end of file +#endif // CC_NV_SetBits diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpace.c b/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpace.c index a8747cc..38b4c29 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpace.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpace.c @@ -38,4 +38,4 @@ TPM2_NV_UndefineSpace(NV_UndefineSpace_In* in // IN: input parameter list return NvDeleteIndex(nvIndex, locator); } -#endif // CC_NV_UndefineSpace \ No newline at end of file +#endif // CC_NV_UndefineSpace diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpaceSpecial.c b/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpaceSpecial.c index 99ca6c4..9b3f626 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpaceSpecial.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpaceSpecial.c @@ -34,4 +34,4 @@ TPM2_NV_UndefineSpaceSpecial( return result; } -#endif // CC_NV_UndefineSpaceSpecial \ No newline at end of file +#endif // CC_NV_UndefineSpaceSpecial diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_Write.c b/TPMCmd/tpm/src/command/NVStorage/NV_Write.c index 2e0e466..604f9c3 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_Write.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_Write.c @@ -72,4 +72,4 @@ TPM2_NV_Write(NV_Write_In* in // IN: input parameter list return NvWriteIndexData(nvIndex, in->offset, in->data.t.size, in->data.t.buffer); } -#endif // CC_NV_Write \ No newline at end of file +#endif // CC_NV_Write diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_WriteLock.c b/TPMCmd/tpm/src/command/NVStorage/NV_WriteLock.c index 4a71e4c..796b7ff 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_WriteLock.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_WriteLock.c @@ -57,4 +57,4 @@ TPM2_NV_WriteLock(NV_WriteLock_In* in // IN: input parameter list return NvWriteIndexAttributes(nvIndex->publicArea.nvIndex, locator, nvAttributes); } -#endif // CC_NV_WriteLock \ No newline at end of file +#endif // CC_NV_WriteLock diff --git a/TPMCmd/tpm/src/command/NVStorage/NV_spt.c b/TPMCmd/tpm/src/command/NVStorage/NV_spt.c index cfd72dd..2a69b97 100644 --- a/TPMCmd/tpm/src/command/NVStorage/NV_spt.c +++ b/TPMCmd/tpm/src/command/NVStorage/NV_spt.c @@ -437,6 +437,7 @@ TPM_RC NvDefineSpace(TPMI_RH_PROVISION authHandle, // It is not allowed to create a PIN Index that can't be modified. if(!IS_ATTRIBUTE(attributes, TPMA_NV, NO_DA)) return TPM_RCS_ATTRIBUTES + blamePublic; + FALLTHROUGH; #endif #ifdef TPM_NT_PIN_PASS case TPM_NT_PIN_PASS: @@ -502,4 +503,4 @@ TPM_RC NvDefineSpace(TPMI_RH_PROVISION authHandle, // Internal Data Update // define the space. A TPM_RC_NV_SPACE error may be returned at this point return NvDefineIndex(publicInfo, auth); -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/command/Object/ActivateCredential.c b/TPMCmd/tpm/src/command/Object/ActivateCredential.c index a46b234..2fcde27 100644 --- a/TPMCmd/tpm/src/command/Object/ActivateCredential.c +++ b/TPMCmd/tpm/src/command/Object/ActivateCredential.c @@ -72,4 +72,4 @@ TPM2_ActivateCredential(ActivateCredential_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_ActivateCredential \ No newline at end of file +#endif // CC_ActivateCredential diff --git a/TPMCmd/tpm/src/command/Object/Create.c b/TPMCmd/tpm/src/command/Object/Create.c index 4fc11aa..457fd32 100644 --- a/TPMCmd/tpm/src/command/Object/Create.c +++ b/TPMCmd/tpm/src/command/Object/Create.c @@ -132,4 +132,4 @@ TPM2_Create(Create_In* in, // IN: input parameter list return result; } -#endif // CC_Create \ No newline at end of file +#endif // CC_Create diff --git a/TPMCmd/tpm/src/command/Object/CreateLoaded.c b/TPMCmd/tpm/src/command/Object/CreateLoaded.c index 74ed9db..821b72f 100644 --- a/TPMCmd/tpm/src/command/Object/CreateLoaded.c +++ b/TPMCmd/tpm/src/command/Object/CreateLoaded.c @@ -208,4 +208,4 @@ TPM2_CreateLoaded(CreateLoaded_In* in, // IN: input parameter list return result; } -#endif // CC_CreateLoaded \ No newline at end of file +#endif // CC_CreateLoaded diff --git a/TPMCmd/tpm/src/command/Object/Load.c b/TPMCmd/tpm/src/command/Object/Load.c index a522633..3734ed3 100644 --- a/TPMCmd/tpm/src/command/Object/Load.c +++ b/TPMCmd/tpm/src/command/Object/Load.c @@ -87,4 +87,4 @@ TPM2_Load(Load_In* in, // IN: input parameter list return result; } -#endif // CC_Load \ No newline at end of file +#endif // CC_Load diff --git a/TPMCmd/tpm/src/command/Object/LoadExternal.c b/TPMCmd/tpm/src/command/Object/LoadExternal.c index c5c0fcd..fc04375 100644 --- a/TPMCmd/tpm/src/command/Object/LoadExternal.c +++ b/TPMCmd/tpm/src/command/Object/LoadExternal.c @@ -96,4 +96,4 @@ TPM2_LoadExternal(LoadExternal_In* in, // IN: input parameter list return result; } -#endif // CC_LoadExternal \ No newline at end of file +#endif // CC_LoadExternal diff --git a/TPMCmd/tpm/src/command/Object/MakeCredential.c b/TPMCmd/tpm/src/command/Object/MakeCredential.c index 94415f3..e8d8267 100644 --- a/TPMCmd/tpm/src/command/Object/MakeCredential.c +++ b/TPMCmd/tpm/src/command/Object/MakeCredential.c @@ -56,4 +56,4 @@ TPM2_MakeCredential(MakeCredential_In* in, // IN: input parameter list &in->credential, &in->objectName.b, &data.b, object, &out->credentialBlob); } -#endif // CC_MakeCredential \ No newline at end of file +#endif // CC_MakeCredential diff --git a/TPMCmd/tpm/src/command/Object/ObjectChangeAuth.c b/TPMCmd/tpm/src/command/Object/ObjectChangeAuth.c index dd5398c..b9d9c3a 100644 --- a/TPMCmd/tpm/src/command/Object/ObjectChangeAuth.c +++ b/TPMCmd/tpm/src/command/Object/ObjectChangeAuth.c @@ -59,4 +59,4 @@ TPM2_ObjectChangeAuth(ObjectChangeAuth_In* in, // IN: input parameter list &out->outPrivate); } -#endif // CC_ObjectChangeAuth \ No newline at end of file +#endif // CC_ObjectChangeAuth diff --git a/TPMCmd/tpm/src/command/Object/Object_spt.c b/TPMCmd/tpm/src/command/Object/Object_spt.c index 47ec316..7391d5e 100644 --- a/TPMCmd/tpm/src/command/Object/Object_spt.c +++ b/TPMCmd/tpm/src/command/Object/Object_spt.c @@ -363,8 +363,7 @@ CreateChecks(OBJECT* parentObject, && !IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt) && IS_ATTRIBUTE(attributes, TPMA_OBJECT, sensitiveDataOrigin)) result = TPM_RC_ATTRIBUTES; - // fall through to prevent a fixedTPM derivation parent - // [[fallthrough]]; + FALLTHROUGH; // To prevent a fixedTPM derivation parent case TPM_ALG_SYMCIPHER: // A restricted key symmetric key (SYMCIPHER and KEYEDHASH) // must have sensitiveDataOrigin SET unless it has fixedParent and @@ -1638,4 +1637,4 @@ UnmarshalToPublic(TPMT_PUBLIC* tOut, // OUT: output void ObjectSetExternal(OBJECT* object) { object->attributes.external = SET; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/command/Object/ReadPublic.c b/TPMCmd/tpm/src/command/Object/ReadPublic.c index 805b64a..1074fc4 100644 --- a/TPMCmd/tpm/src/command/Object/ReadPublic.c +++ b/TPMCmd/tpm/src/command/Object/ReadPublic.c @@ -33,4 +33,4 @@ TPM2_ReadPublic(ReadPublic_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_ReadPublic \ No newline at end of file +#endif // CC_ReadPublic diff --git a/TPMCmd/tpm/src/command/Object/Unseal.c b/TPMCmd/tpm/src/command/Object/Unseal.c index 4ec9239..7a24dc1 100644 --- a/TPMCmd/tpm/src/command/Object/Unseal.c +++ b/TPMCmd/tpm/src/command/Object/Unseal.c @@ -31,4 +31,4 @@ TPM2_Unseal(Unseal_In* in, Unseal_Out* out) return TPM_RC_SUCCESS; } -#endif // CC_Unseal \ No newline at end of file +#endif // CC_Unseal diff --git a/TPMCmd/tpm/src/command/PCR/PCR_Allocate.c b/TPMCmd/tpm/src/command/PCR/PCR_Allocate.c index 61383c8..4c05013 100644 --- a/TPMCmd/tpm/src/command/PCR/PCR_Allocate.c +++ b/TPMCmd/tpm/src/command/PCR/PCR_Allocate.c @@ -45,4 +45,4 @@ TPM2_PCR_Allocate(PCR_Allocate_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PCR_Allocate \ No newline at end of file +#endif // CC_PCR_Allocate diff --git a/TPMCmd/tpm/src/command/PCR/PCR_Event.c b/TPMCmd/tpm/src/command/PCR/PCR_Event.c index ce059b7..413eeec 100644 --- a/TPMCmd/tpm/src/command/PCR/PCR_Event.c +++ b/TPMCmd/tpm/src/command/PCR/PCR_Event.c @@ -53,4 +53,4 @@ TPM2_PCR_Event(PCR_Event_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PCR_Event \ No newline at end of file +#endif // CC_PCR_Event diff --git a/TPMCmd/tpm/src/command/PCR/PCR_Extend.c b/TPMCmd/tpm/src/command/PCR/PCR_Extend.c index 2b53286..2374115 100644 --- a/TPMCmd/tpm/src/command/PCR/PCR_Extend.c +++ b/TPMCmd/tpm/src/command/PCR/PCR_Extend.c @@ -52,4 +52,4 @@ TPM2_PCR_Extend(PCR_Extend_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PCR_Extend \ No newline at end of file +#endif // CC_PCR_Extend diff --git a/TPMCmd/tpm/src/command/PCR/PCR_Read.c b/TPMCmd/tpm/src/command/PCR/PCR_Read.c index 47d211c..b5fd862 100644 --- a/TPMCmd/tpm/src/command/PCR/PCR_Read.c +++ b/TPMCmd/tpm/src/command/PCR/PCR_Read.c @@ -25,4 +25,4 @@ TPM2_PCR_Read(PCR_Read_In* in, // IN: input parameter list return result; } -#endif // CC_PCR_Read \ No newline at end of file +#endif // CC_PCR_Read diff --git a/TPMCmd/tpm/src/command/PCR/PCR_Reset.c b/TPMCmd/tpm/src/command/PCR/PCR_Reset.c index fee0133..ff759f9 100644 --- a/TPMCmd/tpm/src/command/PCR/PCR_Reset.c +++ b/TPMCmd/tpm/src/command/PCR/PCR_Reset.c @@ -36,4 +36,4 @@ TPM2_PCR_Reset(PCR_Reset_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PCR_Reset \ No newline at end of file +#endif // CC_PCR_Reset diff --git a/TPMCmd/tpm/src/command/PCR/PCR_SetAuthPolicy.c b/TPMCmd/tpm/src/command/PCR/PCR_SetAuthPolicy.c index 97b25ce..d68ca04 100644 --- a/TPMCmd/tpm/src/command/PCR/PCR_SetAuthPolicy.c +++ b/TPMCmd/tpm/src/command/PCR/PCR_SetAuthPolicy.c @@ -44,4 +44,4 @@ TPM2_PCR_SetAuthPolicy(PCR_SetAuthPolicy_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PCR_SetAuthPolicy \ No newline at end of file +#endif // CC_PCR_SetAuthPolicy diff --git a/TPMCmd/tpm/src/command/PCR/PCR_SetAuthValue.c b/TPMCmd/tpm/src/command/PCR/PCR_SetAuthValue.c index bd8d013..c9bbe45 100644 --- a/TPMCmd/tpm/src/command/PCR/PCR_SetAuthValue.c +++ b/TPMCmd/tpm/src/command/PCR/PCR_SetAuthValue.c @@ -35,4 +35,4 @@ TPM2_PCR_SetAuthValue(PCR_SetAuthValue_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PCR_SetAuthValue \ No newline at end of file +#endif // CC_PCR_SetAuthValue diff --git a/TPMCmd/tpm/src/command/Random/GetRandom.c b/TPMCmd/tpm/src/command/Random/GetRandom.c index 02b3deb..cdba935 100644 --- a/TPMCmd/tpm/src/command/Random/GetRandom.c +++ b/TPMCmd/tpm/src/command/Random/GetRandom.c @@ -25,4 +25,4 @@ TPM2_GetRandom(GetRandom_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_GetRandom \ No newline at end of file +#endif // CC_GetRandom diff --git a/TPMCmd/tpm/src/command/Random/StirRandom.c b/TPMCmd/tpm/src/command/Random/StirRandom.c index 1906999..a3b8775 100644 --- a/TPMCmd/tpm/src/command/Random/StirRandom.c +++ b/TPMCmd/tpm/src/command/Random/StirRandom.c @@ -16,4 +16,4 @@ TPM2_StirRandom(StirRandom_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_StirRandom \ No newline at end of file +#endif // CC_StirRandom diff --git a/TPMCmd/tpm/src/command/Session/PolicyRestart.c b/TPMCmd/tpm/src/command/Session/PolicyRestart.c index 54c4888..782eecc 100644 --- a/TPMCmd/tpm/src/command/Session/PolicyRestart.c +++ b/TPMCmd/tpm/src/command/Session/PolicyRestart.c @@ -19,4 +19,4 @@ TPM2_PolicyRestart(PolicyRestart_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_PolicyRestart \ No newline at end of file +#endif // CC_PolicyRestart diff --git a/TPMCmd/tpm/src/command/Session/StartAuthSession.c b/TPMCmd/tpm/src/command/Session/StartAuthSession.c index 4357d55..236246f 100644 --- a/TPMCmd/tpm/src/command/Session/StartAuthSession.c +++ b/TPMCmd/tpm/src/command/Session/StartAuthSession.c @@ -135,4 +135,4 @@ TPM2_StartAuthSession(StartAuthSession_In* in, // IN: input parameter buffer return result; } -#endif // CC_StartAuthSession \ No newline at end of file +#endif // CC_StartAuthSession diff --git a/TPMCmd/tpm/src/command/Signature/Sign.c b/TPMCmd/tpm/src/command/Signature/Sign.c index 8a8c41b..601934f 100644 --- a/TPMCmd/tpm/src/command/Signature/Sign.c +++ b/TPMCmd/tpm/src/command/Signature/Sign.c @@ -89,4 +89,4 @@ TPM2_Sign(Sign_In* in, // IN: input parameter list return result; } -#endif // CC_Sign \ No newline at end of file +#endif // CC_Sign diff --git a/TPMCmd/tpm/src/command/Signature/VerifySignature.c b/TPMCmd/tpm/src/command/Signature/VerifySignature.c index 0f0e3e6..e12d85a 100644 --- a/TPMCmd/tpm/src/command/Signature/VerifySignature.c +++ b/TPMCmd/tpm/src/command/Signature/VerifySignature.c @@ -56,4 +56,4 @@ TPM2_VerifySignature(VerifySignature_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_VerifySignature \ No newline at end of file +#endif // CC_VerifySignature diff --git a/TPMCmd/tpm/src/command/Startup/Shutdown.c b/TPMCmd/tpm/src/command/Startup/Shutdown.c index 990db38..5ebf009 100644 --- a/TPMCmd/tpm/src/command/Startup/Shutdown.c +++ b/TPMCmd/tpm/src/command/Startup/Shutdown.c @@ -74,4 +74,4 @@ TPM2_Shutdown(Shutdown_In* in // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_Shutdown \ No newline at end of file +#endif // CC_Shutdown diff --git a/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt.c b/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt.c index 5054e81..70d6c74 100644 --- a/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt.c +++ b/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt.c @@ -134,4 +134,4 @@ TPM2_EncryptDecrypt(EncryptDecrypt_In* in, // IN: input parameter list # endif // CC_EncryptDecrypt2 } -#endif // CC_EncryptDecrypt \ No newline at end of file +#endif // CC_EncryptDecrypt diff --git a/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt2.c b/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt2.c index e0c2800..0adfd97 100644 --- a/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt2.c +++ b/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt2.c @@ -48,4 +48,4 @@ TPM2_EncryptDecrypt2(EncryptDecrypt2_In* in, // IN: input parameter list return result; } -#endif // CC_EncryptDecrypt2 \ No newline at end of file +#endif // CC_EncryptDecrypt2 diff --git a/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt_spt.c b/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt_spt.c index e106088..e747a88 100644 --- a/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt_spt.c +++ b/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt_spt.c @@ -127,4 +127,4 @@ EncryptDecryptShared(TPMI_DH_OBJECT keyHandleIn, return result; } -#endif // CC_EncryptDecrypt \ No newline at end of file +#endif // CC_EncryptDecrypt diff --git a/TPMCmd/tpm/src/command/Symmetric/HMAC.c b/TPMCmd/tpm/src/command/Symmetric/HMAC.c index 099cc39..dd6d6d8 100644 --- a/TPMCmd/tpm/src/command/Symmetric/HMAC.c +++ b/TPMCmd/tpm/src/command/Symmetric/HMAC.c @@ -70,4 +70,4 @@ TPM2_HMAC(HMAC_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_HMAC \ No newline at end of file +#endif // CC_HMAC diff --git a/TPMCmd/tpm/src/command/Symmetric/Hash.c b/TPMCmd/tpm/src/command/Symmetric/Hash.c index 023d318..198a9ff 100644 --- a/TPMCmd/tpm/src/command/Symmetric/Hash.c +++ b/TPMCmd/tpm/src/command/Symmetric/Hash.c @@ -53,4 +53,4 @@ TPM2_Hash(Hash_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_Hash \ No newline at end of file +#endif // CC_Hash diff --git a/TPMCmd/tpm/src/command/Symmetric/MAC.c b/TPMCmd/tpm/src/command/Symmetric/MAC.c index 6f76ebd..1c64bee 100644 --- a/TPMCmd/tpm/src/command/Symmetric/MAC.c +++ b/TPMCmd/tpm/src/command/Symmetric/MAC.c @@ -58,4 +58,4 @@ TPM2_MAC(MAC_In* in, // IN: input parameter list return TPM_RC_SUCCESS; } -#endif // CC_MAC \ No newline at end of file +#endif // CC_MAC diff --git a/TPMCmd/tpm/src/command/Testing/GetTestResult.c b/TPMCmd/tpm/src/command/Testing/GetTestResult.c index 8bc7e99..1817818 100644 --- a/TPMCmd/tpm/src/command/Testing/GetTestResult.c +++ b/TPMCmd/tpm/src/command/Testing/GetTestResult.c @@ -23,4 +23,4 @@ TPM2_GetTestResult(GetTestResult_Out* out // OUT: output parameter list return TPM_RC_SUCCESS; } -#endif // CC_GetTestResult \ No newline at end of file +#endif // CC_GetTestResult diff --git a/TPMCmd/tpm/src/command/Testing/IncrementalSelfTest.c b/TPMCmd/tpm/src/command/Testing/IncrementalSelfTest.c index e87c482..24a18cd 100644 --- a/TPMCmd/tpm/src/command/Testing/IncrementalSelfTest.c +++ b/TPMCmd/tpm/src/command/Testing/IncrementalSelfTest.c @@ -27,4 +27,4 @@ TPM2_IncrementalSelfTest(IncrementalSelfTest_In* in, // IN: input parameter li return result; } -#endif // CC_IncrementalSelfTest \ No newline at end of file +#endif // CC_IncrementalSelfTest diff --git a/TPMCmd/tpm/src/command/Testing/SelfTest.c b/TPMCmd/tpm/src/command/Testing/SelfTest.c index f83c393..e135d52 100644 --- a/TPMCmd/tpm/src/command/Testing/SelfTest.c +++ b/TPMCmd/tpm/src/command/Testing/SelfTest.c @@ -20,4 +20,4 @@ TPM2_SelfTest(SelfTest_In* in // IN: input parameter list return CryptSelfTest(in->fullTest); } -#endif // CC_SelfTest \ No newline at end of file +#endif // CC_SelfTest diff --git a/TPMCmd/tpm/src/crypt/AlgorithmTests.c b/TPMCmd/tpm/src/crypt/AlgorithmTests.c index 53dbedd..6e5ebca 100644 --- a/TPMCmd/tpm/src/crypt/AlgorithmTests.c +++ b/TPMCmd/tpm/src/crypt/AlgorithmTests.c @@ -875,4 +875,4 @@ TestAlgorithm(TPM_ALG_ID alg, ALGORITHM_VECTOR* toTest) return result; } -#endif // SELF_TESTS \ No newline at end of file +#endif // SELF_TESTS diff --git a/TPMCmd/tpm/src/crypt/CryptEccKeyExchange.c b/TPMCmd/tpm/src/crypt/CryptEccKeyExchange.c index 938e209..88bb6a7 100644 --- a/TPMCmd/tpm/src/crypt/CryptEccKeyExchange.c +++ b/TPMCmd/tpm/src/crypt/CryptEccKeyExchange.c @@ -342,4 +342,4 @@ LIB_EXPORT TPM_RC SM2KeyExchange( } # endif -#endif // CC_ZGen_2Phase \ No newline at end of file +#endif // CC_ZGen_2Phase diff --git a/TPMCmd/tpm/src/crypt/CryptEccMain.c b/TPMCmd/tpm/src/crypt/CryptEccMain.c index 71a5986..729f39b 100644 --- a/TPMCmd/tpm/src/crypt/CryptEccMain.c +++ b/TPMCmd/tpm/src/crypt/CryptEccMain.c @@ -664,4 +664,4 @@ LIB_EXPORT TPM_RC CryptEccGenerateKey( return retVal; } -#endif // ALG_ECC \ No newline at end of file +#endif // ALG_ECC diff --git a/TPMCmd/tpm/src/crypt/CryptEccSignature.c b/TPMCmd/tpm/src/crypt/CryptEccSignature.c index faeed67..873c5fa 100644 --- a/TPMCmd/tpm/src/crypt/CryptEccSignature.c +++ b/TPMCmd/tpm/src/crypt/CryptEccSignature.c @@ -276,4 +276,4 @@ LIB_EXPORT TPM_RC CryptEccCommitCompute( return retVal; } -#endif // ALG_ECC \ No newline at end of file +#endif // ALG_ECC diff --git a/TPMCmd/tpm/src/crypt/CryptHash.c b/TPMCmd/tpm/src/crypt/CryptHash.c index 41578a0..2542bf8 100644 --- a/TPMCmd/tpm/src/crypt/CryptHash.c +++ b/TPMCmd/tpm/src/crypt/CryptHash.c @@ -831,4 +831,4 @@ LIB_EXPORT UINT16 CryptKDFe(TPM_ALG_ID hashAlg, // IN: hash algorithm used in keyStream[0] &= ((1 << (sizeInBits % 8)) - 1); return (UINT16)((sizeInBits + 7) / 8); -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/crypt/CryptPrime.c b/TPMCmd/tpm/src/crypt/CryptPrime.c index 6236f1f..cd49e81 100644 --- a/TPMCmd/tpm/src/crypt/CryptPrime.c +++ b/TPMCmd/tpm/src/crypt/CryptPrime.c @@ -347,4 +347,4 @@ TPM_RC TpmRsa_GeneratePrimeForRSA( return (OK && found) ? TPM_RC_SUCCESS : TPM_RC_FAILURE; } -#endif // ALG_RSA \ No newline at end of file +#endif // ALG_RSA diff --git a/TPMCmd/tpm/src/crypt/CryptPrimeSieve.c b/TPMCmd/tpm/src/crypt/CryptPrimeSieve.c index 782a14f..08e64fe 100644 --- a/TPMCmd/tpm/src/crypt/CryptPrimeSieve.c +++ b/TPMCmd/tpm/src/crypt/CryptPrimeSieve.c @@ -517,4 +517,4 @@ void RsaSimulationEnd(void) { return; } -#endif \ No newline at end of file +#endif diff --git a/TPMCmd/tpm/src/crypt/CryptRsa.c b/TPMCmd/tpm/src/crypt/CryptRsa.c index fdbdeda..093950c 100644 --- a/TPMCmd/tpm/src/crypt/CryptRsa.c +++ b/TPMCmd/tpm/src/crypt/CryptRsa.c @@ -520,9 +520,7 @@ static TPM_RC RSAES_Decode(TPM2B* message, // OUT: the recovered message } //*** CryptRsaPssSaltSize() -// This function computes the salt size used in PSS. It is broken out so that -// the X509 code can get the same value that is used by the encoding function in this -// module. +// This function computes the salt size used in PSS. INT16 CryptRsaPssSaltSize(INT16 hashSize, INT16 outSize) { @@ -1416,4 +1414,4 @@ LIB_EXPORT TPM_RC CryptRsaGenerateKey( return retVal; } -#endif // ALG_RSA \ No newline at end of file +#endif // ALG_RSA diff --git a/TPMCmd/tpm/src/crypt/CryptSelfTest.c b/TPMCmd/tpm/src/crypt/CryptSelfTest.c index c39a25c..6a97db1 100644 --- a/TPMCmd/tpm/src/crypt/CryptSelfTest.c +++ b/TPMCmd/tpm/src/crypt/CryptSelfTest.c @@ -185,4 +185,4 @@ CryptTestAlgorithm(TPM_ALG_ID alg, ALGORITHM_VECTOR* toTest) result = TPM_RC_SUCCESS; #endif return result; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/crypt/PrimeData.c b/TPMCmd/tpm/src/crypt/PrimeData.c index 9788db3..611b800 100644 --- a/TPMCmd/tpm/src/crypt/PrimeData.c +++ b/TPMCmd/tpm/src/crypt/PrimeData.c @@ -355,4 +355,4 @@ UINT32 emptyFieldsSieved[3] = {0}; UINT32 noPrimeFields[3] = {0}; UINT32 primesChecked[3] = {0}; UINT16 lastSievePrime = 0; -#endif \ No newline at end of file +#endif diff --git a/TPMCmd/tpm/src/crypt/Ticket.c b/TPMCmd/tpm/src/crypt/Ticket.c index 66a1e78..b1f8b85 100644 --- a/TPMCmd/tpm/src/crypt/Ticket.c +++ b/TPMCmd/tpm/src/crypt/Ticket.c @@ -252,4 +252,4 @@ TPM_RC TicketComputeCreation(TPMI_RH_HIERARCHY hierarchy, // IN: hierarchy for CryptHmacEnd2B(&hmacState, &ticket->digest.b); return TPM_RC_SUCCESS; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/crypt/ecc/TpmEcc_Util.c b/TPMCmd/tpm/src/crypt/ecc/TpmEcc_Util.c index b449678..c6c63c4 100644 --- a/TPMCmd/tpm/src/crypt/ecc/TpmEcc_Util.c +++ b/TPMCmd/tpm/src/crypt/ecc/TpmEcc_Util.c @@ -59,4 +59,4 @@ LIB_EXPORT BOOL TpmEcc_PointTo2B( ecP, p->x.t.buffer, &p->x.t.size, p->y.t.buffer, &p->y.t.size); } -#endif // ALG_ECC \ No newline at end of file +#endif // ALG_ECC diff --git a/TPMCmd/tpm/src/crypt/math/TpmMath_Debug.c b/TPMCmd/tpm/src/crypt/math/TpmMath_Debug.c index 03bcea1..f4c22eb 100644 --- a/TPMCmd/tpm/src/crypt/math/TpmMath_Debug.c +++ b/TPMCmd/tpm/src/crypt/math/TpmMath_Debug.c @@ -109,4 +109,4 @@ BOOL TpmEccDebug_HexEqual(const Crypt_Int* bn, //IN: big number value return (ExtMath_UnsignedCmp(bn, bnC) == 0); } # endif // _SM2_SIGN_DEBUG -#endif // ALG_SM2 \ No newline at end of file +#endif // ALG_SM2 diff --git a/TPMCmd/tpm/src/events/_TPM_Hash_Data.c b/TPMCmd/tpm/src/events/_TPM_Hash_Data.c index 91eedaf..08f1452 100644 --- a/TPMCmd/tpm/src/events/_TPM_Hash_Data.c +++ b/TPMCmd/tpm/src/events/_TPM_Hash_Data.c @@ -35,4 +35,4 @@ LIB_EXPORT BOOL _TPM_Hash_Data(uint32_t dataSize, // IN: size of data to be ex } return TRUE; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/events/_TPM_Hash_End.c b/TPMCmd/tpm/src/events/_TPM_Hash_End.c index 4b73af2..1bcf642 100644 --- a/TPMCmd/tpm/src/events/_TPM_Hash_End.c +++ b/TPMCmd/tpm/src/events/_TPM_Hash_End.c @@ -65,4 +65,4 @@ LIB_EXPORT BOOL _TPM_Hash_End(void) TPMI_DH_OBJECT oldHandle = g_DRTMHandle; g_DRTMHandle = TPM_RH_UNASSIGNED; return FlushObject(oldHandle); -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/events/_TPM_Hash_Start.c b/TPMCmd/tpm/src/events/_TPM_Hash_Start.c index 8f5a0e4..6aaa2a8 100644 --- a/TPMCmd/tpm/src/events/_TPM_Hash_Start.c +++ b/TPMCmd/tpm/src/events/_TPM_Hash_Start.c @@ -57,4 +57,4 @@ LIB_EXPORT BOOL _TPM_Hash_Start(void) } return TRUE; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/events/_TPM_Init.c b/TPMCmd/tpm/src/events/_TPM_Init.c index 17c946b..5810524 100644 --- a/TPMCmd/tpm/src/events/_TPM_Init.c +++ b/TPMCmd/tpm/src/events/_TPM_Init.c @@ -4,7 +4,7 @@ // Move this to a future _plat_NvUpdateData() API and perform this in // platform code. -void UpgradeNvData() +static void UpgradeNvData(void) { // only update when required to avoid unnecessary flash defragmentation if(gp.firmwareV1 != _plat__GetTpmFirmwareVersionHigh() @@ -86,4 +86,4 @@ LIB_EXPORT void _TPM_Init(void) } return; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/main/CommandDispatcher.c b/TPMCmd/tpm/src/main/CommandDispatcher.c index 6eb8a54..a7e7654 100644 --- a/TPMCmd/tpm/src/main/CommandDispatcher.c +++ b/TPMCmd/tpm/src/main/CommandDispatcher.c @@ -363,4 +363,4 @@ CommandDispatcher(COMMAND* command) Exit: MemoryIoBufferZero(); return result; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/subsystem/CommandAudit.c b/TPMCmd/tpm/src/subsystem/CommandAudit.c index 0f3181a..22c67d7 100644 --- a/TPMCmd/tpm/src/subsystem/CommandAudit.c +++ b/TPMCmd/tpm/src/subsystem/CommandAudit.c @@ -230,4 +230,4 @@ void CommandAuditGetDigest(TPM2B_DIGEST* digest // OUT: command digest CryptHashEnd2B(&hashState, &digest->b); return; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/subsystem/DA.c b/TPMCmd/tpm/src/subsystem/DA.c index cf06d69..d5d3a9f 100644 --- a/TPMCmd/tpm/src/subsystem/DA.c +++ b/TPMCmd/tpm/src/subsystem/DA.c @@ -187,4 +187,4 @@ void DASelfHeal(void) } } return; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/subsystem/Hierarchy.c b/TPMCmd/tpm/src/subsystem/Hierarchy.c index 0963a1f..f8a73bc 100644 --- a/TPMCmd/tpm/src/subsystem/Hierarchy.c +++ b/TPMCmd/tpm/src/subsystem/Hierarchy.c @@ -504,4 +504,4 @@ BOOL HierarchyIsSvnLimited(TPMI_RH_HIERARCHY handle // IN DecomposeHandle(handle, &modifier); return modifier.type == HM_SVN_LIMITED; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/subsystem/NvReserved.c b/TPMCmd/tpm/src/subsystem/NvReserved.c index f919084..ce5cba5 100644 --- a/TPMCmd/tpm/src/subsystem/NvReserved.c +++ b/TPMCmd/tpm/src/subsystem/NvReserved.c @@ -218,4 +218,4 @@ void NvReadPersistent(void) { NvRead(&gp, NV_PERSISTENT_DATA, sizeof(gp)); return; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/subsystem/Object.c b/TPMCmd/tpm/src/subsystem/Object.c index 171d02d..e198767 100644 --- a/TPMCmd/tpm/src/subsystem/Object.c +++ b/TPMCmd/tpm/src/subsystem/Object.c @@ -918,4 +918,4 @@ OBJECT_ATTRIBUTES ObjectGetProperties(TPM_HANDLE handle) { return HandleToObject(handle)->attributes; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/subsystem/Time.c b/TPMCmd/tpm/src/subsystem/Time.c index d357b0e..7d39a0c 100644 --- a/TPMCmd/tpm/src/subsystem/Time.c +++ b/TPMCmd/tpm/src/subsystem/Time.c @@ -216,4 +216,4 @@ void TimeFillInfo(TPMS_CLOCK_INFO* clockInfo) clockInfo->safe = NO; return; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/support/AlgorithmCap.c b/TPMCmd/tpm/src/support/AlgorithmCap.c index 1990e05..ad95d61 100644 --- a/TPMCmd/tpm/src/support/AlgorithmCap.c +++ b/TPMCmd/tpm/src/support/AlgorithmCap.c @@ -221,4 +221,4 @@ void AlgorithmGetImplementedVector( index--) SET_BIT(s_algorithms[index].algID, *implemented); return; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/support/Entity.c b/TPMCmd/tpm/src/support/Entity.c index 00a6600..4268d54 100644 --- a/TPMCmd/tpm/src/support/Entity.c +++ b/TPMCmd/tpm/src/support/Entity.c @@ -521,4 +521,4 @@ EntityGetHierarchy(TPMI_DH_ENTITY handle // IN :handle of entity // this is unreachable but it provides a return value for the default // case which makes the complier happy return hierarchy; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/support/Global.c b/TPMCmd/tpm/src/support/Global.c index 20726b5..b51d31d 100644 --- a/TPMCmd/tpm/src/support/Global.c +++ b/TPMCmd/tpm/src/support/Global.c @@ -23,10 +23,6 @@ #include "Tpm.h" #include "OIDs.h" -#if CC_CertifyX509 -# include "X509.h" -#endif // CC_CertifyX509 - // Global string constants for consistency in KDF function calls. // These string constants are shared across functions to make sure that they // are all using consistent string values. @@ -66,21 +62,21 @@ TPM2B_STRING(OAEP_TEST_STRING, "OAEP Test Value"); #endif // ENABLE_SELF_TESTS //*** g_rcIndex[] -const UINT16 g_rcIndex[15] = {TPM_RC_1, - TPM_RC_2, - TPM_RC_3, - TPM_RC_4, - TPM_RC_5, - TPM_RC_6, - TPM_RC_7, - TPM_RC_8, - TPM_RC_9, - TPM_RC_A, - TPM_RC_B, - TPM_RC_C, - TPM_RC_D, - TPM_RC_E, - TPM_RC_F}; +const UINT16 g_rcIndex[15] = {TPM_RC_1, + TPM_RC_2, + TPM_RC_3, + TPM_RC_4, + TPM_RC_5, + TPM_RC_6, + TPM_RC_7, + TPM_RC_8, + TPM_RC_9, + TPM_RC_A, + TPM_RC_B, + TPM_RC_C, + TPM_RC_D, + TPM_RC_E, + TPM_RC_F}; -BOOL g_manufactured = FALSE; +BOOL g_manufactured = FALSE; BOOL g_initCompleted = FALSE; diff --git a/TPMCmd/tpm/src/support/Locality.c b/TPMCmd/tpm/src/support/Locality.c index 1dbf28b..1909d42 100644 --- a/TPMCmd/tpm/src/support/Locality.c +++ b/TPMCmd/tpm/src/support/Locality.c @@ -37,4 +37,4 @@ LocalityGetAttributes(UINT8 locality // IN: locality value break; } return locality_attributes; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/support/Manufacture.c b/TPMCmd/tpm/src/support/Manufacture.c index f9af9ea..aa7c54a 100644 --- a/TPMCmd/tpm/src/support/Manufacture.c +++ b/TPMCmd/tpm/src/support/Manufacture.c @@ -153,4 +153,4 @@ LIB_EXPORT void TpmEndSimulation(void) EccSimulationEnd(); # endif #endif // SIMULATION -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/support/Response.c b/TPMCmd/tpm/src/support/Response.c index bf0a167..4739ee4 100644 --- a/TPMCmd/tpm/src/support/Response.c +++ b/TPMCmd/tpm/src/support/Response.c @@ -43,4 +43,4 @@ void BuildResponseHeader(COMMAND* command, // IN: main control structure UINT32_Marshal((UINT32*)&command->parameterSize, &buffer, NULL); } command->parameterSize = size; -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/support/TpmFail.c b/TPMCmd/tpm/src/support/TpmFail.c index 46db0c0..a8585fb 100644 --- a/TPMCmd/tpm/src/support/TpmFail.c +++ b/TPMCmd/tpm/src/support/TpmFail.c @@ -371,4 +371,4 @@ void UnmarshalFail(void* type, BYTE** buffer, INT32* size) NOT_REFERENCED(buffer); NOT_REFERENCED(size); FAIL(FATAL_ERROR_INTERNAL); -} \ No newline at end of file +} diff --git a/TPMCmd/tpm/src/support/TpmSizeChecks.c b/TPMCmd/tpm/src/support/TpmSizeChecks.c index db529fe..ba7fb8a 100644 --- a/TPMCmd/tpm/src/support/TpmSizeChecks.c +++ b/TPMCmd/tpm/src/support/TpmSizeChecks.c @@ -170,6 +170,7 @@ BOOL TpmSizeChecks(void) "TPM_RH_ACT_%1X is not implemented by platform\n", act); PASS = FALSE; } + FALLTHROUGH; default: break; } @@ -191,4 +192,4 @@ BOOL TpmSizeChecks(void) return (PASS); } -#endif // RUNTIME_SIZE_CHECKS \ No newline at end of file +#endif // RUNTIME_SIZE_CHECKS