cryptlib
3.4.1
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
random
vmcms.c
Go to the documentation of this file.
1
/****************************************************************************
2
* *
3
* VM/CMS Randomness-Gathering Code *
4
* Copyright Peter Gutmann 1999 *
5
* *
6
****************************************************************************/
7
8
/* This module is part of the cryptlib continuously seeded pseudorandom
9
number generator. For usage conditions, see random.c.
10
11
This code represents a template for randomness-gathering only and will
12
need to be modified to provide OS-specific randomness. In its current
13
form it does not provide any usable entropy and should not be used as an
14
entropy source */
15
16
/* General includes */
17
18
#include "
crypt.h
"
19
20
/* OS-specific includes */
21
22
void
fastPoll
(
void
)
23
{
24
MESSAGE_DATA
msgData
;
25
time_t timeStamp = time( NULL );
26
27
/* There's not much we can do under VM */
28
setMessageData
( &msgData, &timeStamp,
sizeof
( time_t ) );
29
krnlSendMessage
(
SYSTEM_OBJECT_HANDLE
,
IMESSAGE_SETATTRIBUTE_S
, &msgData,
30
CRYPT_IATTRIBUTE_ENTROPY );
31
}
32
33
void
slowPoll
(
void
)
34
{
35
MESSAGE_DATA
msgData
;
36
BYTE
buffer
[ 128 ];
37
int
quality = 1, total = 128;
38
39
/* Kludge something here */
40
setMessageData
( &msgData, buffer, total );
41
krnlSendMessage
(
SYSTEM_OBJECT_HANDLE
,
IMESSAGE_SETATTRIBUTE_S
, &msgData,
42
CRYPT_IATTRIBUTE_ENTROPY );
43
zeroise
( buffer,
sizeof
( buffer ) );
44
krnlSendMessage
(
SYSTEM_OBJECT_HANDLE
,
IMESSAGE_SETATTRIBUTE
, &quality,
45
CRYPT_IATTRIBUTE_ENTROPY_QUALITY );
46
}
Generated on Thu Jan 10 2013 10:00:51 for cryptlib by
1.8.2