Commit 7861b1e8 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

Revert "crypt32: Do not create persistent container in CRYPT_CreateKeyProv().".

This reverts commit a19c8712.
parent 00df1bea
......@@ -3682,21 +3682,54 @@ static void CRYPT_MakeCertInfo(PCERT_INFO info, const CRYPT_DATA_BLOB *pSerialNu
}
}
typedef RPC_STATUS (RPC_ENTRY *UuidCreateFunc)(UUID *);
typedef RPC_STATUS (RPC_ENTRY *UuidToStringFunc)(UUID *, unsigned char **);
typedef RPC_STATUS (RPC_ENTRY *RpcStringFreeFunc)(unsigned char **);
static HCRYPTPROV CRYPT_CreateKeyProv(void)
{
HCRYPTPROV prov;
HCRYPTKEY key;
HCRYPTPROV hProv = 0;
HMODULE rpcrt = LoadLibraryW(L"rpcrt4");
if (!CryptAcquireContextA(&prov, NULL, MS_DEF_PROV_A, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_NEWKEYSET))
return 0;
if (!CryptGenKey(prov, AT_SIGNATURE, 0, &key))
if (rpcrt)
{
CryptReleaseContext(prov, 0);
return 0;
UuidCreateFunc uuidCreate = (UuidCreateFunc)GetProcAddress(rpcrt,
"UuidCreate");
UuidToStringFunc uuidToString = (UuidToStringFunc)GetProcAddress(rpcrt,
"UuidToStringA");
RpcStringFreeFunc rpcStringFree = (RpcStringFreeFunc)GetProcAddress(
rpcrt, "RpcStringFreeA");
if (uuidCreate && uuidToString && rpcStringFree)
{
UUID uuid;
RPC_STATUS status = uuidCreate(&uuid);
if (status == RPC_S_OK || status == RPC_S_UUID_LOCAL_ONLY)
{
unsigned char *uuidStr;
status = uuidToString(&uuid, &uuidStr);
if (status == RPC_S_OK)
{
BOOL ret = CryptAcquireContextA(&hProv, (LPCSTR)uuidStr,
MS_DEF_PROV_A, PROV_RSA_FULL, CRYPT_NEWKEYSET);
if (ret)
{
HCRYPTKEY key;
ret = CryptGenKey(hProv, AT_SIGNATURE, 0, &key);
if (ret)
CryptDestroyKey(key);
}
rpcStringFree(&uuidStr);
}
}
}
FreeLibrary(rpcrt);
}
CryptDestroyKey(key);
return prov;
return hProv;
}
PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hProv,
......
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