@@ -99,11 +99,12 @@ static std::string CalculateFileSha256(HANDLE hFile) {
9999 DWORD dwError = GetLastError ();
100100 LogError (LOG_TAG " CalculateFileSha256.SetFilePointer failed. Error: %u" ,
101101 dwError);
102- return " " ; // Return empty string on failure
102+ return " " ; // Return empty string on failure
103103 }
104104
105105 // Acquire Crypto Provider.
106- // Using CRYPT_VERIFYCONTEXT for operations that don't require private key access.
106+ // Using CRYPT_VERIFYCONTEXT for operations that don't require private key
107+ // access.
107108 if (!CryptAcquireContextW (&hProv, NULL , NULL , PROV_RSA_AES,
108109 CRYPT_VERIFYCONTEXT)) {
109110 DWORD dwError = GetLastError ();
@@ -152,7 +153,8 @@ static std::string CalculateFileSha256(HANDLE hFile) {
152153 // --- Get the binary hash value ---
153154 DWORD cbHashValue = 0 ;
154155 DWORD dwCount = sizeof (DWORD);
155- if (!CryptGetHashParam (hHash, HP_HASHSIZE, (BYTE*)&cbHashValue, &dwCount, 0 )) {
156+ if (!CryptGetHashParam (hHash, HP_HASHSIZE, (BYTE*)&cbHashValue, &dwCount,
157+ 0 )) {
156158 DWORD dwError = GetLastError ();
157159 LogError (LOG_TAG
158160 " CalculateFileSha256.CryptGetHashParam (HP_HASHSIZE) failed. "
@@ -179,12 +181,13 @@ static std::string CalculateFileSha256(HANDLE hFile) {
179181 // --- Convert the binary hash to a hex string ---
180182 DWORD hex_string_size = 0 ;
181183 if (!CryptBinaryToStringA (binary_hash_value.data (), binary_hash_value.size (),
182- CRYPT_STRING_HEXRAW | CRYPT_STRING_NOCRLF,
183- NULL , &hex_string_size)) {
184+ CRYPT_STRING_HEXRAW | CRYPT_STRING_NOCRLF, NULL ,
185+ &hex_string_size)) {
184186 DWORD dwError = GetLastError ();
185- LogError (LOG_TAG
186- " CalculateFileSha256.CryptBinaryToStringA (size) failed. Error: %u" ,
187- dwError);
187+ LogError (
188+ LOG_TAG
189+ " CalculateFileSha256.CryptBinaryToStringA (size) failed. Error: %u" ,
190+ dwError);
188191 CryptDestroyHash (hHash);
189192 CryptReleaseContext (hProv, 0 );
190193 return " " ;
@@ -196,7 +199,8 @@ static std::string CalculateFileSha256(HANDLE hFile) {
196199 &hex_hash_string[0 ], &hex_string_size)) {
197200 DWORD dwError = GetLastError ();
198201 LogError (LOG_TAG
199- " CalculateFileSha256.CryptBinaryToStringA (conversion) failed. Error: %u" ,
202+ " CalculateFileSha256.CryptBinaryToStringA (conversion) failed. "
203+ " Error: %u" ,
200204 dwError);
201205 CryptDestroyHash (hHash);
202206 CryptReleaseContext (hProv, 0 );
@@ -286,9 +290,9 @@ HMODULE VerifyAndLoadAnalyticsLibrary(
286290 if (calculated_hash == expected_hash) {
287291 hash_matched = true ;
288292 break ;
289- }
290- else {
291- LogDebug (LOG_TAG " Hash mismatch: got %s expected %s " , calculated_hash.c_str (), expected_hash.c_str ());
293+ } else {
294+ LogDebug (LOG_TAG " Hash mismatch: got %s expected %s " ,
295+ calculated_hash.c_str (), expected_hash.c_str ());
292296 }
293297 }
294298
0 commit comments