Commit a19c8712 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

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

parent e0ce5e33
...@@ -3682,54 +3682,21 @@ static void CRYPT_MakeCertInfo(PCERT_INFO info, const CRYPT_DATA_BLOB *pSerialNu ...@@ -3682,54 +3682,21 @@ 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) static HCRYPTPROV CRYPT_CreateKeyProv(void)
{ {
HCRYPTPROV hProv = 0; HCRYPTPROV prov;
HMODULE rpcrt = LoadLibraryW(L"rpcrt4"); HCRYPTKEY key;
if (rpcrt)
{
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) if (!CryptAcquireContextA(&prov, NULL, MS_DEF_PROV_A, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_NEWKEYSET))
{ return 0;
HCRYPTKEY key;
ret = CryptGenKey(hProv, AT_SIGNATURE, 0, &key); if (!CryptGenKey(prov, AT_SIGNATURE, 0, &key))
if (ret) {
CryptDestroyKey(key); CryptReleaseContext(prov, 0);
} return 0;
rpcStringFree(&uuidStr);
}
}
}
FreeLibrary(rpcrt);
} }
return hProv; CryptDestroyKey(key);
return prov;
} }
PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE 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