crypt32: Use public functions when finding certificates.

This commit is contained in:
Juan Lang 2006-05-25 08:51:37 -07:00 committed by Alexandre Julliard
parent 163ee76592
commit 3be75cebe8
1 changed files with 12 additions and 14 deletions

View File

@ -553,7 +553,12 @@ BOOL WINAPI CertCompareIntegerBlob(PCRYPT_INTEGER_BLOB pInt1,
cb1 = CRYPT_significantBytes(pInt1); cb1 = CRYPT_significantBytes(pInt1);
cb2 = CRYPT_significantBytes(pInt2); cb2 = CRYPT_significantBytes(pInt2);
if (cb1 == cb2) if (cb1 == cb2)
ret = !memcmp(pInt1->pbData, pInt1->pbData, cb1); {
if (cb1)
ret = !memcmp(pInt1->pbData, pInt1->pbData, cb1);
else
ret = TRUE;
}
else else
ret = FALSE; ret = FALSE;
return ret; return ret;
@ -634,32 +639,25 @@ static BOOL compare_cert_by_sha1_hash(PCCERT_CONTEXT pCertContext, DWORD dwType,
static BOOL compare_cert_by_name(PCCERT_CONTEXT pCertContext, DWORD dwType, static BOOL compare_cert_by_name(PCCERT_CONTEXT pCertContext, DWORD dwType,
DWORD dwFlags, const void *pvPara) DWORD dwFlags, const void *pvPara)
{ {
const CERT_NAME_BLOB *blob = (const CERT_NAME_BLOB *)pvPara, *toCompare; CERT_NAME_BLOB *blob = (CERT_NAME_BLOB *)pvPara, *toCompare;
BOOL ret; BOOL ret;
if (dwType & CERT_INFO_SUBJECT_FLAG) if (dwType & CERT_INFO_SUBJECT_FLAG)
toCompare = &pCertContext->pCertInfo->Subject; toCompare = &pCertContext->pCertInfo->Subject;
else else
toCompare = &pCertContext->pCertInfo->Issuer; toCompare = &pCertContext->pCertInfo->Issuer;
if (toCompare->cbData == blob->cbData) ret = CertCompareCertificateName(pCertContext->dwCertEncodingType,
ret = !memcmp(toCompare->pbData, blob->pbData, blob->cbData); toCompare, blob);
else
ret = FALSE;
return ret; return ret;
} }
static BOOL compare_cert_by_subject_cert(PCCERT_CONTEXT pCertContext, static BOOL compare_cert_by_subject_cert(PCCERT_CONTEXT pCertContext,
DWORD dwType, DWORD dwFlags, const void *pvPara) DWORD dwType, DWORD dwFlags, const void *pvPara)
{ {
const CERT_INFO *pCertInfo = (const CERT_INFO *)pvPara; CERT_INFO *pCertInfo = (CERT_INFO *)pvPara;
BOOL ret;
if (pCertInfo->Issuer.cbData == pCertContext->pCertInfo->Subject.cbData) return CertCompareCertificateName(pCertContext->dwCertEncodingType,
ret = !memcmp(pCertInfo->Issuer.pbData, &pCertInfo->Issuer, &pCertContext->pCertInfo->Subject);
pCertContext->pCertInfo->Subject.pbData, pCertInfo->Issuer.cbData);
else
ret = FALSE;
return ret;
} }
static BOOL compare_cert_by_issuer(PCCERT_CONTEXT pCertContext, static BOOL compare_cert_by_issuer(PCCERT_CONTEXT pCertContext,