static void checkHash(const BYTE *data, DWORD dataLen, ALG_ID algID, PCCTL_CONTEXT context, DWORD propID) { BYTE hash[20] = { 0 }, hashProperty[20]; BOOL ret; DWORD size; memset(hash, 0, sizeof(hash)); memset(hashProperty, 0, sizeof(hashProperty)); size = sizeof(hash); ret = CryptHashCertificate(0, algID, 0, data, dataLen, hash, &size); ret = CertGetCTLContextProperty(context, propID, hashProperty, &size); ok(ret, "CertGetCTLContextProperty failed: %08x\n", GetLastError()); if (ret) ok(!memcmp(hash, hashProperty, size), "Unexpected hash for property %d\n", propID); }
static BOOL CRLContext_GetHashProp(crl_t *crl, DWORD dwPropId, ALG_ID algID, const BYTE *toHash, DWORD toHashLen, void *pvData, DWORD *pcbData) { BOOL ret = CryptHashCertificate(0, algID, 0, toHash, toHashLen, pvData, pcbData); if (ret && pvData) { CRYPT_DATA_BLOB blob = { *pcbData, pvData }; ret = CRLContext_SetProperty(crl, dwPropId, 0, &blob); } return ret; }