From 494483650da94e5500e77ef94f3270509b6cfd2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Fri, 24 Nov 2023 15:28:32 +0100 Subject: [PATCH] Added DomitoFreePortableExecutableDigest --- include/Domito.h | 10 ++++++++++ src/Domito.CodeIntegrity.cpp | 14 ++++++++++++++ 2 files changed, 24 insertions(+) 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)