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
b8ada902
Commit
b8ada902
authored
Sep 29, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Move setting a symmetric key vector to the generic code.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
54c1b0ac
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
47 deletions
+33
-47
bcrypt_internal.h
dlls/bcrypt/bcrypt_internal.h
+1
-4
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+20
-2
gnutls.c
dlls/bcrypt/gnutls.c
+5
-20
macos.c
dlls/bcrypt/macos.c
+7
-21
No files found.
dlls/bcrypt/bcrypt_internal.h
View file @
b8ada902
...
@@ -257,7 +257,7 @@ NTSTATUS get_alg_property( const struct algorithm *, const WCHAR *, UCHAR *, ULO
...
@@ -257,7 +257,7 @@ NTSTATUS get_alg_property( const struct algorithm *, const WCHAR *, UCHAR *, ULO
NTSTATUS
key_set_property
(
struct
key
*
,
const
WCHAR
*
,
UCHAR
*
,
ULONG
,
ULONG
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_set_property
(
struct
key
*
,
const
WCHAR
*
,
UCHAR
*
,
ULONG
,
ULONG
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_symmetric_init
(
struct
key
*
,
struct
algorithm
*
,
const
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_symmetric_init
(
struct
key
*
,
struct
algorithm
*
,
const
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_symmetric_set_vector
(
struct
key
*
,
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
void
key_symmetric_vector_reset
(
struct
key
*
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_symmetric_set_auth_data
(
struct
key
*
,
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_symmetric_set_auth_data
(
struct
key
*
,
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_symmetric_encrypt
(
struct
key
*
,
const
UCHAR
*
,
ULONG
,
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_symmetric_encrypt
(
struct
key
*
,
const
UCHAR
*
,
ULONG
,
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_symmetric_decrypt
(
struct
key
*
,
const
UCHAR
*
,
ULONG
,
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_symmetric_decrypt
(
struct
key
*
,
const
UCHAR
*
,
ULONG
,
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
...
@@ -273,9 +273,6 @@ NTSTATUS key_export_ecc( struct key *, UCHAR *, ULONG, ULONG * ) DECLSPEC_HIDDEN
...
@@ -273,9 +273,6 @@ NTSTATUS key_export_ecc( struct key *, UCHAR *, ULONG, ULONG * ) DECLSPEC_HIDDEN
NTSTATUS
key_import_dsa_capi
(
struct
key
*
,
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_import_dsa_capi
(
struct
key
*
,
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_import_ecc
(
struct
key
*
,
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
NTSTATUS
key_import_ecc
(
struct
key
*
,
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
BOOL
is_zero_vector
(
const
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
BOOL
is_equal_vector
(
const
UCHAR
*
,
ULONG
,
const
UCHAR
*
,
ULONG
)
DECLSPEC_HIDDEN
;
BOOL
gnutls_initialize
(
void
)
DECLSPEC_HIDDEN
;
BOOL
gnutls_initialize
(
void
)
DECLSPEC_HIDDEN
;
void
gnutls_uninitialize
(
void
)
DECLSPEC_HIDDEN
;
void
gnutls_uninitialize
(
void
)
DECLSPEC_HIDDEN
;
...
...
dlls/bcrypt/bcrypt_main.c
View file @
b8ada902
...
@@ -891,7 +891,7 @@ BOOL key_is_symmetric( struct key *key )
...
@@ -891,7 +891,7 @@ BOOL key_is_symmetric( struct key *key )
return
builtin_algorithms
[
key
->
alg_id
].
class
==
BCRYPT_CIPHER_INTERFACE
;
return
builtin_algorithms
[
key
->
alg_id
].
class
==
BCRYPT_CIPHER_INTERFACE
;
}
}
BOOL
is_zero_vector
(
const
UCHAR
*
vector
,
ULONG
len
)
static
BOOL
is_zero_vector
(
const
UCHAR
*
vector
,
ULONG
len
)
{
{
ULONG
i
;
ULONG
i
;
if
(
!
vector
)
return
FALSE
;
if
(
!
vector
)
return
FALSE
;
...
@@ -899,13 +899,31 @@ BOOL is_zero_vector( const UCHAR *vector, ULONG len )
...
@@ -899,13 +899,31 @@ BOOL is_zero_vector( const UCHAR *vector, ULONG len )
return
TRUE
;
return
TRUE
;
}
}
BOOL
is_equal_vector
(
const
UCHAR
*
vector
,
ULONG
len
,
const
UCHAR
*
vector2
,
ULONG
len2
)
static
BOOL
is_equal_vector
(
const
UCHAR
*
vector
,
ULONG
len
,
const
UCHAR
*
vector2
,
ULONG
len2
)
{
{
if
(
!
vector
&&
!
vector2
)
return
TRUE
;
if
(
!
vector
&&
!
vector2
)
return
TRUE
;
if
(
len
!=
len2
)
return
FALSE
;
if
(
len
!=
len2
)
return
FALSE
;
return
!
memcmp
(
vector
,
vector2
,
len
);
return
!
memcmp
(
vector
,
vector2
,
len
);
}
}
static
NTSTATUS
key_symmetric_set_vector
(
struct
key
*
key
,
UCHAR
*
vector
,
ULONG
vector_len
)
{
BOOL
needs_reset
=
(
!
is_zero_vector
(
vector
,
vector_len
)
||
!
is_equal_vector
(
key
->
u
.
s
.
vector
,
key
->
u
.
s
.
vector_len
,
vector
,
vector_len
));
heap_free
(
key
->
u
.
s
.
vector
);
key
->
u
.
s
.
vector
=
NULL
;
key
->
u
.
s
.
vector_len
=
0
;
if
(
vector
)
{
if
(
!
(
key
->
u
.
s
.
vector
=
heap_alloc
(
vector_len
)))
return
STATUS_NO_MEMORY
;
memcpy
(
key
->
u
.
s
.
vector
,
vector
,
vector_len
);
key
->
u
.
s
.
vector_len
=
vector_len
;
}
if
(
needs_reset
)
key_symmetric_vector_reset
(
key
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
key_import
(
BCRYPT_ALG_HANDLE
algorithm
,
const
WCHAR
*
type
,
BCRYPT_KEY_HANDLE
*
key
,
UCHAR
*
object
,
static
NTSTATUS
key_import
(
BCRYPT_ALG_HANDLE
algorithm
,
const
WCHAR
*
type
,
BCRYPT_KEY_HANDLE
*
key
,
UCHAR
*
object
,
ULONG
object_len
,
UCHAR
*
input
,
ULONG
input_len
)
ULONG
object_len
,
UCHAR
*
input
,
ULONG
input_len
)
{
{
...
...
dlls/bcrypt/gnutls.c
View file @
b8ada902
...
@@ -520,27 +520,12 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
...
@@ -520,27 +520,12 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
}
}
}
}
NTSTATUS
key_symmetric_set_vector
(
struct
key
*
key
,
UCHAR
*
vector
,
ULONG
vector_len
)
void
key_symmetric_vector_reset
(
struct
key
*
key
)
{
{
if
(
key
->
u
.
s
.
handle
&&
(
!
is_zero_vector
(
vector
,
vector_len
)
||
if
(
!
key
->
u
.
s
.
handle
)
return
;
!
is_equal_vector
(
key
->
u
.
s
.
vector
,
key
->
u
.
s
.
vector_len
,
vector
,
vector_len
)))
TRACE
(
"invalidating cipher handle
\n
"
);
{
pgnutls_cipher_deinit
(
key
->
u
.
s
.
handle
);
TRACE
(
"invalidating cipher handle
\n
"
);
key
->
u
.
s
.
handle
=
NULL
;
pgnutls_cipher_deinit
(
key
->
u
.
s
.
handle
);
key
->
u
.
s
.
handle
=
NULL
;
}
heap_free
(
key
->
u
.
s
.
vector
);
key
->
u
.
s
.
vector
=
NULL
;
key
->
u
.
s
.
vector_len
=
0
;
if
(
vector
)
{
if
(
!
(
key
->
u
.
s
.
vector
=
heap_alloc
(
vector_len
)))
return
STATUS_NO_MEMORY
;
memcpy
(
key
->
u
.
s
.
vector
,
vector
,
vector_len
);
key
->
u
.
s
.
vector_len
=
vector_len
;
}
return
STATUS_SUCCESS
;
}
}
static
NTSTATUS
init_cipher_handle
(
struct
key
*
key
)
static
NTSTATUS
init_cipher_handle
(
struct
key
*
key
)
...
...
dlls/bcrypt/macos.c
View file @
b8ada902
...
@@ -123,30 +123,16 @@ static CCMode get_cryptor_mode( struct key *key )
...
@@ -123,30 +123,16 @@ static CCMode get_cryptor_mode( struct key *key )
}
}
}
}
NTSTATUS
key_symmetric_set_vector
(
struct
key
*
key
,
UCHAR
*
vector
,
ULONG
vector_len
)
void
key_symmetric_vector_reset
(
struct
key
*
key
)
{
{
if
(
key
->
u
.
s
.
ref_encrypt
&&
(
!
is_zero_vector
(
vector
,
vector_len
)
||
if
(
!
key
->
u
.
s
.
ref_encrypt
)
return
;
!
is_equal_vector
(
key
->
u
.
s
.
vector
,
key
->
u
.
s
.
vector_len
,
vector
,
vector_len
)))
{
TRACE
(
"invalidating cryptor handles
\n
"
);
CCCryptorRelease
(
key
->
u
.
s
.
ref_encrypt
);
key
->
u
.
s
.
ref_encrypt
=
NULL
;
CCCryptorRelease
(
key
->
u
.
s
.
ref_decrypt
);
key
->
u
.
s
.
ref_decrypt
=
NULL
;
}
heap_free
(
key
->
u
.
s
.
vector
);
TRACE
(
"invalidating cryptor handles
\n
"
);
key
->
u
.
s
.
vector
=
NULL
;
CCCryptorRelease
(
key
->
u
.
s
.
ref_encrypt
);
key
->
u
.
s
.
vector_len
=
0
;
key
->
u
.
s
.
ref_encrypt
=
NULL
;
if
(
vector
)
{
if
(
!
(
key
->
u
.
s
.
vector
=
heap_alloc
(
vector_len
)))
return
STATUS_NO_MEMORY
;
memcpy
(
key
->
u
.
s
.
vector
,
vector
,
vector_len
);
key
->
u
.
s
.
vector_len
=
vector_len
;
}
return
STATUS_SUCCESS
;
CCCryptorRelease
(
key
->
u
.
s
.
ref_decrypt
);
key
->
u
.
s
.
ref_decrypt
=
NULL
;
}
}
static
NTSTATUS
init_cryptor_handles
(
struct
key
*
key
)
static
NTSTATUS
init_cryptor_handles
(
struct
key
*
key
)
...
...
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