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
1b5e8771
Commit
1b5e8771
authored
Mar 22, 2018
by
Michael Müller
Committed by
Alexandre Julliard
Mar 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Add support for auth data in AES GCM mode.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4f4adf69
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
1 deletion
+41
-1
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+41
-1
No files found.
dlls/bcrypt/bcrypt_main.c
View file @
1b5e8771
...
@@ -52,6 +52,7 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
...
@@ -52,6 +52,7 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
/* Not present in gnutls version < 3.0 */
/* Not present in gnutls version < 3.0 */
static
int
(
*
pgnutls_cipher_tag
)(
gnutls_cipher_hd_t
handle
,
void
*
tag
,
size_t
tag_size
);
static
int
(
*
pgnutls_cipher_tag
)(
gnutls_cipher_hd_t
handle
,
void
*
tag
,
size_t
tag_size
);
static
int
(
*
pgnutls_cipher_add_auth
)(
gnutls_cipher_hd_t
handle
,
const
void
*
ptext
,
size_t
ptext_size
);
static
void
*
libgnutls_handle
;
static
void
*
libgnutls_handle
;
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
...
@@ -72,7 +73,12 @@ MAKE_FUNCPTR(gnutls_perror);
...
@@ -72,7 +73,12 @@ MAKE_FUNCPTR(gnutls_perror);
#define GNUTLS_CIPHER_AES_256_GCM 94
#define GNUTLS_CIPHER_AES_256_GCM 94
#endif
#endif
static
int
compat_gnutls_cipher_tag
(
gnutls_cipher_hd_t
handle
,
void
*
tag
,
size_t
tag_size
)
static
int
compat_gnutls_cipher_tag
(
gnutls_cipher_hd_t
handle
,
void
*
tag
,
size_t
tag_size
)
{
return
GNUTLS_E_UNKNOWN_CIPHER_TYPE
;
}
static
int
compat_gnutls_cipher_add_auth
(
gnutls_cipher_hd_t
handle
,
const
void
*
ptext
,
size_t
ptext_size
)
{
{
return
GNUTLS_E_UNKNOWN_CIPHER_TYPE
;
return
GNUTLS_E_UNKNOWN_CIPHER_TYPE
;
}
}
...
@@ -115,6 +121,11 @@ static BOOL gnutls_initialize(void)
...
@@ -115,6 +121,11 @@ static BOOL gnutls_initialize(void)
WARN
(
"gnutls_cipher_tag not found
\n
"
);
WARN
(
"gnutls_cipher_tag not found
\n
"
);
pgnutls_cipher_tag
=
compat_gnutls_cipher_tag
;
pgnutls_cipher_tag
=
compat_gnutls_cipher_tag
;
}
}
if
(
!
(
pgnutls_cipher_add_auth
=
wine_dlsym
(
libgnutls_handle
,
"gnutls_cipher_add_auth"
,
NULL
,
0
)))
{
WARN
(
"gnutls_cipher_add_auth not found
\n
"
);
pgnutls_cipher_add_auth
=
compat_gnutls_cipher_add_auth
;
}
if
((
ret
=
pgnutls_global_init
())
!=
GNUTLS_E_SUCCESS
)
if
((
ret
=
pgnutls_global_init
())
!=
GNUTLS_E_SUCCESS
)
{
{
...
@@ -1022,6 +1033,19 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
...
@@ -1022,6 +1033,19 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
static
NTSTATUS
key_set_auth_data
(
struct
key
*
key
,
UCHAR
*
auth_data
,
ULONG
len
)
{
int
ret
;
if
((
ret
=
pgnutls_cipher_add_auth
(
key
->
handle
,
auth_data
,
len
)))
{
pgnutls_perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
}
return
STATUS_SUCCESS
;
}
static
NTSTATUS
key_encrypt
(
struct
key
*
key
,
const
UCHAR
*
input
,
ULONG
input_len
,
UCHAR
*
output
,
static
NTSTATUS
key_encrypt
(
struct
key
*
key
,
const
UCHAR
*
input
,
ULONG
input_len
,
UCHAR
*
output
,
ULONG
output_len
)
ULONG
output_len
)
{
{
...
@@ -1146,6 +1170,12 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
...
@@ -1146,6 +1170,12 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
static
NTSTATUS
key_set_auth_data
(
struct
key
*
key
,
UCHAR
*
auth_data
,
ULONG
len
)
{
FIXME
(
"not implemented on Mac
\n
"
);
return
STATUS_NOT_IMPLEMENTED
;
}
static
NTSTATUS
key_encrypt
(
struct
key
*
key
,
const
UCHAR
*
input
,
ULONG
input_len
,
UCHAR
*
output
,
static
NTSTATUS
key_encrypt
(
struct
key
*
key
,
const
UCHAR
*
input
,
ULONG
input_len
,
UCHAR
*
output
,
ULONG
output_len
)
ULONG
output_len
)
{
{
...
@@ -1213,6 +1243,12 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
...
@@ -1213,6 +1243,12 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
return
STATUS_NOT_IMPLEMENTED
;
return
STATUS_NOT_IMPLEMENTED
;
}
}
static
NTSTATUS
key_set_auth_data
(
struct
key
*
key
,
UCHAR
*
auth_data
,
ULONG
len
)
{
ERR
(
"support for keys not available at build time
\n
"
);
return
STATUS_NOT_IMPLEMENTED
;
}
static
NTSTATUS
key_encrypt
(
struct
key
*
key
,
const
UCHAR
*
input
,
ULONG
input_len
,
UCHAR
*
output
,
static
NTSTATUS
key_encrypt
(
struct
key
*
key
,
const
UCHAR
*
input
,
ULONG
input_len
,
UCHAR
*
output
,
ULONG
output_len
)
ULONG
output_len
)
{
{
...
@@ -1407,6 +1443,8 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
...
@@ -1407,6 +1443,8 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
if
(
!
output
)
return
STATUS_SUCCESS
;
if
(
!
output
)
return
STATUS_SUCCESS
;
if
(
output_len
<
*
ret_len
)
return
STATUS_BUFFER_TOO_SMALL
;
if
(
output_len
<
*
ret_len
)
return
STATUS_BUFFER_TOO_SMALL
;
if
(
auth_info
->
pbAuthData
&&
(
status
=
key_set_auth_data
(
key
,
auth_info
->
pbAuthData
,
auth_info
->
cbAuthData
)))
return
status
;
if
((
status
=
key_encrypt
(
key
,
input
,
input_len
,
output
,
output_len
)))
if
((
status
=
key_encrypt
(
key
,
input
,
input_len
,
output
,
output_len
)))
return
status
;
return
status
;
...
@@ -1484,6 +1522,8 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
...
@@ -1484,6 +1522,8 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
if
(
!
output
)
return
STATUS_SUCCESS
;
if
(
!
output
)
return
STATUS_SUCCESS
;
if
(
output_len
<
*
ret_len
)
return
STATUS_BUFFER_TOO_SMALL
;
if
(
output_len
<
*
ret_len
)
return
STATUS_BUFFER_TOO_SMALL
;
if
(
auth_info
->
pbAuthData
&&
(
status
=
key_set_auth_data
(
key
,
auth_info
->
pbAuthData
,
auth_info
->
cbAuthData
)))
return
status
;
if
((
status
=
key_decrypt
(
key
,
input
,
input_len
,
output
,
output_len
)))
if
((
status
=
key_decrypt
(
key
,
input
,
input_len
,
output
,
output_len
)))
return
status
;
return
status
;
...
...
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