2 * dlls/advapi32/crypt.c
10 #include "debugtools.h"
12 DEFAULT_DEBUG_CHANNEL(advapi);
14 /******************************************************************************
15 * CryptAcquireContextA (ADVAPI32.@)
16 * Acquire a crypto provider context handle.
19 * phProv: Pointer to HCRYPTPROV for the output.
20 * pszContainer: FIXME (unknown)
21 * pszProvider: FIXME (unknown)
22 * dwProvType: Crypto provider type to get a handle.
23 * dwFlags: flags for the operation
25 * RETURNS TRUE on success, FALSE on failure.
27 BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
28 LPCSTR pszProvider, DWORD dwProvType, DWORD dwFlags)
30 FIXME("(%p, %s, %s, %ld, %08lx): stub!\n", phProv, pszContainer,
31 pszProvider, dwProvType, dwFlags);
35 /******************************************************************************
36 * CryptAcquireContextW (ADVAPI32.@)
38 BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer,
39 LPCWSTR pszProvider, DWORD dwProvType, DWORD dwFlags)
41 FIXME("(%p, %s, %s, %ld, %08lx): stub!\n", phProv, debugstr_w(pszContainer),
42 debugstr_w(pszProvider), dwProvType, dwFlags);
46 /******************************************************************************
47 * CryptGenRandom (ADVAPI32.@)
49 BOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer)
53 FIXME("(0x%lx, %ld, %p): stub!\n", hProv, dwLen, pbBuffer);
55 FIXME: Currently this function is just a stub, it is missing functionality in
56 the following (major) ways:
57 (1) It makes no use of the passed in HCRYPTPROV handle. (ie. it doesn't
58 use a cryptographic service provider (CSP)
59 (2) It doesn't use the values in the passed in pbBuffer to further randomize
61 (3) MSDN mentions that this function produces "cryptographically random"
62 data, which is "... far more random than the data generated by the typical
63 random number generator such as the one shipped with your C compiler".
64 We are currently using the C runtime rand() function. ^_^
66 See MSDN documentation for CryptGenRandom for more information.
73 for (i=0; i<dwLen; i++)
75 *pbBuffer = (BYTE)(rand() % 256);
82 /******************************************************************************
83 * CryptContextAddRef (ADVAPI32.@)
85 BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags)
87 FIXME("(0x%lx, %p, %08lx): stub!\n", hProv, pdwReserved, dwFlags);
91 /******************************************************************************
92 * CryptCreateHash (ADVAPI32.@)
94 BOOL WINAPI CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
95 DWORD dwFlags, HCRYPTHASH *phHash)
97 FIXME("(0x%lx, 0x%x, 0x%lx, %08lx, %p): stub!\n", hProv, Algid, hKey, dwFlags, phHash);
101 /******************************************************************************
102 * CryptDecrypt (ADVAPI32.@)
104 BOOL WINAPI CryptDecrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final,
105 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen)
107 FIXME("(0x%lx, 0x%lx, %d, %08lx, %p, %p): stub!\n", hKey, hHash, Final, dwFlags, pbData, pdwDataLen);
111 /******************************************************************************
112 * CryptDeriveKey (ADVAPI32.@)
114 BOOL WINAPI CryptDeriveKey (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData,
115 DWORD dwFlags, HCRYPTKEY *phKey)
117 FIXME("(0x%lx, %d, 0x%ld, %08ld, %p): stub!\n", hProv, Algid, hBaseData, dwFlags, phKey);
121 /******************************************************************************
122 * CryptDestroyHash (ADVAPI32.@)
124 BOOL WINAPI CryptDestroyHash (HCRYPTHASH hHash)
126 FIXME("(0x%lx): stub!\n", hHash);
130 /******************************************************************************
131 * CryptDestroyKey (ADVAPI32.@)
133 BOOL WINAPI CryptDestroyKey (HCRYPTKEY hKey)
135 FIXME("(0x%lx): stub!\n", hKey);
139 /******************************************************************************
140 * CryptDuplicateHash (ADVAPI32.@)
142 BOOL WINAPI CryptDuplicateHash (HCRYPTHASH hHash, DWORD *pdwReserved,
143 DWORD dwFlags, HCRYPTHASH *phHash)
145 FIXME("(0x%lx, %p, %08ld, %p): stub!\n", hHash, pdwReserved, dwFlags, phHash);
149 /******************************************************************************
150 * CryptDuplicateKey (ADVAPI32.@)
152 BOOL WINAPI CryptDuplicateKey (HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey)
154 FIXME("(0x%lx, %p, %08ld, %p): stub!\n", hKey, pdwReserved, dwFlags, phKey);
158 /******************************************************************************
159 * CryptEncrypt (ADVAPI32.@)
161 BOOL WINAPI CryptEncrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final,
162 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen, DWORD dwBufLen)
164 FIXME("(0x%lx, 0x%lx, %d, %08ld, %p, %p, %ld): stub!\n", hKey, hHash, Final, dwFlags, pbData, pdwDataLen, dwBufLen);
168 /******************************************************************************
169 * CryptEnumProvidersA (ADVAPI32.@)
171 BOOL WINAPI CryptEnumProvidersA (DWORD dwIndex, DWORD *pdwReserved,
172 DWORD dwFlags, DWORD *pdwProvType, LPSTR pszProvName, DWORD *pcbProvName)
174 FIXME("(%ld, %p, %ld, %p, %p, %p): stub!\n", dwIndex, pdwReserved, dwFlags,
175 pdwProvType, pszProvName, pcbProvName);
179 /******************************************************************************
180 * CryptEnumProvidersW (ADVAPI32.@)
182 BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved,
183 DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszProvName, DWORD *pcbProvName)
185 FIXME("(%ld, %p, %08ld, %p, %p, %p): stub!\n", dwIndex, pdwReserved, dwFlags,
186 pdwProvType, pszProvName, pcbProvName);
190 /******************************************************************************
191 * CryptEnumProviderTypesA (ADVAPI32.@)
193 BOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved,
194 DWORD dwFlags, DWORD *pdwProvType, LPSTR pszTypeName, DWORD *pcbTypeName)
196 FIXME("(%ld, %p, %08ld, %p, %p, %p): stub!\n", dwIndex, pdwReserved, dwFlags, pdwProvType, pszTypeName, pcbTypeName);
200 /******************************************************************************
201 * CryptEnumProviderTypesW (ADVAPI32.@)
203 BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved,
204 DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszTypeName, DWORD *pcbTypeName)
206 FIXME("(%ld, %p, %08ld, %p, %p, %p): stub!\n", dwIndex, pdwReserved, dwFlags,
207 pdwProvType, pszTypeName, pcbTypeName);
211 /******************************************************************************
212 * CryptExportKey (ADVAPI32.@)
214 BOOL WINAPI CryptExportKey (HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType,
215 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen)
217 FIXME("(0x%lx, 0x%lx, %ld, %08ld, %p, %p): stub!\n", hKey, hExpKey, dwBlobType, dwFlags, pbData, pdwDataLen);
221 /******************************************************************************
222 * CryptGenKey (ADVAPI32.@)
224 BOOL WINAPI CryptGenKey (HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey)
226 FIXME("(0x%lx, %d, %08ld, %p): stub!\n", hProv, Algid, dwFlags, phKey);
230 /******************************************************************************
231 * CryptGetDefaultProviderA (ADVAPI32.@)
233 BOOL WINAPI CryptGetDefaultProviderA (DWORD dwProvType, DWORD *pdwReserved,
234 DWORD dwFlags, LPSTR pszProvName, DWORD *pcbProvName)
236 FIXME("(%ld, %p, %ld, %p, %p): stub!\n", dwProvType, pdwReserved, dwFlags, pszProvName, pcbProvName);
240 /******************************************************************************
241 * CryptGetDefaultProviderW (ADVAPI32.@)
243 BOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved,
244 DWORD dwFlags, LPWSTR pszProvName, DWORD *pcbProvName)
246 FIXME("(%ld, %p, %08ld, %p, %p): stub!\n", dwProvType, pdwReserved, dwFlags, pszProvName, pcbProvName);
250 /******************************************************************************
251 * CryptGetHashParam (ADVAPI32.@)
253 BOOL WINAPI CryptGetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData,
254 DWORD *pdwDataLen, DWORD dwFlags)
256 FIXME("(0x%lx, %ld, %p, %p, %08ld): stub!\n", hHash, dwParam, pbData, pdwDataLen, dwFlags);
260 /******************************************************************************
261 * CryptGetKeyParam (ADVAPI32.@)
263 BOOL WINAPI CryptGetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData,
264 DWORD *pdwDataLen, DWORD dwFlags)
266 FIXME("(0x%lx, %ld, %p, %p, %08ld): stub!\n", hKey, dwParam, pbData, pdwDataLen, dwFlags);
270 /******************************************************************************
271 * CryptGetProvParam (ADVAPI32.@)
273 BOOL WINAPI CryptGetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData,
274 DWORD *pdwDataLen, DWORD dwFlags)
276 FIXME("(0x%lx, %ld, %p, %p, %08ld): stub!\n", hProv, dwParam, pbData, pdwDataLen, dwFlags);
280 /******************************************************************************
281 * CryptGetUserKey (ADVAPI32.@)
283 BOOL WINAPI CryptGetUserKey (HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUserKey)
285 FIXME("(0x%lx, %ld, %p): stub!\n", hProv, dwKeySpec, phUserKey);
289 /******************************************************************************
290 * CryptHashData (ADVAPI32.@)
292 BOOL WINAPI CryptHashData (HCRYPTHASH hHash, BYTE *pbData, DWORD dwDataLen, DWORD dwFlags)
294 FIXME("(0x%lx, %p, %ld, %08ld): stub!\n", hHash, pbData, dwDataLen, dwFlags);
298 /******************************************************************************
299 * CryptHashSessionKey (ADVAPI32.@)
301 BOOL WINAPI CryptHashSessionKey (HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags)
303 FIXME("(0x%lx, 0x%lx, %08ld): stub!\n", hHash, hKey, dwFlags);
307 /******************************************************************************
308 * CryptImportKey (ADVAPI32.@)
310 BOOL WINAPI CryptImportKey (HCRYPTPROV hProv, BYTE *pbData, DWORD dwDataLen,
311 HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey)
313 FIXME("(0x%lx, %p, %ld, 0x%lx, %08ld, %p): stub!\n", hProv, pbData, dwDataLen, hPubKey, dwFlags, phKey);
317 /******************************************************************************
318 * CryptReleaseContext (ADVAPI32.@)
320 BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags)
322 FIXME("(0x%lx, %08ld): stub!\n", hProv, dwFlags);
326 /******************************************************************************
327 * CryptSignHashA (ADVAPI32.@)
329 BOOL WINAPI CryptSignHashA (HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR sDescription,
330 DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen)
332 FIXME("(0x%lx, %ld, %s, %08ld, %p, %p): stub!\n", hHash, dwKeySpec, sDescription, dwFlags, pbSignature, pdwSigLen);
336 /******************************************************************************
337 * CryptSignHashW (ADVAPI32.@)
339 BOOL WINAPI CryptSignHashW (HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR sDescription,
340 DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen)
342 FIXME("(0x%lx, %ld, %s, %08ld, %p, %p): stub!\n", hHash, dwKeySpec, debugstr_w(sDescription), dwFlags, pbSignature, pdwSigLen);
346 /******************************************************************************
347 * CryptSetHashParam (ADVAPI32.@)
349 BOOL WINAPI CryptSetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD dwFlags)
351 FIXME("(0x%lx, %ld, %p, %08ld): stub!\n", hHash, dwParam, pbData, dwFlags);
355 /******************************************************************************
356 * CryptSetKeyParam (ADVAPI32.@)
358 BOOL WINAPI CryptSetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD dwFlags)
360 FIXME("(%lx, %lx, %p, %lx): stub!\n", hKey, dwParam, pbData, dwFlags);
364 /******************************************************************************
365 * CryptSetProviderA (ADVAPI32.@)
367 BOOL WINAPI CryptSetProviderA (LPCSTR pszProvName, DWORD dwProvType)
369 FIXME("(%s, %ld): stub!\n", pszProvName, dwProvType);
373 /******************************************************************************
374 * CryptSetProviderW (ADVAPI32.@)
376 BOOL WINAPI CryptSetProviderW (LPCWSTR pszProvName, DWORD dwProvType)
378 FIXME("(%s, %ld): stub!\n", debugstr_w(pszProvName), dwProvType);
382 /******************************************************************************
383 * CryptSetProviderExA (ADVAPI32.@)
385 BOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags)
387 FIXME("(%s, %ld, %p, %08ld): stub!\n", pszProvName, dwProvType, pdwReserved, dwFlags);
391 /******************************************************************************
392 * CryptSetProviderExW (ADVAPI32.@)
394 BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags)
396 FIXME("(%s, %ld, %p, %08ld): stub!\n", debugstr_w(pszProvName), dwProvType, pdwReserved, dwFlags);
400 /******************************************************************************
401 * CryptSetProvParam (ADVAPI32.@)
403 BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD dwFlags)
405 FIXME("(0x%lx, %ld, %p, %08ld): stub!\n", hProv, dwParam, pbData, dwFlags);
409 /******************************************************************************
410 * CryptVerifySignatureA (ADVAPI32.@)
412 BOOL WINAPI CryptVerifySignatureA (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen,
413 HCRYPTKEY hPubKey, LPCSTR sDescription, DWORD dwFlags)
415 FIXME("(0x%lx, %p, %ld, 0x%lx, %s, %08ld): stub!\n", hHash, pbSignature,
416 dwSigLen, hPubKey, sDescription, dwFlags);
420 /******************************************************************************
421 * CryptVerifySignatureW (ADVAPI32.@)
423 BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen,
424 HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags)
426 FIXME("(0x%lx, %p, %ld, 0x%lx, %s, %08ld): stub!\n", hHash, pbSignature,
427 dwSigLen, hPubKey, debugstr_w(sDescription), dwFlags);