Author: akhaldi Date: Tue Apr 22 11:36:10 2014 New Revision: 62872
URL: http://svn.reactos.org/svn/reactos?rev=62872&view=rev Log: [BCRYPT] * Sync with Wine 1.7.17. CORE-8080
Modified: trunk/reactos/dll/win32/bcrypt/CMakeLists.txt trunk/reactos/dll/win32/bcrypt/bcrypt.spec trunk/reactos/dll/win32/bcrypt/bcrypt_main.c trunk/reactos/include/psdk/bcrypt.h trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/bcrypt/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/bcrypt/CMakeLists... ============================================================================== --- trunk/reactos/dll/win32/bcrypt/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/bcrypt/CMakeLists.txt [iso-8859-1] Tue Apr 22 11:36:10 2014 @@ -12,5 +12,5 @@ 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)
Modified: trunk/reactos/dll/win32/bcrypt/bcrypt.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/bcrypt/bcrypt.spe... ============================================================================== --- trunk/reactos/dll/win32/bcrypt/bcrypt.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/bcrypt/bcrypt.spec [iso-8859-1] Tue Apr 22 11:36:10 2014 @@ -24,7 +24,7 @@ @ stub BCryptFinalizeKeyPair @ stub BCryptFinishHash @ stub BCryptFreeBuffer -@ stub BCryptGenRandom +@ stdcall BCryptGenRandom(ptr ptr long long) @ stub BCryptGenerateKeyPair @ stub BCryptGenerateSymmetricKey @ stub BCryptGetFipsAlgorithmMode
Modified: trunk/reactos/dll/win32/bcrypt/bcrypt_main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/bcrypt/bcrypt_mai... ============================================================================== --- trunk/reactos/dll/win32/bcrypt/bcrypt_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/bcrypt/bcrypt_main.c [iso-8859-1] Tue Apr 22 11:36:10 2014 @@ -17,16 +17,16 @@ * */
+#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);
@@ -52,5 +52,41 @@ *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; +}
Modified: trunk/reactos/include/psdk/bcrypt.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/bcrypt.h?rev=6... ============================================================================== --- trunk/reactos/include/psdk/bcrypt.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/bcrypt.h [iso-8859-1] Tue Apr 22 11:36:10 2014 @@ -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 @@ 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 */
Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=6... ============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Apr 22 11:36:10 2014 @@ -55,7 +55,7 @@ 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