added environment variable INFNOISE_DEBUG

This commit is contained in:
Manuel Domke
2017-12-31 19:13:00 +01:00
parent 9a5d776c5c
commit e523de9aee
2 changed files with 17 additions and 2 deletions

View File

@@ -91,6 +91,7 @@ static uint32_t processBytes(uint8_t *keccakState, uint8_t *bytes, uint32_t entr
outputBytes(dataOut, entropy/8u, entropy & 0x7u, opts);
return entropy/8u;
}
// Output 256*outputMultipler bytes.
uint32_t numBits = opts->outputMultiplier*256u;
uint32_t bytesWritten = 0u;
@@ -322,6 +323,14 @@ int main(int argc, char **argv)
}
}
if (opts.debug == false) {
if (getenv("INFNOISE_DEBUG") != NULL) {
if (!strcmp("true",getenv("INFNOISE_DEBUG"))) {
opts.debug = true;
}
}
}
if (multiplierAssigned == false) {
if (getenv("INFNOISE_MULTIPLIER") != NULL) {
int tmpOutputMult = atoi(getenv("INFNOISE_MULTIPLIER"));
@@ -349,6 +358,7 @@ int main(int argc, char **argv)
if(opts.devRandom) {
inmWriteEntropyStart(BUFLEN/8u, &opts);
}
if(!inmHealthCheckStart(PREDICTION_BITS, DESIGN_K, &opts)) {
fputs("Can't intialize health checker\n", stderr);
return 1;

View File

@@ -1,7 +1,12 @@
# systemd configuration file for the Infinite Noise TRNG
#INFNOISE_MULTIPLIER=1
#INFNOISE_MULTIPLIER=10
# keccak multiplier, default = 1
#INFNOISE_SERIAL=
#INFNOISE_SERIAL=DO0032ZA
# serial number of device, default: ""
# use infnoise --list-devices to find out your serial number
#INFNOISE_DEBUG=true
# debug mode, default: false
# debug logging to syslog