mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
[CRYPT32]
* Sync with Wine 1.5.26. svn path=/trunk/; revision=58668
This commit is contained in:
parent
a490eca5f6
commit
a3d0b85dbe
14 changed files with 83 additions and 94 deletions
|
@ -1,7 +1,8 @@
|
|||
|
||||
add_definitions(
|
||||
-D__WINESRC__
|
||||
-D_WINE)
|
||||
-D_WINE
|
||||
-D_CRYPT32_)
|
||||
|
||||
remove_definitions(-D_WIN32_WINNT=0x502)
|
||||
add_definitions(-D_WIN32_WINNT=0x600)
|
||||
|
|
|
@ -828,7 +828,7 @@ BOOL WINAPI CryptStringToBinaryA(LPCSTR pszString,
|
|||
ret = decoder(pszString, cchString, pbBinary, pcbBinary, pdwSkip, pdwFlags);
|
||||
if (ret)
|
||||
SetLastError(ret);
|
||||
return (ret == ERROR_SUCCESS) ? TRUE : FALSE;
|
||||
return ret == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static LONG decodeBase64BlockW(const WCHAR *in_buf, int in_len,
|
||||
|
@ -1160,5 +1160,5 @@ BOOL WINAPI CryptStringToBinaryW(LPCWSTR pszString,
|
|||
ret = decoder(pszString, cchString, pbBinary, pcbBinary, pdwSkip, pdwFlags);
|
||||
if (ret)
|
||||
SetLastError(ret);
|
||||
return (ret == ERROR_SUCCESS) ? TRUE : FALSE;
|
||||
return ret == ERROR_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -846,7 +846,7 @@ static BOOL container_matches_cert(PCCERT_CONTEXT pCert, LPCSTR container,
|
|||
* keyProvInfo->pwszContainerName to be NULL or a heap-allocated container
|
||||
* name.
|
||||
*/
|
||||
memcpy(©, keyProvInfo, sizeof(copy));
|
||||
copy = *keyProvInfo;
|
||||
copy.pwszContainerName = containerW;
|
||||
matches = key_prov_info_matches_cert(pCert, ©);
|
||||
if (matches)
|
||||
|
@ -2220,9 +2220,7 @@ BOOL WINAPI CryptSignAndEncodeCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCrypt
|
|||
|
||||
info.ToBeSigned.cbData = encodedSize;
|
||||
info.ToBeSigned.pbData = encoded;
|
||||
memcpy(&info.SignatureAlgorithm,
|
||||
pSignatureAlgorithm,
|
||||
sizeof(info.SignatureAlgorithm));
|
||||
info.SignatureAlgorithm = *pSignatureAlgorithm;
|
||||
info.Signature.cbData = hashSize;
|
||||
info.Signature.pbData = hash;
|
||||
info.Signature.cUnusedBits = 0;
|
||||
|
@ -2243,8 +2241,10 @@ BOOL WINAPI CryptVerifyCertificateSignature(HCRYPTPROV_LEGACY hCryptProv,
|
|||
DWORD dwCertEncodingType, const BYTE *pbEncoded, DWORD cbEncoded,
|
||||
PCERT_PUBLIC_KEY_INFO pPublicKey)
|
||||
{
|
||||
CRYPT_DATA_BLOB blob = { cbEncoded, (BYTE *)pbEncoded };
|
||||
|
||||
return CryptVerifyCertificateSignatureEx(hCryptProv, dwCertEncodingType,
|
||||
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, (void *)pbEncoded,
|
||||
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &blob,
|
||||
CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY, pPublicKey, 0, NULL);
|
||||
}
|
||||
|
||||
|
@ -2988,8 +2988,7 @@ static PCCERT_CONTEXT CRYPT_CreateSignedCert(const CRYPT_DER_BLOB *blob,
|
|||
|
||||
signedInfo.ToBeSigned.cbData = blob->cbData;
|
||||
signedInfo.ToBeSigned.pbData = blob->pbData;
|
||||
memcpy(&signedInfo.SignatureAlgorithm, sigAlgo,
|
||||
sizeof(signedInfo.SignatureAlgorithm));
|
||||
signedInfo.SignatureAlgorithm = *sigAlgo;
|
||||
signedInfo.Signature.cbData = sigSize;
|
||||
signedInfo.Signature.pbData = sig;
|
||||
signedInfo.Signature.cUnusedBits = 0;
|
||||
|
@ -3040,8 +3039,7 @@ static void CRYPT_MakeCertInfo(PCERT_INFO info, const CRYPT_DATA_BLOB *pSerialNu
|
|||
info->SerialNumber.cbData = pSerialNumber->cbData;
|
||||
info->SerialNumber.pbData = pSerialNumber->pbData;
|
||||
if (pSignatureAlgorithm)
|
||||
memcpy(&info->SignatureAlgorithm, pSignatureAlgorithm,
|
||||
sizeof(info->SignatureAlgorithm));
|
||||
info->SignatureAlgorithm = *pSignatureAlgorithm;
|
||||
else
|
||||
{
|
||||
info->SignatureAlgorithm.pszObjId = oid;
|
||||
|
@ -3068,8 +3066,7 @@ static void CRYPT_MakeCertInfo(PCERT_INFO info, const CRYPT_DATA_BLOB *pSerialNu
|
|||
}
|
||||
info->Subject.cbData = pSubjectIssuerBlob->cbData;
|
||||
info->Subject.pbData = pSubjectIssuerBlob->pbData;
|
||||
memcpy(&info->SubjectPublicKeyInfo, pubKey,
|
||||
sizeof(info->SubjectPublicKeyInfo));
|
||||
info->SubjectPublicKeyInfo = *pubKey;
|
||||
if (pExtensions)
|
||||
{
|
||||
info->cExtension = pExtensions->cExtension;
|
||||
|
@ -3141,7 +3138,7 @@ PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HAN
|
|||
PCCERT_CONTEXT context = NULL;
|
||||
BOOL ret, releaseContext = FALSE;
|
||||
PCERT_PUBLIC_KEY_INFO pubKey = NULL;
|
||||
DWORD pubKeySize = 0,dwKeySpec = AT_SIGNATURE;
|
||||
DWORD pubKeySize = 0, dwKeySpec;
|
||||
|
||||
TRACE("(%08lx, %p, %08x, %p, %p, %p, %p, %p)\n", hProv,
|
||||
pSubjectIssuerBlob, dwFlags, pKeyProvInfo, pSignatureAlgorithm, pStartTime,
|
||||
|
@ -3153,6 +3150,7 @@ PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HAN
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dwKeySpec = pKeyProvInfo ? pKeyProvInfo->dwKeySpec : AT_SIGNATURE;
|
||||
if (!hProv)
|
||||
{
|
||||
if (!pKeyProvInfo)
|
||||
|
@ -3183,7 +3181,6 @@ PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HAN
|
|||
if (!ret)
|
||||
return NULL;
|
||||
}
|
||||
dwKeySpec = pKeyProvInfo->dwKeySpec;
|
||||
/* check if the key is here */
|
||||
ret = CryptGetUserKey(hProv,dwKeySpec,&hKey);
|
||||
if(!ret)
|
||||
|
@ -3203,14 +3200,11 @@ PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HAN
|
|||
releaseContext = TRUE;
|
||||
}
|
||||
}
|
||||
else if (pKeyProvInfo)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CryptExportPublicKeyInfo(hProv, dwKeySpec, X509_ASN_ENCODING, NULL,
|
||||
ret = CryptExportPublicKeyInfo(hProv, dwKeySpec, X509_ASN_ENCODING, NULL,
|
||||
&pubKeySize);
|
||||
if (!ret)
|
||||
goto end;
|
||||
pubKey = CryptMemAlloc(pubKeySize);
|
||||
if (pubKey)
|
||||
{
|
||||
|
@ -3244,6 +3238,7 @@ PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HAN
|
|||
}
|
||||
CryptMemFree(pubKey);
|
||||
}
|
||||
end:
|
||||
if (releaseContext)
|
||||
CryptReleaseContext(hProv, 0);
|
||||
return context;
|
||||
|
|
|
@ -3162,6 +3162,7 @@ static BOOL match_domain_component(LPCWSTR allowed_component, DWORD allowed_len,
|
|||
BOOL matches = TRUE;
|
||||
|
||||
*see_wildcard = FALSE;
|
||||
|
||||
if (server_len < allowed_len)
|
||||
{
|
||||
WARN_(chain)("domain component %s too short for %s\n",
|
||||
|
@ -3221,6 +3222,13 @@ static BOOL match_common_name(LPCWSTR server_name, const CERT_RDN_ATTR *nameAttr
|
|||
|
||||
TRACE_(chain)("CN = %s\n", debugstr_wn(allowed_component, allowed_len));
|
||||
|
||||
/* Remove trailing NULLs from the allowed name; while they shouldn't appear
|
||||
* in a certificate in the first place, they sometimes do, and they should
|
||||
* be ignored.
|
||||
*/
|
||||
while (allowed_len && allowed_component[allowed_len - 1] == 0)
|
||||
allowed_len--;
|
||||
|
||||
/* From RFC 2818 (HTTP over TLS), section 3.1:
|
||||
* "Names may contain the wildcard character * which is considered to match
|
||||
* any single domain name component or component fragment. E.g.,
|
||||
|
|
|
@ -692,8 +692,7 @@ static BOOL CRYPT_AsnDecodeArray(const struct AsnArrayDescriptor *arrayDesc,
|
|||
CryptMemAlloc(
|
||||
cItems * sizeof(struct AsnArrayItemSize));
|
||||
if (itemSizes)
|
||||
memcpy(itemSizes, &itemSize,
|
||||
sizeof(itemSize));
|
||||
*itemSizes = itemSize;
|
||||
}
|
||||
if (itemSizes)
|
||||
{
|
||||
|
@ -1310,22 +1309,17 @@ static BOOL CRYPT_AsnDecodeOidIgnoreTag(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
|
||||
if (dataLen)
|
||||
{
|
||||
/* The largest possible string for the first two components
|
||||
* is 2.175 (= 2 * 40 + 175 = 255), so this is big enough.
|
||||
*/
|
||||
char firstTwo[6];
|
||||
const BYTE *ptr;
|
||||
char str[32];
|
||||
|
||||
snprintf(firstTwo, sizeof(firstTwo), "%d.%d",
|
||||
snprintf(str, sizeof(str), "%d.%d",
|
||||
pbEncoded[1 + lenBytes] / 40,
|
||||
pbEncoded[1 + lenBytes] - (pbEncoded[1 + lenBytes] / 40)
|
||||
* 40);
|
||||
bytesNeeded += strlen(firstTwo) + 1;
|
||||
bytesNeeded += strlen(str) + 1;
|
||||
for (ptr = pbEncoded + 2 + lenBytes; ret &&
|
||||
ptr - pbEncoded - 1 - lenBytes < dataLen; )
|
||||
{
|
||||
/* large enough for ".4000000" */
|
||||
char str[9];
|
||||
int val = 0;
|
||||
|
||||
while (ptr - pbEncoded - 1 - lenBytes < dataLen &&
|
||||
|
@ -1917,7 +1911,7 @@ static BOOL WINAPI CRYPT_AsnDecodeName(DWORD dwCertEncodingType,
|
|||
sizeof(CERT_NAME_INFO),
|
||||
CRYPT_AsnDecodeRdn, sizeof(CERT_RDN), TRUE,
|
||||
offsetof(CERT_RDN, rgRDNAttr) };
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
|
||||
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, NULL, &bytesNeeded,
|
||||
|
@ -2014,7 +2008,7 @@ static BOOL WINAPI CRYPT_AsnDecodeUnicodeName(DWORD dwCertEncodingType,
|
|||
sizeof(CERT_NAME_INFO),
|
||||
CRYPT_AsnDecodeUnicodeRdn, sizeof(CERT_RDN), TRUE,
|
||||
offsetof(CERT_RDN, rgRDNAttr) };
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
|
||||
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, NULL, &bytesNeeded,
|
||||
|
@ -2460,7 +2454,7 @@ static BOOL CRYPT_AsnDecodeNoticeReference(const BYTE *pbEncoded,
|
|||
FALSE, TRUE, offsetof(CERT_POLICY_QUALIFIER_NOTICE_REFERENCE,
|
||||
rgNoticeNumbers), 0 },
|
||||
};
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
|
||||
|
@ -2677,7 +2671,7 @@ static BOOL WINAPI CRYPT_AsnDecodePolicyQualifierUserNotice(
|
|||
|
||||
__TRY
|
||||
{
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
ret = CRYPT_AsnDecodePolicyQualifierUserNoticeInternal(pbEncoded,
|
||||
cbEncoded, dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, &bytesNeeded,
|
||||
|
@ -2771,7 +2765,7 @@ static BOOL WINAPI CRYPT_AsnDecodePKCSAttribute(DWORD dwCertEncodingType,
|
|||
|
||||
__TRY
|
||||
{
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
ret = CRYPT_AsnDecodePKCSAttributeInternal(pbEncoded, cbEncoded,
|
||||
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, &bytesNeeded, NULL);
|
||||
|
@ -2912,7 +2906,7 @@ static BOOL WINAPI CRYPT_AsnDecodePubKeyInfo(DWORD dwCertEncodingType,
|
|||
|
||||
__TRY
|
||||
{
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
if ((ret = CRYPT_AsnDecodePubKeyInfoInternal(pbEncoded, cbEncoded,
|
||||
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, &bytesNeeded, NULL)))
|
||||
|
@ -2982,7 +2976,7 @@ static BOOL CRYPT_AsnDecodeBool(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
else
|
||||
{
|
||||
*pcbStructInfo = sizeof(BOOL);
|
||||
*(BOOL *)pvStructInfo = pbEncoded[2] ? TRUE : FALSE;
|
||||
*(BOOL *)pvStructInfo = pbEncoded[2] != 0;
|
||||
ret = TRUE;
|
||||
}
|
||||
TRACE("returning %d (%08x)\n", ret, GetLastError());
|
||||
|
@ -3414,7 +3408,7 @@ static BOOL WINAPI CRYPT_AsnDecodeAltName(DWORD dwCertEncodingType,
|
|||
|
||||
__TRY
|
||||
{
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
if ((ret = CRYPT_AsnDecodeAltNameInternal(pbEncoded, cbEncoded,
|
||||
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, &bytesNeeded, NULL)))
|
||||
|
@ -4002,7 +3996,7 @@ static BOOL WINAPI CRYPT_AsnDecodeOctets(DWORD dwCertEncodingType,
|
|||
|
||||
__TRY
|
||||
{
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
if (!cbEncoded)
|
||||
{
|
||||
|
@ -4111,7 +4105,7 @@ static BOOL WINAPI CRYPT_AsnDecodeBits(DWORD dwCertEncodingType,
|
|||
|
||||
__TRY
|
||||
{
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
if (!cbEncoded)
|
||||
{
|
||||
|
@ -4205,7 +4199,7 @@ static BOOL WINAPI CRYPT_AsnDecodeInt(DWORD dwCertEncodingType,
|
|||
|
||||
__TRY
|
||||
{
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
if (!cbEncoded)
|
||||
{
|
||||
|
@ -4298,7 +4292,7 @@ static BOOL WINAPI CRYPT_AsnDecodeInteger(DWORD dwCertEncodingType,
|
|||
|
||||
__TRY
|
||||
{
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
if (pbEncoded[0] != ASN_INTEGER)
|
||||
{
|
||||
|
@ -4406,7 +4400,7 @@ static BOOL WINAPI CRYPT_AsnDecodeUnsignedInteger(DWORD dwCertEncodingType,
|
|||
|
||||
__TRY
|
||||
{
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
if ((ret = CRYPT_AsnDecodeUnsignedIntegerInternal(pbEncoded, cbEncoded,
|
||||
dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL, &bytesNeeded, NULL)))
|
||||
|
@ -4662,7 +4656,7 @@ static BOOL WINAPI CRYPT_AsnDecodeUtcTime(DWORD dwCertEncodingType,
|
|||
|
||||
__TRY
|
||||
{
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
ret = CRYPT_AsnDecodeUtcTimeInternal(pbEncoded, cbEncoded,
|
||||
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, &bytesNeeded, NULL);
|
||||
|
@ -4793,7 +4787,7 @@ static BOOL WINAPI CRYPT_AsnDecodeChoiceOfTime(DWORD dwCertEncodingType,
|
|||
|
||||
__TRY
|
||||
{
|
||||
DWORD bytesNeeded;
|
||||
DWORD bytesNeeded = 0;
|
||||
|
||||
ret = CRYPT_AsnDecodeChoiceOfTimeInternal(pbEncoded, cbEncoded,
|
||||
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, &bytesNeeded, NULL);
|
||||
|
@ -4938,7 +4932,7 @@ static BOOL CRYPT_AsnDecodeDistPointName(const BYTE *pbEncoded,
|
|||
|
||||
if (pbEncoded[0] == (ASN_CONTEXT | ASN_CONSTRUCTOR | 0))
|
||||
{
|
||||
DWORD bytesNeeded, dataLen;
|
||||
DWORD bytesNeeded = 0, dataLen;
|
||||
|
||||
if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
|
||||
{
|
||||
|
|
|
@ -140,7 +140,7 @@ BOOL WINAPI CryptVerifyDetachedMessageSignature(
|
|||
|
||||
for (i = 0; ret && i < cToBeSigned; i++)
|
||||
ret = CryptMsgUpdate(msg, rgpbToBeSigned[i], rgcbToBeSigned[i],
|
||||
i == cToBeSigned - 1 ? TRUE : FALSE);
|
||||
i == cToBeSigned - 1);
|
||||
}
|
||||
if (ret)
|
||||
{
|
||||
|
@ -210,6 +210,9 @@ BOOL WINAPI CryptVerifyMessageSignature(PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
|
|||
if (msg)
|
||||
{
|
||||
ret = CryptMsgUpdate(msg, pbSignedBlob, cbSignedBlob, TRUE);
|
||||
if (ret && pcbDecoded)
|
||||
ret = CryptMsgGetParam(msg, CMSG_CONTENT_PARAM, 0, pbDecoded,
|
||||
pcbDecoded);
|
||||
if (ret)
|
||||
{
|
||||
CERT_INFO *certInfo = CRYPT_GetSignerCertInfoFromMsg(msg,
|
||||
|
@ -241,20 +244,6 @@ BOOL WINAPI CryptVerifyMessageSignature(PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
|
|||
}
|
||||
CryptMemFree(certInfo);
|
||||
}
|
||||
if (ret)
|
||||
{
|
||||
/* The caller is expected to pass a valid pointer to pcbDecoded
|
||||
* when the message verifies successfully.
|
||||
*/
|
||||
if (pcbDecoded)
|
||||
ret = CryptMsgGetParam(msg, CMSG_CONTENT_PARAM, 0, pbDecoded,
|
||||
pcbDecoded);
|
||||
else
|
||||
{
|
||||
SetLastError(CRYPT_E_NOT_FOUND);
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
CryptMsgClose(msg);
|
||||
}
|
||||
if(!ret && pcbDecoded)
|
||||
|
@ -296,16 +285,14 @@ BOOL WINAPI CryptHashMessage(PCRYPT_HASH_MESSAGE_PARA pHashPara,
|
|||
memset(&info, 0, sizeof(info));
|
||||
info.cbSize = sizeof(info);
|
||||
info.hCryptProv = pHashPara->hCryptProv;
|
||||
memcpy(&info.HashAlgorithm, &pHashPara->HashAlgorithm,
|
||||
sizeof(info.HashAlgorithm));
|
||||
info.HashAlgorithm = pHashPara->HashAlgorithm;
|
||||
info.pvHashAuxInfo = pHashPara->pvHashAuxInfo;
|
||||
msg = CryptMsgOpenToEncode(pHashPara->dwMsgEncodingType, flags, CMSG_HASHED,
|
||||
&info, NULL, NULL);
|
||||
if (msg)
|
||||
{
|
||||
for (i = 0, ret = TRUE; ret && i < cToBeHashed; i++)
|
||||
ret = CryptMsgUpdate(msg, rgpbToBeHashed[i], rgcbToBeHashed[i],
|
||||
i == cToBeHashed - 1 ? TRUE : FALSE);
|
||||
ret = CryptMsgUpdate(msg, rgpbToBeHashed[i], rgcbToBeHashed[i], i == cToBeHashed - 1);
|
||||
if (ret)
|
||||
{
|
||||
ret = CryptMsgGetParam(msg, CMSG_CONTENT_PARAM, 0, pbHashedBlob,
|
||||
|
@ -356,7 +343,7 @@ BOOL WINAPI CryptVerifyDetachedMessageHash(PCRYPT_HASH_MESSAGE_PARA pHashPara,
|
|||
for (i = 0; ret && i < cToBeHashed; i++)
|
||||
{
|
||||
ret = CryptMsgUpdate(msg, rgpbToBeHashed[i],
|
||||
rgcbToBeHashed[i], i == cToBeHashed - 1 ? TRUE : FALSE);
|
||||
rgcbToBeHashed[i], i == cToBeHashed - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -511,7 +498,7 @@ BOOL WINAPI CryptSignMessage(PCRYPT_SIGN_MESSAGE_PARA pSignPara,
|
|||
for (i = 0; ret && i < cToBeSigned; ++i)
|
||||
{
|
||||
ret = CryptMsgUpdate(msg, rgpbToBeSigned[i], rgcbToBeSigned[i],
|
||||
i == cToBeSigned - 1 ? TRUE : FALSE);
|
||||
i == cToBeSigned - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1450,6 +1450,7 @@ static HCRYPTMSG CSignedEncodeMsg_Open(DWORD dwFlags,
|
|||
if (!ret)
|
||||
{
|
||||
CSignedEncodeMsg_Close(msg);
|
||||
CryptMemFree(msg);
|
||||
msg = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -2397,16 +2398,16 @@ static BOOL CDecodeMsg_FinalizeSignedContent(CDecodeMsg *msg,
|
|||
!strcmp(msg->u.signed_data.info->content.pszObjId,
|
||||
szOID_RSA_data))
|
||||
{
|
||||
CRYPT_DATA_BLOB *blob;
|
||||
CRYPT_DATA_BLOB *rsa_blob;
|
||||
|
||||
ret = CryptDecodeObjectEx(X509_ASN_ENCODING,
|
||||
X509_OCTET_STRING, content->pbData, content->cbData,
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &blob, &size);
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &rsa_blob, &size);
|
||||
if (ret)
|
||||
{
|
||||
ret = CSignedMsgData_Update(&msg->u.signed_data,
|
||||
blob->pbData, blob->cbData, TRUE, Verify);
|
||||
LocalFree(blob);
|
||||
rsa_blob->pbData, rsa_blob->cbData, TRUE, Verify);
|
||||
LocalFree(rsa_blob);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -842,7 +842,7 @@ static BOOL CRYPT_FormatBits(BYTE bits, const struct BitToString *map,
|
|||
DWORD mapEntries, void *pbFormat, DWORD *pcbFormat, BOOL *first)
|
||||
{
|
||||
DWORD bytesNeeded = sizeof(WCHAR);
|
||||
int i;
|
||||
unsigned int i;
|
||||
BOOL ret = TRUE, localFirst = *first;
|
||||
|
||||
for (i = 0; i < mapEntries; i++)
|
||||
|
@ -947,7 +947,7 @@ static BOOL WINAPI CRYPT_FormatKeyUsage(DWORD dwCertEncodingType,
|
|||
else
|
||||
{
|
||||
static BOOL stringsLoaded = FALSE;
|
||||
int i;
|
||||
unsigned int i;
|
||||
DWORD bitStringLen;
|
||||
BOOL first = TRUE;
|
||||
|
||||
|
@ -1866,7 +1866,7 @@ static BOOL CRYPT_FormatReason(DWORD dwFormatStrType,
|
|||
static const WCHAR sep[] = { ',',' ',0 };
|
||||
static const WCHAR bitsFmt[] = { ' ','(','%','0','2','x',')',0 };
|
||||
static BOOL stringsLoaded = FALSE;
|
||||
int i, numReasons = 0;
|
||||
unsigned int i, numReasons = 0;
|
||||
BOOL ret = TRUE;
|
||||
DWORD bytesNeeded = sizeof(WCHAR);
|
||||
WCHAR bits[6];
|
||||
|
@ -2317,7 +2317,7 @@ static BOOL WINAPI CRYPT_FormatNetscapeCertType(DWORD dwCertEncodingType,
|
|||
else
|
||||
{
|
||||
static BOOL stringsLoaded = FALSE;
|
||||
int i;
|
||||
unsigned int i;
|
||||
DWORD bitStringLen;
|
||||
BOOL first = TRUE;
|
||||
|
||||
|
|
|
@ -684,7 +684,7 @@ BOOL WINAPI CryptUnregisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName,
|
|||
CryptMemFree(szKey);
|
||||
if (rc)
|
||||
SetLastError(rc);
|
||||
return rc ? FALSE : TRUE;
|
||||
return !rc;
|
||||
}
|
||||
|
||||
BOOL WINAPI CryptGetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
|
||||
|
@ -721,7 +721,7 @@ BOOL WINAPI CryptGetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
|
|||
SetLastError(rc);
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
return rc ? FALSE : TRUE;
|
||||
return !rc;
|
||||
}
|
||||
|
||||
BOOL WINAPI CryptSetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
|
||||
|
@ -758,7 +758,7 @@ BOOL WINAPI CryptSetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
|
|||
SetLastError(rc);
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
return rc ? FALSE : TRUE;
|
||||
return !rc;
|
||||
}
|
||||
|
||||
static LPCWSTR CRYPT_FindStringInMultiString(LPCWSTR multi, LPCWSTR toFind)
|
||||
|
@ -1053,9 +1053,6 @@ static const WCHAR rc2[] = { 'r','c','2',0 };
|
|||
static const WCHAR rc4[] = { 'r','c','4',0 };
|
||||
static const WCHAR sha[] = { 's','h','a',0 };
|
||||
static const WCHAR sha1[] = { 's','h','a','1',0 };
|
||||
static const WCHAR sha256[] = { 's','h','a','2','5','6',0 };
|
||||
static const WCHAR sha384[] = { 's','h','a','3','8','4',0 };
|
||||
static const WCHAR sha512[] = { 's','h','a','5','1','2',0 };
|
||||
static const WCHAR RSA[] = { 'R','S','A',0 };
|
||||
static const WCHAR RSA_KEYX[] = { 'R','S','A','_','K','E','Y','X',0 };
|
||||
static const WCHAR RSA_SIGN[] = { 'R','S','A','_','S','I','G','N',0 };
|
||||
|
@ -1105,6 +1102,9 @@ static const WCHAR Phone[] = { 'P','h','o','n','e',0 };
|
|||
static const WCHAR X21Address[] = { 'X','2','1','A','d','d','r','e','s','s',0 };
|
||||
static const WCHAR dnQualifier[] =
|
||||
{ 'd','n','Q','u','a','l','i','f','i','e','r',0 };
|
||||
static const WCHAR SpcSpAgencyInfo[] = { 'S','p','c','S','p','A','g','e','n','c','y','I','n','f','o',0 };
|
||||
static const WCHAR SpcFinancialCriteria[] = { 'S','p','c','F','i','n','a','n','c','i','a','l','C','r','i','t','e','r','i','a',0 };
|
||||
static const WCHAR SpcMinimalCriteria[] = { 'S','p','c','M','i','n','i','m','a','l','C','r','i','t','e','r','i','a',0 };
|
||||
static const WCHAR Email[] = { 'E','m','a','i','l',0 };
|
||||
static const WCHAR GN[] = { 'G','N',0 };
|
||||
|
||||
|
@ -1273,9 +1273,9 @@ static const struct OIDInfoConstructor {
|
|||
{ 6, szOID_NETSCAPE_CA_POLICY_URL, 0, (LPCWSTR)IDS_NETSCAPE_CA_POLICY_URL, NULL },
|
||||
{ 6, szOID_NETSCAPE_SSL_SERVER_NAME, 0, (LPCWSTR)IDS_NETSCAPE_SSL_SERVER_NAME, NULL },
|
||||
{ 6, szOID_NETSCAPE_COMMENT, 0, (LPCWSTR)IDS_NETSCAPE_COMMENT, NULL },
|
||||
{ 6, "1.3.6.1.4.1.311.2.1.10", 0, (LPCWSTR)IDS_SPC_SP_AGENCY_INFO, NULL },
|
||||
{ 6, "1.3.6.1.4.1.311.2.1.27", 0, (LPCWSTR)IDS_SPC_FINANCIAL_CRITERIA, NULL },
|
||||
{ 6, "1.3.6.1.4.1.311.2.1.26", 0, (LPCWSTR)IDS_SPC_MINIMAL_CRITERIA, NULL },
|
||||
{ 6, "1.3.6.1.4.1.311.2.1.10", 0, SpcSpAgencyInfo, NULL },
|
||||
{ 6, "1.3.6.1.4.1.311.2.1.27", 0, SpcFinancialCriteria, NULL },
|
||||
{ 6, "1.3.6.1.4.1.311.2.1.26", 0, SpcMinimalCriteria, NULL },
|
||||
{ 6, szOID_COUNTRY_NAME, 0, (LPCWSTR)IDS_COUNTRY, NULL },
|
||||
{ 6, szOID_ORGANIZATION_NAME, 0, (LPCWSTR)IDS_ORGANIZATION, NULL },
|
||||
{ 6, szOID_ORGANIZATIONAL_UNIT_NAME, 0, (LPCWSTR)IDS_ORGANIZATIONAL_UNIT, NULL },
|
||||
|
|
|
@ -189,7 +189,7 @@ static const char *trust_status_to_str(DWORD status)
|
|||
"\n\tbad name constraints");
|
||||
if (status & CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT)
|
||||
pos += snprintf(buf + pos, sizeof(buf) - pos,
|
||||
"\n\tunsuported name constraint");
|
||||
"\n\tunsupported name constraint");
|
||||
if (status & CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT)
|
||||
pos += snprintf(buf + pos, sizeof(buf) - pos,
|
||||
"\n\tundefined name constraint");
|
||||
|
|
|
@ -652,21 +652,21 @@ static BOOL CRYPT_WriteSerializedStoreToStream(HCERTSTORE store,
|
|||
ret = output(handle, fileHeader, sizeof(fileHeader));
|
||||
if (ret)
|
||||
{
|
||||
memcpy(&interface, pCertInterface, sizeof(interface));
|
||||
interface = *pCertInterface;
|
||||
interface.serialize = (SerializeElementFunc)CRYPT_SerializeCertNoHash;
|
||||
ret = CRYPT_SerializeContextsToStream(output, handle, &interface,
|
||||
store);
|
||||
}
|
||||
if (ret)
|
||||
{
|
||||
memcpy(&interface, pCRLInterface, sizeof(interface));
|
||||
interface = *pCRLInterface;
|
||||
interface.serialize = (SerializeElementFunc)CRYPT_SerializeCRLNoHash;
|
||||
ret = CRYPT_SerializeContextsToStream(output, handle, &interface,
|
||||
store);
|
||||
}
|
||||
if (ret)
|
||||
{
|
||||
memcpy(&interface, pCTLInterface, sizeof(interface));
|
||||
interface = *pCTLInterface;
|
||||
interface.serialize = (SerializeElementFunc)CRYPT_SerializeCTLNoHash;
|
||||
ret = CRYPT_SerializeContextsToStream(output, handle, &interface,
|
||||
store);
|
||||
|
|
|
@ -634,14 +634,17 @@ static BOOL CRYPT_LoadSIP(const GUID *pgSubject)
|
|||
if (!sip.pfPut || temp != lib)
|
||||
goto error;
|
||||
FreeLibrary(temp);
|
||||
temp = NULL;
|
||||
sip.pfCreate = CRYPT_LoadSIPFunc(pgSubject, szCreate, &temp);
|
||||
if (!sip.pfCreate || temp != lib)
|
||||
goto error;
|
||||
FreeLibrary(temp);
|
||||
temp = NULL;
|
||||
sip.pfVerify = CRYPT_LoadSIPFunc(pgSubject, szVerify, &temp);
|
||||
if (!sip.pfVerify || temp != lib)
|
||||
goto error;
|
||||
FreeLibrary(temp);
|
||||
temp = NULL;
|
||||
sip.pfRemove = CRYPT_LoadSIPFunc(pgSubject, szRemoveSigned, &temp);
|
||||
if (!sip.pfRemove || temp != lib)
|
||||
goto error;
|
||||
|
|
|
@ -163,7 +163,7 @@ static BOOL CRYPT_MemAddCert(PWINECRYPT_CERTSTORE store, void *cert,
|
|||
if (ppStoreContext)
|
||||
*ppStoreContext = CertDuplicateCertificateContext(context);
|
||||
}
|
||||
return context ? TRUE : FALSE;
|
||||
return context != 0;
|
||||
}
|
||||
|
||||
static void *CRYPT_MemEnumCert(PWINECRYPT_CERTSTORE store, void *pPrev)
|
||||
|
@ -208,7 +208,7 @@ static BOOL CRYPT_MemAddCrl(PWINECRYPT_CERTSTORE store, void *crl,
|
|||
if (ppStoreContext)
|
||||
*ppStoreContext = CertDuplicateCRLContext(context);
|
||||
}
|
||||
return context ? TRUE : FALSE;
|
||||
return context != 0;
|
||||
}
|
||||
|
||||
static void *CRYPT_MemEnumCrl(PWINECRYPT_CERTSTORE store, void *pPrev)
|
||||
|
@ -253,7 +253,7 @@ static BOOL CRYPT_MemAddCtl(PWINECRYPT_CERTSTORE store, void *ctl,
|
|||
if (ppStoreContext)
|
||||
*ppStoreContext = CertDuplicateCTLContext(context);
|
||||
}
|
||||
return context ? TRUE : FALSE;
|
||||
return context != 0;
|
||||
}
|
||||
|
||||
static void *CRYPT_MemEnumCtl(PWINECRYPT_CERTSTORE store, void *pPrev)
|
||||
|
|
|
@ -52,7 +52,7 @@ reactos/dll/win32/comctl32 # Synced to Wine 1.5.26
|
|||
reactos/dll/win32/comdlg32 # Synced to Wine 1.3.37
|
||||
reactos/dll/win32/compstui # Synced to Wine-1.5.19
|
||||
reactos/dll/win32/credui # Synced to Wine-1.5.4
|
||||
reactos/dll/win32/crypt32 # Synced to Wine-1.3.37
|
||||
reactos/dll/win32/crypt32 # Synced to Wine-1.5.26
|
||||
reactos/dll/win32/cryptdlg # Synced to Wine-1.5.4
|
||||
reactos/dll/win32/cryptdll # Synced to Wine-1.5.4
|
||||
reactos/dll/win32/cryptnet # Synced to Wine-1.3.37
|
||||
|
|
Loading…
Reference in a new issue