mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[CRYPT32] Sync with Wine Staging 3.17. CORE-15127
This commit is contained in:
parent
156cac53d2
commit
997d44c915
17 changed files with 352 additions and 437 deletions
|
@ -53,10 +53,10 @@ static const WCHAR CERT_TRAILER_START_W[] = {
|
|||
'-','-','-','-','-','E','N','D',' ',0 };
|
||||
static const WCHAR CERT_REQUEST_HEADER_W[] = {
|
||||
'-','-','-','-','-','B','E','G','I','N',' ','N','E','W',' ','C','E','R','T',
|
||||
'I','F','I','C','A','T','E','R','E','Q','U','E','S','T','-','-','-','-','-',0 };
|
||||
'I','F','I','C','A','T','E',' ','R','E','Q','U','E','S','T','-','-','-','-','-',0 };
|
||||
static const WCHAR CERT_REQUEST_TRAILER_W[] = {
|
||||
'-','-','-','-','-','E','N','D',' ','N','E','W',' ','C','E','R','T','I','F',
|
||||
'I','C','A','T','E','R','E','Q','U','E','S','T','-','-','-','-','-',0 };
|
||||
'I','C','A','T','E',' ','R','E','Q','U','E','S','T','-','-','-','-','-',0 };
|
||||
static const WCHAR X509_HEADER_W[] = {
|
||||
'-','-','-','-','-','B','E','G','I','N',' ','X','5','0','9',' ','C','R','L',
|
||||
'-','-','-','-','-',0 };
|
||||
|
@ -77,23 +77,19 @@ static BOOL EncodeBinaryToBinaryA(const BYTE *pbBinary,
|
|||
{
|
||||
BOOL ret = TRUE;
|
||||
|
||||
if (*pcchString < cbBinary)
|
||||
if (pszString)
|
||||
{
|
||||
if (!pszString)
|
||||
*pcchString = cbBinary;
|
||||
else
|
||||
if (*pcchString < cbBinary)
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
*pcchString = cbBinary;
|
||||
ret = FALSE;
|
||||
}
|
||||
else if (cbBinary)
|
||||
memcpy(pszString, pbBinary, cbBinary);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cbBinary)
|
||||
memcpy(pszString, pbBinary, cbBinary);
|
||||
*pcchString = cbBinary;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -107,8 +103,9 @@ static LONG encodeBase64A(const BYTE *in_buf, int in_len, LPCSTR sep,
|
|||
LPSTR ptr;
|
||||
|
||||
TRACE("bytes is %d, pad bytes is %d\n", bytes, pad_bytes);
|
||||
needed = bytes + pad_bytes + 1;
|
||||
needed += (needed / 64 + 1) * strlen(sep);
|
||||
needed = bytes + pad_bytes;
|
||||
needed += (needed / 64 + (needed % 64 ? 1 : 0)) * strlen(sep);
|
||||
needed++;
|
||||
|
||||
if (needed > *out_len)
|
||||
{
|
||||
|
@ -215,36 +212,41 @@ static BOOL BinaryToBase64A(const BYTE *pbBinary,
|
|||
charsNeeded += strlen(header) + strlen(sep);
|
||||
if (trailer)
|
||||
charsNeeded += strlen(trailer) + strlen(sep);
|
||||
if (charsNeeded <= *pcchString)
|
||||
{
|
||||
LPSTR ptr = pszString;
|
||||
DWORD size = charsNeeded;
|
||||
|
||||
if (header)
|
||||
{
|
||||
strcpy(ptr, header);
|
||||
ptr += strlen(ptr);
|
||||
strcpy(ptr, sep);
|
||||
ptr += strlen(sep);
|
||||
}
|
||||
encodeBase64A(pbBinary, cbBinary, sep, ptr, &size);
|
||||
ptr += size - 1;
|
||||
if (trailer)
|
||||
{
|
||||
strcpy(ptr, trailer);
|
||||
ptr += strlen(ptr);
|
||||
strcpy(ptr, sep);
|
||||
}
|
||||
*pcchString = charsNeeded - 1;
|
||||
}
|
||||
else if (pszString)
|
||||
if (pszString)
|
||||
{
|
||||
*pcchString = charsNeeded;
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
ret = FALSE;
|
||||
if (charsNeeded <= *pcchString)
|
||||
{
|
||||
LPSTR ptr = pszString;
|
||||
DWORD size = charsNeeded;
|
||||
|
||||
if (header)
|
||||
{
|
||||
strcpy(ptr, header);
|
||||
ptr += strlen(ptr);
|
||||
strcpy(ptr, sep);
|
||||
ptr += strlen(sep);
|
||||
}
|
||||
encodeBase64A(pbBinary, cbBinary, sep, ptr, &size);
|
||||
ptr += size - 1;
|
||||
if (trailer)
|
||||
{
|
||||
strcpy(ptr, trailer);
|
||||
ptr += strlen(ptr);
|
||||
strcpy(ptr, sep);
|
||||
}
|
||||
*pcchString = charsNeeded - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pcchString = charsNeeded;
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
*pcchString = charsNeeded;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -291,6 +293,26 @@ BOOL WINAPI CryptBinaryToStringA(const BYTE *pbBinary,
|
|||
return encoder(pbBinary, cbBinary, dwFlags, pszString, pcchString);
|
||||
}
|
||||
|
||||
static BOOL EncodeBinaryToBinaryW(const BYTE *in_buf, DWORD in_len, DWORD flags, WCHAR *out_buf, DWORD *out_len)
|
||||
{
|
||||
BOOL ret = TRUE;
|
||||
|
||||
if (out_buf)
|
||||
{
|
||||
if (*out_len < in_len)
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
ret = FALSE;
|
||||
}
|
||||
else if (in_len)
|
||||
memcpy(out_buf, in_buf, in_len);
|
||||
}
|
||||
else
|
||||
*out_len = in_len;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep,
|
||||
WCHAR* out_buf, DWORD *out_len)
|
||||
{
|
||||
|
@ -301,8 +323,9 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep,
|
|||
LPWSTR ptr;
|
||||
|
||||
TRACE("bytes is %d, pad bytes is %d\n", bytes, pad_bytes);
|
||||
needed = bytes + pad_bytes + 1;
|
||||
needed += (needed / 64 + 1) * strlenW(sep);
|
||||
needed = bytes + pad_bytes;
|
||||
needed += (needed / 64 + (needed % 64 ? 1 : 0)) * strlenW(sep);
|
||||
needed++;
|
||||
|
||||
if (needed > *out_len)
|
||||
{
|
||||
|
@ -409,36 +432,41 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary,
|
|||
charsNeeded += strlenW(header) + strlenW(sep);
|
||||
if (trailer)
|
||||
charsNeeded += strlenW(trailer) + strlenW(sep);
|
||||
if (charsNeeded <= *pcchString)
|
||||
{
|
||||
LPWSTR ptr = pszString;
|
||||
DWORD size = charsNeeded;
|
||||
|
||||
if (header)
|
||||
{
|
||||
strcpyW(ptr, header);
|
||||
ptr += strlenW(ptr);
|
||||
strcpyW(ptr, sep);
|
||||
ptr += strlenW(sep);
|
||||
}
|
||||
encodeBase64W(pbBinary, cbBinary, sep, ptr, &size);
|
||||
ptr += size - 1;
|
||||
if (trailer)
|
||||
{
|
||||
strcpyW(ptr, trailer);
|
||||
ptr += strlenW(ptr);
|
||||
strcpyW(ptr, sep);
|
||||
}
|
||||
*pcchString = charsNeeded - 1;
|
||||
}
|
||||
else if (pszString)
|
||||
if (pszString)
|
||||
{
|
||||
*pcchString = charsNeeded;
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
ret = FALSE;
|
||||
if (charsNeeded <= *pcchString)
|
||||
{
|
||||
LPWSTR ptr = pszString;
|
||||
DWORD size = charsNeeded;
|
||||
|
||||
if (header)
|
||||
{
|
||||
strcpyW(ptr, header);
|
||||
ptr += strlenW(ptr);
|
||||
strcpyW(ptr, sep);
|
||||
ptr += strlenW(sep);
|
||||
}
|
||||
encodeBase64W(pbBinary, cbBinary, sep, ptr, &size);
|
||||
ptr += size - 1;
|
||||
if (trailer)
|
||||
{
|
||||
strcpyW(ptr, trailer);
|
||||
ptr += strlenW(ptr);
|
||||
strcpyW(ptr, sep);
|
||||
}
|
||||
*pcchString = charsNeeded - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pcchString = charsNeeded;
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
*pcchString = charsNeeded;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -463,13 +491,15 @@ BOOL WINAPI CryptBinaryToStringW(const BYTE *pbBinary,
|
|||
|
||||
switch (dwFlags & 0x0fffffff)
|
||||
{
|
||||
case CRYPT_STRING_BINARY:
|
||||
encoder = EncodeBinaryToBinaryW;
|
||||
break;
|
||||
case CRYPT_STRING_BASE64:
|
||||
case CRYPT_STRING_BASE64HEADER:
|
||||
case CRYPT_STRING_BASE64REQUESTHEADER:
|
||||
case CRYPT_STRING_BASE64X509CRLHEADER:
|
||||
encoder = BinaryToBase64W;
|
||||
break;
|
||||
case CRYPT_STRING_BINARY:
|
||||
case CRYPT_STRING_HEX:
|
||||
case CRYPT_STRING_HEXASCII:
|
||||
case CRYPT_STRING_HEXADDR:
|
||||
|
@ -622,7 +652,7 @@ static LONG Base64WithHeaderAndTrailerToBinaryA(LPCSTR pszString,
|
|||
|
||||
if (!(headerBegins = strstr(pszString, header)))
|
||||
{
|
||||
TRACE("Can't find %s in %s.\n", header, pszString);
|
||||
TRACE("Can't find %s in %s.\n", header, debugstr_an(pszString, cchString));
|
||||
return ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
|
@ -746,7 +776,7 @@ BOOL WINAPI CryptStringToBinaryA(LPCSTR pszString,
|
|||
StringToBinaryAFunc decoder;
|
||||
LONG ret;
|
||||
|
||||
TRACE("(%s, %d, %08x, %p, %p, %p, %p)\n", debugstr_a(pszString),
|
||||
TRACE("(%s, %d, %08x, %p, %p, %p, %p)\n", debugstr_an(pszString, cchString ? cchString : -1),
|
||||
cchString, dwFlags, pbBinary, pcbBinary, pdwSkip, pdwFlags);
|
||||
|
||||
if (!pszString)
|
||||
|
@ -833,7 +863,7 @@ static LONG Base64WithHeaderAndTrailerToBinaryW(LPCWSTR pszString,
|
|||
|
||||
if (!(headerBegins = strstrW(pszString, header)))
|
||||
{
|
||||
TRACE("Can't find %s in %s.\n", debugstr_w(header), debugstr_w(pszString));
|
||||
TRACE("Can't find %s in %s.\n", debugstr_w(header), debugstr_wn(pszString, cchString));
|
||||
return ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
|
@ -957,7 +987,7 @@ BOOL WINAPI CryptStringToBinaryW(LPCWSTR pszString,
|
|||
StringToBinaryWFunc decoder;
|
||||
LONG ret;
|
||||
|
||||
TRACE("(%s, %d, %08x, %p, %p, %p, %p)\n", debugstr_w(pszString),
|
||||
TRACE("(%s, %d, %08x, %p, %p, %p, %p)\n", debugstr_wn(pszString, cchString ? cchString : -1),
|
||||
cchString, dwFlags, pbBinary, pcbBinary, pdwSkip, pdwFlags);
|
||||
|
||||
if (!pszString)
|
||||
|
|
|
@ -992,8 +992,7 @@ static BOOL container_matches_cert(PCCERT_CONTEXT pCert, LPCSTR container,
|
|||
WCHAR containerW[MAX_PATH];
|
||||
BOOL matches;
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, container, -1,
|
||||
containerW, sizeof(containerW) / sizeof(containerW[0]));
|
||||
MultiByteToWideChar(CP_ACP, 0, container, -1, containerW, ARRAY_SIZE(containerW));
|
||||
/* We make a copy of the CRYPT_KEY_PROV_INFO because the caller expects
|
||||
* keyProvInfo->pwszContainerName to be NULL or a heap-allocated container
|
||||
* name.
|
||||
|
@ -1889,7 +1888,7 @@ PCCERT_CONTEXT WINAPI CertGetIssuerCertificateFromStore(HCERTSTORE hCertStore,
|
|||
CertFreeCertificateContext(ret);
|
||||
ret = NULL;
|
||||
}
|
||||
if (CRYPT_IsCertificateSelfSigned(pSubjectContext, NULL))
|
||||
if (CRYPT_IsCertificateSelfSigned(pSubjectContext))
|
||||
{
|
||||
CertFreeCertificateContext(ret);
|
||||
ret = NULL;
|
||||
|
@ -2414,29 +2413,27 @@ BOOL WINAPI CryptVerifyCertificateSignature(HCRYPTPROV_LEGACY hCryptProv,
|
|||
CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY, pPublicKey, 0, NULL);
|
||||
}
|
||||
|
||||
static BOOL verify_signature_crypt(HCRYPTPROV_LEGACY hCryptProv,
|
||||
DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pubKeyInfo,
|
||||
const CERT_SIGNED_CONTENT_INFO *signedCert, PCCRYPT_OID_INFO info)
|
||||
static BOOL CRYPT_VerifySignature(HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType,
|
||||
CERT_PUBLIC_KEY_INFO *pubKeyInfo, const CERT_SIGNED_CONTENT_INFO *signedCert, const CRYPT_OID_INFO *info)
|
||||
{
|
||||
ALG_ID pubKeyID, hashID;
|
||||
HCRYPTHASH hash;
|
||||
HCRYPTKEY key;
|
||||
BOOL ret;
|
||||
HCRYPTKEY key;
|
||||
ALG_ID pubKeyID, hashID;
|
||||
|
||||
hashID = info->u.Algid;
|
||||
if (info->ExtraInfo.cbData >= sizeof(ALG_ID))
|
||||
pubKeyID = *(ALG_ID *)info->ExtraInfo.pbData;
|
||||
else
|
||||
pubKeyID = hashID;
|
||||
|
||||
/* Load the default provider if necessary */
|
||||
if (!hCryptProv)
|
||||
hCryptProv = CRYPT_GetDefaultProvider();
|
||||
|
||||
ret = CryptImportPublicKeyInfoEx(hCryptProv, dwCertEncodingType,
|
||||
pubKeyInfo, pubKeyID, 0, NULL, &key);
|
||||
if (ret)
|
||||
{
|
||||
HCRYPTHASH hash;
|
||||
|
||||
ret = CryptCreateHash(hCryptProv, hashID, 0, 0, &hash);
|
||||
if (ret)
|
||||
{
|
||||
|
@ -2452,14 +2449,13 @@ static BOOL verify_signature_crypt(HCRYPTPROV_LEGACY hCryptProv,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static BOOL calculate_hash_bcrypt(const WCHAR *algorithm,
|
||||
const CERT_SIGNED_CONTENT_INFO *signedCert, BYTE **hash_value, DWORD *hash_len)
|
||||
static BOOL CNG_CalcHash(const WCHAR *algorithm, const CERT_SIGNED_CONTENT_INFO *signedCert,
|
||||
BYTE **hash_value, DWORD *hash_len)
|
||||
{
|
||||
BCRYPT_HASH_HANDLE hash = NULL;
|
||||
BCRYPT_ALG_HANDLE alg = NULL;
|
||||
NTSTATUS status;
|
||||
DWORD size;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if ((status = BCryptOpenAlgorithmProvider(&alg, algorithm, NULL, 0)))
|
||||
goto done;
|
||||
|
@ -2485,23 +2481,21 @@ static BOOL calculate_hash_bcrypt(const WCHAR *algorithm,
|
|||
goto done;
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
done:
|
||||
if (hash) BCryptDestroyHash(hash);
|
||||
if (alg) BCryptCloseAlgorithmProvider(alg, 0);
|
||||
if (status) SetLastError(RtlNtStatusToDosError(status));
|
||||
return ret;
|
||||
return status == 0;
|
||||
}
|
||||
|
||||
static BOOL import_bcrypt_pubkey_ecc(PCERT_PUBLIC_KEY_INFO pubKeyInfo, BCRYPT_KEY_HANDLE *key)
|
||||
static BOOL CNG_ImportECCPubKey(CERT_PUBLIC_KEY_INFO *pubKeyInfo, BCRYPT_KEY_HANDLE *key)
|
||||
{
|
||||
DWORD blob_magic, ecckey_len, size;
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
BCRYPT_ALG_HANDLE alg = NULL;
|
||||
BCRYPT_ECCKEY_BLOB *ecckey;
|
||||
const WCHAR *sign_algo;
|
||||
BCRYPT_ALG_HANDLE alg;
|
||||
LPSTR *ecc_curve;
|
||||
char **ecc_curve;
|
||||
NTSTATUS status;
|
||||
|
||||
if (!pubKeyInfo->PublicKey.cbData)
|
||||
{
|
||||
|
@ -2516,10 +2510,8 @@ static BOOL import_bcrypt_pubkey_ecc(PCERT_PUBLIC_KEY_INFO pubKeyInfo, BCRYPT_KE
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_OBJECT_IDENTIFIER,
|
||||
pubKeyInfo->Algorithm.Parameters.pbData,
|
||||
pubKeyInfo->Algorithm.Parameters.cbData,
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &ecc_curve, &size))
|
||||
if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_OBJECT_IDENTIFIER, pubKeyInfo->Algorithm.Parameters.pbData,
|
||||
pubKeyInfo->Algorithm.Parameters.cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, &ecc_curve, &size))
|
||||
return FALSE;
|
||||
|
||||
if (!strcmp(*ecc_curve, szOID_ECC_CURVE_P256))
|
||||
|
@ -2527,7 +2519,7 @@ static BOOL import_bcrypt_pubkey_ecc(PCERT_PUBLIC_KEY_INFO pubKeyInfo, BCRYPT_KE
|
|||
sign_algo = BCRYPT_ECDSA_P256_ALGORITHM;
|
||||
blob_magic = BCRYPT_ECDSA_PUBLIC_P256_MAGIC;
|
||||
}
|
||||
else if(!strcmp(*ecc_curve, szOID_ECC_CURVE_P384))
|
||||
else if (!strcmp(*ecc_curve, szOID_ECC_CURVE_P384))
|
||||
{
|
||||
sign_algo = BCRYPT_ECDSA_P384_ALGORITHM;
|
||||
blob_magic = BCRYPT_ECDSA_PUBLIC_P384_MAGIC;
|
||||
|
@ -2547,17 +2539,13 @@ static BOOL import_bcrypt_pubkey_ecc(PCERT_PUBLIC_KEY_INFO pubKeyInfo, BCRYPT_KE
|
|||
}
|
||||
|
||||
if ((status = BCryptOpenAlgorithmProvider(&alg, sign_algo, NULL, 0)))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(status));
|
||||
return FALSE;
|
||||
}
|
||||
goto done;
|
||||
|
||||
ecckey_len = sizeof(BCRYPT_ECCKEY_BLOB) + pubKeyInfo->PublicKey.cbData - 1;
|
||||
if (!(ecckey = CryptMemAlloc(ecckey_len)))
|
||||
{
|
||||
BCryptCloseAlgorithmProvider(alg, 0);
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return FALSE;
|
||||
status = STATUS_NO_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
|
||||
ecckey->dwMagic = blob_magic;
|
||||
|
@ -2565,36 +2553,32 @@ static BOOL import_bcrypt_pubkey_ecc(PCERT_PUBLIC_KEY_INFO pubKeyInfo, BCRYPT_KE
|
|||
memcpy(ecckey + 1, pubKeyInfo->PublicKey.pbData + 1, pubKeyInfo->PublicKey.cbData - 1);
|
||||
|
||||
status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, key, (BYTE*)ecckey, ecckey_len, 0);
|
||||
BCryptCloseAlgorithmProvider(alg, 0);
|
||||
if (status)
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(status));
|
||||
return FALSE;
|
||||
}
|
||||
CryptMemFree(ecckey);
|
||||
|
||||
return TRUE;
|
||||
done:
|
||||
if (alg) BCryptCloseAlgorithmProvider(alg, 0);
|
||||
if (status) SetLastError(RtlNtStatusToDosError(status));
|
||||
return !status;
|
||||
}
|
||||
|
||||
static BOOL import_bcrypt_pubkey(PCERT_PUBLIC_KEY_INFO pubKeyInfo, BCRYPT_KEY_HANDLE *key)
|
||||
static BOOL CNG_ImportPubKey(CERT_PUBLIC_KEY_INFO *pubKeyInfo, BCRYPT_KEY_HANDLE *key)
|
||||
{
|
||||
if (!strcmp(pubKeyInfo->Algorithm.pszObjId, szOID_ECC_PUBLIC_KEY))
|
||||
return import_bcrypt_pubkey_ecc(pubKeyInfo, key);
|
||||
return CNG_ImportECCPubKey(pubKeyInfo, key);
|
||||
|
||||
FIXME("Unsupported public key type: %s\n", debugstr_a(pubKeyInfo->Algorithm.pszObjId));
|
||||
SetLastError(NTE_BAD_ALGID);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL prepare_bcrypt_signature_ecc(BYTE *encoded_sig, DWORD encoded_size,
|
||||
BYTE **sig_value, DWORD *sig_len)
|
||||
static BOOL CNG_PrepareSignatureECC(BYTE *encoded_sig, DWORD encoded_size, BYTE **sig_value, DWORD *sig_len)
|
||||
{
|
||||
CERT_ECC_SIGNATURE *ecc_sig;
|
||||
DWORD size;
|
||||
int i;
|
||||
|
||||
if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ECC_SIGNATURE,
|
||||
encoded_sig, encoded_size,
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &ecc_sig, &size))
|
||||
if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ECC_SIGNATURE, encoded_sig, encoded_size,
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &ecc_sig, &size))
|
||||
return FALSE;
|
||||
|
||||
if (!ecc_sig->r.cbData || !ecc_sig->s.cbData)
|
||||
|
@ -2621,8 +2605,8 @@ static BOOL prepare_bcrypt_signature_ecc(BYTE *encoded_sig, DWORD encoded_size,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL prepare_bcrypt_signature(PCERT_PUBLIC_KEY_INFO pubKeyInfo,
|
||||
const CERT_SIGNED_CONTENT_INFO *signedCert, BYTE **sig_value, DWORD *sig_len)
|
||||
static BOOL CNG_PrepareSignature(CERT_PUBLIC_KEY_INFO *pubKeyInfo, const CERT_SIGNED_CONTENT_INFO *signedCert,
|
||||
BYTE **sig_value, DWORD *sig_len)
|
||||
{
|
||||
BYTE *encoded_sig;
|
||||
BOOL ret = FALSE;
|
||||
|
@ -2644,7 +2628,7 @@ static BOOL prepare_bcrypt_signature(PCERT_PUBLIC_KEY_INFO pubKeyInfo,
|
|||
encoded_sig[i] = signedCert->Signature.pbData[signedCert->Signature.cbData - i - 1];
|
||||
|
||||
if (!strcmp(pubKeyInfo->Algorithm.pszObjId, szOID_ECC_PUBLIC_KEY))
|
||||
ret = prepare_bcrypt_signature_ecc(encoded_sig, signedCert->Signature.cbData, sig_value, sig_len);
|
||||
ret = CNG_PrepareSignatureECC(encoded_sig, signedCert->Signature.cbData, sig_value, sig_len);
|
||||
else
|
||||
{
|
||||
FIXME("Unsupported public key type: %s\n", debugstr_a(pubKeyInfo->Algorithm.pszObjId));
|
||||
|
@ -2655,55 +2639,47 @@ static BOOL prepare_bcrypt_signature(PCERT_PUBLIC_KEY_INFO pubKeyInfo,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static BOOL verify_signature_bcrypt(HCRYPTPROV_LEGACY hCryptProv,
|
||||
DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pubKeyInfo,
|
||||
const CERT_SIGNED_CONTENT_INFO *signedCert, PCCRYPT_OID_INFO info)
|
||||
static BOOL CNG_VerifySignature(HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType,
|
||||
CERT_PUBLIC_KEY_INFO *pubKeyInfo, const CERT_SIGNED_CONTENT_INFO *signedCert, const CRYPT_OID_INFO *info)
|
||||
{
|
||||
BCRYPT_KEY_HANDLE key = NULL;
|
||||
BYTE *hash_value, *sig_value;
|
||||
BYTE *hash_value = NULL, *sig_value;
|
||||
DWORD hash_len, sig_len;
|
||||
NTSTATUS status;
|
||||
BOOL ret;
|
||||
|
||||
if (!calculate_hash_bcrypt(info->pwszCNGAlgid, signedCert, &hash_value, &hash_len))
|
||||
return FALSE;
|
||||
|
||||
if (!import_bcrypt_pubkey(pubKeyInfo, &key))
|
||||
ret = CNG_ImportPubKey(pubKeyInfo, &key);
|
||||
if (ret)
|
||||
{
|
||||
CryptMemFree(hash_value);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!prepare_bcrypt_signature(pubKeyInfo, signedCert, &sig_value, &sig_len))
|
||||
{
|
||||
CryptMemFree(hash_value);
|
||||
ret = CNG_CalcHash(info->pwszCNGAlgid, signedCert, &hash_value, &hash_len);
|
||||
if (ret)
|
||||
{
|
||||
ret = CNG_PrepareSignature(pubKeyInfo, signedCert, &sig_value, &sig_len);
|
||||
if (ret)
|
||||
{
|
||||
status = BCryptVerifySignature(key, NULL, hash_value, hash_len, sig_value, sig_len, 0);
|
||||
if (status)
|
||||
{
|
||||
FIXME("Failed to verify signature: %08x\n", status);
|
||||
SetLastError(RtlNtStatusToDosError(status));
|
||||
ret = FALSE;
|
||||
}
|
||||
CryptMemFree(sig_value);
|
||||
}
|
||||
CryptMemFree(hash_value);
|
||||
}
|
||||
BCryptDestroyKey(key);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
status = BCryptVerifySignature(key, NULL, hash_value, hash_len, sig_value, sig_len, 0);
|
||||
|
||||
BCryptDestroyKey(key);
|
||||
CryptMemFree(hash_value);
|
||||
CryptMemFree(sig_value);
|
||||
|
||||
if (status)
|
||||
{
|
||||
FIXME("Failed to verify signature: %08x\n", status);
|
||||
SetLastError(RtlNtStatusToDosError(status));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL CRYPT_VerifyCertSignatureFromPublicKeyInfo(HCRYPTPROV_LEGACY hCryptProv,
|
||||
DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pubKeyInfo,
|
||||
const CERT_SIGNED_CONTENT_INFO *signedCert)
|
||||
static BOOL CRYPT_VerifyCertSignatureFromPublicKeyInfo(HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType,
|
||||
CERT_PUBLIC_KEY_INFO *pubKeyInfo, const CERT_SIGNED_CONTENT_INFO *signedCert)
|
||||
{
|
||||
PCCRYPT_OID_INFO info;
|
||||
CCRYPT_OID_INFO *info;
|
||||
|
||||
info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY,
|
||||
signedCert->SignatureAlgorithm.pszObjId, 0);
|
||||
info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, signedCert->SignatureAlgorithm.pszObjId, 0);
|
||||
if (!info || info->dwGroupId != CRYPT_SIGN_ALG_OID_GROUP_ID)
|
||||
{
|
||||
SetLastError(NTE_BAD_ALGID);
|
||||
|
@ -2711,9 +2687,9 @@ static BOOL CRYPT_VerifyCertSignatureFromPublicKeyInfo(HCRYPTPROV_LEGACY hCryptP
|
|||
}
|
||||
|
||||
if (info->u.Algid == CALG_OID_INFO_CNG_ONLY)
|
||||
return verify_signature_bcrypt(hCryptProv, dwCertEncodingType, pubKeyInfo, signedCert, info);
|
||||
return CNG_VerifySignature(hCryptProv, dwCertEncodingType, pubKeyInfo, signedCert, info);
|
||||
else
|
||||
return verify_signature_crypt(hCryptProv, dwCertEncodingType, pubKeyInfo, signedCert, info);
|
||||
return CRYPT_VerifySignature(hCryptProv, dwCertEncodingType, pubKeyInfo, signedCert, info);
|
||||
}
|
||||
|
||||
BOOL WINAPI CryptVerifyCertificateSignatureEx(HCRYPTPROV_LEGACY hCryptProv,
|
||||
|
|
|
@ -146,9 +146,9 @@ HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE root, DWORD system_store, co
|
|||
worldStores[2] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, myW);
|
||||
worldStores[3] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, trustW);
|
||||
|
||||
CRYPT_AddStoresToCollection(engine->hWorld, sizeof(worldStores) / sizeof(worldStores[0]), worldStores);
|
||||
CRYPT_AddStoresToCollection(engine->hWorld, config->cAdditionalStore, config->rghAdditionalStore);
|
||||
CRYPT_CloseStores(sizeof(worldStores) / sizeof(worldStores[0]), worldStores);
|
||||
CRYPT_AddStoresToCollection(engine->hWorld, ARRAY_SIZE(worldStores), worldStores);
|
||||
CRYPT_AddStoresToCollection(engine->hWorld, config->cAdditionalStore, config->rghAdditionalStore);
|
||||
CRYPT_CloseStores(ARRAY_SIZE(worldStores), worldStores);
|
||||
|
||||
engine->dwFlags = config->dwFlags;
|
||||
engine->dwUrlRetrievalTimeout = config->dwUrlRetrievalTimeout;
|
||||
|
@ -265,10 +265,10 @@ typedef struct _CertificateChain
|
|||
LONG ref;
|
||||
} CertificateChain;
|
||||
|
||||
BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert, DWORD *type)
|
||||
DWORD CRYPT_IsCertificateSelfSigned(const CERT_CONTEXT *cert)
|
||||
{
|
||||
DWORD size, status = 0;
|
||||
PCERT_EXTENSION ext;
|
||||
DWORD size;
|
||||
BOOL ret;
|
||||
|
||||
if ((ext = CertFindExtension(szOID_AUTHORITY_KEY_IDENTIFIER2,
|
||||
|
@ -296,11 +296,9 @@ BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert, DWORD *type)
|
|||
&info->AuthorityCertIssuer.rgAltEntry[i];
|
||||
if (directoryName)
|
||||
{
|
||||
ret = CertCompareCertificateName(cert->dwCertEncodingType,
|
||||
&directoryName->u.DirectoryName, &cert->pCertInfo->Issuer)
|
||||
&& CertCompareIntegerBlob(&info->AuthorityCertSerialNumber,
|
||||
&cert->pCertInfo->SerialNumber);
|
||||
if (type) *type = CERT_TRUST_HAS_NAME_MATCH_ISSUER;
|
||||
if (CertCompareCertificateName(cert->dwCertEncodingType, &directoryName->u.DirectoryName, &cert->pCertInfo->Issuer)
|
||||
&& CertCompareIntegerBlob(&info->AuthorityCertSerialNumber, &cert->pCertInfo->SerialNumber))
|
||||
status = CERT_TRUST_HAS_NAME_MATCH_ISSUER;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -318,17 +316,12 @@ BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert, DWORD *type)
|
|||
|
||||
if (buf)
|
||||
{
|
||||
CertGetCertificateContextProperty(cert,
|
||||
CERT_KEY_IDENTIFIER_PROP_ID, buf, &size);
|
||||
ret = !memcmp(buf, info->KeyId.pbData, size);
|
||||
CertGetCertificateContextProperty(cert, CERT_KEY_IDENTIFIER_PROP_ID, buf, &size);
|
||||
if (!memcmp(buf, info->KeyId.pbData, size))
|
||||
status = CERT_TRUST_HAS_KEY_MATCH_ISSUER;
|
||||
CryptMemFree(buf);
|
||||
if (type) *type = CERT_TRUST_HAS_KEY_MATCH_ISSUER;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
}
|
||||
LocalFree(info);
|
||||
}
|
||||
|
@ -346,11 +339,9 @@ BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert, DWORD *type)
|
|||
{
|
||||
if (info->CertIssuer.cbData && info->CertSerialNumber.cbData)
|
||||
{
|
||||
ret = CertCompareCertificateName(cert->dwCertEncodingType,
|
||||
&info->CertIssuer, &cert->pCertInfo->Issuer) &&
|
||||
CertCompareIntegerBlob(&info->CertSerialNumber,
|
||||
&cert->pCertInfo->SerialNumber);
|
||||
if (type) *type = CERT_TRUST_HAS_NAME_MATCH_ISSUER;
|
||||
if (CertCompareCertificateName(cert->dwCertEncodingType, &info->CertIssuer, &cert->pCertInfo->Issuer)
|
||||
&& CertCompareIntegerBlob(&info->CertSerialNumber, &cert->pCertInfo->SerialNumber))
|
||||
status = CERT_TRUST_HAS_NAME_MATCH_ISSUER;
|
||||
}
|
||||
else if (info->KeyId.cbData)
|
||||
{
|
||||
|
@ -364,28 +355,23 @@ BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert, DWORD *type)
|
|||
{
|
||||
CertGetCertificateContextProperty(cert,
|
||||
CERT_KEY_IDENTIFIER_PROP_ID, buf, &size);
|
||||
ret = !memcmp(buf, info->KeyId.pbData, size);
|
||||
if (!memcmp(buf, info->KeyId.pbData, size))
|
||||
status = CERT_TRUST_HAS_KEY_MATCH_ISSUER;
|
||||
CryptMemFree(buf);
|
||||
if (type) *type = CERT_TRUST_HAS_KEY_MATCH_ISSUER;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
LocalFree(info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = CertCompareCertificateName(cert->dwCertEncodingType,
|
||||
&cert->pCertInfo->Subject, &cert->pCertInfo->Issuer);
|
||||
if (type) *type = CERT_TRUST_HAS_NAME_MATCH_ISSUER;
|
||||
}
|
||||
return ret;
|
||||
if (CertCompareCertificateName(cert->dwCertEncodingType, &cert->pCertInfo->Subject, &cert->pCertInfo->Issuer))
|
||||
status = CERT_TRUST_HAS_NAME_MATCH_ISSUER;
|
||||
|
||||
if (status)
|
||||
status |= CERT_TRUST_IS_SELF_SIGNED;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static void CRYPT_FreeChainElement(PCERT_CHAIN_ELEMENT element)
|
||||
|
@ -745,8 +731,7 @@ static BOOL url_matches(LPCWSTR constraint, LPCWSTR name,
|
|||
/* Ignore any path or query portion of the URL. */
|
||||
if (*authority_end)
|
||||
{
|
||||
if (authority_end - name < sizeof(hostname_buf) /
|
||||
sizeof(hostname_buf[0]))
|
||||
if (authority_end - name < ARRAY_SIZE(hostname_buf))
|
||||
{
|
||||
memcpy(hostname_buf, name,
|
||||
(authority_end - name) * sizeof(WCHAR));
|
||||
|
@ -1327,7 +1312,7 @@ static void CRYPT_CheckChainNameConstraints(PCERT_SIMPLE_CHAIN chain)
|
|||
* constraints checked unless they're the end cert.
|
||||
*/
|
||||
if (j == 0 || !CRYPT_IsCertificateSelfSigned(
|
||||
chain->rgpElement[j]->pCertContext, NULL))
|
||||
chain->rgpElement[j]->pCertContext))
|
||||
{
|
||||
CRYPT_CheckNameConstraints(nameConstraints,
|
||||
chain->rgpElement[j]->pCertContext->pCertInfo,
|
||||
|
@ -1695,11 +1680,9 @@ static LPCSTR filetime_to_str(const FILETIME *time)
|
|||
|
||||
if (!time) return "(null)";
|
||||
|
||||
GetLocaleInfoA(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE, dateFmt,
|
||||
sizeof(dateFmt) / sizeof(dateFmt[0]));
|
||||
GetLocaleInfoA(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE, dateFmt, ARRAY_SIZE(dateFmt));
|
||||
FileTimeToSystemTime(time, &sysTime);
|
||||
GetDateFormatA(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, dateFmt, date,
|
||||
sizeof(date) / sizeof(date[0]));
|
||||
GetDateFormatA(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, dateFmt, date, ARRAY_SIZE(date));
|
||||
return wine_dbg_sprintf("%s", date);
|
||||
}
|
||||
|
||||
|
@ -1900,7 +1883,7 @@ static void CRYPT_CheckSimpleChain(CertificateChainEngine *engine,
|
|||
int i;
|
||||
BOOL pathLengthConstraintViolated = FALSE;
|
||||
CERT_BASIC_CONSTRAINTS2_INFO constraints = { FALSE, FALSE, 0 };
|
||||
DWORD type;
|
||||
DWORD status;
|
||||
|
||||
TRACE_(chain)("checking chain with %d elements for time %s\n",
|
||||
chain->cElement, filetime_to_str(time));
|
||||
|
@ -1912,7 +1895,7 @@ static void CRYPT_CheckSimpleChain(CertificateChainEngine *engine,
|
|||
dump_element(chain->rgpElement[i]->pCertContext);
|
||||
if (i == chain->cElement - 1)
|
||||
isRoot = CRYPT_IsCertificateSelfSigned(
|
||||
chain->rgpElement[i]->pCertContext, NULL);
|
||||
chain->rgpElement[i]->pCertContext);
|
||||
else
|
||||
isRoot = FALSE;
|
||||
if (!CRYPT_IsCertVersionValid(chain->rgpElement[i]->pCertContext))
|
||||
|
@ -1988,10 +1971,9 @@ static void CRYPT_CheckSimpleChain(CertificateChainEngine *engine,
|
|||
}
|
||||
CRYPT_CheckChainNameConstraints(chain);
|
||||
CRYPT_CheckChainPolicies(chain);
|
||||
if (CRYPT_IsCertificateSelfSigned(rootElement->pCertContext, &type))
|
||||
if ((status = CRYPT_IsCertificateSelfSigned(rootElement->pCertContext)))
|
||||
{
|
||||
rootElement->TrustStatus.dwInfoStatus |=
|
||||
CERT_TRUST_IS_SELF_SIGNED | type;
|
||||
rootElement->TrustStatus.dwInfoStatus |= status;
|
||||
CRYPT_CheckRootCert(engine->hRoot, rootElement);
|
||||
}
|
||||
CRYPT_CombineTrustStatus(&chain->TrustStatus, &rootElement->TrustStatus);
|
||||
|
@ -2203,7 +2185,7 @@ static BOOL CRYPT_BuildSimpleChain(const CertificateChainEngine *engine,
|
|||
PCCERT_CONTEXT cert = chain->rgpElement[chain->cElement - 1]->pCertContext;
|
||||
|
||||
while (ret && !CRYPT_IsSimpleChainCyclic(chain) &&
|
||||
!CRYPT_IsCertificateSelfSigned(cert, NULL))
|
||||
!CRYPT_IsCertificateSelfSigned(cert))
|
||||
{
|
||||
PCCERT_CONTEXT issuer = CRYPT_GetIssuer(engine, world, cert, NULL, flags,
|
||||
&chain->rgpElement[chain->cElement - 1]->TrustStatus.dwInfoStatus);
|
||||
|
@ -2712,19 +2694,14 @@ static void CRYPT_VerifyChainRevocation(PCERT_CHAIN_CONTEXT chain,
|
|||
revocationPara.pIssuerCert =
|
||||
chain->rgpChain[i]->rgpElement[j + 1]->pCertContext;
|
||||
else
|
||||
revocationPara.pIssuerCert = certToCheck;
|
||||
|
||||
revocationPara.pIssuerCert = NULL;
|
||||
ret = CertVerifyRevocation(X509_ASN_ENCODING,
|
||||
CERT_CONTEXT_REVOCATION_TYPE, 1, (void **)&certToCheck,
|
||||
revocationFlags, &revocationPara, &revocationStatus);
|
||||
|
||||
if (!ret && revocationStatus.dwError == CRYPT_E_NO_REVOCATION_CHECK &&
|
||||
revocationPara.pIssuerCert == certToCheck)
|
||||
{
|
||||
FIXME("Unable to find CRL for CA certificate\n");
|
||||
if (!ret && chainFlags & CERT_CHAIN_REVOCATION_CHECK_CHAIN
|
||||
&& revocationStatus.dwError == CRYPT_E_NO_REVOCATION_CHECK && revocationPara.pIssuerCert == NULL)
|
||||
ret = TRUE;
|
||||
revocationStatus.dwError = 0;
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
|
@ -3135,8 +3112,7 @@ static BOOL WINAPI verify_authenticode_policy(LPCSTR szPolicyOID,
|
|||
};
|
||||
|
||||
/* Check whether the root is an MS test root */
|
||||
for (i = 0; !isMSTestRoot && i < sizeof(keyBlobs) / sizeof(keyBlobs[0]);
|
||||
i++)
|
||||
for (i = 0; !isMSTestRoot && i < ARRAY_SIZE(keyBlobs); i++)
|
||||
{
|
||||
msPubKey.PublicKey.cbData = keyBlobs[i].cbData;
|
||||
msPubKey.PublicKey.pbData = keyBlobs[i].pbData;
|
||||
|
@ -3426,7 +3402,7 @@ static BOOL match_dns_to_subject_dn(PCCERT_CONTEXT cert, LPCWSTR server_name)
|
|||
|
||||
end = dot ? dot : ptr + strlenW(ptr);
|
||||
len = end - ptr;
|
||||
if (len >= sizeof(component) / sizeof(component[0]))
|
||||
if (len >= ARRAY_SIZE(component))
|
||||
{
|
||||
WARN_(chain)("domain component %s too long\n",
|
||||
debugstr_wn(ptr, len));
|
||||
|
@ -3708,8 +3684,7 @@ static BOOL WINAPI verify_ms_root_policy(LPCSTR szPolicyOID,
|
|||
PCCERT_CONTEXT root =
|
||||
rootChain->rgpElement[rootChain->cElement - 1]->pCertContext;
|
||||
|
||||
for (i = 0; !isMSRoot && i < sizeof(keyBlobs) / sizeof(keyBlobs[0]);
|
||||
i++)
|
||||
for (i = 0; !isMSRoot && i < ARRAY_SIZE(keyBlobs); i++)
|
||||
{
|
||||
msPubKey.PublicKey.cbData = keyBlobs[i].cbData;
|
||||
msPubKey.PublicKey.pbData = keyBlobs[i].pbData;
|
||||
|
|
|
@ -341,7 +341,7 @@ void CRYPT_ImportSystemRootCertsToReg(void) DECLSPEC_HIDDEN;
|
|||
BOOL CRYPT_SerializeContextsToReg(HKEY key, DWORD flags, const WINE_CONTEXT_INTERFACE *contextInterface,
|
||||
HCERTSTORE memStore) DECLSPEC_HIDDEN;
|
||||
|
||||
BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert, DWORD *type) DECLSPEC_HIDDEN;
|
||||
DWORD CRYPT_IsCertificateSelfSigned(const CERT_CONTEXT *cert) DECLSPEC_HIDDEN;
|
||||
|
||||
/* Allocates and initializes a certificate chain engine, but without creating
|
||||
* the root store. Instead, it uses root, and assumes the caller has done any
|
||||
|
|
|
@ -890,7 +890,7 @@ static BOOL WINAPI CRYPT_AsnDecodeCertSignedContent(DWORD dwCertEncodingType,
|
|||
|
||||
if (dwFlags & CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG)
|
||||
items[2].decodeFunc = CRYPT_AsnDecodeBitsInternal;
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
|
||||
pcbStructInfo, NULL, NULL);
|
||||
}
|
||||
|
@ -935,7 +935,7 @@ static BOOL CRYPT_AsnDecodeValidity(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
CRYPT_AsnDecodeChoiceOfTimeInternal, sizeof(FILETIME), FALSE, FALSE, 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, NULL);
|
||||
return ret;
|
||||
|
@ -1020,7 +1020,7 @@ static BOOL CRYPT_AsnDecodeCertInfo(DWORD dwCertEncodingType,
|
|||
TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pDecodePara, pvStructInfo, *pcbStructInfo);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, pcbStructInfo,
|
||||
NULL, NULL);
|
||||
if (ret && pvStructInfo)
|
||||
|
@ -1135,7 +1135,7 @@ static BOOL CRYPT_AsnDecodeCRLEntry(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags, entry,
|
||||
*pcbStructInfo);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, entry, pcbStructInfo, pcbDecoded,
|
||||
entry ? entry->SerialNumber.pbData : NULL);
|
||||
if (ret && entry && !entry->SerialNumber.cbData)
|
||||
|
@ -1236,9 +1236,8 @@ static BOOL CRYPT_AsnDecodeCRLInfo(DWORD dwCertEncodingType,
|
|||
TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pDecodePara, pvStructInfo, *pcbStructInfo);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, pcbStructInfo,
|
||||
NULL, NULL);
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items), pbEncoded, cbEncoded, dwFlags,
|
||||
pDecodePara, pvStructInfo, pcbStructInfo, NULL, NULL);
|
||||
|
||||
TRACE("Returning %d (%08x)\n", ret, GetLastError());
|
||||
return ret;
|
||||
|
@ -1433,7 +1432,7 @@ static BOOL CRYPT_AsnDecodeExtension(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
|
||||
if (ext)
|
||||
TRACE("ext->pszObjId is %p\n", ext->pszObjId);
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, ext, pcbStructInfo,
|
||||
pcbDecoded, ext ? ext->pszObjId : NULL);
|
||||
if (ext)
|
||||
|
@ -1871,7 +1870,7 @@ static BOOL CRYPT_AsnDecodeRdnAttr(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
|
||||
if (attr)
|
||||
TRACE("attr->pszObjId is %p\n", attr->pszObjId);
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, attr, pcbStructInfo, pcbDecoded,
|
||||
attr ? attr->pszObjId : NULL);
|
||||
if (attr)
|
||||
|
@ -1968,7 +1967,7 @@ static BOOL CRYPT_AsnDecodeUnicodeRdnAttr(const BYTE *pbEncoded,
|
|||
|
||||
if (attr)
|
||||
TRACE("attr->pszObjId is %p\n", attr->pszObjId);
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, attr, pcbStructInfo, pcbDecoded,
|
||||
attr ? attr->pszObjId : NULL);
|
||||
if (attr)
|
||||
|
@ -2197,7 +2196,7 @@ static BOOL CRYPT_AsnDecodeCTLEntry(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags, entry,
|
||||
*pcbStructInfo);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, entry, pcbStructInfo,
|
||||
pcbDecoded, entry ? entry->SubjectIdentifier.pbData : NULL);
|
||||
return ret;
|
||||
|
@ -2300,7 +2299,7 @@ static BOOL WINAPI CRYPT_AsnDecodeCTL(DWORD dwCertEncodingType,
|
|||
TRUE, TRUE, offsetof(CTL_INFO, rgExtension), 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
|
||||
pcbStructInfo, NULL, NULL);
|
||||
}
|
||||
|
@ -2330,7 +2329,7 @@ static BOOL CRYPT_AsnDecodeSMIMECapability(const BYTE *pbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, capability ? capability->pszObjId : NULL);
|
||||
TRACE("returning %d\n", ret);
|
||||
|
@ -2460,7 +2459,7 @@ static BOOL CRYPT_AsnDecodeNoticeReference(const BYTE *pbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, NULL, &bytesNeeded, pcbDecoded,
|
||||
NULL);
|
||||
if (ret)
|
||||
|
@ -2496,10 +2495,8 @@ static BOOL CRYPT_AsnDecodeNoticeReference(const BYTE *pbEncoded,
|
|||
*(PCERT_POLICY_QUALIFIER_NOTICE_REFERENCE *)pvStructInfo;
|
||||
noticeRef->pszOrganization = (LPSTR)((LPBYTE)noticeRef +
|
||||
sizeof(CERT_POLICY_QUALIFIER_NOTICE_REFERENCE));
|
||||
ret = CRYPT_AsnDecodeSequence(items,
|
||||
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
|
||||
NULL, noticeRef, &bytesNeeded, pcbDecoded,
|
||||
noticeRef->pszOrganization);
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items), pbEncoded, cbEncoded, dwFlags,
|
||||
NULL, noticeRef, &bytesNeeded, pcbDecoded, noticeRef->pszOrganization);
|
||||
}
|
||||
}
|
||||
TRACE("returning %d\n", ret);
|
||||
|
@ -2653,7 +2650,7 @@ static BOOL CRYPT_AsnDecodePolicyQualifierUserNoticeInternal(
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, notice ? notice->pNoticeReference : NULL);
|
||||
TRACE("returning %d\n", ret);
|
||||
|
@ -2748,7 +2745,7 @@ static BOOL CRYPT_AsnDecodePKCSAttributeInternal(const BYTE *pbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, attr ? attr->pszObjId : NULL);
|
||||
TRACE("returning %d\n", ret);
|
||||
|
@ -2866,7 +2863,7 @@ static BOOL CRYPT_AsnDecodeAlgorithmId(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo, pcbDecoded);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, algo ? algo->pszObjId : NULL);
|
||||
if (ret && pvStructInfo)
|
||||
|
@ -2893,7 +2890,7 @@ static BOOL CRYPT_AsnDecodePubKeyInfoInternal(const BYTE *pbEncoded,
|
|||
};
|
||||
PCERT_PUBLIC_KEY_INFO info = pvStructInfo;
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, info ? info->Algorithm.Parameters.pbData : NULL);
|
||||
return ret;
|
||||
|
@ -3150,7 +3147,7 @@ static BOOL WINAPI CRYPT_AsnDecodeAuthorityKeyId(DWORD dwCertEncodingType,
|
|||
offsetof(CERT_AUTHORITY_KEY_ID_INFO, CertSerialNumber.pbData), 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
|
||||
pcbStructInfo, NULL, NULL);
|
||||
}
|
||||
|
@ -3187,7 +3184,7 @@ static BOOL WINAPI CRYPT_AsnDecodeAuthorityKeyId2(DWORD dwCertEncodingType,
|
|||
AuthorityCertSerialNumber.pbData), 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
|
||||
pcbStructInfo, NULL, NULL);
|
||||
}
|
||||
|
@ -3214,7 +3211,7 @@ static BOOL CRYPT_AsnDecodeAccessDescription(const BYTE *pbEncoded,
|
|||
};
|
||||
CERT_ACCESS_DESCRIPTION *descr = pvStructInfo;
|
||||
|
||||
return CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
return CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, descr ? descr->pszAccessMethod : NULL);
|
||||
}
|
||||
|
@ -3323,7 +3320,7 @@ static BOOL CRYPT_AsnDecodePKCSContentInfoInternal(const BYTE *pbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo, pcbDecoded);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, info ? info->pszObjId : NULL);
|
||||
return ret;
|
||||
|
@ -3392,7 +3389,7 @@ BOOL CRYPT_AsnDecodePKCSDigestedData(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
offsetof(CRYPT_DIGESTED_DATA, hash.pbData), 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, digestedData, pcbDigestedData,
|
||||
NULL, NULL);
|
||||
return ret;
|
||||
|
@ -3531,7 +3528,7 @@ static BOOL WINAPI CRYPT_AsnDecodeBasicConstraints(DWORD dwCertEncodingType,
|
|||
offsetof(CERT_BASIC_CONSTRAINTS_INFO, rgSubtreesConstraint), 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
|
||||
pcbStructInfo, NULL, NULL);
|
||||
}
|
||||
|
@ -3560,7 +3557,7 @@ static BOOL WINAPI CRYPT_AsnDecodeBasicConstraints2(DWORD dwCertEncodingType,
|
|||
sizeof(struct PATH_LEN_CONSTRAINT), TRUE, FALSE, 0, 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
|
||||
pcbStructInfo, NULL, NULL);
|
||||
}
|
||||
|
@ -3592,7 +3589,7 @@ static BOOL CRYPT_AsnDecodePolicyQualifier(const BYTE *pbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, qualifier ? qualifier->pszPolicyQualifierId : NULL);
|
||||
return ret;
|
||||
|
@ -3637,7 +3634,7 @@ static BOOL CRYPT_AsnDecodeCertPolicy(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, info ? info->pszPolicyIdentifier : NULL);
|
||||
return ret;
|
||||
|
@ -3694,7 +3691,7 @@ static BOOL CRYPT_AsnDecodeCertPolicyMapping(const BYTE *pbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, mapping ? mapping->pszIssuerDomainPolicy : NULL);
|
||||
return ret;
|
||||
|
@ -3851,7 +3848,7 @@ static BOOL WINAPI CRYPT_AsnDecodeCertPolicyConstraints(
|
|||
TRUE, FALSE, 0, 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
|
||||
pcbStructInfo, NULL, NULL);
|
||||
}
|
||||
|
@ -3890,7 +3887,7 @@ static BOOL WINAPI CRYPT_AsnDecodeRsaPubKey(DWORD dwCertEncodingType,
|
|||
struct DECODED_RSA_PUB_KEY *decodedKey = NULL;
|
||||
DWORD size = 0;
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL, &decodedKey,
|
||||
&size, NULL, NULL);
|
||||
if (ret)
|
||||
|
@ -3998,7 +3995,7 @@ static BOOL WINAPI CRYPT_AsnDecodeRsaPrivKey(DWORD dwCertEncodingType,
|
|||
struct DECODED_RSA_PRIV_KEY *decodedKey = NULL;
|
||||
DWORD size = 0;
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL, &decodedKey,
|
||||
&size, NULL, NULL);
|
||||
if (ret)
|
||||
|
@ -5242,7 +5239,7 @@ static BOOL CRYPT_AsnDecodeDistPoint(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
CRL_DIST_POINT *point = pvStructInfo;
|
||||
BOOL ret;
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, point ? point->DistPointName.u.FullName.rgAltEntry : NULL);
|
||||
return ret;
|
||||
|
@ -5344,7 +5341,7 @@ static BOOL WINAPI CRYPT_AsnDecodeIssuingDistPoint(DWORD dwCertEncodingType,
|
|||
fIndirectCRL), CRYPT_AsnDecodeBool, sizeof(BOOL), TRUE, FALSE, 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
|
||||
pcbStructInfo, NULL, NULL);
|
||||
}
|
||||
|
@ -5427,7 +5424,7 @@ static BOOL CRYPT_AsnDecodeSubtree(const BYTE *pbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo, pcbDecoded);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, subtree ? subtree->Base.u.pwszURL : NULL);
|
||||
if (pcbDecoded)
|
||||
|
@ -5508,7 +5505,7 @@ static BOOL WINAPI CRYPT_AsnDecodeNameConstraints(DWORD dwCertEncodingType,
|
|||
offsetof(CERT_NAME_CONSTRAINTS_INFO, rgExcludedSubtree), 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
|
||||
pcbStructInfo, NULL, NULL);
|
||||
}
|
||||
|
@ -5538,7 +5535,7 @@ static BOOL CRYPT_AsnDecodeIssuerSerialNumber(const BYTE *pbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo, pcbDecoded);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, issuerSerial ? issuerSerial->Issuer.pbData : NULL);
|
||||
if (ret && issuerSerial && !issuerSerial->SerialNumber.cbData)
|
||||
|
@ -5585,7 +5582,7 @@ static BOOL CRYPT_AsnDecodePKCSSignerInfoInternal(const BYTE *pbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, info ? info->Issuer.pbData : NULL);
|
||||
return ret;
|
||||
|
@ -5754,7 +5751,7 @@ static BOOL CRYPT_AsnDecodeCMSSignerInfoInternal(const BYTE *pbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, info ? info->SignerId.u.KeyId.pbData : NULL);
|
||||
return ret;
|
||||
|
@ -5854,7 +5851,7 @@ BOOL CRYPT_AsnDecodeCMSSignedInfo(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %p, %p\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pDecodePara, signedInfo, pcbSignedInfo);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, signedInfo, pcbSignedInfo,
|
||||
NULL, NULL);
|
||||
TRACE("returning %d\n", ret);
|
||||
|
@ -5887,7 +5884,7 @@ static BOOL CRYPT_AsnDecodeRecipientInfo(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo, pcbDecoded);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, info ? info->RecipientId.u.IssuerSerialNumber.Issuer.pbData :
|
||||
NULL);
|
||||
|
@ -5944,7 +5941,7 @@ static BOOL CRYPT_AsnDecodeEncryptedContentInfo(const BYTE *pbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo, pcbDecoded);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
|
||||
pcbDecoded, info ? info->contentType : NULL);
|
||||
TRACE("returning %d\n", ret);
|
||||
|
@ -5972,7 +5969,7 @@ BOOL CRYPT_AsnDecodePKCSEnvelopedData(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
TRACE("%p, %d, %08x, %p, %p, %p\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pDecodePara, envelopedData, pcbEnvelopedData);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, envelopedData,
|
||||
pcbEnvelopedData, NULL, NULL);
|
||||
TRACE("returning %d\n", ret);
|
||||
|
@ -5981,7 +5978,7 @@ BOOL CRYPT_AsnDecodePKCSEnvelopedData(const BYTE *pbEncoded, DWORD cbEncoded,
|
|||
|
||||
static BOOL WINAPI CRYPT_AsnDecodeObjectIdentifier(DWORD dwCertEncodingType,
|
||||
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
|
||||
PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
|
||||
CRYPT_DECODE_PARA *pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
|
||||
{
|
||||
DWORD bytesNeeded = 0;
|
||||
BOOL ret;
|
||||
|
@ -6021,7 +6018,7 @@ static BOOL WINAPI CRYPT_AsnDecodeObjectIdentifier(DWORD dwCertEncodingType,
|
|||
|
||||
static BOOL WINAPI CRYPT_AsnDecodeEccSignature(DWORD dwCertEncodingType,
|
||||
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
|
||||
PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
|
||||
CRYPT_DECODE_PARA *pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
|
||||
{
|
||||
BOOL ret;
|
||||
struct AsnDecodeSequenceItem items[] = {
|
||||
|
@ -6035,7 +6032,7 @@ static BOOL WINAPI CRYPT_AsnDecodeEccSignature(DWORD dwCertEncodingType,
|
|||
|
||||
__TRY
|
||||
{
|
||||
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnDecodeSequence(items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
|
||||
pcbStructInfo, NULL, NULL);
|
||||
}
|
||||
|
|
|
@ -372,7 +372,7 @@ static BOOL WINAPI CRYPT_AsnEncodeValidity(DWORD dwCertEncodingType,
|
|||
};
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
return ret;
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams(
|
|||
else
|
||||
items[1].pvStructInfo = &nullBlob;
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
return ret;
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ static BOOL WINAPI CRYPT_AsnEncodeAlgorithmId(DWORD dwCertEncodingType,
|
|||
};
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
return ret;
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ static BOOL WINAPI CRYPT_AsnEncodePubKeyInfo(DWORD dwCertEncodingType,
|
|||
TRACE("Encoding public key with OID %s\n",
|
||||
debugstr_a(info->Algorithm.pszObjId));
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
|
@ -469,7 +469,7 @@ static BOOL WINAPI CRYPT_AsnEncodeCert(DWORD dwCertEncodingType,
|
|||
if (dwFlags & CRYPT_ENCODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG)
|
||||
items[2].encodeFunc = CRYPT_AsnEncodeBits;
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
|
@ -495,7 +495,7 @@ BOOL WINAPI CRYPT_AsnEncodePubKeyInfoNoNull(DWORD dwCertEncodingType,
|
|||
TRACE("Encoding public key with OID %s\n",
|
||||
debugstr_a(info->Algorithm.pszObjId));
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1530,7 +1530,7 @@ static BOOL CRYPT_AsnEncodeCTLEntry(const CTL_ENTRY *entry,
|
|||
BOOL ret;
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items,
|
||||
sizeof(items) / sizeof(items[0]), 0, NULL, pbEncoded, pcbEncoded);
|
||||
ARRAY_SIZE(items), 0, NULL, pbEncoded, pcbEncoded);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1679,7 +1679,7 @@ static BOOL CRYPT_AsnEncodeSMIMECapability(DWORD dwCertEncodingType,
|
|||
};
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
}
|
||||
}
|
||||
|
@ -1822,7 +1822,7 @@ static BOOL WINAPI CRYPT_AsnEncodeNoticeReference(DWORD dwCertEncodingType,
|
|||
};
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1887,7 +1887,7 @@ static BOOL WINAPI CRYPT_AsnEncodePKCSAttribute(DWORD dwCertEncodingType,
|
|||
};
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
}
|
||||
}
|
||||
|
@ -1960,8 +1960,7 @@ BOOL CRYPT_AsnEncodePKCSDigestedData(const CRYPT_DIGESTED_DATA *digestedData,
|
|||
{ &digestedData->hash, CRYPT_AsnEncodeOctets, 0 },
|
||||
};
|
||||
|
||||
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items,
|
||||
sizeof(items) / sizeof(items[0]), 0, NULL, pvData, pcbData);
|
||||
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items), 0, NULL, pvData, pcbData);
|
||||
}
|
||||
|
||||
static BOOL WINAPI CRYPT_AsnEncodePKCSContentInfo(DWORD dwCertEncodingType,
|
||||
|
@ -2708,8 +2707,7 @@ static BOOL CRYPT_AsnEncodeAccessDescription(
|
|||
SetLastError(E_INVALIDARG);
|
||||
return FALSE;
|
||||
}
|
||||
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items,
|
||||
sizeof(items) / sizeof(items[0]), 0, NULL, pbEncoded, pcbEncoded);
|
||||
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items), 0, NULL, pbEncoded, pcbEncoded);
|
||||
}
|
||||
|
||||
static BOOL WINAPI CRYPT_AsnEncodeAuthorityInfoAccess(DWORD dwCertEncodingType,
|
||||
|
@ -2877,8 +2875,7 @@ static BOOL WINAPI CRYPT_AsnEncodeCertPolicyQualifiers(DWORD dwCertEncodingType,
|
|||
items[0].pvStructInfo =
|
||||
info->rgPolicyQualifier[i].pszPolicyQualifierId;
|
||||
items[1].pvStructInfo = &info->rgPolicyQualifier[i].Qualifier;
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL, NULL, &size);
|
||||
if (ret)
|
||||
bytesNeeded += size;
|
||||
|
@ -2909,8 +2906,7 @@ static BOOL WINAPI CRYPT_AsnEncodeCertPolicyQualifiers(DWORD dwCertEncodingType,
|
|||
items[1].pvStructInfo =
|
||||
&info->rgPolicyQualifier[i].Qualifier;
|
||||
size = bytesNeeded;
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]),
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL, out, &size);
|
||||
if (ret)
|
||||
{
|
||||
|
@ -2942,8 +2938,7 @@ static BOOL CRYPT_AsnEncodeCertPolicy(DWORD dwCertEncodingType,
|
|||
SetLastError(E_INVALIDARG);
|
||||
return FALSE;
|
||||
}
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, NULL, pbEncoded, pcbEncoded);
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items), dwFlags, NULL, pbEncoded, pcbEncoded);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -3026,8 +3021,7 @@ static BOOL CRYPT_AsnEncodeCertPolicyMapping(DWORD dwCertEncodingType,
|
|||
SetLastError(E_INVALIDARG);
|
||||
return FALSE;
|
||||
}
|
||||
return CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, NULL, pbEncoded, pcbEncoded);
|
||||
return CRYPT_AsnEncodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items), dwFlags, NULL, pbEncoded, pcbEncoded);
|
||||
}
|
||||
|
||||
static BOOL WINAPI CRYPT_AsnEncodeCertPolicyMappings(DWORD dwCertEncodingType,
|
||||
|
@ -3169,8 +3163,7 @@ static BOOL WINAPI CRYPT_AsnEncodeRsaPubKey(DWORD dwCertEncodingType,
|
|||
};
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded, pcbEncoded);
|
||||
}
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
|
@ -4151,8 +4144,7 @@ static BOOL WINAPI CRYPT_AsnEncodeIssuerSerialNumber(
|
|||
};
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded, pcbEncoded);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -4402,8 +4394,7 @@ static BOOL WINAPI CRYPT_AsnEncodeRecipientInfo(DWORD dwCertEncodingType,
|
|||
};
|
||||
|
||||
return CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded, pcbEncoded);
|
||||
}
|
||||
|
||||
static BOOL WINAPI CRYPT_AsnEncodeEncryptedContentInfo(DWORD dwCertEncodingType,
|
||||
|
@ -4421,8 +4412,7 @@ static BOOL WINAPI CRYPT_AsnEncodeEncryptedContentInfo(DWORD dwCertEncodingType,
|
|||
};
|
||||
|
||||
return CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
|
||||
pcbEncoded);
|
||||
ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded, pcbEncoded);
|
||||
}
|
||||
|
||||
BOOL CRYPT_AsnEncodePKCSEnvelopedData(const CRYPT_ENVELOPED_DATA *envelopedData,
|
||||
|
@ -4439,7 +4429,7 @@ BOOL CRYPT_AsnEncodePKCSEnvelopedData(const CRYPT_ENVELOPED_DATA *envelopedData,
|
|||
};
|
||||
|
||||
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items,
|
||||
sizeof(items) / sizeof(items[0]), 0, NULL, pvData, pcbData);
|
||||
ARRAY_SIZE(items), 0, NULL, pvData, pcbData);
|
||||
}
|
||||
|
||||
static CryptEncodeObjectExFunc CRYPT_GetBuiltinEncoder(DWORD dwCertEncodingType,
|
||||
|
|
|
@ -231,8 +231,7 @@ static WINECRYPT_CERTSTORE *CRYPT_CreateFileStore(DWORD dwFlags,
|
|||
info->type = type;
|
||||
info->dirty = FALSE;
|
||||
provInfo.cbSize = sizeof(provInfo);
|
||||
provInfo.cStoreProvFunc = sizeof(fileProvFuncs) /
|
||||
sizeof(fileProvFuncs[0]);
|
||||
provInfo.cStoreProvFunc = ARRAY_SIZE(fileProvFuncs);
|
||||
provInfo.rgpvStoreProvFunc = fileProvFuncs;
|
||||
provInfo.hStoreProv = info;
|
||||
store = CRYPT_ProvCreateStore(dwFlags, memStore, &provInfo);
|
||||
|
|
|
@ -252,7 +252,8 @@ ASN1encoding_t WINAPI I_CryptGetAsn1Encoder(HCRYPTASN1MODULE x)
|
|||
|
||||
BOOL WINAPI CryptProtectMemory(void *data, DWORD len, DWORD flags)
|
||||
{
|
||||
FIXME("(%p %u %08x): stub\n", data, len, flags);
|
||||
static int fixme_once;
|
||||
if (!fixme_once++) FIXME("(%p %u %08x): stub\n", data, len, flags);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ static BOOL CRYPT_EncodeDataContentInfoHeader(const CDataEncodeMsg *msg,
|
|||
};
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items,
|
||||
sizeof(items) / sizeof(items[0]), CRYPT_ENCODE_ALLOC_FLAG, NULL,
|
||||
ARRAY_SIZE(items), CRYPT_ENCODE_ALLOC_FLAG, NULL,
|
||||
(LPBYTE)&header->pbData, &header->cbData);
|
||||
if (ret)
|
||||
{
|
||||
|
|
|
@ -929,8 +929,7 @@ static BOOL WINAPI CRYPT_FormatKeyUsage(DWORD dwCertEncodingType,
|
|||
WCHAR infoNotAvailable[MAX_STRING_RESOURCE_LEN];
|
||||
DWORD bytesNeeded = sizeof(WCHAR);
|
||||
|
||||
LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable,
|
||||
sizeof(infoNotAvailable) / sizeof(infoNotAvailable[0]));
|
||||
LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable, ARRAY_SIZE(infoNotAvailable));
|
||||
if (!bits->cbData || bits->cbData > 2)
|
||||
{
|
||||
bytesNeeded += strlenW(infoNotAvailable) * sizeof(WCHAR);
|
||||
|
@ -959,26 +958,18 @@ static BOOL WINAPI CRYPT_FormatKeyUsage(DWORD dwCertEncodingType,
|
|||
|
||||
if (!stringsLoaded)
|
||||
{
|
||||
for (i = 0;
|
||||
i < sizeof(keyUsageByte0Map) / sizeof(keyUsageByte0Map[0]);
|
||||
i++)
|
||||
LoadStringW(hInstance, keyUsageByte0Map[i].id,
|
||||
keyUsageByte0Map[i].str, MAX_STRING_RESOURCE_LEN);
|
||||
for (i = 0;
|
||||
i < sizeof(keyUsageByte1Map) / sizeof(keyUsageByte1Map[0]);
|
||||
i++)
|
||||
LoadStringW(hInstance, keyUsageByte1Map[i].id,
|
||||
keyUsageByte1Map[i].str, MAX_STRING_RESOURCE_LEN);
|
||||
for (i = 0; i < ARRAY_SIZE(keyUsageByte0Map); i++)
|
||||
LoadStringW(hInstance, keyUsageByte0Map[i].id, keyUsageByte0Map[i].str, MAX_STRING_RESOURCE_LEN);
|
||||
for (i = 0; i < ARRAY_SIZE(keyUsageByte1Map); i++)
|
||||
LoadStringW(hInstance, keyUsageByte1Map[i].id, keyUsageByte1Map[i].str, MAX_STRING_RESOURCE_LEN);
|
||||
stringsLoaded = TRUE;
|
||||
}
|
||||
CRYPT_FormatBits(bits->pbData[0], keyUsageByte0Map,
|
||||
sizeof(keyUsageByte0Map) / sizeof(keyUsageByte0Map[0]),
|
||||
NULL, &bitStringLen, &first);
|
||||
CRYPT_FormatBits(bits->pbData[0], keyUsageByte0Map, ARRAY_SIZE(keyUsageByte0Map),
|
||||
NULL, &bitStringLen, &first);
|
||||
bytesNeeded += bitStringLen;
|
||||
if (bits->cbData == 2)
|
||||
{
|
||||
CRYPT_FormatBits(bits->pbData[1], keyUsageByte1Map,
|
||||
sizeof(keyUsageByte1Map) / sizeof(keyUsageByte1Map[0]),
|
||||
CRYPT_FormatBits(bits->pbData[1], keyUsageByte1Map, ARRAY_SIZE(keyUsageByte1Map),
|
||||
NULL, &bitStringLen, &first);
|
||||
bytesNeeded += bitStringLen;
|
||||
}
|
||||
|
@ -1000,15 +991,13 @@ static BOOL WINAPI CRYPT_FormatKeyUsage(DWORD dwCertEncodingType,
|
|||
|
||||
bitStringLen = bytesNeeded;
|
||||
first = TRUE;
|
||||
CRYPT_FormatBits(bits->pbData[0], keyUsageByte0Map,
|
||||
sizeof(keyUsageByte0Map) / sizeof(keyUsageByte0Map[0]),
|
||||
CRYPT_FormatBits(bits->pbData[0], keyUsageByte0Map, ARRAY_SIZE(keyUsageByte0Map),
|
||||
str, &bitStringLen, &first);
|
||||
str += bitStringLen / sizeof(WCHAR) - 1;
|
||||
if (bits->cbData == 2)
|
||||
{
|
||||
bitStringLen = bytesNeeded;
|
||||
CRYPT_FormatBits(bits->pbData[1], keyUsageByte1Map,
|
||||
sizeof(keyUsageByte1Map) / sizeof(keyUsageByte1Map[0]),
|
||||
CRYPT_FormatBits(bits->pbData[1], keyUsageByte1Map, ARRAY_SIZE(keyUsageByte1Map),
|
||||
str, &bitStringLen, &first);
|
||||
str += bitStringLen / sizeof(WCHAR) - 1;
|
||||
}
|
||||
|
@ -1070,15 +1059,10 @@ static BOOL WINAPI CRYPT_FormatBasicConstraints2(DWORD dwCertEncodingType,
|
|||
|
||||
if (!stringsLoaded)
|
||||
{
|
||||
LoadStringW(hInstance, IDS_SUBJECT_TYPE, subjectTypeHeader,
|
||||
sizeof(subjectTypeHeader) / sizeof(subjectTypeHeader[0]));
|
||||
LoadStringW(hInstance, IDS_SUBJECT_TYPE_CA, subjectTypeCA,
|
||||
sizeof(subjectTypeCA) / sizeof(subjectTypeCA[0]));
|
||||
LoadStringW(hInstance, IDS_SUBJECT_TYPE_END_CERT,
|
||||
subjectTypeEndCert,
|
||||
sizeof(subjectTypeEndCert) / sizeof(subjectTypeEndCert[0]));
|
||||
LoadStringW(hInstance, IDS_PATH_LENGTH, pathLengthHeader,
|
||||
sizeof(pathLengthHeader) / sizeof(pathLengthHeader[0]));
|
||||
LoadStringW(hInstance, IDS_SUBJECT_TYPE, subjectTypeHeader, ARRAY_SIZE(subjectTypeHeader));
|
||||
LoadStringW(hInstance, IDS_SUBJECT_TYPE_CA, subjectTypeCA, ARRAY_SIZE(subjectTypeCA));
|
||||
LoadStringW(hInstance, IDS_SUBJECT_TYPE_END_CERT, subjectTypeEndCert, ARRAY_SIZE(subjectTypeEndCert));
|
||||
LoadStringW(hInstance, IDS_PATH_LENGTH, pathLengthHeader, ARRAY_SIZE(pathLengthHeader));
|
||||
stringsLoaded = TRUE;
|
||||
}
|
||||
bytesNeeded += strlenW(subjectTypeHeader) * sizeof(WCHAR);
|
||||
|
@ -1092,8 +1076,7 @@ static BOOL WINAPI CRYPT_FormatBasicConstraints2(DWORD dwCertEncodingType,
|
|||
if (info->fPathLenConstraint)
|
||||
sprintfW(pathLength, pathFmt, info->dwPathLenConstraint);
|
||||
else
|
||||
LoadStringW(hInstance, IDS_PATH_LENGTH_NONE, pathLength,
|
||||
sizeof(pathLength) / sizeof(pathLength[0]));
|
||||
LoadStringW(hInstance, IDS_PATH_LENGTH_NONE, pathLength, ARRAY_SIZE(pathLength));
|
||||
bytesNeeded += strlenW(pathLength) * sizeof(WCHAR);
|
||||
if (!pbFormat)
|
||||
*pcbFormat = bytesNeeded;
|
||||
|
@ -1130,7 +1113,7 @@ static BOOL CRYPT_FormatHexStringWithPrefix(const CRYPT_DATA_BLOB *blob, int id,
|
|||
DWORD bytesNeeded;
|
||||
BOOL ret;
|
||||
|
||||
LoadStringW(hInstance, id, buf, sizeof(buf) / sizeof(buf[0]));
|
||||
LoadStringW(hInstance, id, buf, ARRAY_SIZE(buf));
|
||||
CRYPT_FormatHexString(X509_ASN_ENCODING, 0, 0, NULL, NULL,
|
||||
blob->pbData, blob->cbData, NULL, &bytesNeeded);
|
||||
bytesNeeded += strlenW(buf) * sizeof(WCHAR);
|
||||
|
@ -1189,14 +1172,12 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
|
|||
switch (entry->dwAltNameChoice)
|
||||
{
|
||||
case CERT_ALT_NAME_RFC822_NAME:
|
||||
LoadStringW(hInstance, IDS_ALT_NAME_RFC822_NAME, buf,
|
||||
sizeof(buf) / sizeof(buf[0]));
|
||||
LoadStringW(hInstance, IDS_ALT_NAME_RFC822_NAME, buf, ARRAY_SIZE(buf));
|
||||
bytesNeeded += strlenW(entry->u.pwszRfc822Name) * sizeof(WCHAR);
|
||||
ret = TRUE;
|
||||
break;
|
||||
case CERT_ALT_NAME_DNS_NAME:
|
||||
LoadStringW(hInstance, IDS_ALT_NAME_DNS_NAME, buf,
|
||||
sizeof(buf) / sizeof(buf[0]));
|
||||
LoadStringW(hInstance, IDS_ALT_NAME_DNS_NAME, buf, ARRAY_SIZE(buf));
|
||||
bytesNeeded += strlenW(entry->u.pwszDNSName) * sizeof(WCHAR);
|
||||
ret = TRUE;
|
||||
break;
|
||||
|
@ -1208,8 +1189,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
|
|||
strType |= CERT_NAME_STR_CRLF_FLAG;
|
||||
directoryNameLen = cert_name_to_str_with_indent(X509_ASN_ENCODING,
|
||||
indentLevel + 1, &entry->u.DirectoryName, strType, NULL, 0);
|
||||
LoadStringW(hInstance, IDS_ALT_NAME_DIRECTORY_NAME, buf,
|
||||
sizeof(buf) / sizeof(buf[0]));
|
||||
LoadStringW(hInstance, IDS_ALT_NAME_DIRECTORY_NAME, buf, ARRAY_SIZE(buf));
|
||||
bytesNeeded += (directoryNameLen - 1) * sizeof(WCHAR);
|
||||
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
|
||||
bytesNeeded += strlenW(colonCrlf) * sizeof(WCHAR);
|
||||
|
@ -1219,8 +1199,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
|
|||
break;
|
||||
}
|
||||
case CERT_ALT_NAME_URL:
|
||||
LoadStringW(hInstance, IDS_ALT_NAME_URL, buf,
|
||||
sizeof(buf) / sizeof(buf[0]));
|
||||
LoadStringW(hInstance, IDS_ALT_NAME_URL, buf, ARRAY_SIZE(buf));
|
||||
bytesNeeded += strlenW(entry->u.pwszURL) * sizeof(WCHAR);
|
||||
ret = TRUE;
|
||||
break;
|
||||
|
@ -1232,14 +1211,12 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
|
|||
static const WCHAR ipAddrFmt[] = { '%','d','.','%','d','.','%','d',
|
||||
'.','%','d',0 };
|
||||
|
||||
LoadStringW(hInstance, IDS_ALT_NAME_IP_ADDRESS, buf,
|
||||
sizeof(buf) / sizeof(buf[0]));
|
||||
LoadStringW(hInstance, IDS_ALT_NAME_IP_ADDRESS, buf, ARRAY_SIZE(buf));
|
||||
if (entry->u.IPAddress.cbData == 8)
|
||||
{
|
||||
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
|
||||
{
|
||||
LoadStringW(hInstance, IDS_ALT_NAME_MASK, mask,
|
||||
sizeof(mask) / sizeof(mask[0]));
|
||||
LoadStringW(hInstance, IDS_ALT_NAME_MASK, mask, ARRAY_SIZE(mask));
|
||||
bytesNeeded += strlenW(mask) * sizeof(WCHAR);
|
||||
sprintfW(ipAddrBuf, ipAddrFmt,
|
||||
entry->u.IPAddress.pbData[0],
|
||||
|
@ -1448,7 +1425,7 @@ static BOOL CRYPT_FormatCertIssuer(DWORD dwFormatStrType,
|
|||
LPCWSTR sep;
|
||||
BOOL ret;
|
||||
|
||||
LoadStringW(hInstance, IDS_CERT_ISSUER, buf, sizeof(buf) / sizeof(buf[0]));
|
||||
LoadStringW(hInstance, IDS_CERT_ISSUER, buf, ARRAY_SIZE(buf));
|
||||
ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 1, issuer, NULL,
|
||||
&bytesNeeded);
|
||||
bytesNeeded += strlenW(buf) * sizeof(WCHAR);
|
||||
|
@ -1652,8 +1629,7 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType,
|
|||
{
|
||||
WCHAR infoNotAvailable[MAX_STRING_RESOURCE_LEN];
|
||||
|
||||
LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable,
|
||||
sizeof(infoNotAvailable) / sizeof(infoNotAvailable[0]));
|
||||
LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable, ARRAY_SIZE(infoNotAvailable));
|
||||
bytesNeeded += strlenW(infoNotAvailable) * sizeof(WCHAR);
|
||||
if (!pbFormat)
|
||||
*pcbFormat = bytesNeeded;
|
||||
|
@ -1680,18 +1656,12 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType,
|
|||
|
||||
if (!stringsLoaded)
|
||||
{
|
||||
LoadStringW(hInstance, IDS_AIA, aia,
|
||||
sizeof(aia) / sizeof(aia[0]));
|
||||
LoadStringW(hInstance, IDS_ACCESS_METHOD, accessMethod,
|
||||
sizeof(accessMethod) / sizeof(accessMethod[0]));
|
||||
LoadStringW(hInstance, IDS_ACCESS_METHOD_OCSP, ocsp,
|
||||
sizeof(ocsp) / sizeof(ocsp[0]));
|
||||
LoadStringW(hInstance, IDS_ACCESS_METHOD_CA_ISSUERS, caIssuers,
|
||||
sizeof(caIssuers) / sizeof(caIssuers[0]));
|
||||
LoadStringW(hInstance, IDS_ACCESS_METHOD_UNKNOWN, unknown,
|
||||
sizeof(unknown) / sizeof(unknown[0]));
|
||||
LoadStringW(hInstance, IDS_ACCESS_LOCATION, accessLocation,
|
||||
sizeof(accessLocation) / sizeof(accessLocation[0]));
|
||||
LoadStringW(hInstance, IDS_AIA, aia, ARRAY_SIZE(aia));
|
||||
LoadStringW(hInstance, IDS_ACCESS_METHOD, accessMethod, ARRAY_SIZE(accessMethod));
|
||||
LoadStringW(hInstance, IDS_ACCESS_METHOD_OCSP, ocsp, ARRAY_SIZE(ocsp));
|
||||
LoadStringW(hInstance, IDS_ACCESS_METHOD_CA_ISSUERS, caIssuers, ARRAY_SIZE(caIssuers));
|
||||
LoadStringW(hInstance, IDS_ACCESS_METHOD_UNKNOWN, unknown, ARRAY_SIZE(unknown));
|
||||
LoadStringW(hInstance, IDS_ACCESS_LOCATION, accessLocation, ARRAY_SIZE(accessLocation));
|
||||
stringsLoaded = TRUE;
|
||||
}
|
||||
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
|
||||
|
@ -1879,7 +1849,7 @@ static BOOL CRYPT_FormatReason(DWORD dwFormatStrType,
|
|||
|
||||
if (!stringsLoaded)
|
||||
{
|
||||
for (i = 0; i < sizeof(reason_map) / sizeof(reason_map[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(reason_map); i++)
|
||||
LoadStringW(hInstance, reason_map[i].id, reason_map[i].reason,
|
||||
MAX_STRING_RESOURCE_LEN);
|
||||
stringsLoaded = TRUE;
|
||||
|
@ -1887,7 +1857,7 @@ static BOOL CRYPT_FormatReason(DWORD dwFormatStrType,
|
|||
/* No need to check reasonFlags->cbData, we already know it's positive.
|
||||
* Ignore any other bytes, as they're for undefined bits.
|
||||
*/
|
||||
for (i = 0; i < sizeof(reason_map) / sizeof(reason_map[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(reason_map); i++)
|
||||
{
|
||||
if (reasonFlags->pbData[0] & reason_map[i].reasonBit)
|
||||
{
|
||||
|
@ -1909,14 +1879,13 @@ static BOOL CRYPT_FormatReason(DWORD dwFormatStrType,
|
|||
else
|
||||
{
|
||||
*pcbStr = bytesNeeded;
|
||||
for (i = 0; i < sizeof(reason_map) / sizeof(reason_map[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(reason_map); i++)
|
||||
{
|
||||
if (reasonFlags->pbData[0] & reason_map[i].reasonBit)
|
||||
{
|
||||
strcpyW(str, reason_map[i].reason);
|
||||
str += strlenW(reason_map[i].reason);
|
||||
if (i < sizeof(reason_map) / sizeof(reason_map[0]) - 1 &&
|
||||
numReasons)
|
||||
if (i < ARRAY_SIZE(reason_map) - 1 && numReasons)
|
||||
{
|
||||
strcpyW(str, sep);
|
||||
str += strlenW(sep);
|
||||
|
@ -1963,18 +1932,12 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
|
|||
|
||||
if (!stringsLoaded)
|
||||
{
|
||||
LoadStringW(hInstance, IDS_CRL_DIST_POINT, crlDistPoint,
|
||||
sizeof(crlDistPoint) / sizeof(crlDistPoint[0]));
|
||||
LoadStringW(hInstance, IDS_CRL_DIST_POINT_NAME, distPointName,
|
||||
sizeof(distPointName) / sizeof(distPointName[0]));
|
||||
LoadStringW(hInstance, IDS_CRL_DIST_POINT_FULL_NAME, fullName,
|
||||
sizeof(fullName) / sizeof(fullName[0]));
|
||||
LoadStringW(hInstance, IDS_CRL_DIST_POINT_RDN_NAME, rdnName,
|
||||
sizeof(rdnName) / sizeof(rdnName[0]));
|
||||
LoadStringW(hInstance, IDS_CRL_DIST_POINT_REASON, reason,
|
||||
sizeof(reason) / sizeof(reason[0]));
|
||||
LoadStringW(hInstance, IDS_CRL_DIST_POINT_ISSUER, issuer,
|
||||
sizeof(issuer) / sizeof(issuer[0]));
|
||||
LoadStringW(hInstance, IDS_CRL_DIST_POINT, crlDistPoint, ARRAY_SIZE(crlDistPoint));
|
||||
LoadStringW(hInstance, IDS_CRL_DIST_POINT_NAME, distPointName, ARRAY_SIZE(distPointName));
|
||||
LoadStringW(hInstance, IDS_CRL_DIST_POINT_FULL_NAME, fullName, ARRAY_SIZE(fullName));
|
||||
LoadStringW(hInstance, IDS_CRL_DIST_POINT_RDN_NAME, rdnName, ARRAY_SIZE(rdnName));
|
||||
LoadStringW(hInstance, IDS_CRL_DIST_POINT_REASON, reason, ARRAY_SIZE(reason));
|
||||
LoadStringW(hInstance, IDS_CRL_DIST_POINT_ISSUER, issuer, ARRAY_SIZE(issuer));
|
||||
stringsLoaded = TRUE;
|
||||
}
|
||||
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
|
||||
|
@ -2050,8 +2013,7 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
|
|||
{
|
||||
WCHAR infoNotAvailable[MAX_STRING_RESOURCE_LEN];
|
||||
|
||||
LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable,
|
||||
sizeof(infoNotAvailable) / sizeof(infoNotAvailable[0]));
|
||||
LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable, ARRAY_SIZE(infoNotAvailable));
|
||||
bytesNeeded += strlenW(infoNotAvailable) * sizeof(WCHAR);
|
||||
if (!pbFormat)
|
||||
*pcbFormat = bytesNeeded;
|
||||
|
@ -2202,8 +2164,7 @@ static BOOL WINAPI CRYPT_FormatEnhancedKeyUsage(DWORD dwCertEncodingType,
|
|||
sepLen = strlenW(commaSpace) * sizeof(WCHAR);
|
||||
}
|
||||
|
||||
LoadStringW(hInstance, IDS_USAGE_UNKNOWN, unknown,
|
||||
sizeof(unknown) / sizeof(unknown[0]));
|
||||
LoadStringW(hInstance, IDS_USAGE_UNKNOWN, unknown, ARRAY_SIZE(unknown));
|
||||
for (i = 0; i < usage->cUsageIdentifier; i++)
|
||||
{
|
||||
PCCRYPT_OID_INFO info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY,
|
||||
|
@ -2299,8 +2260,7 @@ static BOOL WINAPI CRYPT_FormatNetscapeCertType(DWORD dwCertEncodingType,
|
|||
WCHAR infoNotAvailable[MAX_STRING_RESOURCE_LEN];
|
||||
DWORD bytesNeeded = sizeof(WCHAR);
|
||||
|
||||
LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable,
|
||||
sizeof(infoNotAvailable) / sizeof(infoNotAvailable[0]));
|
||||
LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable, ARRAY_SIZE(infoNotAvailable));
|
||||
if (!bits->cbData || bits->cbData > 1)
|
||||
{
|
||||
bytesNeeded += strlenW(infoNotAvailable) * sizeof(WCHAR);
|
||||
|
@ -2329,15 +2289,13 @@ static BOOL WINAPI CRYPT_FormatNetscapeCertType(DWORD dwCertEncodingType,
|
|||
|
||||
if (!stringsLoaded)
|
||||
{
|
||||
for (i = 0; i < sizeof(netscapeCertTypeMap) /
|
||||
sizeof(netscapeCertTypeMap[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(netscapeCertTypeMap); i++)
|
||||
LoadStringW(hInstance, netscapeCertTypeMap[i].id,
|
||||
netscapeCertTypeMap[i].str, MAX_STRING_RESOURCE_LEN);
|
||||
stringsLoaded = TRUE;
|
||||
}
|
||||
CRYPT_FormatBits(bits->pbData[0], netscapeCertTypeMap,
|
||||
sizeof(netscapeCertTypeMap) / sizeof(netscapeCertTypeMap[0]),
|
||||
NULL, &bitStringLen, &first);
|
||||
CRYPT_FormatBits(bits->pbData[0], netscapeCertTypeMap, ARRAY_SIZE(netscapeCertTypeMap),
|
||||
NULL, &bitStringLen, &first);
|
||||
bytesNeeded += bitStringLen;
|
||||
bytesNeeded += 3 * sizeof(WCHAR); /* " (" + ")" */
|
||||
CRYPT_FormatHexString(0, 0, 0, NULL, NULL, bits->pbData,
|
||||
|
@ -2357,9 +2315,8 @@ static BOOL WINAPI CRYPT_FormatNetscapeCertType(DWORD dwCertEncodingType,
|
|||
|
||||
bitStringLen = bytesNeeded;
|
||||
first = TRUE;
|
||||
CRYPT_FormatBits(bits->pbData[0], netscapeCertTypeMap,
|
||||
sizeof(netscapeCertTypeMap) / sizeof(netscapeCertTypeMap[0]),
|
||||
str, &bitStringLen, &first);
|
||||
CRYPT_FormatBits(bits->pbData[0], netscapeCertTypeMap, ARRAY_SIZE(netscapeCertTypeMap),
|
||||
str, &bitStringLen, &first);
|
||||
str += bitStringLen / sizeof(WCHAR) - 1;
|
||||
*str++ = ' ';
|
||||
*str++ = '(';
|
||||
|
@ -2407,16 +2364,12 @@ static BOOL WINAPI CRYPT_FormatSpcFinancialCriteria(DWORD dwCertEncodingType,
|
|||
|
||||
if (!stringsLoaded)
|
||||
{
|
||||
LoadStringW(hInstance, IDS_FINANCIAL_CRITERIA, financialCriteria,
|
||||
sizeof(financialCriteria) / sizeof(financialCriteria[0]));
|
||||
LoadStringW(hInstance, IDS_FINANCIAL_CRITERIA_AVAILABLE, available,
|
||||
sizeof(available) / sizeof(available[0]));
|
||||
LoadStringW(hInstance, IDS_FINANCIAL_CRITERIA_NOT_AVAILABLE,
|
||||
notAvailable, sizeof(notAvailable) / sizeof(notAvailable[0]));
|
||||
LoadStringW(hInstance, IDS_FINANCIAL_CRITERIA_MEETS_CRITERIA,
|
||||
meetsCriteria, sizeof(meetsCriteria) / sizeof(meetsCriteria[0]));
|
||||
LoadStringW(hInstance, IDS_YES, yes, sizeof(yes) / sizeof(yes[0]));
|
||||
LoadStringW(hInstance, IDS_NO, no, sizeof(no) / sizeof(no[0]));
|
||||
LoadStringW(hInstance, IDS_FINANCIAL_CRITERIA, financialCriteria, ARRAY_SIZE(financialCriteria));
|
||||
LoadStringW(hInstance, IDS_FINANCIAL_CRITERIA_AVAILABLE, available, ARRAY_SIZE(available));
|
||||
LoadStringW(hInstance, IDS_FINANCIAL_CRITERIA_NOT_AVAILABLE, notAvailable, ARRAY_SIZE(notAvailable));
|
||||
LoadStringW(hInstance, IDS_FINANCIAL_CRITERIA_MEETS_CRITERIA, meetsCriteria, ARRAY_SIZE(meetsCriteria));
|
||||
LoadStringW(hInstance, IDS_YES, yes, ARRAY_SIZE(yes));
|
||||
LoadStringW(hInstance, IDS_NO, no, ARRAY_SIZE(no));
|
||||
stringsLoaded = TRUE;
|
||||
}
|
||||
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
|
||||
|
|
|
@ -70,7 +70,7 @@ static const WCHAR ADDRESSBOOK[] = {'A','D','D','R','E','S','S','B','O','O','K',
|
|||
static const WCHAR TRUSTEDPUBLISHER[] = {'T','r','u','s','t','e','d','P','u','b','l','i','s','h','e','r',0};
|
||||
static const WCHAR DISALLOWED[] = {'D','i','s','a','l','l','o','w','e','d',0};
|
||||
static const LPCWSTR LocalizedKeys[] = {ROOT,MY,CA,ADDRESSBOOK,TRUSTEDPUBLISHER,DISALLOWED};
|
||||
static WCHAR LocalizedNames[sizeof(LocalizedKeys)/sizeof(LocalizedKeys[0])][256];
|
||||
static WCHAR LocalizedNames[ARRAY_SIZE(LocalizedKeys)][256];
|
||||
|
||||
static void free_function_sets(void)
|
||||
{
|
||||
|
@ -1007,7 +1007,7 @@ static void oid_init_localizednames(void)
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
for(i = 0; i < sizeof(LocalizedKeys)/sizeof(LPCWSTR); i++)
|
||||
for(i = 0; i < ARRAY_SIZE(LocalizedKeys); i++)
|
||||
{
|
||||
LoadStringW(hInstance, IDS_LOCALIZEDNAME_ROOT+i, LocalizedNames[i], 256);
|
||||
}
|
||||
|
@ -1020,7 +1020,7 @@ LPCWSTR WINAPI CryptFindLocalizedName(LPCWSTR pwszCryptName)
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
for(i = 0; i < sizeof(LocalizedKeys)/sizeof(LPCWSTR); i++)
|
||||
for(i = 0; i < ARRAY_SIZE(LocalizedKeys); i++)
|
||||
{
|
||||
if(!lstrcmpiW(LocalizedKeys[i], pwszCryptName))
|
||||
{
|
||||
|
@ -1129,16 +1129,14 @@ static const DWORD dssSign[2] = { CALG_DSS_SIGN,
|
|||
static const DWORD mosaicSign[2] = { CALG_DSS_SIGN,
|
||||
CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG |
|
||||
CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG };
|
||||
static const DWORD ecdsaSign[2] = { CALG_OID_INFO_PARAMETERS,
|
||||
CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG };
|
||||
static const DWORD ecdsaSign[2] = { CALG_OID_INFO_PARAMETERS, CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG };
|
||||
static const CRYPT_DATA_BLOB rsaSignBlob = { sizeof(rsaSign),
|
||||
(LPBYTE)&rsaSign };
|
||||
static const CRYPT_DATA_BLOB dssSignBlob = { sizeof(dssSign),
|
||||
(LPBYTE)dssSign };
|
||||
static const CRYPT_DATA_BLOB mosaicSignBlob = { sizeof(mosaicSign),
|
||||
(LPBYTE)mosaicSign };
|
||||
static const CRYPT_DATA_BLOB ecdsaSignBlob = { sizeof(ecdsaSign),
|
||||
(LPBYTE)ecdsaSign };
|
||||
static const CRYPT_DATA_BLOB ecdsaSignBlob = { sizeof(ecdsaSign), (BYTE *)ecdsaSign };
|
||||
|
||||
static const DWORD ia5String[] = { CERT_RDN_IA5_STRING, 0 };
|
||||
static const DWORD numericString[] = { CERT_RDN_NUMERIC_STRING, 0 };
|
||||
|
@ -1160,8 +1158,8 @@ static const struct OIDInfoConstructor {
|
|||
UINT Algid;
|
||||
LPCWSTR pwszName;
|
||||
const CRYPT_DATA_BLOB *blob;
|
||||
LPCWSTR pwszCNGAlgid;
|
||||
LPCWSTR pwszCNGExtraAlgid;
|
||||
const WCHAR *pwszCNGAlgid;
|
||||
const WCHAR *pwszCNGExtraAlgid;
|
||||
} oidInfoConstructors[] = {
|
||||
{ 1, szOID_OIWSEC_sha1, CALG_SHA1, sha1, NULL },
|
||||
{ 1, szOID_OIWSEC_sha1, CALG_SHA1, sha, NULL },
|
||||
|
@ -1412,8 +1410,7 @@ static void init_oid_info(void)
|
|||
DWORD i;
|
||||
|
||||
oid_init_localizednames();
|
||||
for (i = 0; i < sizeof(oidInfoConstructors) /
|
||||
sizeof(oidInfoConstructors[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(oidInfoConstructors); i++)
|
||||
{
|
||||
if (!IS_INTRESOURCE(oidInfoConstructors[i].pwszName))
|
||||
{
|
||||
|
|
|
@ -71,7 +71,7 @@ static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType,
|
|||
WCHAR subKeyName[MAX_PATH];
|
||||
|
||||
do {
|
||||
DWORD size = sizeof(subKeyName) / sizeof(WCHAR);
|
||||
DWORD size = ARRAY_SIZE(subKeyName);
|
||||
|
||||
rc = RegEnumKeyExW(key, index++, subKeyName, &size, NULL, NULL, NULL,
|
||||
NULL);
|
||||
|
@ -163,7 +163,7 @@ static void CRYPT_RegReadFromReg(HKEY key, HCERTSTORE store)
|
|||
CERT_STORE_CRL_CONTEXT_FLAG, CERT_STORE_CTL_CONTEXT_FLAG };
|
||||
DWORD i;
|
||||
|
||||
for (i = 0; i < sizeof(subKeys) / sizeof(subKeys[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(subKeys); i++)
|
||||
{
|
||||
HKEY hKey;
|
||||
LONG rc;
|
||||
|
@ -255,7 +255,7 @@ static BOOL CRYPT_RegWriteToReg(WINE_REGSTOREINFO *store)
|
|||
BOOL ret = TRUE;
|
||||
DWORD i;
|
||||
|
||||
for (i = 0; ret && i < sizeof(subKeys) / sizeof(subKeys[0]); i++)
|
||||
for (i = 0; ret && i < ARRAY_SIZE(subKeys); i++)
|
||||
{
|
||||
HKEY key;
|
||||
LONG rc = RegCreateKeyExW(store->key, subKeys[i], 0, NULL, 0,
|
||||
|
@ -561,8 +561,7 @@ WINECRYPT_CERTSTORE *CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags,
|
|||
CRYPT_RegReadFromReg(regInfo->key, regInfo->memStore);
|
||||
regInfo->dirty = FALSE;
|
||||
provInfo.cbSize = sizeof(provInfo);
|
||||
provInfo.cStoreProvFunc = sizeof(regProvFuncs) /
|
||||
sizeof(regProvFuncs[0]);
|
||||
provInfo.cStoreProvFunc = ARRAY_SIZE(regProvFuncs);
|
||||
provInfo.rgpvStoreProvFunc = regProvFuncs;
|
||||
provInfo.hStoreProv = regInfo;
|
||||
store = CRYPT_ProvCreateStore(dwFlags, memStore, &provInfo);
|
||||
|
|
|
@ -931,7 +931,7 @@ static void add_ms_root_certs(HCERTSTORE to)
|
|||
|
||||
TRACE("\n");
|
||||
|
||||
for (i = 0; i < sizeof(msRootCerts) / sizeof(msRootCerts[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(msRootCerts); i++)
|
||||
if (!CertAddEncodedCertificateToStore(to, X509_ASN_ENCODING,
|
||||
msRootCerts[i].pb, msRootCerts[i].cb, CERT_STORE_ADD_NEW, NULL))
|
||||
WARN("adding root cert %d failed: %08x\n", i, GetLastError());
|
||||
|
@ -981,9 +981,7 @@ static void read_trusted_roots_from_known_locations(HCERTSTORE store)
|
|||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; !ret &&
|
||||
i < sizeof(CRYPT_knownLocations) / sizeof(CRYPT_knownLocations[0]);
|
||||
i++)
|
||||
for (i = 0; !ret && i < ARRAY_SIZE(CRYPT_knownLocations); i++)
|
||||
ret = import_certs_from_path(CRYPT_knownLocations[i], from, TRUE);
|
||||
check_and_store_certs(from, store);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "winnls.h"
|
||||
#include "mssip.h"
|
||||
#include "winuser.h"
|
||||
#include "crypt32_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/list.h"
|
||||
|
@ -440,7 +441,7 @@ BOOL WINAPI CryptSIPRetrieveSubjectGuid
|
|||
WCHAR subKeyName[MAX_PATH];
|
||||
|
||||
do {
|
||||
size = sizeof(subKeyName) / sizeof(subKeyName[0]);
|
||||
size = ARRAY_SIZE(subKeyName);
|
||||
r = RegEnumKeyExW(key, index++, subKeyName, &size, NULL, NULL,
|
||||
NULL, NULL);
|
||||
if (r == ERROR_SUCCESS)
|
||||
|
@ -478,7 +479,7 @@ BOOL WINAPI CryptSIPRetrieveSubjectGuid
|
|||
WCHAR subKeyName[MAX_PATH];
|
||||
|
||||
do {
|
||||
size = sizeof(subKeyName) / sizeof(subKeyName[0]);
|
||||
size = ARRAY_SIZE(subKeyName);
|
||||
r = RegEnumKeyExW(key, index++, subKeyName, &size, NULL, NULL,
|
||||
NULL, NULL);
|
||||
if (r == ERROR_SUCCESS)
|
||||
|
|
|
@ -124,7 +124,7 @@ BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0,
|
|||
/* Poor-man's resync: empty first store, then add everything from second
|
||||
* store to it.
|
||||
*/
|
||||
for (i = 0; i < sizeof(interfaces) / sizeof(interfaces[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(interfaces); i++)
|
||||
{
|
||||
const void *context;
|
||||
|
||||
|
@ -717,8 +717,7 @@ static WINECRYPT_CERTSTORE *CRYPT_MsgOpenStore(HCRYPTPROV hCryptProv,
|
|||
CERT_STORE_PROV_INFO provInfo = { 0 };
|
||||
|
||||
provInfo.cbSize = sizeof(provInfo);
|
||||
provInfo.cStoreProvFunc = sizeof(msgProvFuncs) /
|
||||
sizeof(msgProvFuncs[0]);
|
||||
provInfo.cStoreProvFunc = ARRAY_SIZE(msgProvFuncs);
|
||||
provInfo.rgpvStoreProvFunc = msgProvFuncs;
|
||||
provInfo.hStoreProv = CryptMsgDuplicate(msg);
|
||||
store = CRYPT_ProvCreateStore(dwFlags, memStore, &provInfo);
|
||||
|
@ -1338,7 +1337,7 @@ BOOL WINAPI CertEnumSystemStore(DWORD dwFlags, void *pvSystemStoreLocationPara,
|
|||
ret = TRUE;
|
||||
do {
|
||||
WCHAR name[MAX_PATH];
|
||||
DWORD size = sizeof(name) / sizeof(name[0]);
|
||||
DWORD size = ARRAY_SIZE(name);
|
||||
|
||||
rc = RegEnumKeyExW(key, index++, name, &size, NULL, NULL, NULL,
|
||||
NULL);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "wincrypt.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "crypt32_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(crypt);
|
||||
|
||||
|
@ -775,7 +776,7 @@ struct KeynameKeeper
|
|||
static void CRYPT_InitializeKeynameKeeper(struct KeynameKeeper *keeper)
|
||||
{
|
||||
keeper->keyName = keeper->buf;
|
||||
keeper->keyLen = sizeof(keeper->buf) / sizeof(keeper->buf[0]);
|
||||
keeper->keyLen = ARRAY_SIZE(keeper->buf);
|
||||
}
|
||||
|
||||
static void CRYPT_FreeKeynameKeeper(struct KeynameKeeper *keeper)
|
||||
|
@ -1326,8 +1327,7 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType,
|
|||
{
|
||||
PCERT_RDN_ATTR nameAttr = NULL;
|
||||
|
||||
for (i = 0; !nameAttr && i < sizeof(simpleAttributeOIDs) /
|
||||
sizeof(simpleAttributeOIDs[0]); i++)
|
||||
for (i = 0; !nameAttr && i < ARRAY_SIZE(simpleAttributeOIDs); i++)
|
||||
nameAttr = CertFindRDNAttr(simpleAttributeOIDs[i], nameInfo);
|
||||
if (nameAttr)
|
||||
ret = CertRDNValueToStrW(nameAttr->dwValueType,
|
||||
|
|
|
@ -58,7 +58,7 @@ reactos/dll/win32/comctl32 # Synced to Wine-3.0
|
|||
reactos/dll/win32/comdlg32 # Synced to WineStaging-3.17
|
||||
reactos/dll/win32/compstui # Synced to WineStaging-3.3
|
||||
reactos/dll/win32/credui # Synced to WineStaging-3.17
|
||||
reactos/dll/win32/crypt32 # Synced to WineStaging-3.9
|
||||
reactos/dll/win32/crypt32 # Synced to WineStaging-3.17
|
||||
reactos/dll/win32/cryptdlg # Synced to WineStaging-3.3
|
||||
reactos/dll/win32/cryptdll # Synced to WineStaging-3.3
|
||||
reactos/dll/win32/cryptnet # Synced to WineStaging-3.3
|
||||
|
|
Loading…
Reference in a new issue