crypt32: Store properties directly in link contexts and get rid of Context_GetProperties.
This commit is contained in:
parent
275ac93e8d
commit
6eddbf18ca
|
@ -38,7 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt);
|
|||
* CertGetCertificateContextProperty, and are particular to the store in which
|
||||
* the property exists (which is separate from the context.)
|
||||
*/
|
||||
static BOOL CertContext_GetProperty(void *context, DWORD dwPropId,
|
||||
static BOOL CertContext_GetProperty(cert_t *cert, DWORD dwPropId,
|
||||
void *pvData, DWORD *pcbData);
|
||||
|
||||
/* Internal version of CertSetCertificateContextProperty that sets properties
|
||||
|
@ -46,7 +46,7 @@ static BOOL CertContext_GetProperty(void *context, DWORD dwPropId,
|
|||
* type.) Doesn't handle special cases, since they're handled by
|
||||
* CertSetCertificateContextProperty anyway.
|
||||
*/
|
||||
static BOOL CertContext_SetProperty(void *context, DWORD dwPropId,
|
||||
static BOOL CertContext_SetProperty(cert_t *cert, DWORD dwPropId,
|
||||
DWORD dwFlags, const void *pvData);
|
||||
|
||||
BOOL WINAPI CertAddEncodedCertificateToStore(HCERTSTORE hCertStore,
|
||||
|
@ -380,19 +380,19 @@ BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
|
|||
DWORD WINAPI CertEnumCertificateContextProperties(PCCERT_CONTEXT pCertContext,
|
||||
DWORD dwPropId)
|
||||
{
|
||||
CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(pCertContext);
|
||||
cert_t *cert = cert_from_ptr(pCertContext);
|
||||
DWORD ret;
|
||||
|
||||
TRACE("(%p, %d)\n", pCertContext, dwPropId);
|
||||
|
||||
if (properties)
|
||||
ret = ContextPropertyList_EnumPropIDs(properties, dwPropId);
|
||||
if (cert->base.properties)
|
||||
ret = ContextPropertyList_EnumPropIDs(cert->base.properties, dwPropId);
|
||||
else
|
||||
ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL CertContext_GetHashProp(void *context, DWORD dwPropId,
|
||||
static BOOL CertContext_GetHashProp(cert_t *cert, DWORD dwPropId,
|
||||
ALG_ID algID, const BYTE *toHash, DWORD toHashLen, void *pvData,
|
||||
DWORD *pcbData)
|
||||
{
|
||||
|
@ -402,7 +402,7 @@ static BOOL CertContext_GetHashProp(void *context, DWORD dwPropId,
|
|||
{
|
||||
CRYPT_DATA_BLOB blob = { *pcbData, pvData };
|
||||
|
||||
ret = CertContext_SetProperty(context, dwPropId, 0, &blob);
|
||||
ret = CertContext_SetProperty(cert, dwPropId, 0, &blob);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -428,18 +428,16 @@ static BOOL CertContext_CopyParam(void *pvData, DWORD *pcbData, const void *pb,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static BOOL CertContext_GetProperty(void *context, DWORD dwPropId,
|
||||
static BOOL CertContext_GetProperty(cert_t *cert, DWORD dwPropId,
|
||||
void *pvData, DWORD *pcbData)
|
||||
{
|
||||
PCCERT_CONTEXT pCertContext = context;
|
||||
CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context);
|
||||
BOOL ret;
|
||||
CRYPT_DATA_BLOB blob;
|
||||
|
||||
TRACE("(%p, %d, %p, %p)\n", context, dwPropId, pvData, pcbData);
|
||||
TRACE("(%p, %d, %p, %p)\n", cert, dwPropId, pvData, pcbData);
|
||||
|
||||
if (properties)
|
||||
ret = ContextPropertyList_FindProperty(properties, dwPropId, &blob);
|
||||
if (cert->base.properties)
|
||||
ret = ContextPropertyList_FindProperty(cert->base.properties, dwPropId, &blob);
|
||||
else
|
||||
ret = FALSE;
|
||||
if (ret)
|
||||
|
@ -450,49 +448,49 @@ static BOOL CertContext_GetProperty(void *context, DWORD dwPropId,
|
|||
switch (dwPropId)
|
||||
{
|
||||
case CERT_SHA1_HASH_PROP_ID:
|
||||
ret = CertContext_GetHashProp(context, dwPropId, CALG_SHA1,
|
||||
pCertContext->pbCertEncoded, pCertContext->cbCertEncoded, pvData,
|
||||
ret = CertContext_GetHashProp(cert, dwPropId, CALG_SHA1,
|
||||
cert->ctx.pbCertEncoded, cert->ctx.cbCertEncoded, pvData,
|
||||
pcbData);
|
||||
break;
|
||||
case CERT_MD5_HASH_PROP_ID:
|
||||
ret = CertContext_GetHashProp(context, dwPropId, CALG_MD5,
|
||||
pCertContext->pbCertEncoded, pCertContext->cbCertEncoded, pvData,
|
||||
ret = CertContext_GetHashProp(cert, dwPropId, CALG_MD5,
|
||||
cert->ctx.pbCertEncoded, cert->ctx.cbCertEncoded, pvData,
|
||||
pcbData);
|
||||
break;
|
||||
case CERT_SUBJECT_NAME_MD5_HASH_PROP_ID:
|
||||
ret = CertContext_GetHashProp(context, dwPropId, CALG_MD5,
|
||||
pCertContext->pCertInfo->Subject.pbData,
|
||||
pCertContext->pCertInfo->Subject.cbData,
|
||||
ret = CertContext_GetHashProp(cert, dwPropId, CALG_MD5,
|
||||
cert->ctx.pCertInfo->Subject.pbData,
|
||||
cert->ctx.pCertInfo->Subject.cbData,
|
||||
pvData, pcbData);
|
||||
break;
|
||||
case CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID:
|
||||
ret = CertContext_GetHashProp(context, dwPropId, CALG_MD5,
|
||||
pCertContext->pCertInfo->SubjectPublicKeyInfo.PublicKey.pbData,
|
||||
pCertContext->pCertInfo->SubjectPublicKeyInfo.PublicKey.cbData,
|
||||
ret = CertContext_GetHashProp(cert, dwPropId, CALG_MD5,
|
||||
cert->ctx.pCertInfo->SubjectPublicKeyInfo.PublicKey.pbData,
|
||||
cert->ctx.pCertInfo->SubjectPublicKeyInfo.PublicKey.cbData,
|
||||
pvData, pcbData);
|
||||
break;
|
||||
case CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID:
|
||||
ret = CertContext_GetHashProp(context, dwPropId, CALG_MD5,
|
||||
pCertContext->pCertInfo->SerialNumber.pbData,
|
||||
pCertContext->pCertInfo->SerialNumber.cbData,
|
||||
ret = CertContext_GetHashProp(cert, dwPropId, CALG_MD5,
|
||||
cert->ctx.pCertInfo->SerialNumber.pbData,
|
||||
cert->ctx.pCertInfo->SerialNumber.cbData,
|
||||
pvData, pcbData);
|
||||
break;
|
||||
case CERT_SIGNATURE_HASH_PROP_ID:
|
||||
ret = CryptHashToBeSigned(0, pCertContext->dwCertEncodingType,
|
||||
pCertContext->pbCertEncoded, pCertContext->cbCertEncoded, pvData,
|
||||
ret = CryptHashToBeSigned(0, cert->ctx.dwCertEncodingType,
|
||||
cert->ctx.pbCertEncoded, cert->ctx.cbCertEncoded, pvData,
|
||||
pcbData);
|
||||
if (ret && pvData)
|
||||
{
|
||||
CRYPT_DATA_BLOB blob = { *pcbData, pvData };
|
||||
|
||||
ret = CertContext_SetProperty(context, dwPropId, 0, &blob);
|
||||
ret = CertContext_SetProperty(cert, dwPropId, 0, &blob);
|
||||
}
|
||||
break;
|
||||
case CERT_KEY_IDENTIFIER_PROP_ID:
|
||||
{
|
||||
PCERT_EXTENSION ext = CertFindExtension(
|
||||
szOID_SUBJECT_KEY_IDENTIFIER, pCertContext->pCertInfo->cExtension,
|
||||
pCertContext->pCertInfo->rgExtension);
|
||||
szOID_SUBJECT_KEY_IDENTIFIER, cert->ctx.pCertInfo->cExtension,
|
||||
cert->ctx.pCertInfo->rgExtension);
|
||||
|
||||
if (ext)
|
||||
{
|
||||
|
@ -507,7 +505,7 @@ static BOOL CertContext_GetProperty(void *context, DWORD dwPropId,
|
|||
{
|
||||
ret = CertContext_CopyParam(pvData, pcbData, value.pbData,
|
||||
value.cbData);
|
||||
CertContext_SetProperty(context, dwPropId, 0, &value);
|
||||
CertContext_SetProperty(cert, dwPropId, 0, &value);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -548,6 +546,7 @@ void CRYPT_FixKeyProvInfoPointers(PCRYPT_KEY_PROV_INFO info)
|
|||
BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext,
|
||||
DWORD dwPropId, void *pvData, DWORD *pcbData)
|
||||
{
|
||||
cert_t *cert = cert_from_ptr(pCertContext);
|
||||
BOOL ret;
|
||||
|
||||
TRACE("(%p, %d, %p, %p)\n", pCertContext, dwPropId, pvData, pcbData);
|
||||
|
@ -577,7 +576,7 @@ BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext,
|
|||
CERT_KEY_CONTEXT keyContext;
|
||||
DWORD size = sizeof(keyContext);
|
||||
|
||||
ret = CertContext_GetProperty((void *)pCertContext,
|
||||
ret = CertContext_GetProperty(cert,
|
||||
CERT_KEY_CONTEXT_PROP_ID, &keyContext, &size);
|
||||
if (ret)
|
||||
ret = CertContext_CopyParam(pvData, pcbData, &keyContext.hCryptProv,
|
||||
|
@ -585,13 +584,13 @@ BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext,
|
|||
break;
|
||||
}
|
||||
case CERT_KEY_PROV_INFO_PROP_ID:
|
||||
ret = CertContext_GetProperty((void *)pCertContext, dwPropId, pvData,
|
||||
ret = CertContext_GetProperty(cert, dwPropId, pvData,
|
||||
pcbData);
|
||||
if (ret && pvData)
|
||||
CRYPT_FixKeyProvInfoPointers(pvData);
|
||||
break;
|
||||
default:
|
||||
ret = CertContext_GetProperty((void *)pCertContext, dwPropId, pvData,
|
||||
ret = CertContext_GetProperty(cert, dwPropId, pvData,
|
||||
pcbData);
|
||||
}
|
||||
|
||||
|
@ -679,15 +678,14 @@ static BOOL CertContext_SetKeyProvInfoProperty(CONTEXT_PROPERTY_LIST *properties
|
|||
return ret;
|
||||
}
|
||||
|
||||
static BOOL CertContext_SetProperty(void *context, DWORD dwPropId,
|
||||
static BOOL CertContext_SetProperty(cert_t *cert, DWORD dwPropId,
|
||||
DWORD dwFlags, const void *pvData)
|
||||
{
|
||||
CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context);
|
||||
BOOL ret;
|
||||
|
||||
TRACE("(%p, %d, %08x, %p)\n", context, dwPropId, dwFlags, pvData);
|
||||
TRACE("(%p, %d, %08x, %p)\n", cert, dwPropId, dwFlags, pvData);
|
||||
|
||||
if (!properties)
|
||||
if (!cert->base.properties)
|
||||
ret = FALSE;
|
||||
else
|
||||
{
|
||||
|
@ -716,23 +714,23 @@ static BOOL CertContext_SetProperty(void *context, DWORD dwPropId,
|
|||
{
|
||||
const CRYPT_DATA_BLOB *blob = pvData;
|
||||
|
||||
ret = ContextPropertyList_SetProperty(properties, dwPropId,
|
||||
ret = ContextPropertyList_SetProperty(cert->base.properties, dwPropId,
|
||||
blob->pbData, blob->cbData);
|
||||
}
|
||||
else
|
||||
{
|
||||
ContextPropertyList_RemoveProperty(properties, dwPropId);
|
||||
ContextPropertyList_RemoveProperty(cert->base.properties, dwPropId);
|
||||
ret = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CERT_DATE_STAMP_PROP_ID:
|
||||
if (pvData)
|
||||
ret = ContextPropertyList_SetProperty(properties, dwPropId,
|
||||
ret = ContextPropertyList_SetProperty(cert->base.properties, dwPropId,
|
||||
pvData, sizeof(FILETIME));
|
||||
else
|
||||
{
|
||||
ContextPropertyList_RemoveProperty(properties, dwPropId);
|
||||
ContextPropertyList_RemoveProperty(cert->base.properties, dwPropId);
|
||||
ret = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -748,22 +746,22 @@ static BOOL CertContext_SetProperty(void *context, DWORD dwPropId,
|
|||
ret = FALSE;
|
||||
}
|
||||
else
|
||||
ret = ContextPropertyList_SetProperty(properties, dwPropId,
|
||||
ret = ContextPropertyList_SetProperty(cert->base.properties, dwPropId,
|
||||
(const BYTE *)keyContext, keyContext->cbSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
ContextPropertyList_RemoveProperty(properties, dwPropId);
|
||||
ContextPropertyList_RemoveProperty(cert->base.properties, dwPropId);
|
||||
ret = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CERT_KEY_PROV_INFO_PROP_ID:
|
||||
if (pvData)
|
||||
ret = CertContext_SetKeyProvInfoProperty(properties, pvData);
|
||||
ret = CertContext_SetKeyProvInfoProperty(cert->base.properties, pvData);
|
||||
else
|
||||
{
|
||||
ContextPropertyList_RemoveProperty(properties, dwPropId);
|
||||
ContextPropertyList_RemoveProperty(cert->base.properties, dwPropId);
|
||||
ret = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -772,7 +770,7 @@ static BOOL CertContext_SetProperty(void *context, DWORD dwPropId,
|
|||
CERT_KEY_CONTEXT keyContext;
|
||||
DWORD size = sizeof(keyContext);
|
||||
|
||||
ret = CertContext_GetProperty(context, CERT_KEY_CONTEXT_PROP_ID,
|
||||
ret = CertContext_GetProperty(cert, CERT_KEY_CONTEXT_PROP_ID,
|
||||
&keyContext, &size);
|
||||
if (ret)
|
||||
{
|
||||
|
@ -787,7 +785,7 @@ static BOOL CertContext_SetProperty(void *context, DWORD dwPropId,
|
|||
keyContext.hCryptProv = 0;
|
||||
keyContext.dwKeySpec = AT_SIGNATURE;
|
||||
}
|
||||
ret = CertContext_SetProperty(context, CERT_KEY_CONTEXT_PROP_ID,
|
||||
ret = CertContext_SetProperty(cert, CERT_KEY_CONTEXT_PROP_ID,
|
||||
0, &keyContext);
|
||||
break;
|
||||
}
|
||||
|
@ -820,7 +818,7 @@ BOOL WINAPI CertSetCertificateContextProperty(PCCERT_CONTEXT pCertContext,
|
|||
SetLastError(E_INVALIDARG);
|
||||
return FALSE;
|
||||
}
|
||||
ret = CertContext_SetProperty((void *)pCertContext, dwPropId, dwFlags,
|
||||
ret = CertContext_SetProperty(cert_from_ptr(pCertContext), dwPropId, dwFlags,
|
||||
pvData);
|
||||
TRACE("returning %d\n", ret);
|
||||
return ret;
|
||||
|
|
|
@ -64,6 +64,7 @@ context_t *Context_CreateLinkContext(unsigned int contextSize, context_t *linked
|
|||
context->vtbl = linked->vtbl;
|
||||
context->ref = 1;
|
||||
context->linked = linked;
|
||||
context->properties = linked->properties;
|
||||
Context_AddRef(linked);
|
||||
|
||||
TRACE("returning %p\n", context);
|
||||
|
@ -76,16 +77,6 @@ void Context_AddRef(context_t *context)
|
|||
TRACE("(%p) ref=%d\n", context, context->ref);
|
||||
}
|
||||
|
||||
CONTEXT_PROPERTY_LIST *Context_GetProperties(const void *context)
|
||||
{
|
||||
BASE_CONTEXT *ptr = BASE_CONTEXT_FROM_CONTEXT(context);
|
||||
|
||||
while (ptr && ptr->linked)
|
||||
ptr = ptr->linked;
|
||||
|
||||
return ptr->properties;
|
||||
}
|
||||
|
||||
BOOL Context_Release(context_t *context)
|
||||
{
|
||||
BOOL ret = TRUE;
|
||||
|
@ -116,8 +107,8 @@ void Context_CopyProperties(const void *to, const void *from)
|
|||
{
|
||||
CONTEXT_PROPERTY_LIST *toProperties, *fromProperties;
|
||||
|
||||
toProperties = Context_GetProperties(to);
|
||||
fromProperties = Context_GetProperties(from);
|
||||
toProperties = context_from_ptr(to)->properties;
|
||||
fromProperties = context_from_ptr(from)->properties;
|
||||
assert(toProperties && fromProperties);
|
||||
ContextPropertyList_Copy(toProperties, fromProperties);
|
||||
}
|
||||
|
|
|
@ -375,22 +375,15 @@ BOOL WINAPI CertFreeCRLContext(PCCRL_CONTEXT pCrlContext)
|
|||
DWORD WINAPI CertEnumCRLContextProperties(PCCRL_CONTEXT pCRLContext,
|
||||
DWORD dwPropId)
|
||||
{
|
||||
CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(pCRLContext);
|
||||
DWORD ret;
|
||||
|
||||
TRACE("(%p, %d)\n", pCRLContext, dwPropId);
|
||||
|
||||
if (properties)
|
||||
ret = ContextPropertyList_EnumPropIDs(properties, dwPropId);
|
||||
else
|
||||
ret = 0;
|
||||
return ret;
|
||||
return ContextPropertyList_EnumPropIDs(crl_from_ptr(pCRLContext)->base.properties, dwPropId);
|
||||
}
|
||||
|
||||
static BOOL CRLContext_SetProperty(PCCRL_CONTEXT context, DWORD dwPropId,
|
||||
static BOOL CRLContext_SetProperty(crl_t *crl, DWORD dwPropId,
|
||||
DWORD dwFlags, const void *pvData);
|
||||
|
||||
static BOOL CRLContext_GetHashProp(PCCRL_CONTEXT context, DWORD dwPropId,
|
||||
static BOOL CRLContext_GetHashProp(crl_t *crl, DWORD dwPropId,
|
||||
ALG_ID algID, const BYTE *toHash, DWORD toHashLen, void *pvData,
|
||||
DWORD *pcbData)
|
||||
{
|
||||
|
@ -400,22 +393,21 @@ static BOOL CRLContext_GetHashProp(PCCRL_CONTEXT context, DWORD dwPropId,
|
|||
{
|
||||
CRYPT_DATA_BLOB blob = { *pcbData, pvData };
|
||||
|
||||
ret = CRLContext_SetProperty(context, dwPropId, 0, &blob);
|
||||
ret = CRLContext_SetProperty(crl, dwPropId, 0, &blob);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL CRLContext_GetProperty(PCCRL_CONTEXT context, DWORD dwPropId,
|
||||
static BOOL CRLContext_GetProperty(crl_t *crl, DWORD dwPropId,
|
||||
void *pvData, DWORD *pcbData)
|
||||
{
|
||||
CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context);
|
||||
BOOL ret;
|
||||
CRYPT_DATA_BLOB blob;
|
||||
|
||||
TRACE("(%p, %d, %p, %p)\n", context, dwPropId, pvData, pcbData);
|
||||
TRACE("(%p, %d, %p, %p)\n", crl, dwPropId, pvData, pcbData);
|
||||
|
||||
if (properties)
|
||||
ret = ContextPropertyList_FindProperty(properties, dwPropId, &blob);
|
||||
if (crl->base.properties)
|
||||
ret = ContextPropertyList_FindProperty(crl->base.properties, dwPropId, &blob);
|
||||
else
|
||||
ret = FALSE;
|
||||
if (ret)
|
||||
|
@ -440,13 +432,13 @@ static BOOL CRLContext_GetProperty(PCCRL_CONTEXT context, DWORD dwPropId,
|
|||
switch (dwPropId)
|
||||
{
|
||||
case CERT_SHA1_HASH_PROP_ID:
|
||||
ret = CRLContext_GetHashProp(context, dwPropId, CALG_SHA1,
|
||||
context->pbCrlEncoded, context->cbCrlEncoded, pvData,
|
||||
ret = CRLContext_GetHashProp(crl, dwPropId, CALG_SHA1,
|
||||
crl->ctx.pbCrlEncoded, crl->ctx.cbCrlEncoded, pvData,
|
||||
pcbData);
|
||||
break;
|
||||
case CERT_MD5_HASH_PROP_ID:
|
||||
ret = CRLContext_GetHashProp(context, dwPropId, CALG_MD5,
|
||||
context->pbCrlEncoded, context->cbCrlEncoded, pvData,
|
||||
ret = CRLContext_GetHashProp(crl, dwPropId, CALG_MD5,
|
||||
crl->ctx.pbCrlEncoded, crl->ctx.cbCrlEncoded, pvData,
|
||||
pcbData);
|
||||
break;
|
||||
default:
|
||||
|
@ -498,25 +490,23 @@ BOOL WINAPI CertGetCRLContextProperty(PCCRL_CONTEXT pCRLContext,
|
|||
}
|
||||
break;
|
||||
default:
|
||||
ret = CRLContext_GetProperty(pCRLContext, dwPropId, pvData,
|
||||
pcbData);
|
||||
ret = CRLContext_GetProperty(crl_from_ptr(pCRLContext), dwPropId, pvData, pcbData);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL CRLContext_SetProperty(PCCRL_CONTEXT context, DWORD dwPropId,
|
||||
static BOOL CRLContext_SetProperty(crl_t *crl, DWORD dwPropId,
|
||||
DWORD dwFlags, const void *pvData)
|
||||
{
|
||||
CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context);
|
||||
BOOL ret;
|
||||
|
||||
TRACE("(%p, %d, %08x, %p)\n", context, dwPropId, dwFlags, pvData);
|
||||
TRACE("(%p, %d, %08x, %p)\n", crl, dwPropId, dwFlags, pvData);
|
||||
|
||||
if (!properties)
|
||||
if (!crl->base.properties)
|
||||
ret = FALSE;
|
||||
else if (!pvData)
|
||||
{
|
||||
ContextPropertyList_RemoveProperty(properties, dwPropId);
|
||||
ContextPropertyList_RemoveProperty(crl->base.properties, dwPropId);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -543,12 +533,12 @@ static BOOL CRLContext_SetProperty(PCCRL_CONTEXT context, DWORD dwPropId,
|
|||
{
|
||||
PCRYPT_DATA_BLOB blob = (PCRYPT_DATA_BLOB)pvData;
|
||||
|
||||
ret = ContextPropertyList_SetProperty(properties, dwPropId,
|
||||
ret = ContextPropertyList_SetProperty(crl->base.properties, dwPropId,
|
||||
blob->pbData, blob->cbData);
|
||||
break;
|
||||
}
|
||||
case CERT_DATE_STAMP_PROP_ID:
|
||||
ret = ContextPropertyList_SetProperty(properties, dwPropId,
|
||||
ret = ContextPropertyList_SetProperty(crl->base.properties, dwPropId,
|
||||
pvData, sizeof(FILETIME));
|
||||
break;
|
||||
default:
|
||||
|
@ -580,7 +570,7 @@ BOOL WINAPI CertSetCRLContextProperty(PCCRL_CONTEXT pCRLContext,
|
|||
SetLastError(E_INVALIDARG);
|
||||
return FALSE;
|
||||
}
|
||||
ret = CRLContext_SetProperty(pCRLContext, dwPropId, dwFlags, pvData);
|
||||
ret = CRLContext_SetProperty(crl_from_ptr(pCRLContext), dwPropId, dwFlags, pvData);
|
||||
TRACE("returning %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -402,11 +402,6 @@ context_t *Context_CreateLinkContext(unsigned contextSize, context_t *linked) DE
|
|||
/* Copies properties from fromContext to toContext. */
|
||||
void Context_CopyProperties(const void *to, const void *from) DECLSPEC_HIDDEN;
|
||||
|
||||
/* Returns context's properties, or the linked context's properties if context
|
||||
* is a link context.
|
||||
*/
|
||||
CONTEXT_PROPERTY_LIST *Context_GetProperties(const void *context) DECLSPEC_HIDDEN;
|
||||
|
||||
void Context_AddRef(context_t*) DECLSPEC_HIDDEN;
|
||||
|
||||
/* Decrements context's ref count. If context is a link context, releases its
|
||||
|
|
|
@ -508,22 +508,22 @@ BOOL WINAPI CertFreeCTLContext(PCCTL_CONTEXT pCTLContext)
|
|||
DWORD WINAPI CertEnumCTLContextProperties(PCCTL_CONTEXT pCTLContext,
|
||||
DWORD dwPropId)
|
||||
{
|
||||
CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(pCTLContext);
|
||||
ctl_t *ctl = ctl_from_ptr(pCTLContext);
|
||||
DWORD ret;
|
||||
|
||||
TRACE("(%p, %d)\n", pCTLContext, dwPropId);
|
||||
|
||||
if (properties)
|
||||
ret = ContextPropertyList_EnumPropIDs(properties, dwPropId);
|
||||
if (ctl->base.properties)
|
||||
ret = ContextPropertyList_EnumPropIDs(ctl->base.properties, dwPropId);
|
||||
else
|
||||
ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL CTLContext_SetProperty(PCCTL_CONTEXT context, DWORD dwPropId,
|
||||
static BOOL CTLContext_SetProperty(ctl_t *ctl, DWORD dwPropId,
|
||||
DWORD dwFlags, const void *pvData);
|
||||
|
||||
static BOOL CTLContext_GetHashProp(PCCTL_CONTEXT context, DWORD dwPropId,
|
||||
static BOOL CTLContext_GetHashProp(ctl_t *ctl, DWORD dwPropId,
|
||||
ALG_ID algID, const BYTE *toHash, DWORD toHashLen, void *pvData,
|
||||
DWORD *pcbData)
|
||||
{
|
||||
|
@ -533,22 +533,21 @@ static BOOL CTLContext_GetHashProp(PCCTL_CONTEXT context, DWORD dwPropId,
|
|||
{
|
||||
CRYPT_DATA_BLOB blob = { *pcbData, pvData };
|
||||
|
||||
ret = CTLContext_SetProperty(context, dwPropId, 0, &blob);
|
||||
ret = CTLContext_SetProperty(ctl, dwPropId, 0, &blob);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL CTLContext_GetProperty(PCCTL_CONTEXT context, DWORD dwPropId,
|
||||
static BOOL CTLContext_GetProperty(ctl_t *ctl, DWORD dwPropId,
|
||||
void *pvData, DWORD *pcbData)
|
||||
{
|
||||
CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context);
|
||||
BOOL ret;
|
||||
CRYPT_DATA_BLOB blob;
|
||||
|
||||
TRACE("(%p, %d, %p, %p)\n", context, dwPropId, pvData, pcbData);
|
||||
TRACE("(%p, %d, %p, %p)\n", ctl, dwPropId, pvData, pcbData);
|
||||
|
||||
if (properties)
|
||||
ret = ContextPropertyList_FindProperty(properties, dwPropId, &blob);
|
||||
if (ctl->base.properties)
|
||||
ret = ContextPropertyList_FindProperty(ctl->base.properties, dwPropId, &blob);
|
||||
else
|
||||
ret = FALSE;
|
||||
if (ret)
|
||||
|
@ -573,12 +572,12 @@ static BOOL CTLContext_GetProperty(PCCTL_CONTEXT context, DWORD dwPropId,
|
|||
switch (dwPropId)
|
||||
{
|
||||
case CERT_SHA1_HASH_PROP_ID:
|
||||
ret = CTLContext_GetHashProp(context, dwPropId, CALG_SHA1,
|
||||
context->pbCtlEncoded, context->cbCtlEncoded, pvData, pcbData);
|
||||
ret = CTLContext_GetHashProp(ctl, dwPropId, CALG_SHA1,
|
||||
ctl->ctx.pbCtlEncoded, ctl->ctx.cbCtlEncoded, pvData, pcbData);
|
||||
break;
|
||||
case CERT_MD5_HASH_PROP_ID:
|
||||
ret = CTLContext_GetHashProp(context, dwPropId, CALG_MD5,
|
||||
context->pbCtlEncoded, context->cbCtlEncoded, pvData, pcbData);
|
||||
ret = CTLContext_GetHashProp(ctl, dwPropId, CALG_MD5,
|
||||
ctl->ctx.pbCtlEncoded, ctl->ctx.cbCtlEncoded, pvData, pcbData);
|
||||
break;
|
||||
default:
|
||||
SetLastError(CRYPT_E_NOT_FOUND);
|
||||
|
@ -629,25 +628,24 @@ BOOL WINAPI CertGetCTLContextProperty(PCCTL_CONTEXT pCTLContext,
|
|||
}
|
||||
break;
|
||||
default:
|
||||
ret = CTLContext_GetProperty(pCTLContext, dwPropId, pvData,
|
||||
ret = CTLContext_GetProperty(ctl_from_ptr(pCTLContext), dwPropId, pvData,
|
||||
pcbData);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL CTLContext_SetProperty(PCCTL_CONTEXT context, DWORD dwPropId,
|
||||
static BOOL CTLContext_SetProperty(ctl_t *ctl, DWORD dwPropId,
|
||||
DWORD dwFlags, const void *pvData)
|
||||
{
|
||||
CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context);
|
||||
BOOL ret;
|
||||
|
||||
TRACE("(%p, %d, %08x, %p)\n", context, dwPropId, dwFlags, pvData);
|
||||
TRACE("(%p, %d, %08x, %p)\n", ctl, dwPropId, dwFlags, pvData);
|
||||
|
||||
if (!properties)
|
||||
if (!ctl->base.properties)
|
||||
ret = FALSE;
|
||||
else if (!pvData)
|
||||
{
|
||||
ContextPropertyList_RemoveProperty(properties, dwPropId);
|
||||
ContextPropertyList_RemoveProperty(ctl->base.properties, dwPropId);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -674,12 +672,12 @@ static BOOL CTLContext_SetProperty(PCCTL_CONTEXT context, DWORD dwPropId,
|
|||
{
|
||||
PCRYPT_DATA_BLOB blob = (PCRYPT_DATA_BLOB)pvData;
|
||||
|
||||
ret = ContextPropertyList_SetProperty(properties, dwPropId,
|
||||
ret = ContextPropertyList_SetProperty(ctl->base.properties, dwPropId,
|
||||
blob->pbData, blob->cbData);
|
||||
break;
|
||||
}
|
||||
case CERT_DATE_STAMP_PROP_ID:
|
||||
ret = ContextPropertyList_SetProperty(properties, dwPropId,
|
||||
ret = ContextPropertyList_SetProperty(ctl->base.properties, dwPropId,
|
||||
pvData, sizeof(FILETIME));
|
||||
break;
|
||||
default:
|
||||
|
@ -711,7 +709,7 @@ BOOL WINAPI CertSetCTLContextProperty(PCCTL_CONTEXT pCTLContext,
|
|||
SetLastError(E_INVALIDARG);
|
||||
return FALSE;
|
||||
}
|
||||
ret = CTLContext_SetProperty(pCTLContext, dwPropId, dwFlags, pvData);
|
||||
ret = CTLContext_SetProperty(ctl_from_ptr(pCTLContext), dwPropId, dwFlags, pvData);
|
||||
TRACE("returning %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue