winex11: Move common code out of the export functions and simplify their usage.
[wine.git] / include / bcrypt.h
blobc521bcc8ce4ba2f4c04c8ef8b6e39451a1dbe1d1
1 /*
2 * Copyright (C) 2007 Francois Gouget
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
19 #ifndef __WINE_BCRYPT_H
20 #define __WINE_BCRYPT_H
22 #ifndef WINAPI
23 #define WINAPI __stdcall
24 #endif
26 #ifndef IN
27 #define IN
28 #endif
30 #ifndef OUT
31 #define OUT
32 #endif
34 #ifndef OPTIONAL
35 #define OPTIONAL
36 #endif
38 #ifndef WINE_NTSTATUS_DECLARED
39 #define WINE_NTSTATUS_DECLARED
40 typedef LONG NTSTATUS;
41 #endif
43 #define BCRYPT_ALGORITHM_NAME (const WCHAR []){'A','l','g','o','r','i','t','h','m','N','a','m','e',0}
44 #define BCRYPT_AUTH_TAG_LENGTH (const WCHAR []){'A','u','t','h','T','a','g','L','e','n','g','t','h',0}
45 #define BCRYPT_BLOCK_LENGTH (const WCHAR []){'B','l','o','c','k','L','e','n','g','t','h',0}
46 #define BCRYPT_BLOCK_SIZE_LIST (const WCHAR []){'B','l','o','c','k','S','i','z','e','L','i','s','t',0}
47 #define BCRYPT_CHAINING_MODE (const WCHAR []){'C','h','a','i','n','i','n','g','M','o','d','e',0}
48 #define BCRYPT_EFFECTIVE_KEY_LENGTH (const WCHAR []){'E','f','f','e','c','t','i','v','e','K','e','y','L','e','n','g','t','h',0}
49 #define BCRYPT_HASH_BLOCK_LENGTH (const WCHAR []){'H','a','s','h','B','l','o','c','k','L','e','n','g','t','h',0}
50 #define BCRYPT_HASH_LENGTH (const WCHAR []){'H','a','s','h','D','i','g','e','s','t','L','e','n','g','t','h',0}
51 #define BCRYPT_HASH_OID_LIST (const WCHAR []){'H','a','s','h','O','I','D','L','i','s','t',0}
52 #define BCRYPT_KEY_LENGTH (const WCHAR []){'K','e','y','L','e','n','g','t','h',0}
53 #define BCRYPT_KEY_LENGTHS (const WCHAR []){'K','e','y','L','e','n','g','t','h','s',0}
54 #define BCRYPT_KEY_OBJECT_LENGTH (const WCHAR []){'K','e','y','O','b','j','e','c','t','L','e','n','g','t','h',0}
55 #define BCRYPT_KEY_STRENGTH (const WCHAR []){'K','e','y','S','t','r','e','n','g','t','h',0}
56 #define BCRYPT_OBJECT_LENGTH (const WCHAR []){'O','b','j','e','c','t','L','e','n','g','t','h',0}
57 #define BCRYPT_PADDING_SCHEMES (const WCHAR []){'P','a','d','d','i','n','g','S','c','h','e','m','e','s',0}
58 #define BCRYPT_PROVIDER_HANDLE (const WCHAR []){'P','r','o','v','i','d','e','r','H','a','n','d','l','e',0}
59 #define BCRYPT_SIGNATURE_LENGTH (const WCHAR []){'S','i','g','n','a','t','u','r','e','L','e','n','g','t','h',0}
61 #define MS_PRIMITIVE_PROVIDER (const WCHAR [])\
62 {'M','i','c','r','o','s','o','f','t',' ','P','r','i','m','i','t','i','v','e',' ','P','r','o','v','i','d','e','r',0}
63 #define MS_PLATFORM_CRYPTO_PROVIDER (const WCHAR [])\
64 {'M','i','c','r','o','s','o','f','t',' ','P','l','a','t','f','o','r','m',' ','C','r','y','p','t','o',' ','P','r','o','v','i','d','e','r',0}
66 #define BCRYPT_MD5_ALGORITHM (const WCHAR []){'M','D','5',0}
67 #define BCRYPT_RNG_ALGORITHM (const WCHAR []){'R','N','G',0}
68 #define BCRYPT_SHA1_ALGORITHM (const WCHAR []){'S','H','A','1',0}
69 #define BCRYPT_SHA256_ALGORITHM (const WCHAR []){'S','H','A','2','5','6',0}
70 #define BCRYPT_SHA384_ALGORITHM (const WCHAR []){'S','H','A','3','8','4',0}
71 #define BCRYPT_SHA512_ALGORITHM (const WCHAR []){'S','H','A','5','1','2',0}
73 typedef struct _BCRYPT_ALGORITHM_IDENTIFIER
75 LPWSTR pszName;
76 ULONG dwClass;
77 ULONG dwFlags;
78 } BCRYPT_ALGORITHM_IDENTIFIER;
80 typedef PVOID BCRYPT_ALG_HANDLE;
81 typedef PVOID BCRYPT_HANDLE;
82 typedef PVOID BCRYPT_HASH_HANDLE;
84 #define BCRYPT_RNG_USE_ENTROPY_IN_BUFFER 0x00000001
85 #define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002
86 #define BCRYPT_ALG_HANDLE_HMAC_FLAG 0x00000008
88 NTSTATUS WINAPI BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE, ULONG);
89 NTSTATUS WINAPI BCryptCreateHash(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG);
90 NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE);
91 NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG, ULONG *, BCRYPT_ALGORITHM_IDENTIFIER **, ULONG);
92 NTSTATUS WINAPI BCryptFinishHash(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG);
93 NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG);
94 NTSTATUS WINAPI BCryptGetFipsAlgorithmMode(BOOLEAN *);
95 NTSTATUS WINAPI BCryptGetProperty(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG);
96 NTSTATUS WINAPI BCryptHash(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, PUCHAR, ULONG);
97 NTSTATUS WINAPI BCryptHashData(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG);
98 NTSTATUS WINAPI BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE *, LPCWSTR, LPCWSTR, ULONG);
100 #endif /* __WINE_BCRYPT_H */