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
af192c20
Commit
af192c20
authored
Oct 16, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Oct 19, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Simplify CRYPT_AsnDecodeInt.
parent
60140610
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
51 deletions
+11
-51
asn.c
dlls/wintrust/asn.c
+11
-51
No files found.
dlls/wintrust/asn.c
View file @
af192c20
...
@@ -2179,62 +2179,24 @@ BOOL WINAPI WVTAsn1SpcSpOpusInfoDecode(DWORD dwCertEncodingType,
...
@@ -2179,62 +2179,24 @@ BOOL WINAPI WVTAsn1SpcSpOpusInfoDecode(DWORD dwCertEncodingType,
return
ret
;
return
ret
;
}
}
static
BOOL
CRYPT_AsnDecodeInteger
(
const
BYTE
*
pbEncoded
,
/* Ignores tag. Only allows integers 4 bytes or smaller in size. */
DWORD
cbEncoded
,
DWORD
dwFlags
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
)
static
BOOL
WINAPI
CRYPT_AsnDecodeInt
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
)
{
{
BOOL
ret
;
BOOL
ret
;
DWORD
bytesNeeded
,
dataLen
;
DWORD
dataLen
;
if
((
ret
=
CRYPT_GetLen
(
pbEncoded
,
cbEncoded
,
&
dataLen
)))
if
((
ret
=
CRYPT_GetLen
(
pbEncoded
,
cbEncoded
,
&
dataLen
)))
{
{
BYTE
lenBytes
=
GET_LEN_BYTES
(
pbEncoded
[
1
]);
BYTE
lenBytes
=
GET_LEN_BYTES
(
pbEncoded
[
1
]);
bytesNeeded
=
dataLen
+
sizeof
(
CRYPT_INTEGER_BLOB
);
if
(
dataLen
>
sizeof
(
int
))
if
(
!
pvStructInfo
)
*
pcbStructInfo
=
bytesNeeded
;
else
if
(
*
pcbStructInfo
<
bytesNeeded
)
{
{
*
pcbStructInfo
=
bytesNeeded
;
SetLastError
(
CRYPT_E_ASN1_LARGE
);
SetLastError
(
ERROR_MORE_DATA
);
ret
=
FALSE
;
ret
=
FALSE
;
}
}
else
else
if
(
!
pvStructInfo
)
{
CRYPT_INTEGER_BLOB
*
blob
=
pvStructInfo
;
*
pcbStructInfo
=
bytesNeeded
;
blob
->
cbData
=
dataLen
;
assert
(
blob
->
pbData
);
if
(
blob
->
cbData
)
{
DWORD
i
;
for
(
i
=
0
;
i
<
blob
->
cbData
;
i
++
)
{
blob
->
pbData
[
i
]
=
*
(
pbEncoded
+
1
+
lenBytes
+
dataLen
-
i
-
1
);
}
}
}
}
return
ret
;
}
/* Ignores tag. Only allows integers 4 bytes or smaller in size. */
static
BOOL
WINAPI
CRYPT_AsnDecodeInt
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
)
{
BOOL
ret
;
BYTE
buf
[
sizeof
(
CRYPT_INTEGER_BLOB
)
+
sizeof
(
int
)];
CRYPT_INTEGER_BLOB
*
blob
=
(
CRYPT_INTEGER_BLOB
*
)
buf
;
DWORD
size
=
sizeof
(
buf
);
blob
->
pbData
=
buf
+
sizeof
(
CRYPT_INTEGER_BLOB
);
ret
=
CRYPT_AsnDecodeInteger
(
pbEncoded
,
cbEncoded
,
0
,
buf
,
&
size
);
if
(
ret
)
{
if
(
!
pvStructInfo
)
*
pcbStructInfo
=
sizeof
(
int
);
*
pcbStructInfo
=
sizeof
(
int
);
else
if
(
*
pcbStructInfo
<
sizeof
(
int
))
else
if
(
*
pcbStructInfo
<
sizeof
(
int
))
{
{
...
@@ -2248,23 +2210,21 @@ static BOOL WINAPI CRYPT_AsnDecodeInt(DWORD dwCertEncodingType,
...
@@ -2248,23 +2210,21 @@ static BOOL WINAPI CRYPT_AsnDecodeInt(DWORD dwCertEncodingType,
DWORD
i
;
DWORD
i
;
*
pcbStructInfo
=
sizeof
(
int
);
*
pcbStructInfo
=
sizeof
(
int
);
if
(
blob
->
pbData
[
blob
->
cbData
-
1
]
&
0x80
)
if
(
dataLen
&&
pbEncoded
[
1
+
lenBytes
]
&
0x80
)
{
{
/* initialize to a negative value to sign-extend */
/* initialize to a negative value to sign-extend */
val
=
-
1
;
val
=
-
1
;
}
}
else
else
val
=
0
;
val
=
0
;
for
(
i
=
0
;
i
<
blob
->
cbData
;
i
++
)
for
(
i
=
0
;
i
<
dataLen
;
i
++
)
{
{
val
<<=
8
;
val
<<=
8
;
val
|=
blob
->
pbData
[
blob
->
cbData
-
i
-
1
];
val
|=
pbEncoded
[
1
+
lenBytes
+
i
];
}
}
memcpy
(
pvStructInfo
,
&
val
,
sizeof
(
int
));
memcpy
(
pvStructInfo
,
&
val
,
sizeof
(
int
));
}
}
}
}
else
if
(
GetLastError
()
==
ERROR_MORE_DATA
)
SetLastError
(
CRYPT_E_ASN1_LARGE
);
return
ret
;
return
ret
;
}
}
...
...
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