X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/d03ab969116fe715d569304c1c474749b2f64529..2685767a6125c1620719c7de6234aedf41857b7e:/noise.h diff --git a/noise.h b/noise.h index cadb747..3777a6f 100644 --- a/noise.h +++ b/noise.h @@ -1,8 +1,8 @@ /* -*-c-*- * - * $Id: noise.h,v 1.1 1999/09/03 08:41:12 mdw Exp $ + * $Id: noise.h,v 1.4 2000/06/17 12:57:47 mdw Exp $ * - * Acquisition of environmental noise (Unix specific) + * Acquisition of environmental noise (Unix-specific) * * (c) 1998 Straylight/Edgeware */ @@ -30,13 +30,23 @@ /*----- Revision history --------------------------------------------------* * * $Log: noise.h,v $ + * Revision 1.4 2000/06/17 12:57:47 mdw + * New free counter noise generator, for use if /dev/random is + * unavailable. + * + * Revision 1.3 1999/12/22 15:57:55 mdw + * Label system-specific parts more clearly. + * + * Revision 1.2 1999/12/10 23:29:48 mdw + * Change header file guard names. + * * Revision 1.1 1999/09/03 08:41:12 mdw * Initial import. * */ -#ifndef NOISE_H -#define NOISE_H +#ifndef CATACOMB_NOISE_H +#define CATACOMB_NOISE_H #ifdef __cplusplus extern "C" { @@ -46,7 +56,7 @@ #include -#ifndef RAND_H +#ifndef CATACOMB_RAND_H # include "rand.h" #endif @@ -97,7 +107,7 @@ extern int noise_devrandom(rand_pool */*r*/); * Use: Sets the user and group ids to be used by @noise_filter@ * when running child processes. This is useful to avoid * giving shell commands (even carefully written ones) undue - * privileges. + * privileges. This interface is Unix-specific. */ extern void noise_setid(uid_t /*uid*/, gid_t /*gid*/); @@ -121,10 +131,38 @@ extern void noise_setid(uid_t /*uid*/, gid_t /*gid*/); * fails to complete within a short time period, it is killed. * Paranoid use of close-on-exec flags for file descriptors is * recommended. + * + * This interface is Unix-specific. */ extern int noise_filter(rand_pool */*r*/, int /*good*/, const char */*c*/); +/* --- @noise_freewheel@ --- * + * + * Arguments: @rand_pool *r@ = pointer to a randomness pool + * + * Returns: Nonzero if some randomness was contributed. + * + * Use: Runs a free counter for a short while as a desparate attempt + * to get randomness from somewhere. This is actually quite + * effective. + */ + +int noise_freewheel(rand_pool */*r*/); + +/* --- @noise_enquire@ --- * + * + * Arguments: @rand_pool *r@ = pointer to a randomness pool + * + * Returns: Nonzero if some randomness was contributed. + * + * Use: Runs some shell commands to enquire about the prevailing + * environment. This can gather quite a lot of low-quality + * entropy. + */ + +extern int noise_enquire(rand_pool */*r*/); + /* --- @noise_acquire@ --- * * * Arguments: @rand_pool *r@ = pointer to a randomness pool