Commit 5eb46095 authored by Kees Cook's avatar Kees Cook Committed by Alexandre Julliard

Correct crypt context init in CryptProtectData/CryptUnprotectData.

parent 54acd10d
......@@ -861,7 +861,8 @@ BOOL WINAPI CryptProtectData(DATA_BLOB* pDataIn,
szDataDescr=(WCHAR[]){'\0'};
/* get crypt context */
if (!CryptAcquireContextW(&hProv,NULL,NULL,CRYPT32_PROTECTDATA_PROV,0))
if (!CryptAcquireContextW(&hProv,NULL,NULL,CRYPT32_PROTECTDATA_PROV,0) &&
!CryptAcquireContextW(&hProv,NULL,NULL,CRYPT32_PROTECTDATA_PROV,CRYPT_NEWKEYSET))
{
ERR("CryptAcquireContextW failed\n");
goto finished;
......@@ -1042,7 +1043,8 @@ BOOL WINAPI CryptUnprotectData(DATA_BLOB* pDataIn,
}
/* get a crypt context */
if (!CryptAcquireContextW(&hProv,NULL,NULL,CRYPT32_PROTECTDATA_PROV,0))
if (!CryptAcquireContextW(&hProv,NULL,NULL,CRYPT32_PROTECTDATA_PROV,0) &&
!CryptAcquireContextW(&hProv,NULL,NULL,CRYPT32_PROTECTDATA_PROV,CRYPT_NEWKEYSET))
{
ERR("CryptAcquireContextW failed\n");
goto free_protect_data;
......
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