cryptlib  3.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros
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  {
25  time_t timeStamp = time( NULL );
26 
27  /* There's not much we can do under VM */
28  setMessageData( &msgData, &timeStamp, sizeof( time_t ) );
30  CRYPT_IATTRIBUTE_ENTROPY );
31  }
32 
33 void slowPoll( void )
34  {
36  BYTE buffer[ 128 ];
37  int quality = 1, total = 128;
38 
39  /* Kludge something here */
40  setMessageData( &msgData, buffer, total );
42  CRYPT_IATTRIBUTE_ENTROPY );
43  zeroise( buffer, sizeof( buffer ) );
45  CRYPT_IATTRIBUTE_ENTROPY_QUALITY );
46  }