1999-02-13 10:08:33 +01:00
|
|
|
/*
|
|
|
|
* dlls/advapi32/crypt.c
|
|
|
|
*/
|
2000-10-24 03:39:29 +02:00
|
|
|
#include <time.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
1999-03-14 17:35:05 +01:00
|
|
|
#include "windef.h"
|
1999-02-13 10:08:33 +01:00
|
|
|
#include "winerror.h"
|
|
|
|
#include "wincrypt.h"
|
1999-05-14 10:17:14 +02:00
|
|
|
#include "debugtools.h"
|
1999-02-13 10:08:33 +01:00
|
|
|
|
2000-10-24 03:39:29 +02:00
|
|
|
DEFAULT_DEBUG_CHANNEL(advapi);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
1999-02-13 10:08:33 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* CryptAcquireContextA
|
|
|
|
* Acquire a crypto provider context handle.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* phProv: Pointer to HCRYPTPROV for the output.
|
|
|
|
* pszContainer: FIXME (unknown)
|
|
|
|
* pszProvider: FIXME (unknown)
|
|
|
|
* dwProvType: Crypto provider type to get a handle.
|
|
|
|
* dwFlags: flags for the operation
|
|
|
|
*
|
|
|
|
* RETURNS TRUE on success, FALSE on failure.
|
|
|
|
*/
|
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
1999-02-13 10:08:33 +01:00
|
|
|
CryptAcquireContextA( HCRYPTPROV *phProv, LPCSTR pszContainer,
|
|
|
|
LPCSTR pszProvider, DWORD dwProvType, DWORD dwFlags)
|
|
|
|
{
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%p, %s, %s, %ld, %08lx): stub!\n", phProv, pszContainer,
|
1999-02-13 10:08:33 +01:00
|
|
|
pszProvider, dwProvType, dwFlags);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-10-31 03:07:05 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* CryptSetKeyParam
|
|
|
|
*/
|
1999-07-31 15:07:19 +02:00
|
|
|
BOOL WINAPI
|
|
|
|
CryptSetKeyParam( HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD dwFlags)
|
|
|
|
{
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("(%lx, %lx, %p, %lx): stub!\n", hKey, dwParam, pbData, dwFlags);
|
1999-07-31 15:07:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
1999-02-13 10:08:33 +01:00
|
|
|
|
2000-10-24 03:39:29 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* CryptGenRandom
|
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
|
|
|
CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer)
|
|
|
|
{
|
|
|
|
DWORD i;
|
|
|
|
|
|
|
|
FIXME("(0x%lx, %ld, %p): stub!\n", hProv, dwLen, pbBuffer);
|
|
|
|
/*
|
|
|
|
FIXME: Currently this function is just a stub, it is missing functionality in
|
|
|
|
the following (major) ways:
|
|
|
|
(1) It makes no use of the passed in HCRYPTPROV handle. (ie. it doesn't
|
|
|
|
use a cryptographic service provider (CSP)
|
|
|
|
(2) It doesn't use the values in the passed in pbBuffer to further randomize
|
|
|
|
its internal seed.
|
|
|
|
(3) MSDN mentions that this function produces "cryptographically random"
|
|
|
|
data, which is "... far more random than the data generated by the typical
|
|
|
|
random number generator such as the one shipped with your C compiler".
|
|
|
|
We are currently using the C runtime rand() function. ^_^
|
|
|
|
|
|
|
|
See MSDN documentation for CryptGenRandom for more information.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (dwLen <= 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
srand(time(NULL));
|
|
|
|
for (i=0; i<dwLen; i++)
|
|
|
|
{
|
|
|
|
*pbBuffer = (BYTE)(rand() % 256);
|
|
|
|
pbBuffer++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* CryptReleaseContext
|
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
|
|
|
CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
FIXME("(0x%lx, 0x%lx): stub!\n", hProv, dwFlags);
|
|
|
|
return FALSE;
|
|
|
|
}
|