Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6de2e83e
Commit
6de2e83e
authored
Jun 20, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Use ARRAY_SIZE macro.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9e2415dd
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
150 additions
and
218 deletions
+150
-218
cert.c
dlls/crypt32/cert.c
+1
-2
chain.c
dlls/crypt32/chain.c
+8
-12
crypt32_private.h
dlls/crypt32/crypt32_private.h
+2
-0
decode.c
dlls/crypt32/decode.c
+43
-46
encode.c
dlls/crypt32/encode.c
+21
-31
filestore.c
dlls/crypt32/filestore.c
+1
-2
msg.c
dlls/crypt32/msg.c
+1
-1
object.c
dlls/crypt32/object.c
+54
-101
oid.c
dlls/crypt32/oid.c
+4
-5
regstore.c
dlls/crypt32/regstore.c
+4
-5
rootstore.c
dlls/crypt32/rootstore.c
+2
-4
sip.c
dlls/crypt32/sip.c
+3
-2
store.c
dlls/crypt32/store.c
+3
-4
str.c
dlls/crypt32/str.c
+3
-3
No files found.
dlls/crypt32/cert.c
View file @
6de2e83e
...
...
@@ -987,8 +987,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.
...
...
dlls/crypt32/chain.c
View file @
6de2e83e
...
...
@@ -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
;
...
...
@@ -1688,11 +1688,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
);
}
...
...
@@ -3117,8 +3115,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
;
...
...
@@ -3408,7 +3405,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
));
...
...
@@ -3690,8 +3687,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
;
...
...
dlls/crypt32/crypt32_private.h
View file @
6de2e83e
...
...
@@ -21,6 +21,8 @@
#include "wine/list.h"
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
/* a few asn.1 tags we need */
#define ASN_BOOL (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x01)
#define ASN_BITSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)
...
...
dlls/crypt32/decode.c
View file @
6de2e83e
...
...
@@ -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
;
...
...
@@ -5751,7 +5748,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
;
...
...
@@ -5851,7 +5848,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
);
...
...
@@ -5884,7 +5881,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
);
...
...
@@ -5941,7 +5938,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
);
...
...
@@ -5969,7 +5966,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
);
...
...
dlls/crypt32/encode.c
View file @
6de2e83e
...
...
@@ -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
,
...
...
dlls/crypt32/filestore.c
View file @
6de2e83e
...
...
@@ -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
);
...
...
dlls/crypt32/msg.c
View file @
6de2e83e
...
...
@@ -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
)
{
...
...
dlls/crypt32/object.c
View file @
6de2e83e
...
...
@@ -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
)
...
...
dlls/crypt32/oid.c
View file @
6de2e83e
...
...
@@ -69,7 +69,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
)
{
...
...
@@ -1006,7 +1006,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
);
}
...
...
@@ -1019,7 +1019,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
))
{
...
...
@@ -1399,8 +1399,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
))
{
...
...
dlls/crypt32/regstore.c
View file @
6de2e83e
...
...
@@ -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
);
...
...
dlls/crypt32/rootstore.c
View file @
6de2e83e
...
...
@@ -780,7 +780,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
());
...
...
@@ -830,9 +830,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
);
}
...
...
dlls/crypt32/sip.c
View file @
6de2e83e
...
...
@@ -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
)
...
...
dlls/crypt32/store.c
View file @
6de2e83e
...
...
@@ -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
);
...
...
dlls/crypt32/str.c
View file @
6de2e83e
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment