entropy2_test.c revision 0eb2572d79822d02ea05448ce4e5f1759c73d171
/*
* Copyright (C) 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <isc/keyboard.h>
#include <stdio.h>
static void
unsigned int len;
unsigned char *base;
printf("\n\t");
}
printf("\n");
}
static void
if (result != ISC_R_SUCCESS) {
exit(1);
}
}
static isc_result_t
if (blocking)
printf("start called, blocking mode.\n");
else
printf("start called, non-blocking mode.\n");
return (isc_keyboard_open(kbd));
}
static void
printf("ENOUGH! Stop typing, please.\r\n");
printf("stop called\n");
}
static isc_result_t
isc_time_t t;
unsigned char c;
if (!blocking)
return (ISC_R_NOENTROPY);
if (result != ISC_R_SUCCESS)
return (result);
result = isc_time_now(&t);
if (result != ISC_R_SUCCESS)
return (result);
sample = isc_time_nanoseconds(&t);
extra = c;
if (result != ISC_R_SUCCESS) {
printf("\r\n");
return (result);
}
printf(".");
return (result);
}
int
unsigned char buffer[512];
unsigned int returned;
unsigned int flags;
CHECK("isc_mem_create()",
isc_mem_create(0, 0, &mctx));
CHECK("isc_entropy_create()",
&source);
"Reading 32 bytes of GOOD random data only, partial OK\n");
flags = 0;
returned = 0;
if (result == ISC_R_NOENTROPY) {
}
return (0);
}