From eb615ea0cbe46e156a7840ad072607c2e7609732 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 28 May 2019 03:32:57 +0000 Subject: [PATCH] bcrypt: Add BCryptDeriveKey stub. Signed-off-by: Alistair Leslie-Hughes Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/bcrypt/bcrypt.spec | 2 +- dlls/bcrypt/bcrypt_main.c | 7 +++++++ dlls/ncrypt/ncrypt.spec | 2 +- include/bcrypt.h | 15 +++++++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec index dfe08e758d2..4946ee5d794 100644 --- a/dlls/bcrypt/bcrypt.spec +++ b/dlls/bcrypt/bcrypt.spec @@ -7,7 +7,7 @@ @ stdcall BCryptCreateHash(ptr ptr ptr long ptr long long) @ stdcall BCryptDecrypt(ptr ptr long ptr ptr long ptr long ptr long) @ stub BCryptDeleteContext -@ stub BCryptDeriveKey +@ stdcall BCryptDeriveKey(ptr wstr ptr ptr long ptr long) @ stdcall BCryptDeriveKeyPBKDF2(ptr ptr long ptr long int64 ptr long long) @ stdcall BCryptDestroyHash(ptr) @ stdcall BCryptDestroyKey(ptr) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index 18783f00880..399626d19be 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -1596,6 +1596,13 @@ NTSTATUS WINAPI BCryptDestroySecret(BCRYPT_SECRET_HANDLE secret) return STATUS_SUCCESS; } +NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE secret, LPCWSTR kdf, BCryptBufferDesc *parameter, + PUCHAR derived, ULONG derived_size, ULONG *result, ULONG flags) +{ + FIXME( "%p, %s, %p, %p, %d, %p, %08x\n", secret, debugstr_w(kdf), parameter, derived, derived_size, result, flags ); + return STATUS_INTERNAL_ERROR; +} + BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) { switch (reason) diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec index d4a32ed8ed6..d35f8a93167 100644 --- a/dlls/ncrypt/ncrypt.spec +++ b/dlls/ncrypt/ncrypt.spec @@ -7,7 +7,7 @@ @ stdcall BCryptCreateHash(ptr ptr ptr long ptr long long) bcrypt.BCryptCreateHash @ stdcall BCryptDecrypt(ptr ptr long ptr ptr long ptr long ptr long) bcrypt.BCryptDecrypt @ stub BCryptDeleteContext -@ stub BCryptDeriveKey +@ stdcall BCryptDeriveKey(ptr wstr ptr ptr long ptr long) bcrypt.BCryptDeriveKey @ stub BCryptDeriveKeyCapi @ stdcall BCryptDeriveKeyPBKDF2(ptr ptr long ptr long int64 ptr long long) bcrypt.BCryptDeriveKeyPBKDF2 @ stdcall BCryptDestroyHash(ptr) bcrypt.BCryptDestroyHash diff --git a/include/bcrypt.h b/include/bcrypt.h index f0185d14fec..b1799d0a848 100644 --- a/include/bcrypt.h +++ b/include/bcrypt.h @@ -204,6 +204,20 @@ typedef struct _BCRYPT_KEY_DATA_BLOB_HEADER ULONG cbKeyData; } BCRYPT_KEY_DATA_BLOB_HEADER, *PBCRYPT_KEY_DATA_BLOB_HEADER; +typedef struct _BCryptBuffer +{ + ULONG cbBuffer; + ULONG BufferType; + void *pvBuffer; +} BCryptBuffer, *PBCryptBuffer; + +typedef struct _BCryptBufferDesc +{ + ULONG ulVersion; + ULONG cBuffers; + PBCryptBuffer pBuffers; +} BCryptBufferDesc, *PBCryptBufferDesc; + #define BCRYPT_KEY_DATA_BLOB_MAGIC 0x4d42444b #define BCRYPT_KEY_DATA_BLOB_VERSION1 1 @@ -229,6 +243,7 @@ typedef PVOID BCRYPT_SECRET_HANDLE; NTSTATUS WINAPI BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE, ULONG); NTSTATUS WINAPI BCryptCreateHash(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG); NTSTATUS WINAPI BCryptDecrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG); +NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE, LPCWSTR, BCryptBufferDesc*, PUCHAR, ULONG, ULONG *, ULONG); NTSTATUS WINAPI BCryptDeriveKeyPBKDF2(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, ULONGLONG, PUCHAR, ULONG, ULONG); NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE); NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE);