diff options
Diffstat (limited to 'contrib/bind9/lib/isc/entropy.c')
-rw-r--r-- | contrib/bind9/lib/isc/entropy.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/contrib/bind9/lib/isc/entropy.c b/contrib/bind9/lib/isc/entropy.c index 3e87d87..25ab002 100644 --- a/contrib/bind9/lib/isc/entropy.c +++ b/contrib/bind9/lib/isc/entropy.c @@ -1,8 +1,8 @@ /* - * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or 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. * @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: entropy.c,v 1.11.18.3 2005/07/12 01:22:28 marka Exp $ */ +/* $Id: entropy.c,v 1.18.332.2 2009/01/18 23:47:41 tbox Exp $ */ /*! \file * \brief @@ -290,7 +290,7 @@ entropypool_add_word(isc_entropypool_t *rp, isc_uint32_t val) { * If we have looped around the pool, increment the rotate * variable so the next value will get xored in rotated to * a different position. - * Increment by a value that is relativly prime to the word size + * Increment by a value that is relatively prime to the word size * to try to spread the bits throughout the pool quickly when the * pool is empty. */ @@ -1102,6 +1102,17 @@ isc_entropy_stats(isc_entropy_t *ent, FILE *out) { UNLOCK(&ent->lock); } +unsigned int +isc_entropy_status(isc_entropy_t *ent) { + unsigned int estimate; + + LOCK(&ent->lock); + estimate = ent->pool.entropy; + UNLOCK(&ent->lock); + + return estimate; +} + void isc_entropy_attach(isc_entropy_t *ent, isc_entropy_t **entp) { REQUIRE(VALID_ENTROPY(ent)); @@ -1251,7 +1262,7 @@ isc_entropy_usebestsource(isc_entropy_t *ectx, isc_entropysource_t **source, if (final_result != ISC_R_SUCCESS) final_result = result; - } + } /* * final_result is ISC_R_SUCCESS if at least one source of entropy |