2 * Copyright 2009 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include <wine/config.h>
23 #define WIN32_NO_STATUS
25 #include <wine/debug.h>
31 WINE_DEFAULT_DEBUG_CHANNEL(bcrypt
);
33 NTSTATUS WINAPI
BCryptEnumAlgorithms(ULONG dwAlgOperations
, ULONG
*pAlgCount
,
34 BCRYPT_ALGORITHM_IDENTIFIER
**ppAlgList
, ULONG dwFlags
)
36 FIXME("%08x, %p, %p, %08x - stub\n", dwAlgOperations
, pAlgCount
, ppAlgList
, dwFlags
);
41 return STATUS_NOT_IMPLEMENTED
;
44 NTSTATUS WINAPI
BCryptGenRandom(BCRYPT_ALG_HANDLE algorithm
, UCHAR
*buffer
, ULONG count
, ULONG flags
)
46 const DWORD supported_flags
= BCRYPT_USE_SYSTEM_PREFERRED_RNG
;
47 TRACE("%p, %p, %u, %08x - semi-stub\n", algorithm
, buffer
, count
, flags
);
51 /* It's valid to call without an algorithm if BCRYPT_USE_SYSTEM_PREFERRED_RNG
52 * is set. In this case the preferred system RNG is used.
54 if (!(flags
& BCRYPT_USE_SYSTEM_PREFERRED_RNG
))
55 return STATUS_INVALID_HANDLE
;
58 return STATUS_INVALID_PARAMETER
;
60 if (flags
& ~supported_flags
)
61 FIXME("unsupported flags %08x\n", flags
& ~supported_flags
);
64 FIXME("ignoring selected algorithm\n");
66 /* When zero bytes are requested the function returns success too. */
68 return STATUS_SUCCESS
;
70 if (flags
& BCRYPT_USE_SYSTEM_PREFERRED_RNG
)
72 if (RtlGenRandom(buffer
, count
))
73 return STATUS_SUCCESS
;
76 FIXME("called with unsupported parameters, returning error\n");
77 return STATUS_NOT_IMPLEMENTED
;
80 NTSTATUS WINAPI
BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE
*algorithm
, LPCWSTR algorithmId
,
81 LPCWSTR implementation
, DWORD flags
)
83 FIXME("%p, %s, %s, %08x - stub\n", algorithm
, wine_dbgstr_w(algorithmId
), wine_dbgstr_w(implementation
), flags
);
86 return STATUS_INVALID_PARAMETER
;
90 return STATUS_NOT_IMPLEMENTED
;
93 NTSTATUS WINAPI
BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE algorithm
, DWORD flags
)
95 FIXME("%p, %08x - stub\n", algorithm
, flags
);
97 return STATUS_NOT_IMPLEMENTED
;
100 NTSTATUS WINAPI
BCryptGetFipsAlgorithmMode(BOOLEAN
*enabled
)
102 FIXME("%p - semi-stub\n", enabled
);
105 return STATUS_INVALID_PARAMETER
;
108 return STATUS_SUCCESS
;