/* * Copyright 2009 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * */ #include #include #define WIN32_NO_STATUS #include #include #include #include WINE_DEFAULT_DEBUG_CHANNEL(bcrypt); BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) { TRACE("fdwReason %u\n", fdwReason); switch(fdwReason) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hInstDLL); break; } return TRUE; } NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG dwAlgOperations, ULONG *pAlgCount, BCRYPT_ALGORITHM_IDENTIFIER **ppAlgList, ULONG dwFlags) { FIXME("%08x, %p, %p, %08x - stub\n", dwAlgOperations, pAlgCount, ppAlgList, dwFlags); *ppAlgList=NULL; *pAlgCount=0; 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; }