/*
* Principal Author: Brian Wellington
- * $Id: dst_api.c,v 1.11.92.9 2009/09/25 01:48:10 marka Exp $
+ * $Id: dst_api.c,v 1.11.92.10 2009/10/20 04:47:52 marka Exp $
*/
/*! \file */
isc_result_t
dst__entropy_getdata(void *buf, unsigned int len, isc_boolean_t pseudo) {
unsigned int flags = dst_entropy_flags;
+
+ if (len == 0)
+ return (ISC_R_SUCCESS);
if (pseudo)
flags &= ~ISC_ENTROPY_GOODONLY;
return (isc_entropy_getdata(dst_entropy_pool, buf, len, NULL, flags));
unsigned int
dst__entropy_status(void) {
+#ifdef GSSAPI
+ unsigned int flags = dst_entropy_flags;
+ isc_result_t ret;
+ unsigned char buf[32];
+ static isc_boolean_t first = ISC_TRUE;
+
+ if (first) {
+ /* Someone believes RAND_status() initializes the PRNG */
+ flags &= ~ISC_ENTROPY_GOODONLY;
+ ret = isc_entropy_getdata(dst_entropy_pool, buf,
+ sizeof(buf), NULL, flags);
+ INSIST(ret == ISC_R_SUCCESS);
+ isc_entropy_putdata(dst_entropy_pool, buf,
+ sizeof(buf), 2 * sizeof(buf));
+ first = ISC_FALSE;
+ }
+#endif
return (isc_entropy_status(dst_entropy_pool));
}