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
cb0a960f
Commit
cb0a960f
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: Implement BCryptDuplicateKey.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
bf9ed469
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
2 deletions
+51
-2
bcrypt.spec
dlls/bcrypt/bcrypt.spec
+1
-1
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+49
-0
ncrypt.spec
dlls/ncrypt/ncrypt.spec
+1
-1
No files found.
dlls/bcrypt/bcrypt.spec
View file @
cb0a960f
...
...
@@ -12,7 +12,7 @@
@ stdcall BCryptDestroyKey(ptr)
@ stub BCryptDestroySecret
@ stdcall BCryptDuplicateHash(ptr ptr ptr long long)
@ st
ub BCryptDuplicateKey
@ st
dcall BCryptDuplicateKey(ptr ptr ptr long long)
@ stdcall BCryptEncrypt(ptr ptr long ptr ptr long ptr long ptr long)
@ stdcall BCryptEnumAlgorithms(long ptr ptr long)
@ stub BCryptEnumContextFunctionProviders
...
...
dlls/bcrypt/bcrypt_main.c
View file @
cb0a960f
...
...
@@ -876,6 +876,7 @@ static ULONG get_block_size( struct algorithm *alg )
get_alg_property
(
alg
,
BCRYPT_BLOCK_LENGTH
,
(
UCHAR
*
)
&
ret
,
sizeof
(
ret
),
&
size
);
return
ret
;
}
static
NTSTATUS
key_export
(
struct
key
*
key
,
const
WCHAR
*
type
,
UCHAR
*
output
,
ULONG
output_len
,
ULONG
*
size
)
{
if
(
!
strcmpW
(
type
,
BCRYPT_KEY_DATA_BLOB
))
...
...
@@ -896,6 +897,24 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U
FIXME
(
"unsupported key type %s
\n
"
,
debugstr_w
(
type
)
);
return
STATUS_NOT_IMPLEMENTED
;
}
static
NTSTATUS
key_duplicate
(
struct
key
*
key_orig
,
struct
key
*
key_copy
)
{
UCHAR
*
buffer
;
if
(
!
(
buffer
=
heap_alloc
(
key_orig
->
secret_len
)))
return
STATUS_NO_MEMORY
;
memcpy
(
buffer
,
key_orig
->
secret
,
key_orig
->
secret_len
);
memset
(
key_copy
,
0
,
sizeof
(
*
key_copy
)
);
key_copy
->
hdr
=
key_orig
->
hdr
;
key_copy
->
alg_id
=
key_orig
->
alg_id
;
key_copy
->
mode
=
key_orig
->
mode
;
key_copy
->
block_size
=
key_orig
->
block_size
;
key_copy
->
secret
=
buffer
;
key_copy
->
secret_len
=
key_orig
->
secret_len
;
return
STATUS_SUCCESS
;
}
#endif
#if defined(HAVE_GNUTLS_CIPHER_INIT) && !defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H)
...
...
@@ -1182,6 +1201,12 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val
return
STATUS_NOT_IMPLEMENTED
;
}
static
NTSTATUS
key_duplicate
(
struct
key
*
key_orig
,
struct
key
*
key_copy
)
{
ERR
(
"support for keys not available at build time
\n
"
);
return
STATUS_NOT_IMPLEMENTED
;
}
static
NTSTATUS
key_set_params
(
struct
key
*
key
,
UCHAR
*
iv
,
ULONG
iv_len
)
{
ERR
(
"support for keys not available at build time
\n
"
);
...
...
@@ -1310,6 +1335,30 @@ NTSTATUS WINAPI BCryptExportKey(BCRYPT_KEY_HANDLE export_key, BCRYPT_KEY_HANDLE
return
key_export
(
key
,
type
,
output
,
output_len
,
size
);
}
NTSTATUS
WINAPI
BCryptDuplicateKey
(
BCRYPT_KEY_HANDLE
handle
,
BCRYPT_KEY_HANDLE
*
handle_copy
,
UCHAR
*
object
,
ULONG
object_len
,
ULONG
flags
)
{
struct
key
*
key_orig
=
handle
;
struct
key
*
key_copy
;
NTSTATUS
status
;
TRACE
(
"%p, %p, %p, %u, %08x
\n
"
,
handle
,
handle_copy
,
object
,
object_len
,
flags
);
if
(
object
)
FIXME
(
"ignoring object buffer
\n
"
);
if
(
!
key_orig
||
key_orig
->
hdr
.
magic
!=
MAGIC_KEY
)
return
STATUS_INVALID_HANDLE
;
if
(
!
handle_copy
)
return
STATUS_INVALID_PARAMETER
;
if
(
!
(
key_copy
=
heap_alloc
(
sizeof
(
*
key_copy
)
)))
return
STATUS_NO_MEMORY
;
if
((
status
=
key_duplicate
(
key_orig
,
key_copy
)))
{
heap_free
(
key_copy
);
return
status
;
}
*
handle_copy
=
key_copy
;
return
STATUS_SUCCESS
;
}
NTSTATUS
WINAPI
BCryptDestroyKey
(
BCRYPT_KEY_HANDLE
handle
)
{
struct
key
*
key
=
handle
;
...
...
dlls/ncrypt/ncrypt.spec
View file @
cb0a960f
...
...
@@ -14,7 +14,7 @@
@ stdcall BCryptDestroyKey(ptr) bcrypt.BCryptDestroyKey
@ stub BCryptDestroySecret
@ stdcall BCryptDuplicateHash(ptr ptr ptr long long) bcrypt.BCryptDuplicateHash
@ st
ub
BCryptDuplicateKey
@ st
dcall BCryptDuplicateKey(ptr ptr ptr long long) bcrypt.
BCryptDuplicateKey
@ stdcall BCryptEncrypt(ptr ptr long ptr ptr long ptr long ptr long) bcrypt.BCryptEncrypt
@ stdcall BCryptEnumAlgorithms(long ptr ptr long) bcrypt.BCryptEnumAlgorithms
@ stub BCryptEnumContextFunctionProviders
...
...
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