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
254eb21c
Commit
254eb21c
authored
Feb 17, 2017
by
Lauri Kenttä
Committed by
Alexandre Julliard
Feb 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Fix wrong Base64 trailer WCHAR constants.
Signed-off-by:
Lauri Kenttä
<
lauri.kentta@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
794e424c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
base64.c
dlls/crypt32/base64.c
+2
-2
base64.c
dlls/crypt32/tests/base64.c
+21
-1
No files found.
dlls/crypt32/base64.c
View file @
254eb21c
...
...
@@ -47,10 +47,10 @@ static const WCHAR CERT_HEADER_START_W[] = {
static
const
WCHAR
CERT_DELIMITER_W
[]
=
{
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
0
};
static
const
WCHAR
CERT_TRAILER_W
[]
=
{
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
'E'
,
'N'
,
'D'
,
' '
,
0
};
static
const
WCHAR
CERT_TRAILER_START_W
[]
=
{
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
'E'
,
'N'
,
'D'
,
' '
,
'C'
,
'E'
,
'R'
,
'T'
,
'I'
,
'F'
,
'I'
,
'C'
,
'A'
,
'T'
,
'E'
,
'-'
,
'-'
,
'-'
,
'-'
,
'-'
,
0
};
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
};
...
...
dlls/crypt32/tests/base64.c
View file @
254eb21c
...
...
@@ -47,6 +47,9 @@ static BOOL (WINAPI *pCryptBinaryToStringA)(const BYTE *pbBinary,
static
BOOL
(
WINAPI
*
pCryptStringToBinaryA
)(
LPCSTR
pszString
,
DWORD
cchString
,
DWORD
dwFlags
,
BYTE
*
pbBinary
,
DWORD
*
pcbBinary
,
DWORD
*
pdwSkip
,
DWORD
*
pdwFlags
);
static
BOOL
(
WINAPI
*
pCryptStringToBinaryW
)(
LPCWSTR
pszString
,
DWORD
cchString
,
DWORD
dwFlags
,
BYTE
*
pbBinary
,
DWORD
*
pcbBinary
,
DWORD
*
pdwSkip
,
DWORD
*
pdwFlags
);
struct
BinTests
{
...
...
@@ -299,10 +302,24 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
}
}
static
void
decodeBase64WithLenFmtW
(
LPCSTR
strA
,
int
len
,
DWORD
fmt
,
BOOL
retA
,
const
BYTE
*
bufA
,
DWORD
bufLenA
,
DWORD
fmtUsedA
)
{
BYTE
buf
[
8
]
=
{
0
};
DWORD
bufLen
=
sizeof
(
buf
)
-
1
,
fmtUsed
=
0xdeadbeef
;
BOOL
ret
;
WCHAR
strW
[
64
];
int
i
;
for
(
i
=
0
;
(
strW
[
i
]
=
strA
[
i
])
!=
0
;
++
i
);
ret
=
pCryptStringToBinaryW
(
strW
,
len
,
fmt
,
buf
,
&
bufLen
,
NULL
,
&
fmtUsed
);
ok
(
ret
==
retA
&&
bufLen
==
bufLenA
&&
memcmp
(
bufA
,
buf
,
bufLen
)
==
0
&&
fmtUsed
==
fmtUsedA
,
"base64
\"
%s
\"
len %d: W and A differ
\n
"
,
strA
,
len
);
}
static
void
decodeBase64WithLenFmt
(
LPCSTR
str
,
int
len
,
DWORD
fmt
,
LPCSTR
expected
,
int
le
,
BOOL
isBroken
)
{
BYTE
buf
[
8
]
=
{
0
};
DWORD
bufLen
=
sizeof
(
buf
)
-
1
,
fmtUsed
;
DWORD
bufLen
=
sizeof
(
buf
)
-
1
,
fmtUsed
=
0xdeadbeef
;
BOOL
ret
;
SetLastError
(
0xdeadbeef
);
ret
=
pCryptStringToBinaryA
(
str
,
len
,
fmt
,
buf
,
&
bufLen
,
NULL
,
&
fmtUsed
);
...
...
@@ -320,6 +337,8 @@ static void decodeBase64WithLenFmt(LPCSTR str, int len, DWORD fmt, LPCSTR expect
"base64
\"
%s
\"
len %d: expected failure, got
\"
%s
\"
(ret %d, le %d)
\n
"
,
str
,
len
,
(
char
*
)
buf
,
ret
,
GetLastError
());
}
if
(
pCryptStringToBinaryW
)
decodeBase64WithLenFmtW
(
str
,
len
,
fmt
,
ret
,
buf
,
bufLen
,
fmtUsed
);
}
static
void
decodeBase64WithLenBroken
(
LPCSTR
str
,
int
len
,
LPCSTR
expected
,
int
le
)
...
...
@@ -539,6 +558,7 @@ START_TEST(base64)
pCryptBinaryToStringA
=
(
void
*
)
GetProcAddress
(
lib
,
"CryptBinaryToStringA"
);
pCryptStringToBinaryA
=
(
void
*
)
GetProcAddress
(
lib
,
"CryptStringToBinaryA"
);
pCryptStringToBinaryW
=
(
void
*
)
GetProcAddress
(
lib
,
"CryptStringToBinaryW"
);
if
(
pCryptBinaryToStringA
)
testBinaryToStringA
();
...
...
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