Commit 430b9db0 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

appwiz.cpl: Use BCryptHash().

parent c7b5778d
......@@ -119,7 +119,6 @@ static BOOL sha_check(const WCHAR *file_name)
const unsigned char *file_map;
HANDLE file, map;
DWORD size, i;
BCRYPT_HASH_HANDLE hash = NULL;
UCHAR sha[32];
char buf[1024];
BOOL ret = FALSE;
......@@ -142,23 +141,16 @@ static BOOL sha_check(const WCHAR *file_name)
if(!file_map)
return FALSE;
if(BCryptCreateHash(BCRYPT_SHA256_ALG_HANDLE, &hash, NULL, 0, NULL, 0, 0))
goto end;
if(BCryptHashData(hash, (UCHAR *)file_map, size, 0))
goto end;
if(BCryptFinishHash(hash, sha, sizeof(sha), 0))
goto end;
if(!BCryptHash(BCRYPT_SHA256_ALG_HANDLE, NULL, 0, (UCHAR *)file_map, size, sha, sizeof(sha))) {
for(i=0; i < sizeof(sha); i++)
sprintf(buf + i * 2, "%02x", sha[i]);
for(i=0; i < sizeof(sha); i++)
sprintf(buf + i * 2, "%02x", sha[i]);
ret = !strcmp(buf, addon->sha);
if(!ret)
WARN("Got %s, expected %s\n", buf, addon->sha);
ret = !strcmp(buf, addon->sha);
if(!ret)
WARN("Got %s, expected %s\n", buf, addon->sha);
}
end:
UnmapViewOfFile(file_map);
if(hash) BCryptDestroyHash(hash);
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment