* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62872
This commit is contained in:
Amine Khaldi 2014-04-22 11:36:10 +00:00
parent f9bca2bec5
commit 94b0b8778e
5 changed files with 53 additions and 8 deletions

View file

@ -12,5 +12,5 @@ list(APPEND SOURCE
add_library(bcrypt SHARED ${SOURCE})
set_module_type(bcrypt win32dll)
target_link_libraries(bcrypt wine)
add_importlibs(bcrypt msvcrt kernel32 ntdll)
add_importlibs(bcrypt advapi32 msvcrt kernel32 ntdll)
add_cd_file(TARGET bcrypt DESTINATION reactos/system32 FOR all)

View file

@ -24,7 +24,7 @@
@ stub BCryptFinalizeKeyPair
@ stub BCryptFinishHash
@ stub BCryptFreeBuffer
@ stub BCryptGenRandom
@ stdcall BCryptGenRandom(ptr ptr long long)
@ stub BCryptGenerateKeyPair
@ stub BCryptGenerateSymmetricKey
@ stub BCryptGetFipsAlgorithmMode

View file

@ -17,17 +17,17 @@
*
*/
#include <wine/config.h>
#include <ntstatus.h>
#define WIN32_NO_STATUS
#include <config.h>
//#include "wine/port.h"
#include <wine/debug.h>
#include <winbase.h>
#include <ntsecapi.h>
#include <bcrypt.h>
typedef LONG NTSTATUS;
WINE_DEFAULT_DEBUG_CHANNEL(bcrypt);
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
@ -52,5 +52,41 @@ NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG dwAlgOperations, ULONG *pAlgCount,
*ppAlgList=NULL;
*pAlgCount=0;
return ERROR_CALL_NOT_IMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE algorithm, UCHAR *buffer, ULONG count, ULONG flags)
{
const DWORD supported_flags = BCRYPT_USE_SYSTEM_PREFERRED_RNG;
TRACE("%p, %p, %u, %08x - semi-stub\n", algorithm, buffer, count, flags);
if (!algorithm)
{
/* It's valid to call without an algorithm if BCRYPT_USE_SYSTEM_PREFERRED_RNG
* is set. In this case the preferred system RNG is used.
*/
if (!(flags & BCRYPT_USE_SYSTEM_PREFERRED_RNG))
return STATUS_INVALID_HANDLE;
}
if (!buffer)
return STATUS_INVALID_PARAMETER;
if (flags & ~supported_flags)
FIXME("unsupported flags %08x\n", flags & ~supported_flags);
if (algorithm)
FIXME("ignoring selected algorithm\n");
/* When zero bytes are requested the function returns success too. */
if (!count)
return STATUS_SUCCESS;
if (flags & BCRYPT_USE_SYSTEM_PREFERRED_RNG)
{
if (RtlGenRandom(buffer, count))
return STATUS_SUCCESS;
}
FIXME("called with unsupported parameters, returning error\n");
return STATUS_NOT_IMPLEMENTED;
}

View file

@ -35,6 +35,10 @@
#define OPTIONAL
#endif
#ifndef _NTDEF_
typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
#endif
typedef struct _BCRYPT_ALGORITHM_IDENTIFIER
{
LPWSTR pszName;
@ -42,4 +46,9 @@ typedef struct _BCRYPT_ALGORITHM_IDENTIFIER
ULONG dwFlags;
} BCRYPT_ALGORITHM_IDENTIFIER;
typedef PVOID BCRYPT_ALG_HANDLE;
#define BCRYPT_RNG_USE_ENTROPY_IN_BUFFER 0x00000001
#define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002
#endif /* __WINE_BCRYPT_H */

View file

@ -55,7 +55,7 @@ reactos/dll/win32/atl # Synced to Wine-1.7.1
reactos/dll/win32/atl100 # Synced to Wine-1.7.1
reactos/dll/win32/atl80 # Synced to Wine-1.7.1
reactos/dll/win32/avifil32 # Synced to Wine-1.7.17
reactos/dll/win32/bcrypt # Synced to Wine-1.7.1
reactos/dll/win32/bcrypt # Synced to Wine-1.7.17
reactos/dll/win32/browseui # Out of sync
reactos/dll/win32/cabinet # Synced to Wine-1.7.1
reactos/dll/win32/clusapi # Synced to Wine-1.7.1