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
25 #define WIN32_NO_STATUS
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(bcrypt
);
34 NTSTATUS WINAPI
BCryptEnumAlgorithms(ULONG dwAlgOperations
, ULONG
*pAlgCount
,
35 BCRYPT_ALGORITHM_IDENTIFIER
**ppAlgList
, ULONG dwFlags
)
37 FIXME("%08x, %p, %p, %08x - stub\n", dwAlgOperations
, pAlgCount
, ppAlgList
, dwFlags
);
42 return STATUS_NOT_IMPLEMENTED
;
45 NTSTATUS WINAPI
BCryptGenRandom(BCRYPT_ALG_HANDLE algorithm
, UCHAR
*buffer
, ULONG count
, ULONG flags
)
47 const DWORD supported_flags
= BCRYPT_USE_SYSTEM_PREFERRED_RNG
;
48 TRACE("%p, %p, %u, %08x - semi-stub\n", algorithm
, buffer
, count
, flags
);
52 /* It's valid to call without an algorithm if BCRYPT_USE_SYSTEM_PREFERRED_RNG
53 * is set. In this case the preferred system RNG is used.
55 if (!(flags
& BCRYPT_USE_SYSTEM_PREFERRED_RNG
))
56 return STATUS_INVALID_HANDLE
;
59 return STATUS_INVALID_PARAMETER
;
61 if (flags
& ~supported_flags
)
62 FIXME("unsupported flags %08x\n", flags
& ~supported_flags
);
65 FIXME("ignoring selected algorithm\n");
67 /* When zero bytes are requested the function returns success too. */
69 return STATUS_SUCCESS
;
71 if (flags
& BCRYPT_USE_SYSTEM_PREFERRED_RNG
)
73 if (RtlGenRandom(buffer
, count
))
74 return STATUS_SUCCESS
;
77 FIXME("called with unsupported parameters, returning error\n");
78 return STATUS_NOT_IMPLEMENTED
;
81 NTSTATUS WINAPI
BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE
*algorithm
, LPCWSTR algorithmId
,
82 LPCWSTR implementation
, DWORD flags
)
84 FIXME("%p, %s, %s, %08x - stub\n", algorithm
, wine_dbgstr_w(algorithmId
), wine_dbgstr_w(implementation
), flags
);
87 return STATUS_INVALID_PARAMETER
;
91 return STATUS_NOT_IMPLEMENTED
;
94 NTSTATUS WINAPI
BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE algorithm
, DWORD flags
)
96 FIXME("%p, %08x - stub\n", algorithm
, flags
);
98 return STATUS_NOT_IMPLEMENTED
;
101 NTSTATUS WINAPI
BCryptGetFipsAlgorithmMode(BOOLEAN
*enabled
)
103 FIXME("%p - semi-stub\n", enabled
);
106 return STATUS_INVALID_PARAMETER
;
109 return STATUS_SUCCESS
;
112 NTSTATUS WINAPI
BCryptGetProperty(BCRYPT_HANDLE obj
, LPCWSTR prop
, UCHAR
*buffer
, ULONG count
, ULONG
*res
, ULONG flags
)
114 FIXME("%p, %s, %p, %u, %p, %08x - stub\n", obj
, wine_dbgstr_w(prop
), buffer
, count
, res
, flags
);
116 return STATUS_NOT_IMPLEMENTED
;