Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
fc0aff0d
Commit
fc0aff0d
authored
Oct 29, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Nov 03, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add support for the CRYPT_STRING_NOCRLF flag to CryptBinaryToStringA/W.
parent
2d5ac92d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
24 deletions
+47
-24
base64.c
dlls/crypt32/base64.c
+46
-24
wincrypt.h
include/wincrypt.h
+1
-0
No files found.
dlls/crypt32/base64.c
View file @
fc0aff0d
...
...
@@ -99,7 +99,8 @@ static LONG encodeBase64A(const BYTE *in_buf, int in_len, LPCSTR sep,
TRACE
(
"bytes is %d, pad bytes is %d
\n
"
,
bytes
,
pad_bytes
);
needed
=
bytes
+
pad_bytes
+
1
;
needed
+=
(
needed
/
64
+
1
)
*
strlen
(
sep
);
if
(
sep
)
needed
+=
(
needed
/
64
+
1
)
*
strlen
(
sep
);
if
(
needed
>
*
out_len
)
{
...
...
@@ -116,7 +117,7 @@ static LONG encodeBase64A(const BYTE *in_buf, int in_len, LPCSTR sep,
i
=
0
;
while
(
div
>
0
)
{
if
(
i
&&
i
%
64
==
0
)
if
(
sep
&&
i
&&
i
%
64
==
0
)
{
strcpy
(
ptr
,
sep
);
ptr
+=
strlen
(
sep
);
...
...
@@ -162,7 +163,8 @@ static LONG encodeBase64A(const BYTE *in_buf, int in_len, LPCSTR sep,
*
ptr
++
=
'='
;
break
;
}
strcpy
(
ptr
,
sep
);
if
(
sep
)
strcpy
(
ptr
,
sep
);
return
ERROR_SUCCESS
;
}
...
...
@@ -172,14 +174,16 @@ static BOOL BinaryToBase64A(const BYTE *pbBinary,
{
static
const
char
crlf
[]
=
"
\r\n
"
,
lf
[]
=
"
\n
"
;
BOOL
ret
=
TRUE
;
LPCSTR
header
=
NULL
,
trailer
=
NULL
,
sep
=
NULL
;
LPCSTR
header
=
NULL
,
trailer
=
NULL
,
sep
;
DWORD
charsNeeded
;
if
(
dwFlags
&
CRYPT_STRING_NOCR
)
sep
=
lf
;
else
if
(
dwFlags
&
CRYPT_STRING_NOCRLF
)
sep
=
NULL
;
else
sep
=
crlf
;
switch
(
dwFlags
&
0x
7
fffffff
)
switch
(
dwFlags
&
0x
0
fffffff
)
{
case
CRYPT_STRING_BASE64
:
/* no header or footer */
...
...
@@ -200,7 +204,8 @@ static BOOL BinaryToBase64A(const BYTE *pbBinary,
charsNeeded
=
0
;
encodeBase64A
(
pbBinary
,
cbBinary
,
sep
,
NULL
,
&
charsNeeded
);
charsNeeded
+=
strlen
(
sep
);
if
(
sep
)
charsNeeded
+=
strlen
(
sep
);
if
(
header
)
charsNeeded
+=
strlen
(
header
)
+
strlen
(
sep
);
if
(
trailer
)
...
...
@@ -214,8 +219,11 @@ static BOOL BinaryToBase64A(const BYTE *pbBinary,
{
strcpy
(
ptr
,
header
);
ptr
+=
strlen
(
ptr
);
strcpy
(
ptr
,
sep
);
ptr
+=
strlen
(
sep
);
if
(
sep
)
{
strcpy
(
ptr
,
sep
);
ptr
+=
strlen
(
sep
);
}
}
encodeBase64A
(
pbBinary
,
cbBinary
,
sep
,
ptr
,
&
size
);
ptr
+=
size
-
1
;
...
...
@@ -223,8 +231,11 @@ static BOOL BinaryToBase64A(const BYTE *pbBinary,
{
strcpy
(
ptr
,
trailer
);
ptr
+=
strlen
(
ptr
);
strcpy
(
ptr
,
sep
);
ptr
+=
strlen
(
sep
);
if
(
sep
)
{
strcpy
(
ptr
,
sep
);
ptr
+=
strlen
(
sep
);
}
}
*
pcchString
=
charsNeeded
-
1
;
}
...
...
@@ -258,7 +269,7 @@ BOOL WINAPI CryptBinaryToStringA(const BYTE *pbBinary,
return
FALSE
;
}
switch
(
dwFlags
&
0x
7
fffffff
)
switch
(
dwFlags
&
0x
0
fffffff
)
{
case
CRYPT_STRING_BINARY
:
encoder
=
EncodeBinaryToBinaryA
;
...
...
@@ -273,7 +284,7 @@ BOOL WINAPI CryptBinaryToStringA(const BYTE *pbBinary,
case
CRYPT_STRING_HEXASCII
:
case
CRYPT_STRING_HEXADDR
:
case
CRYPT_STRING_HEXASCIIADDR
:
FIXME
(
"Unimplemented type %d
\n
"
,
dwFlags
&
0x
7
fffffff
);
FIXME
(
"Unimplemented type %d
\n
"
,
dwFlags
&
0x
0
fffffff
);
/* fall through */
default:
SetLastError
(
ERROR_INVALID_PARAMETER
);
...
...
@@ -293,7 +304,8 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep,
TRACE
(
"bytes is %d, pad bytes is %d
\n
"
,
bytes
,
pad_bytes
);
needed
=
bytes
+
pad_bytes
+
1
;
needed
+=
(
needed
/
64
+
1
)
*
strlenW
(
sep
);
if
(
sep
)
needed
+=
(
needed
/
64
+
1
)
*
strlenW
(
sep
);
if
(
needed
>
*
out_len
)
{
...
...
@@ -310,7 +322,7 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep,
i
=
0
;
while
(
div
>
0
)
{
if
(
i
&&
i
%
64
==
0
)
if
(
sep
&&
i
&&
i
%
64
==
0
)
{
strcpyW
(
ptr
,
sep
);
ptr
+=
strlenW
(
sep
);
...
...
@@ -356,7 +368,8 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep,
*
ptr
++
=
'='
;
break
;
}
strcpyW
(
ptr
,
sep
);
if
(
sep
)
strcpyW
(
ptr
,
sep
);
return
ERROR_SUCCESS
;
}
...
...
@@ -366,14 +379,16 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary,
{
static
const
WCHAR
crlf
[]
=
{
'\r'
,
'\n'
,
0
},
lf
[]
=
{
'\n'
,
0
};
BOOL
ret
=
TRUE
;
LPCWSTR
header
=
NULL
,
trailer
=
NULL
,
sep
=
NULL
;
LPCWSTR
header
=
NULL
,
trailer
=
NULL
,
sep
;
DWORD
charsNeeded
;
if
(
dwFlags
&
CRYPT_STRING_NOCR
)
sep
=
lf
;
else
if
(
dwFlags
&
CRYPT_STRING_NOCRLF
)
sep
=
NULL
;
else
sep
=
crlf
;
switch
(
dwFlags
&
0x
7
fffffff
)
switch
(
dwFlags
&
0x
0
fffffff
)
{
case
CRYPT_STRING_BASE64
:
/* no header or footer */
...
...
@@ -394,7 +409,8 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary,
charsNeeded
=
0
;
encodeBase64W
(
pbBinary
,
cbBinary
,
sep
,
NULL
,
&
charsNeeded
);
charsNeeded
+=
strlenW
(
sep
);
if
(
sep
)
charsNeeded
+=
strlenW
(
sep
);
if
(
header
)
charsNeeded
+=
strlenW
(
header
)
+
strlenW
(
sep
);
if
(
trailer
)
...
...
@@ -408,8 +424,11 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary,
{
strcpyW
(
ptr
,
header
);
ptr
+=
strlenW
(
ptr
);
strcpyW
(
ptr
,
sep
);
ptr
+=
strlenW
(
sep
);
if
(
sep
)
{
strcpyW
(
ptr
,
sep
);
ptr
+=
strlenW
(
sep
);
}
}
encodeBase64W
(
pbBinary
,
cbBinary
,
sep
,
ptr
,
&
size
);
ptr
+=
size
-
1
;
...
...
@@ -417,8 +436,11 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary,
{
strcpyW
(
ptr
,
trailer
);
ptr
+=
strlenW
(
ptr
);
strcpyW
(
ptr
,
sep
);
ptr
+=
strlenW
(
sep
);
if
(
sep
)
{
strcpyW
(
ptr
,
sep
);
ptr
+=
strlenW
(
sep
);
}
}
*
pcchString
=
charsNeeded
-
1
;
}
...
...
@@ -452,7 +474,7 @@ BOOL WINAPI CryptBinaryToStringW(const BYTE *pbBinary,
return
FALSE
;
}
switch
(
dwFlags
&
0x
7
fffffff
)
switch
(
dwFlags
&
0x
0
fffffff
)
{
case
CRYPT_STRING_BASE64
:
case
CRYPT_STRING_BASE64HEADER
:
...
...
@@ -465,7 +487,7 @@ BOOL WINAPI CryptBinaryToStringW(const BYTE *pbBinary,
case
CRYPT_STRING_HEXASCII
:
case
CRYPT_STRING_HEXADDR
:
case
CRYPT_STRING_HEXASCIIADDR
:
FIXME
(
"Unimplemented type %d
\n
"
,
dwFlags
&
0x
7
fffffff
);
FIXME
(
"Unimplemented type %d
\n
"
,
dwFlags
&
0x
0
fffffff
);
/* fall through */
default:
SetLastError
(
ERROR_INVALID_PARAMETER
);
...
...
include/wincrypt.h
View file @
fc0aff0d
...
...
@@ -2750,6 +2750,7 @@ typedef struct _CTL_FIND_SUBJECT_PARA
#define CRYPT_STRING_BASE64X509CRLHEADER 0x00000009
#define CRYPT_STRING_HEXADDR 0x0000000a
#define CRYPT_STRING_HEXASCIIADDR 0x0000000b
#define CRYPT_STRING_NOCRLF 0x40000000
#define CRYPT_STRING_NOCR 0x80000000
/* OIDs */
...
...
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