crypt32: Directly call I_CryptGetDefaultCryptProv to make hooking from a 3rd party CSP work.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-11-02 17:06:57 +03:00 committed by Alexandre Julliard
parent 0dd0d879a1
commit 41e0a38f7c
4 changed files with 10 additions and 10 deletions

View File

@ -2169,7 +2169,7 @@ BOOL WINAPI CryptHashCertificate(HCRYPTPROV_LEGACY hCryptProv, ALG_ID Algid,
pbEncoded, cbEncoded, pbComputedHash, pcbComputedHash);
if (!hCryptProv)
hCryptProv = CRYPT_GetDefaultProvider();
hCryptProv = I_CryptGetDefaultCryptProv(0);
if (!Algid)
Algid = CALG_SHA1;
if (ret)
@ -2198,7 +2198,7 @@ BOOL WINAPI CryptHashPublicKeyInfo(HCRYPTPROV_LEGACY hCryptProv, ALG_ID Algid,
dwCertEncodingType, pInfo, pbComputedHash, pcbComputedHash);
if (!hCryptProv)
hCryptProv = CRYPT_GetDefaultProvider();
hCryptProv = I_CryptGetDefaultCryptProv(0);
if (!Algid)
Algid = CALG_MD5;
if ((dwCertEncodingType & CERT_ENCODING_TYPE_MASK) != X509_ASN_ENCODING)
@ -2250,7 +2250,7 @@ BOOL WINAPI CryptHashToBeSigned(HCRYPTPROV_LEGACY hCryptProv,
HCRYPTHASH hHash;
if (!hCryptProv)
hCryptProv = CRYPT_GetDefaultProvider();
hCryptProv = I_CryptGetDefaultCryptProv(0);
oidInfo = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY,
info->SignatureAlgorithm.pszObjId, 0);
if (!oidInfo)
@ -2299,7 +2299,7 @@ BOOL WINAPI CryptSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProv,
if (info->dwGroupId == CRYPT_HASH_ALG_OID_GROUP_ID)
{
if (!hCryptProv)
hCryptProv = CRYPT_GetDefaultProvider();
hCryptProv = I_CryptGetDefaultCryptProv(0);
ret = CryptCreateHash(hCryptProv, info->u.Algid, 0, 0, &hHash);
if (ret)
{
@ -2423,7 +2423,7 @@ static BOOL CRYPT_VerifySignature(HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEnco
pubKeyID = hashID;
/* Load the default provider if necessary */
if (!hCryptProv)
hCryptProv = CRYPT_GetDefaultProvider();
hCryptProv = I_CryptGetDefaultCryptProv(0);
ret = CryptImportPublicKeyInfoEx(hCryptProv, dwCertEncodingType,
pubKeyInfo, pubKeyID, 0, NULL, &key);
if (ret)

View File

@ -149,7 +149,7 @@ BOOL WINAPI CRYPT_AsnEncodePubKeyInfoNoNull(DWORD dwCertEncodingType,
/* Returns a handle to the default crypto provider; loads it if necessary.
* Returns NULL on failure.
*/
HCRYPTPROV CRYPT_GetDefaultProvider(void) DECLSPEC_HIDDEN;
HCRYPTPROV WINAPI I_CryptGetDefaultCryptProv(DWORD);
HINSTANCE hInstance DECLSPEC_HIDDEN;

View File

@ -56,7 +56,7 @@ BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved)
return TRUE;
}
HCRYPTPROV CRYPT_GetDefaultProvider(void)
static HCRYPTPROV CRYPT_GetDefaultProvider(void)
{
if (!hDefProv)
{

View File

@ -567,7 +567,7 @@ static HCRYPTMSG CHashEncodeMsg_Open(DWORD dwFlags, const void *pvMsgEncodeInfo,
prov = info->hCryptProv;
else
{
prov = CRYPT_GetDefaultProvider();
prov = I_CryptGetDefaultCryptProv(0);
dwFlags &= ~CMSG_CRYPT_RELEASE_CONTEXT_FLAG;
}
msg = CryptMemAlloc(sizeof(CHashEncodeMsg));
@ -1956,7 +1956,7 @@ static HCRYPTMSG CEnvelopedEncodeMsg_Open(DWORD dwFlags,
prov = info->hCryptProv;
else
{
prov = CRYPT_GetDefaultProvider();
prov = I_CryptGetDefaultCryptProv(0);
dwFlags &= ~CMSG_CRYPT_RELEASE_CONTEXT_FLAG;
}
msg = CryptMemAlloc(sizeof(CEnvelopedEncodeMsg));
@ -3545,7 +3545,7 @@ HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags,
msg->crypt_prov = hCryptProv;
else
{
msg->crypt_prov = CRYPT_GetDefaultProvider();
msg->crypt_prov = I_CryptGetDefaultCryptProv(0);
msg->base.open_flags &= ~CMSG_CRYPT_RELEASE_CONTEXT_FLAG;
}
memset(&msg->u, 0, sizeof(msg->u));