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
9afaafc0
Commit
9afaafc0
authored
Oct 14, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Oct 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Simplify CRYPT_AsnDecodeExtensions.
parent
d1f94671
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
35 deletions
+25
-35
decode.c
dlls/crypt32/decode.c
+25
-35
No files found.
dlls/crypt32/decode.c
View file @
9afaafc0
...
...
@@ -85,12 +85,6 @@ static BOOL CRYPT_AsnDecodePubKeyInfoInternal(const BYTE *pbEncoded,
*/
static
BOOL
CRYPT_AsnDecodeExtension
(
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
,
DWORD
*
pcbDecoded
);
/* Like CRYPT_AsnDecodeExtensions, except assumes rgExtension is set ahead of
* time, doesn't do memory allocation, and doesn't do exception handling.
*/
static
BOOL
CRYPT_AsnDecodeExtensionsInternal
(
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
,
DWORD
*
pcbDecoded
);
/* Assumes algo->Parameters.pbData is set ahead of time. */
static
BOOL
CRYPT_AsnDecodeAlgorithmId
(
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
,
DWORD
*
pcbDecoded
);
...
...
@@ -1673,51 +1667,47 @@ static BOOL CRYPT_AsnDecodeExtension(const BYTE *pbEncoded, DWORD cbEncoded,
return
ret
;
}
static
BOOL
CRYPT_AsnDecodeExtensionsInternal
(
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
,
DWORD
*
pcbDecoded
)
{
BOOL
ret
=
TRUE
;
struct
AsnArrayDescriptor
arrayDesc
=
{
ASN_SEQUENCEOF
,
CRYPT_AsnDecodeExtension
,
sizeof
(
CERT_EXTENSION
),
TRUE
,
offsetof
(
CERT_EXTENSION
,
pszObjId
)
};
PCERT_EXTENSIONS
exts
=
pvStructInfo
;
TRACE
(
"%p, %d, %08x, %p, %d, %p
\n
"
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pvStructInfo
,
*
pcbStructInfo
,
pcbDecoded
);
ret
=
CRYPT_AsnDecodeArray
(
&
arrayDesc
,
pbEncoded
,
cbEncoded
,
dwFlags
,
NULL
,
pvStructInfo
,
pcbStructInfo
,
pcbDecoded
,
exts
?
exts
->
rgExtension
:
NULL
);
return
ret
;
}
static
BOOL
WINAPI
CRYPT_AsnDecodeExtensions
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
PCRYPT_DECODE_PARA
pDecodePara
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
)
{
BOOL
ret
=
TRUE
;
TRACE
(
"%p, %d, %08x, %p, %d
\n
"
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pvStructInfo
,
pvStructInfo
?
*
pcbStructInfo
:
0
);
__TRY
{
ret
=
CRYPT_AsnDecodeExtensionsInternal
(
pbEncoded
,
cbEncoded
,
dwFlags
&
~
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
pcbStructInfo
,
NULL
);
if
(
ret
&&
pvStructInfo
)
struct
AsnArrayDescriptor
arrayDesc
=
{
ASN_SEQUENCEOF
,
CRYPT_AsnDecodeExtension
,
sizeof
(
CERT_EXTENSION
),
TRUE
,
offsetof
(
CERT_EXTENSION
,
pszObjId
)
};
DWORD
itemSize
;
ret
=
CRYPT_AsnDecodeArrayNoAlloc
(
&
arrayDesc
,
pbEncoded
,
cbEncoded
,
NULL
,
NULL
,
&
itemSize
,
NULL
);
if
(
ret
)
{
ret
=
CRYPT_DecodeEnsureSpace
(
dwFlags
,
pDecodePara
,
pvStructInfo
,
pcbStructInfo
,
*
pcbStructInfo
);
if
(
ret
)
DWORD
bytesNeeded
;
/* CRYPT_AsnDecodeArrayNoAlloc only returns the size of the decoded
* items, so add the size of CERT_EXTENSIONS.
*/
bytesNeeded
=
sizeof
(
CERT_EXTENSIONS
)
+
itemSize
;
if
(
!
pvStructInfo
)
*
pcbStructInfo
=
bytesNeeded
;
else
if
((
ret
=
CRYPT_DecodeEnsureSpace
(
dwFlags
,
pDecodePara
,
pvStructInfo
,
pcbStructInfo
,
bytesNeeded
)))
{
CERT_EXTENSIONS
*
exts
;
if
(
dwFlags
&
CRYPT_DECODE_ALLOC_FLAG
)
pvStructInfo
=
*
(
BYTE
**
)
pvStructInfo
;
exts
=
pvStructInfo
;
exts
=
(
CERT_EXTENSIONS
*
)
pvStructInfo
;
exts
->
rgExtension
=
(
CERT_EXTENSION
*
)((
BYTE
*
)
exts
+
sizeof
(
CERT_EXTENSIONS
));
ret
=
CRYPT_AsnDecode
ExtensionsInternal
(
pbEncoded
,
c
bEncoded
,
dwFlags
&
~
CRYPT_DECODE_ALLOC_FLAG
,
pvStructInfo
,
pcbStructInfo
,
NULL
);
ret
=
CRYPT_AsnDecode
ArrayNoAlloc
(
&
arrayDesc
,
p
bEncoded
,
cbEncoded
,
&
exts
->
cExtension
,
exts
->
rgExtension
,
&
itemSize
,
NULL
);
}
}
}
...
...
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