From aff69d94c931851302d870316b05772193568e29 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 5 Feb 2019 10:00:26 +1100 Subject: [PATCH 1/2] bcrypt: Add BCryptDestroySecret/BCryptSecretAgreement stubs --- dlls/bcrypt/bcrypt.spec | 4 ++-- dlls/bcrypt/bcrypt_main.c | 16 ++++++++++++++++ dlls/ncrypt/ncrypt.spec | 4 ++-- include/bcrypt.h | 3 +++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec index 052a099..dfe08e7 100644 --- a/dlls/bcrypt/bcrypt.spec +++ b/dlls/bcrypt/bcrypt.spec @@ -11,7 +11,7 @@ @ stdcall BCryptDeriveKeyPBKDF2(ptr ptr long ptr long int64 ptr long long) @ stdcall BCryptDestroyHash(ptr) @ stdcall BCryptDestroyKey(ptr) -@ stub BCryptDestroySecret +@ stdcall BCryptDestroySecret(ptr) @ stdcall BCryptDuplicateHash(ptr ptr ptr long long) @ stdcall BCryptDuplicateKey(ptr ptr ptr long long) @ stdcall BCryptEncrypt(ptr ptr long ptr ptr long ptr long ptr long) @@ -44,7 +44,7 @@ @ stdcall BCryptRemoveContextFunction(long wstr long wstr) @ stdcall BCryptRemoveContextFunctionProvider(long wstr long wstr wstr) @ stub BCryptResolveProviders -@ stub BCryptSecretAgreement +@ stdcall BCryptSecretAgreement(ptr ptr ptr long) @ stub BCryptSetAuditingInterface @ stub BCryptSetContextFunctionProperty @ stdcall BCryptSetProperty(ptr wstr ptr long long) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index b9c51a1..18783f0 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -1580,6 +1580,22 @@ NTSTATUS WINAPI BCryptDeriveKeyPBKDF2( BCRYPT_ALG_HANDLE handle, UCHAR *pwd, ULO return STATUS_SUCCESS; } +NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE key, BCRYPT_SECRET_HANDLE *secret, ULONG flags) +{ + FIXME( "%p, %p, %p, %08x\n", handle, key, secret, flags ); + + if(secret) + *secret = (BCRYPT_SECRET_HANDLE *)0xDEADFEED; + + return STATUS_SUCCESS; +} + +NTSTATUS WINAPI BCryptDestroySecret(BCRYPT_SECRET_HANDLE secret) +{ + FIXME( "%p\n", secret ); + return STATUS_SUCCESS; +} + BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) { switch (reason) diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec index 85fa5c0..d4a32ed 100644 --- a/dlls/ncrypt/ncrypt.spec +++ b/dlls/ncrypt/ncrypt.spec @@ -12,7 +12,7 @@ @ stdcall BCryptDeriveKeyPBKDF2(ptr ptr long ptr long int64 ptr long long) bcrypt.BCryptDeriveKeyPBKDF2 @ stdcall BCryptDestroyHash(ptr) bcrypt.BCryptDestroyHash @ stdcall BCryptDestroyKey(ptr) bcrypt.BCryptDestroyKey -@ stub BCryptDestroySecret +@ stdcall BCryptDestroySecret(ptr) bcrypt.BCryptDestroySecret @ stdcall BCryptDuplicateHash(ptr ptr ptr long long) bcrypt.BCryptDuplicateHash @ stdcall BCryptDuplicateKey(ptr ptr ptr long long) bcrypt.BCryptDuplicateKey @ stdcall BCryptEncrypt(ptr ptr long ptr ptr long ptr long ptr long) bcrypt.BCryptEncrypt @@ -46,7 +46,7 @@ @ stdcall BCryptRemoveContextFunction(long wstr long wstr) bcrypt.BCryptRemoveContextFunction @ stdcall BCryptRemoveContextFunctionProvider(long wstr long wstr wstr) bcrypt.BCryptRemoveContextFunctionProvider @ stub BCryptResolveProviders -@ stub BCryptSecretAgreement +@ stdcall BCryptSecretAgreement(ptr ptr ptr long) bcrypt.BCryptSecretAgreement @ stub BCryptSetAuditingInterface @ stub BCryptSetContextFunctionProperty @ stdcall BCryptSetProperty(ptr wstr ptr long long) bcrypt.BCryptSetProperty diff --git a/include/bcrypt.h b/include/bcrypt.h index a0b0d52..f0185d1 100644 --- a/include/bcrypt.h +++ b/include/bcrypt.h @@ -211,6 +211,7 @@ typedef PVOID BCRYPT_ALG_HANDLE; typedef PVOID BCRYPT_KEY_HANDLE; typedef PVOID BCRYPT_HANDLE; typedef PVOID BCRYPT_HASH_HANDLE; +typedef PVOID BCRYPT_SECRET_HANDLE; /* Flags for BCryptGenRandom */ #define BCRYPT_RNG_USE_ENTROPY_IN_BUFFER 0x00000001 @@ -231,6 +232,7 @@ NTSTATUS WINAPI BCryptDecrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, 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); +NTSTATUS WINAPI BCryptDestroySecret(BCRYPT_SECRET_HANDLE); NTSTATUS WINAPI BCryptDuplicateHash(BCRYPT_HASH_HANDLE, BCRYPT_HASH_HANDLE *, UCHAR *, ULONG, ULONG); NTSTATUS WINAPI BCryptEncrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG); NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG, ULONG *, BCRYPT_ALGORITHM_IDENTIFIER **, ULONG); @@ -245,6 +247,7 @@ NTSTATUS WINAPI BCryptHash(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, PUCH NTSTATUS WINAPI BCryptHashData(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); NTSTATUS WINAPI BCryptImportKeyPair(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *, UCHAR *, ULONG, ULONG); NTSTATUS WINAPI BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE *, LPCWSTR, LPCWSTR, ULONG); +NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE, BCRYPT_SECRET_HANDLE *, ULONG); NTSTATUS WINAPI BCryptSetProperty(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG); NTSTATUS WINAPI BCryptVerifySignature(BCRYPT_KEY_HANDLE, void *, UCHAR *, ULONG, UCHAR *, ULONG, ULONG); -- 1.9.1