diff --git a/include/Domito.h b/include/Domito.h index 530a3a7..3a1f9b4 100644 --- a/include/Domito.h +++ b/include/Domito.h @@ -199,6 +199,16 @@ DomitoCalculatePortableExecutableDigest( _Out_ PULONG pSizeOfSecurityDirectory ); +// +// Frees the memory allocated by DomitoCalculatePortableExecutableDigest. +// +_IRQL_requires_max_(DISPATCH_LEVEL) +EXTERN_C +void +DomitoFreePortableExecutableDigest( + _In_ PVOID pDigestOut +); + // // Verifies if the Authenticode signature of a give PE file matches the provided (e.g. SHA1) file digest. // diff --git a/src/Domito.CodeIntegrity.cpp b/src/Domito.CodeIntegrity.cpp index de67e90..d181ae7 100644 --- a/src/Domito.CodeIntegrity.cpp +++ b/src/Domito.CodeIntegrity.cpp @@ -363,6 +363,20 @@ cleanup: return status; } +_IRQL_requires_max_(DISPATCH_LEVEL) +void +DomitoFreePortableExecutableDigest( + _In_ PVOID pDigestOut +) +{ + if (!pDigestOut) + { + return; + } + + ExFreePoolWithTag(pDigestOut, DOMITO_POOL_TAG); +} + _Success_(return == STATUS_SUCCESS) _Must_inspect_result_ _IRQL_requires_max_(PASSIVE_LEVEL)