[4/6] bcrypt: Implement BCryptDuplicateHash.
Sebastian Lackner
sebastian at fds-team.de
Fri Mar 10 08:35:14 CST 2017
From: Michael Müller <michael at fds-team.de>
Signed-off-by: Michael Müller <michael at fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---
dlls/bcrypt/bcrypt.spec | 2 +-
dlls/bcrypt/bcrypt_main.c | 21 +++++++++++++++++++++
dlls/ncrypt/ncrypt.spec | 2 +-
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec
index e299fe0cce8..a1cce4423dc 100644
--- a/dlls/bcrypt/bcrypt.spec
+++ b/dlls/bcrypt/bcrypt.spec
@@ -11,7 +11,7 @@
@ stdcall BCryptDestroyHash(ptr)
@ stub BCryptDestroyKey
@ stub BCryptDestroySecret
-@ stub BCryptDuplicateHash
+@ stdcall BCryptDuplicateHash(ptr ptr ptr long long)
@ stub BCryptDuplicateKey
@ stub BCryptEncrypt
@ stdcall BCryptEnumAlgorithms(long ptr ptr long)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index 561b45957c8..1d24231453d 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -536,6 +536,27 @@ end:
return STATUS_SUCCESS;
}
+NTSTATUS WINAPI BCryptDuplicateHash( BCRYPT_HASH_HANDLE handle, BCRYPT_HASH_HANDLE *handle_copy,
+ UCHAR *object, ULONG objectlen, ULONG flags )
+{
+ struct hash *hash_orig = handle;
+ struct hash *hash_copy;
+
+ TRACE( "%p, %p, %p, %u, %u\n", handle, handle_copy, object, objectlen, flags );
+
+ if (!hash_orig || hash_orig->hdr.magic != MAGIC_HASH) return STATUS_INVALID_HANDLE;
+ if (!handle_copy) return STATUS_INVALID_PARAMETER;
+ if (object) FIXME( "ignoring object buffer\n" );
+
+ if (!(hash_copy = HeapAlloc( GetProcessHeap(), 0, sizeof(*hash_copy) )))
+ return STATUS_NO_MEMORY;
+
+ memcpy( hash_copy, hash_orig, sizeof(*hash_orig) );
+
+ *handle_copy = hash_copy;
+ return STATUS_SUCCESS;
+}
+
NTSTATUS WINAPI BCryptDestroyHash( BCRYPT_HASH_HANDLE handle )
{
struct hash *hash = handle;
diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec
index 04127608d68..6e871a5d6b8 100644
--- a/dlls/ncrypt/ncrypt.spec
+++ b/dlls/ncrypt/ncrypt.spec
@@ -13,7 +13,7 @@
@ stdcall BCryptDestroyHash(ptr) bcrypt.BCryptDestroyHash
@ stub BCryptDestroyKey
@ stub BCryptDestroySecret
-@ stub BCryptDuplicateHash
+@ stdcall BCryptDuplicateHash(ptr ptr ptr long long) bcrypt.BCryptDuplicateHash
@ stub BCryptDuplicateKey
@ stub BCryptEncrypt
@ stdcall BCryptEnumAlgorithms(long ptr ptr long) bcrypt.BCryptEnumAlgorithms
--
2.11.0
More information about the wine-patches
mailing list