mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 23:13:04 +00:00
sync wintrust with wine 1.1.27
svn path=/trunk/; revision=42813
This commit is contained in:
parent
a2e0b86cd0
commit
7f4bc6c2db
5 changed files with 104 additions and 50 deletions
|
@ -2079,15 +2079,6 @@ BOOL WINAPI WVTAsn1SpcIndirectDataContentDecode(DWORD dwCertEncodingType,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI WVTAsn1SpcSpOpusInfoDecode(DWORD dwCertEncodingType,
|
|
||||||
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
|
|
||||||
void *pvStructInfo, DWORD *pcbStructInfo)
|
|
||||||
{
|
|
||||||
FIXME("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
|
||||||
pvStructInfo, *pcbStructInfo);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL WINAPI CRYPT_AsnDecodeBMPString(DWORD dwCertEncodingType,
|
static BOOL WINAPI CRYPT_AsnDecodeBMPString(DWORD dwCertEncodingType,
|
||||||
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
|
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
|
||||||
void *pvStructInfo, DWORD *pcbStructInfo)
|
void *pvStructInfo, DWORD *pcbStructInfo)
|
||||||
|
@ -2126,6 +2117,66 @@ static BOOL WINAPI CRYPT_AsnDecodeBMPString(DWORD dwCertEncodingType,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL WINAPI CRYPT_AsnDecodeProgramName(DWORD dwCertEncodingType,
|
||||||
|
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
|
||||||
|
void *pvStructInfo, DWORD *pcbStructInfo)
|
||||||
|
{
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
DWORD dataLen;
|
||||||
|
|
||||||
|
TRACE("(%p, %d, %08x, %p, %d)\n", pbEncoded, cbEncoded, dwFlags,
|
||||||
|
pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
|
||||||
|
|
||||||
|
if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
|
||||||
|
{
|
||||||
|
BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]);
|
||||||
|
|
||||||
|
ret = CRYPT_AsnDecodeBMPString(dwCertEncodingType, lpszStructType,
|
||||||
|
pbEncoded + 1 + lenBytes, dataLen, dwFlags, pvStructInfo,
|
||||||
|
pcbStructInfo);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL WINAPI WVTAsn1SpcSpOpusInfoDecode(DWORD dwCertEncodingType,
|
||||||
|
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
|
||||||
|
void *pvStructInfo, DWORD *pcbStructInfo)
|
||||||
|
{
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
|
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||||
|
pvStructInfo, *pcbStructInfo);
|
||||||
|
|
||||||
|
__TRY
|
||||||
|
{
|
||||||
|
struct AsnDecodeSequenceItem items[] = {
|
||||||
|
{ ASN_CONSTRUCTOR | ASN_CONTEXT,
|
||||||
|
offsetof(SPC_SP_OPUS_INFO, pwszProgramName),
|
||||||
|
CRYPT_AsnDecodeProgramName, sizeof(LPCWSTR), TRUE, TRUE,
|
||||||
|
offsetof(SPC_SP_OPUS_INFO, pwszProgramName), 0 },
|
||||||
|
{ ASN_CONSTRUCTOR | ASN_CONTEXT | 1,
|
||||||
|
offsetof(SPC_SP_OPUS_INFO, pMoreInfo),
|
||||||
|
CRYPT_AsnDecodeSPCLinkPointer, sizeof(PSPC_LINK), TRUE, TRUE,
|
||||||
|
offsetof(SPC_SP_OPUS_INFO, pMoreInfo), 0 },
|
||||||
|
{ ASN_CONSTRUCTOR | ASN_CONTEXT | 2,
|
||||||
|
offsetof(SPC_SP_OPUS_INFO, pPublisherInfo),
|
||||||
|
CRYPT_AsnDecodeSPCLinkPointer, sizeof(PSPC_LINK), TRUE, TRUE,
|
||||||
|
offsetof(SPC_SP_OPUS_INFO, pPublisherInfo), 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
|
||||||
|
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
|
||||||
|
pvStructInfo, pcbStructInfo, NULL);
|
||||||
|
}
|
||||||
|
__EXCEPT_PAGE_FAULT
|
||||||
|
{
|
||||||
|
SetLastError(STATUS_ACCESS_VIOLATION);
|
||||||
|
}
|
||||||
|
__ENDTRY
|
||||||
|
TRACE("returning %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static BOOL CRYPT_AsnDecodeInteger(const BYTE *pbEncoded,
|
static BOOL CRYPT_AsnDecodeInteger(const BYTE *pbEncoded,
|
||||||
DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo)
|
DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1121,36 +1121,6 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
|
||||||
TRACE("(%p %p %d %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
|
TRACE("(%p %p %d %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
|
||||||
pcbSignedDataMsg, pbSignedDataMsg);
|
pcbSignedDataMsg, pbSignedDataMsg);
|
||||||
|
|
||||||
/*
|
|
||||||
* FIXME: I just noticed that I am memorizing the initial file pointer
|
|
||||||
* offset and restoring it before reading in the rest of the header
|
|
||||||
* information in the cabinet. Perhaps that's correct -- that is, perhaps
|
|
||||||
* this API is supposed to support "streaming" cabinets which are embedded
|
|
||||||
* in other files, or cabinets which begin at file offsets other than zero.
|
|
||||||
* Otherwise, I should instead go to the absolute beginning of the file.
|
|
||||||
* (Either way, the semantics of wine's FDICopy require me to leave the
|
|
||||||
* file pointer where it is afterwards -- If Windows does not do so, we
|
|
||||||
* ought to duplicate the native behavior in the FDIIsCabinet API, not here.
|
|
||||||
*
|
|
||||||
* So, the answer lies in Windows; will native cabinet.dll recognize a
|
|
||||||
* cabinet "file" embedded in another file? Note that cabextract.c does
|
|
||||||
* support this, which implies that Microsoft's might. I haven't tried it
|
|
||||||
* yet so I don't know. ATM, most of wine's FDI cabinet routines (except
|
|
||||||
* this one) would not work in this way. To fix it, we could just make the
|
|
||||||
* various references to absolute file positions in the code relative to an
|
|
||||||
* initial "beginning" offset. Because the FDICopy API doesn't take a
|
|
||||||
* file-handle like this one, we would therein need to search through the
|
|
||||||
* file for the beginning of the cabinet (as we also do in cabextract.c).
|
|
||||||
* Note that this limits us to a maximum of one cabinet per. file: the first.
|
|
||||||
*
|
|
||||||
* So, in summary: either the code below is wrong, or the rest of fdi.c is
|
|
||||||
* wrong... I cannot imagine that both are correct ;) One of these flaws
|
|
||||||
* should be fixed after determining the behavior on Windows. We ought
|
|
||||||
* to check both FDIIsCabinet and FDICopy for the right behavior.
|
|
||||||
*
|
|
||||||
* -gmt
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* get basic offset & size info */
|
/* get basic offset & size info */
|
||||||
base_offset = SetFilePointer(pSubjectInfo->hFile, 0L, NULL, SEEK_CUR);
|
base_offset = SetFilePointer(pSubjectInfo->hFile, 0L, NULL, SEEK_CUR);
|
||||||
|
|
||||||
|
@ -1162,7 +1132,7 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
|
||||||
|
|
||||||
cabsize = SetFilePointer(pSubjectInfo->hFile, 0L, NULL, SEEK_CUR);
|
cabsize = SetFilePointer(pSubjectInfo->hFile, 0L, NULL, SEEK_CUR);
|
||||||
if ((cabsize == -1) || (base_offset == -1) ||
|
if ((cabsize == -1) || (base_offset == -1) ||
|
||||||
(SetFilePointer(pSubjectInfo->hFile, base_offset, NULL, SEEK_SET) == INVALID_SET_FILE_POINTER))
|
(SetFilePointer(pSubjectInfo->hFile, 0, NULL, SEEK_SET) == INVALID_SET_FILE_POINTER))
|
||||||
{
|
{
|
||||||
TRACE("seek error\n");
|
TRACE("seek error\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1267,6 +1237,7 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
|
||||||
NULL) || dwRead != cert_size)
|
NULL) || dwRead != cert_size)
|
||||||
{
|
{
|
||||||
ERR("couldn't read cert\n");
|
ERR("couldn't read cert\n");
|
||||||
|
SetFilePointer(pSubjectInfo->hFile, base_offset, NULL, SEEK_SET);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* The encoding of the files I've seen appears to be in ASN.1
|
/* The encoding of the files I've seen appears to be in ASN.1
|
||||||
|
@ -1274,6 +1245,8 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
|
||||||
* always is.
|
* always is.
|
||||||
*/
|
*/
|
||||||
*pdwEncodingType = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING;
|
*pdwEncodingType = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING;
|
||||||
|
/* Restore base offset */
|
||||||
|
SetFilePointer(pSubjectInfo->hFile, base_offset, NULL, SEEK_SET);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,9 @@ static BOOL SOFTPUB_GetFileSubject(CRYPT_PROVIDER_DATA *data)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
if (!data->pWintrustData->u.pFile->pgKnownSubject)
|
if (!WVT_ISINSTRUCT(WINTRUST_FILE_INFO,
|
||||||
|
data->pWintrustData->u.pFile->cbStruct, pgKnownSubject) ||
|
||||||
|
!data->pWintrustData->u.pFile->pgKnownSubject)
|
||||||
{
|
{
|
||||||
ret = CryptSIPRetrieveSubjectGuid(
|
ret = CryptSIPRetrieveSubjectGuid(
|
||||||
data->pWintrustData->u.pFile->pcwszFilePath,
|
data->pWintrustData->u.pFile->pcwszFilePath,
|
||||||
|
@ -254,7 +256,8 @@ static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
if (data->pWintrustData->u.pCert &&
|
if (data->pWintrustData->u.pCert &&
|
||||||
data->pWintrustData->u.pCert->cbStruct == sizeof(WINTRUST_CERT_INFO))
|
WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(WINTRUST_CERT_INFO,
|
||||||
|
data->pWintrustData->u.pCert->cbStruct, psCertContext))
|
||||||
{
|
{
|
||||||
if (data->psPfns)
|
if (data->psPfns)
|
||||||
{
|
{
|
||||||
|
@ -264,7 +267,9 @@ static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
|
||||||
/* Add a signer with nothing but the time to verify, so we can
|
/* Add a signer with nothing but the time to verify, so we can
|
||||||
* add a cert to it
|
* add a cert to it
|
||||||
*/
|
*/
|
||||||
if (data->pWintrustData->u.pCert->psftVerifyAsOf)
|
if (WVT_ISINSTRUCT(WINTRUST_CERT_INFO,
|
||||||
|
data->pWintrustData->u.pCert->cbStruct, psftVerifyAsOf) &&
|
||||||
|
data->pWintrustData->u.pCert->psftVerifyAsOf)
|
||||||
data->sftSystemTime = signer.sftVerifyAsOf;
|
data->sftSystemTime = signer.sftVerifyAsOf;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -278,8 +283,10 @@ static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
|
||||||
{
|
{
|
||||||
ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0,
|
ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0,
|
||||||
data->pWintrustData->u.pCert->psCertContext);
|
data->pWintrustData->u.pCert->psCertContext);
|
||||||
for (i = 0; ret && i < data->pWintrustData->u.pCert->chStores;
|
if (WVT_ISINSTRUCT(WINTRUST_CERT_INFO,
|
||||||
i++)
|
data->pWintrustData->u.pCert->cbStruct, pahStores))
|
||||||
|
for (i = 0;
|
||||||
|
ret && i < data->pWintrustData->u.pCert->chStores; i++)
|
||||||
ret = data->psPfns->pfnAddStore2Chain(data,
|
ret = data->psPfns->pfnAddStore2Chain(data,
|
||||||
data->pWintrustData->u.pCert->pahStores[i]);
|
data->pWintrustData->u.pCert->pahStores[i]);
|
||||||
}
|
}
|
||||||
|
@ -1058,3 +1065,15 @@ HRESULT WINAPI SoftpubCleanup(CRYPT_PROVIDER_DATA *data)
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI HTTPSCertificateTrust(CRYPT_PROVIDER_DATA *data)
|
||||||
|
{
|
||||||
|
FIXME("(%p)\n", data);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI HTTPSFinalProv(CRYPT_PROVIDER_DATA *data)
|
||||||
|
{
|
||||||
|
FIXME("(%p)\n", data);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
|
@ -48,8 +48,8 @@
|
||||||
@ stub FindCertsByIssuer
|
@ stub FindCertsByIssuer
|
||||||
@ stdcall GenericChainCertificateTrust(ptr)
|
@ stdcall GenericChainCertificateTrust(ptr)
|
||||||
@ stdcall GenericChainFinalProv(ptr)
|
@ stdcall GenericChainFinalProv(ptr)
|
||||||
@ stub HTTPSCertificateTrust
|
@ stdcall HTTPSCertificateTrust(ptr)
|
||||||
@ stub HTTPSFinalProv
|
@ stdcall HTTPSFinalProv(ptr)
|
||||||
@ stub IsCatalogFile
|
@ stub IsCatalogFile
|
||||||
@ stub MsCatConstructHashTag
|
@ stub MsCatConstructHashTag
|
||||||
@ stub MsCatFreeHashTag
|
@ stub MsCatFreeHashTag
|
||||||
|
@ -73,6 +73,7 @@
|
||||||
@ stub TrustFreeDecode
|
@ stub TrustFreeDecode
|
||||||
@ stdcall TrustIsCertificateSelfSigned(ptr)
|
@ stdcall TrustIsCertificateSelfSigned(ptr)
|
||||||
@ stub TrustOpenStores
|
@ stub TrustOpenStores
|
||||||
|
@ stdcall WTHelperCertCheckValidSignature(ptr)
|
||||||
@ stub WTHelperCertFindIssuerCertificate
|
@ stub WTHelperCertFindIssuerCertificate
|
||||||
@ stub WTHelperCertIsSelfSigned
|
@ stub WTHelperCertIsSelfSigned
|
||||||
@ stub WTHelperCheckCertUsage
|
@ stub WTHelperCheckCertUsage
|
||||||
|
|
|
@ -303,7 +303,8 @@ static HRESULT WINAPI WINTRUST_CertVerifyObjTrust(CRYPT_PROVIDER_DATA *data)
|
||||||
{
|
{
|
||||||
case WTD_CHOICE_BLOB:
|
case WTD_CHOICE_BLOB:
|
||||||
if (data->pWintrustData->u.pBlob &&
|
if (data->pWintrustData->u.pBlob &&
|
||||||
data->pWintrustData->u.pBlob->cbStruct == sizeof(WINTRUST_BLOB_INFO) &&
|
WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(WINTRUST_BLOB_INFO,
|
||||||
|
data->pWintrustData->u.pBlob->cbStruct, pbMemObject) &&
|
||||||
data->pWintrustData->u.pBlob->cbMemObject ==
|
data->pWintrustData->u.pBlob->cbMemObject ==
|
||||||
sizeof(CERT_VERIFY_CERTIFICATE_TRUST) &&
|
sizeof(CERT_VERIFY_CERTIFICATE_TRUST) &&
|
||||||
data->pWintrustData->u.pBlob->pbMemObject)
|
data->pWintrustData->u.pBlob->pbMemObject)
|
||||||
|
@ -1084,3 +1085,12 @@ BOOL WINAPI OpenPersonalTrustDBDialog(HWND hwnd)
|
||||||
uiCertMgr.pszInitUsageOID = NULL;
|
uiCertMgr.pszInitUsageOID = NULL;
|
||||||
return CryptUIDlgCertMgr(&uiCertMgr);
|
return CryptUIDlgCertMgr(&uiCertMgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* WTHelperCertCheckValidSignature
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI WTHelperCertCheckValidSignature(CRYPT_PROVIDER_DATA *pProvData)
|
||||||
|
{
|
||||||
|
FIXME("Stub\n");
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue