wintrust: Use helper function for setting confidence in SoftpubCheckCert.
This commit is contained in:
parent
cc3a94f40d
commit
c20a617aec
@ -501,6 +501,20 @@ HRESULT WINAPI SoftpubLoadSignature(CRYPT_PROVIDER_DATA *data)
|
|||||||
return ret ? S_OK : S_FALSE;
|
return ret ? S_OK : S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DWORD WINTRUST_TrustStatusToConfidence(DWORD errorStatus)
|
||||||
|
{
|
||||||
|
DWORD confidence = 0;
|
||||||
|
|
||||||
|
confidence = 0;
|
||||||
|
if (!(errorStatus & CERT_TRUST_IS_NOT_SIGNATURE_VALID))
|
||||||
|
confidence |= CERT_CONFIDENCE_SIG;
|
||||||
|
if (!(errorStatus & CERT_TRUST_IS_NOT_TIME_VALID))
|
||||||
|
confidence |= CERT_CONFIDENCE_TIME;
|
||||||
|
if (!(errorStatus & CERT_TRUST_IS_NOT_TIME_NESTED))
|
||||||
|
confidence |= CERT_CONFIDENCE_TIMENEST;
|
||||||
|
return confidence;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL WINAPI SoftpubCheckCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
|
BOOL WINAPI SoftpubCheckCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
|
||||||
BOOL fCounterSignerChain, DWORD idxCounterSigner)
|
BOOL fCounterSignerChain, DWORD idxCounterSigner)
|
||||||
{
|
{
|
||||||
@ -524,19 +538,9 @@ BOOL WINAPI SoftpubCheckCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
|
|||||||
for (i = 0; i < simpleChain->cElement; i++)
|
for (i = 0; i < simpleChain->cElement; i++)
|
||||||
{
|
{
|
||||||
/* Set confidence */
|
/* Set confidence */
|
||||||
data->pasSigners[idxSigner].pasCertChain[i].dwConfidence = 0;
|
data->pasSigners[idxSigner].pasCertChain[i].dwConfidence =
|
||||||
if (!(simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus &
|
WINTRUST_TrustStatusToConfidence(
|
||||||
CERT_TRUST_IS_NOT_TIME_VALID))
|
simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus);
|
||||||
data->pasSigners[idxSigner].pasCertChain[i].dwConfidence
|
|
||||||
|= CERT_CONFIDENCE_TIME;
|
|
||||||
if (!(simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus &
|
|
||||||
CERT_TRUST_IS_NOT_TIME_NESTED))
|
|
||||||
data->pasSigners[idxSigner].pasCertChain[i].dwConfidence
|
|
||||||
|= CERT_CONFIDENCE_TIMENEST;
|
|
||||||
if (!(simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus &
|
|
||||||
CERT_TRUST_IS_NOT_SIGNATURE_VALID))
|
|
||||||
data->pasSigners[idxSigner].pasCertChain[i].dwConfidence
|
|
||||||
|= CERT_CONFIDENCE_SIG;
|
|
||||||
/* Set additional flags */
|
/* Set additional flags */
|
||||||
if (!(simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus &
|
if (!(simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus &
|
||||||
CERT_TRUST_IS_UNTRUSTED_ROOT))
|
CERT_TRUST_IS_UNTRUSTED_ROOT))
|
||||||
@ -552,20 +556,6 @@ BOOL WINAPI SoftpubCheckCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD WINTRUST_TrustStatusToConfidence(DWORD errorStatus)
|
|
||||||
{
|
|
||||||
DWORD confidence = 0;
|
|
||||||
|
|
||||||
confidence = 0;
|
|
||||||
if (!(errorStatus & CERT_TRUST_IS_NOT_SIGNATURE_VALID))
|
|
||||||
confidence |= CERT_CONFIDENCE_SIG;
|
|
||||||
if (!(errorStatus & CERT_TRUST_IS_NOT_TIME_VALID))
|
|
||||||
confidence |= CERT_CONFIDENCE_TIME;
|
|
||||||
if (!(errorStatus & CERT_TRUST_IS_NOT_TIME_NESTED))
|
|
||||||
confidence |= CERT_CONFIDENCE_TIMENEST;
|
|
||||||
return confidence;
|
|
||||||
}
|
|
||||||
|
|
||||||
static DWORD WINTRUST_TrustStatusToError(DWORD errorStatus)
|
static DWORD WINTRUST_TrustStatusToError(DWORD errorStatus)
|
||||||
{
|
{
|
||||||
DWORD error;
|
DWORD error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user