wintrust: Return error directly from WINTRUST_VerifySigner.

This commit is contained in:
Juan Lang 2010-01-27 14:03:13 -08:00 committed by Alexandre Julliard
parent 9e47c59427
commit 1781878b00
1 changed files with 21 additions and 13 deletions

View File

@ -520,9 +520,9 @@ static CERT_INFO *WINTRUST_GetSignerCertInfo(CRYPT_PROVIDER_DATA *data,
return certInfo; return certInfo;
} }
static BOOL WINTRUST_VerifySigner(CRYPT_PROVIDER_DATA *data, DWORD signerIdx) static DWORD WINTRUST_VerifySigner(CRYPT_PROVIDER_DATA *data, DWORD signerIdx)
{ {
BOOL ret; DWORD err;
CERT_INFO *certInfo = WINTRUST_GetSignerCertInfo(data, signerIdx); CERT_INFO *certInfo = WINTRUST_GetSignerCertInfo(data, signerIdx);
if (certInfo) if (certInfo)
@ -535,25 +535,24 @@ static BOOL WINTRUST_VerifySigner(CRYPT_PROVIDER_DATA *data, DWORD signerIdx)
CMSG_CTRL_VERIFY_SIGNATURE_EX_PARA para = { sizeof(para), 0, CMSG_CTRL_VERIFY_SIGNATURE_EX_PARA para = { sizeof(para), 0,
signerIdx, CMSG_VERIFY_SIGNER_CERT, (LPVOID)subject }; signerIdx, CMSG_VERIFY_SIGNER_CERT, (LPVOID)subject };
ret = CryptMsgControl(data->hMsg, 0, CMSG_CTRL_VERIFY_SIGNATURE_EX, if (!CryptMsgControl(data->hMsg, 0, CMSG_CTRL_VERIFY_SIGNATURE_EX,
&para); &para))
if (!ret) err = TRUST_E_CERT_SIGNATURE;
SetLastError(TRUST_E_CERT_SIGNATURE);
else else
{
data->psPfns->pfnAddCert2Chain(data, signerIdx, FALSE, 0, data->psPfns->pfnAddCert2Chain(data, signerIdx, FALSE, 0,
subject); subject);
err = ERROR_SUCCESS;
}
CertFreeCertificateContext(subject); CertFreeCertificateContext(subject);
} }
else else
{ err = TRUST_E_NO_SIGNER_CERT;
SetLastError(TRUST_E_NO_SIGNER_CERT);
ret = FALSE;
}
data->psPfns->pfnFree(certInfo); data->psPfns->pfnFree(certInfo);
} }
else else
ret = FALSE; err = GetLastError();
return ret; return err;
} }
HRESULT WINAPI SoftpubLoadSignature(CRYPT_PROVIDER_DATA *data) HRESULT WINAPI SoftpubLoadSignature(CRYPT_PROVIDER_DATA *data)
@ -579,7 +578,16 @@ HRESULT WINAPI SoftpubLoadSignature(CRYPT_PROVIDER_DATA *data)
for (i = 0; ret && i < signerCount; i++) for (i = 0; ret && i < signerCount; i++)
{ {
if ((ret = WINTRUST_SaveSigner(data, i))) if ((ret = WINTRUST_SaveSigner(data, i)))
ret = WINTRUST_VerifySigner(data, i); {
DWORD err;
err = WINTRUST_VerifySigner(data, i);
if (err)
{
SetLastError(err);
ret = FALSE;
}
}
} }
} }
else else