update
This commit is contained in:
@@ -129,16 +129,9 @@ static void scaleEntropy(void) {
|
|||||||
// This should be called for each bit generated.
|
// This should be called for each bit generated.
|
||||||
bool inmHealthCheckAddBit(bool bit, bool even) {
|
bool inmHealthCheckAddBit(bool bit, bool even) {
|
||||||
inmTotalBits++;
|
inmTotalBits++;
|
||||||
if((inmTotalBits & 0xfffff) == 0) {
|
if(inmDebug && (inmTotalBits & 0xfffff) == 0) {
|
||||||
if(inmDebug) {
|
printf("Generated %lu bits. Estimated entropy per bit: %f, estimated K: %f\n",
|
||||||
printf("Generated %lu bits. Estimated entropy per bit: %f, estimated K: %f\n",
|
inmTotalBits, inmHealthCheckEstimateEntropyPerBit(), inmHealthCheckEstimateK());
|
||||||
inmTotalBits, inmHealthCheckEstimateEntropyPerBit(), inmHealthCheckEstimateK());
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if(inmTotalBits > 3000000) {
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
inmPrevBits = (inmPrevBits << 1) & ((1 << inmN)-1);
|
inmPrevBits = (inmPrevBits << 1) & ((1 << inmN)-1);
|
||||||
if(inmPrevBit) {
|
if(inmPrevBit) {
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ void inmWriteEntropyStart(uint32_t bufLen, bool debug) {
|
|||||||
|
|
||||||
// Block until either the entropy pool has room, or 1 second has passed.
|
// Block until either the entropy pool has room, or 1 second has passed.
|
||||||
void inmWaitForPoolToHaveRoom(void) {
|
void inmWaitForPoolToHaveRoom(void) {
|
||||||
printf("starting select\n");
|
|
||||||
int ent_count;
|
int ent_count;
|
||||||
struct pollfd pfd = {
|
struct pollfd pfd = {
|
||||||
fd: inmDevRandomFD,
|
fd: inmDevRandomFD,
|
||||||
@@ -70,12 +69,10 @@ void inmWaitForPoolToHaveRoom(void) {
|
|||||||
};
|
};
|
||||||
int64_t timeout_usec;
|
int64_t timeout_usec;
|
||||||
if (ioctl(inmDevRandomFD, RNDGETENTCNT, &ent_count) == 0 && ent_count < inmFillWatermark) {
|
if (ioctl(inmDevRandomFD, RNDGETENTCNT, &ent_count) == 0 && ent_count < inmFillWatermark) {
|
||||||
printf("Not full\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
timeout_usec = 1000; // One second
|
timeout_usec = 1000; // One second
|
||||||
poll(&pfd, 1, timeout_usec);
|
poll(&pfd, 1, timeout_usec);
|
||||||
printf("Finished select\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the bytes to the entropy pool. This can be unwhitenened, but the estimated bits of
|
// Add the bytes to the entropy pool. This can be unwhitenened, but the estimated bits of
|
||||||
|
|||||||
Reference in New Issue
Block a user