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
c48c5c85
Commit
c48c5c85
authored
Nov 07, 2008
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Nov 07, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Fix the aligning up to a DWORD_PTR boundary.
parent
c46a88a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
21 deletions
+18
-21
crypt32_private.h
dlls/crypt32/crypt32_private.h
+9
-0
decode.c
dlls/crypt32/decode.c
+1
-3
msg.c
dlls/crypt32/msg.c
+8
-18
No files found.
dlls/crypt32/crypt32_private.h
View file @
c48c5c85
...
...
@@ -376,4 +376,13 @@ void ContextList_Empty(struct ContextList *list);
void
ContextList_Free
(
struct
ContextList
*
list
);
/**
* Utilities.
*/
/* Align up to a DWORD_PTR boundary
*/
#define ALIGN_DWORD_PTR(x) (((x) + sizeof(DWORD_PTR) - 1) & ~(sizeof(DWORD_PTR) - 1))
#define POINTER_ALIGN_DWORD_PTR(p) ((LPVOID)ALIGN_DWORD_PTR((DWORD_PTR)(p)))
#endif
dlls/crypt32/decode.c
View file @
c48c5c85
...
...
@@ -362,9 +362,7 @@ static BOOL CRYPT_AsnDecodeSequenceItems(struct AsnDecodeSequenceItem items[],
if
(
ret
)
{
/* Account for alignment padding */
if
(
items
[
i
].
size
%
sizeof
(
DWORD_PTR
))
items
[
i
].
size
+=
sizeof
(
DWORD_PTR
)
-
items
[
i
].
size
%
sizeof
(
DWORD_PTR
);
items
[
i
].
size
=
ALIGN_DWORD_PTR
(
items
[
i
].
size
);
TRACE
(
"item %d size: %d
\n
"
,
i
,
items
[
i
].
size
);
if
(
nextData
&&
items
[
i
].
hasPointer
&&
items
[
i
].
size
>
items
[
i
].
minSize
)
...
...
dlls/crypt32/msg.c
View file @
c48c5c85
...
...
@@ -1970,8 +1970,7 @@ static inline void CRYPT_CopyAttributes(CRYPT_ATTRIBUTES *out,
{
DWORD
i
;
if
((
*
nextData
-
(
LPBYTE
)
0
)
%
sizeof
(
DWORD_PTR
))
*
nextData
+=
(
*
nextData
-
(
LPBYTE
)
0
)
%
sizeof
(
DWORD_PTR
);
*
nextData
=
POINTER_ALIGN_DWORD_PTR
(
*
nextData
);
out
->
rgAttr
=
(
CRYPT_ATTRIBUTE
*
)
*
nextData
;
*
nextData
+=
in
->
cAttr
*
sizeof
(
CRYPT_ATTRIBUTE
);
for
(
i
=
0
;
i
<
in
->
cAttr
;
i
++
)
...
...
@@ -1987,8 +1986,7 @@ static inline void CRYPT_CopyAttributes(CRYPT_ATTRIBUTES *out,
DWORD
j
;
out
->
rgAttr
[
i
].
cValue
=
in
->
rgAttr
[
i
].
cValue
;
if
((
*
nextData
-
(
LPBYTE
)
0
)
%
sizeof
(
DWORD_PTR
))
*
nextData
+=
(
*
nextData
-
(
LPBYTE
)
0
)
%
sizeof
(
DWORD_PTR
);
*
nextData
=
POINTER_ALIGN_DWORD_PTR
(
*
nextData
);
out
->
rgAttr
[
i
].
rgValue
=
(
PCRYPT_DATA_BLOB
)
*
nextData
;
*
nextData
+=
in
->
rgAttr
[
i
].
cValue
*
sizeof
(
CRYPT_DATA_BLOB
);
for
(
j
=
0
;
j
<
in
->
rgAttr
[
i
].
cValue
;
j
++
)
...
...
@@ -2008,15 +2006,13 @@ static DWORD CRYPT_SizeOfAttributes(const CRYPT_ATTRIBUTES *attr)
if
(
attr
->
rgAttr
[
i
].
pszObjId
)
size
+=
strlen
(
attr
->
rgAttr
[
i
].
pszObjId
)
+
1
;
/* align pointer */
if
(
size
%
sizeof
(
DWORD_PTR
))
size
+=
size
%
sizeof
(
DWORD_PTR
);
size
=
ALIGN_DWORD_PTR
(
size
);
size
+=
attr
->
rgAttr
[
i
].
cValue
*
sizeof
(
CRYPT_DATA_BLOB
);
for
(
j
=
0
;
j
<
attr
->
rgAttr
[
i
].
cValue
;
j
++
)
size
+=
attr
->
rgAttr
[
i
].
rgValue
[
j
].
cbData
;
}
/* align pointer again to be conservative */
if
(
size
%
sizeof
(
DWORD_PTR
))
size
+=
size
%
sizeof
(
DWORD_PTR
);
size
=
ALIGN_DWORD_PTR
(
size
);
return
size
;
}
...
...
@@ -2094,8 +2090,7 @@ static BOOL CRYPT_CopySignerInfo(void *pvData, DWORD *pcbData,
size
+=
in
->
HashEncryptionAlgorithm
.
Parameters
.
cbData
;
size
+=
in
->
EncryptedHash
.
cbData
;
/* align pointer */
if
(
size
%
sizeof
(
DWORD_PTR
))
size
+=
size
%
sizeof
(
DWORD_PTR
);
size
=
ALIGN_DWORD_PTR
(
size
);
size
+=
CRYPT_SizeOfAttributes
(
&
in
->
AuthAttrs
);
size
+=
CRYPT_SizeOfAttributes
(
&
in
->
UnauthAttrs
);
if
(
!
pvData
)
...
...
@@ -2133,9 +2128,7 @@ static BOOL CRYPT_CopySignerInfo(void *pvData, DWORD *pcbData,
CRYPT_CopyAlgorithmId
(
&
out
->
HashEncryptionAlgorithm
,
&
in
->
HashEncryptionAlgorithm
,
&
nextData
);
CRYPT_CopyBlob
(
&
out
->
EncryptedHash
,
&
in
->
EncryptedHash
,
&
nextData
);
/* align pointer */
if
((
nextData
-
(
LPBYTE
)
0
)
%
sizeof
(
DWORD_PTR
))
nextData
+=
(
nextData
-
(
LPBYTE
)
0
)
%
sizeof
(
DWORD_PTR
);
nextData
=
POINTER_ALIGN_DWORD_PTR
(
nextData
);
CRYPT_CopyAttributes
(
&
out
->
AuthAttrs
,
&
in
->
AuthAttrs
,
&
nextData
);
CRYPT_CopyAttributes
(
&
out
->
UnauthAttrs
,
&
in
->
UnauthAttrs
,
&
nextData
);
}
...
...
@@ -2167,8 +2160,7 @@ static BOOL CRYPT_CopyCMSSignerInfo(void *pvData, DWORD *pcbData,
size
+=
in
->
HashEncryptionAlgorithm
.
Parameters
.
cbData
;
size
+=
in
->
EncryptedHash
.
cbData
;
/* align pointer */
if
(
size
%
sizeof
(
DWORD_PTR
))
size
+=
size
%
sizeof
(
DWORD_PTR
);
size
=
ALIGN_DWORD_PTR
(
size
);
size
+=
CRYPT_SizeOfAttributes
(
&
in
->
AuthAttrs
);
size
+=
CRYPT_SizeOfAttributes
(
&
in
->
UnauthAttrs
);
if
(
!
pvData
)
...
...
@@ -2203,9 +2195,7 @@ static BOOL CRYPT_CopyCMSSignerInfo(void *pvData, DWORD *pcbData,
CRYPT_CopyAlgorithmId
(
&
out
->
HashEncryptionAlgorithm
,
&
in
->
HashEncryptionAlgorithm
,
&
nextData
);
CRYPT_CopyBlob
(
&
out
->
EncryptedHash
,
&
in
->
EncryptedHash
,
&
nextData
);
/* align pointer */
if
((
nextData
-
(
LPBYTE
)
0
)
%
sizeof
(
DWORD_PTR
))
nextData
+=
(
nextData
-
(
LPBYTE
)
0
)
%
sizeof
(
DWORD_PTR
);
nextData
=
POINTER_ALIGN_DWORD_PTR
(
nextData
);
CRYPT_CopyAttributes
(
&
out
->
AuthAttrs
,
&
in
->
AuthAttrs
,
&
nextData
);
CRYPT_CopyAttributes
(
&
out
->
UnauthAttrs
,
&
in
->
UnauthAttrs
,
&
nextData
);
ret
=
TRUE
;
...
...
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