mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
snapshot
This commit is contained in:
@@ -71,10 +71,9 @@ main(int argc, char **argv) {
|
|||||||
|
|
||||||
isc_entropy_stats(ent, stderr);
|
isc_entropy_stats(ent, stderr);
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
devrandom = NULL;
|
devrandom = NULL;
|
||||||
flags = 0;
|
flags = 0;
|
||||||
flags |= ISC_ENTROPYSOURCE_ISDEVICE;
|
|
||||||
CHECK("isc_entropy_createfilesource()",
|
CHECK("isc_entropy_createfilesource()",
|
||||||
isc_entropy_createfilesource(ent, "/dev/random",
|
isc_entropy_createfilesource(ent, "/dev/random",
|
||||||
flags, &devrandom));
|
flags, &devrandom));
|
||||||
|
@@ -97,14 +97,8 @@ ISC_LANG_BEGINDECLS
|
|||||||
* If this is not set, the source will be gathered and perodically
|
* If this is not set, the source will be gathered and perodically
|
||||||
* mixed into the entropy pool, but no increment in contained entropy
|
* mixed into the entropy pool, but no increment in contained entropy
|
||||||
* will be assumed. This flag only makes sense on sample sources.
|
* will be assumed. This flag only makes sense on sample sources.
|
||||||
*
|
|
||||||
* _ISDEVICE
|
|
||||||
* The file named is really a device file, and blocking is possible.
|
|
||||||
* Otherwise, the file is assumed to be a finite length file, and
|
|
||||||
* any I/O error (including blocking) terminates the source.
|
|
||||||
*/
|
*/
|
||||||
#define ISC_ENTROPYSOURCE_ESTIMATE 0x00000001U
|
#define ISC_ENTROPYSOURCE_ESTIMATE 0x00000001U
|
||||||
#define ISC_ENTROPYSOURCE_ISDEVICE 0x00000002U
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*** Functions
|
*** Functions
|
||||||
|
@@ -278,13 +278,10 @@ get_from_filesource(isc_entropysource_t *source, isc_uint32_t desired) {
|
|||||||
int fd = source->sources.file.fd;
|
int fd = source->sources.file.fd;
|
||||||
ssize_t n, ndesired;
|
ssize_t n, ndesired;
|
||||||
isc_uint32_t added;
|
isc_uint32_t added;
|
||||||
isc_boolean_t isdevice;
|
|
||||||
|
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
isdevice = ISC_TF((source->flags & ISC_ENTROPYSOURCE_ISDEVICE) != 0);
|
|
||||||
|
|
||||||
desired = desired / 8 + (((desired & 0x07) > 0) ? 1 : 0);
|
desired = desired / 8 + (((desired & 0x07) > 0) ? 1 : 0);
|
||||||
|
|
||||||
added = 0;
|
added = 0;
|
||||||
@@ -292,7 +289,7 @@ get_from_filesource(isc_entropysource_t *source, isc_uint32_t desired) {
|
|||||||
ndesired = ISC_MIN(desired, sizeof(buf));
|
ndesired = ISC_MIN(desired, sizeof(buf));
|
||||||
n = read(fd, buf, ndesired);
|
n = read(fd, buf, ndesired);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
if (isdevice && (errno == EAGAIN))
|
if (errno == EAGAIN)
|
||||||
goto out;
|
goto out;
|
||||||
close(fd);
|
close(fd);
|
||||||
source->sources.file.fd = -1;
|
source->sources.file.fd = -1;
|
||||||
|
Reference in New Issue
Block a user