/src/libtpms/src/tpm2/Utils.h
Line | Count | Source |
1 | | // SPDX-License-Identifier: BSD-2-Clause |
2 | | |
3 | | // (c) Copyright IBM Corporation 2017,2018. |
4 | | |
5 | | #ifndef UTILS_H |
6 | | #define UTILS_H |
7 | | |
8 | | #include "prototypes/Memory_fp.h" |
9 | | |
10 | | #define TPM2_ROUNDUP(VAL, SIZE) \ |
11 | 194k | ( ( (VAL) + (SIZE) - 1) / (SIZE) ) * (SIZE) |
12 | | |
13 | 1.78k | __attribute__((unused)) static inline void clear_and_free(void *ptr, size_t size) { |
14 | 1.78k | if (ptr) { |
15 | 892 | MemorySet(ptr, 0, size); |
16 | 892 | free(ptr); |
17 | 892 | } |
18 | 1.78k | } Unexecuted instantiation: tpm_tpm2_interface.c:clear_and_free Unexecuted instantiation: tpm_tpm2_tis.c:clear_and_free Unexecuted instantiation: ExpDCache.c:clear_and_free Unexecuted instantiation: IntegrityCommands.c:clear_and_free Unexecuted instantiation: Manufacture.c:clear_and_free Unexecuted instantiation: NVMarshal.c:clear_and_free Unexecuted instantiation: NVMem.c:clear_and_free Unexecuted instantiation: NV_spt.c:clear_and_free Unexecuted instantiation: NvDynamic.c:clear_and_free Unexecuted instantiation: NvReserved.c:clear_and_free Unexecuted instantiation: Object.c:clear_and_free Unexecuted instantiation: Object_spt.c:clear_and_free Unexecuted instantiation: PCR.c:clear_and_free Unexecuted instantiation: PP.c:clear_and_free Unexecuted instantiation: Power.c:clear_and_free Unexecuted instantiation: ResponseCodeProcessing.c:clear_and_free Unexecuted instantiation: RuntimeAlgorithm.c:clear_and_free Unexecuted instantiation: RuntimeAttributes.c:clear_and_free Unexecuted instantiation: RuntimeCommands.c:clear_and_free Unexecuted instantiation: RuntimeProfile.c:clear_and_free Unexecuted instantiation: StateMarshal.c:clear_and_free Unexecuted instantiation: TpmFail.c:clear_and_free Unexecuted instantiation: Unmarshal.c:clear_and_free Unexecuted instantiation: Volatile.c:clear_and_free Unexecuted instantiation: BackwardsCompatibilityBitArray.c:clear_and_free Unexecuted instantiation: BackwardsCompatibilityObject.c:clear_and_free Unexecuted instantiation: Bits.c:clear_and_free Unexecuted instantiation: BnMath.c:clear_and_free Unexecuted instantiation: Clock.c:clear_and_free Unexecuted instantiation: CommandAudit.c:clear_and_free Unexecuted instantiation: CommandCodeAttributes.c:clear_and_free Unexecuted instantiation: CryptEccMain.c:clear_and_free Unexecuted instantiation: CryptHash.c:clear_and_free Unexecuted instantiation: CryptRand.c:clear_and_free Unexecuted instantiation: CryptRsa.c:clear_and_free Unexecuted instantiation: CryptSelfTest.c:clear_and_free Unexecuted instantiation: CryptSmac.c:clear_and_free CryptSym.c:clear_and_free Line | Count | Source | 13 | 1.78k | __attribute__((unused)) static inline void clear_and_free(void *ptr, size_t size) { | 14 | 1.78k | if (ptr) { | 15 | 892 | MemorySet(ptr, 0, size); | 16 | 892 | free(ptr); | 17 | 892 | } | 18 | 1.78k | } |
Unexecuted instantiation: CryptUtil.c:clear_and_free Unexecuted instantiation: DA.c:clear_and_free Unexecuted instantiation: ExecCommand.c:clear_and_free Unexecuted instantiation: Global.c:clear_and_free Unexecuted instantiation: Handle.c:clear_and_free Unexecuted instantiation: Helpers.c:clear_and_free Unexecuted instantiation: Hierarchy.c:clear_and_free Unexecuted instantiation: LibtpmsCallbacks.c:clear_and_free Unexecuted instantiation: Locality.c:clear_and_free Unexecuted instantiation: Marshal.c:clear_and_free Unexecuted instantiation: MathOnByteBuffers.c:clear_and_free Unexecuted instantiation: Memory.c:clear_and_free Unexecuted instantiation: PropertyCap.c:clear_and_free Unexecuted instantiation: Response.c:clear_and_free Unexecuted instantiation: Session.c:clear_and_free Unexecuted instantiation: SessionProcess.c:clear_and_free Unexecuted instantiation: Time.c:clear_and_free Unexecuted instantiation: TpmEcc_Signature_ECDSA.c:clear_and_free Unexecuted instantiation: TpmEcc_Util.c:clear_and_free Unexecuted instantiation: TpmMath_Util.c:clear_and_free Unexecuted instantiation: TpmToOsslDesSupport.c:clear_and_free Unexecuted instantiation: _TPM_Init.c:clear_and_free Unexecuted instantiation: AlgorithmCap.c:clear_and_free Unexecuted instantiation: AlgorithmTests.c:clear_and_free Unexecuted instantiation: CommandDispatcher.c:clear_and_free Unexecuted instantiation: ContextCommands.c:clear_and_free Unexecuted instantiation: Context_spt.c:clear_and_free Unexecuted instantiation: Create.c:clear_and_free Unexecuted instantiation: CreateLoaded.c:clear_and_free Unexecuted instantiation: CreatePrimary.c:clear_and_free Unexecuted instantiation: CryptCmac.c:clear_and_free Unexecuted instantiation: CryptDes.c:clear_and_free Unexecuted instantiation: CryptEccData.c:clear_and_free Unexecuted instantiation: CryptEccSignature.c:clear_and_free Unexecuted instantiation: CryptPrime.c:clear_and_free Unexecuted instantiation: CryptPrimeSieve.c:clear_and_free Unexecuted instantiation: DictionaryCommands.c:clear_and_free Unexecuted instantiation: Duplicate.c:clear_and_free Unexecuted instantiation: DuplicationCommands.c:clear_and_free Unexecuted instantiation: EACommands.c:clear_and_free Unexecuted instantiation: Entity.c:clear_and_free Unexecuted instantiation: EphemeralCommands.c:clear_and_free Unexecuted instantiation: HashCommands.c:clear_and_free Unexecuted instantiation: HierarchyCommands.c:clear_and_free Unexecuted instantiation: Import.c:clear_and_free Unexecuted instantiation: IoBuffers.c:clear_and_free Unexecuted instantiation: MakeCredential.c:clear_and_free Unexecuted instantiation: ManagementCommands.c:clear_and_free Unexecuted instantiation: NVCommands.c:clear_and_free Unexecuted instantiation: NV_Read.c:clear_and_free Unexecuted instantiation: NV_ReadPublic.c:clear_and_free Unexecuted instantiation: ObjectChangeAuth.c:clear_and_free Unexecuted instantiation: ObjectCommands.c:clear_and_free Unexecuted instantiation: PCR_Read.c:clear_and_free Unexecuted instantiation: PolicyAuthorize.c:clear_and_free Unexecuted instantiation: PolicyAuthorizeNV.c:clear_and_free Unexecuted instantiation: PolicyPCR.c:clear_and_free Unexecuted instantiation: PolicySecret.c:clear_and_free Unexecuted instantiation: PolicySigned.c:clear_and_free Unexecuted instantiation: PolicyTicket.c:clear_and_free Unexecuted instantiation: Policy_spt.c:clear_and_free Unexecuted instantiation: PrimeData.c:clear_and_free Unexecuted instantiation: Quote.c:clear_and_free Unexecuted instantiation: RandomCommands.c:clear_and_free Unexecuted instantiation: SessionCommands.c:clear_and_free Unexecuted instantiation: SigningCommands.c:clear_and_free Unexecuted instantiation: StartupCommands.c:clear_and_free Unexecuted instantiation: SymmetricCommands.c:clear_and_free Unexecuted instantiation: TestingCommands.c:clear_and_free Unexecuted instantiation: Ticket.c:clear_and_free Unexecuted instantiation: TpmEcc_Signature_ECDAA.c:clear_and_free Unexecuted instantiation: TpmEcc_Signature_SM2.c:clear_and_free Unexecuted instantiation: TpmEcc_Signature_Schnorr.c:clear_and_free Unexecuted instantiation: TpmEcc_Signature_Util.c:clear_and_free Unexecuted instantiation: ACT_spt.c:clear_and_free Unexecuted instantiation: AsymmetricCommands.c:clear_and_free Unexecuted instantiation: Attest_spt.c:clear_and_free Unexecuted instantiation: AttestationCommands.c:clear_and_free Unexecuted instantiation: AuditCommands.c:clear_and_free Unexecuted instantiation: CapabilityCommands.c:clear_and_free Unexecuted instantiation: ClockCommands.c:clear_and_free Unexecuted instantiation: CryptEccCrypt.c:clear_and_free Unexecuted instantiation: CryptEccKeyExchange.c:clear_and_free Unexecuted instantiation: EncryptDecrypt_spt.c:clear_and_free Unexecuted instantiation: TpmASN1.c:clear_and_free Unexecuted instantiation: X509_spt.c:clear_and_free Unexecuted instantiation: X509_ECC.c:clear_and_free Unexecuted instantiation: X509_RSA.c:clear_and_free |
19 | | |
20 | | #endif /* UTILS_H */ |