Fisrt completed USB key works
This commit is contained in:
@@ -18,6 +18,11 @@ estimation of bits added to an entropy pool or cryptographic hash function.
|
||||
|
||||
### The Eagle open-source boards work!
|
||||
|
||||
Here's the first completed Infinite Noise USB key. This is what I would offer on Tindie
|
||||
if needed to get the INM concept out there.
|
||||
|
||||

|
||||
|
||||
Here's the first three boards from OSH Park. They work _exactly_ as predicted. They all
|
||||
generate 300,000 bits per second, resulting in 259,000 bits of entropy per second.
|
||||
|
||||
|
||||
BIN
images/infnoise_key.jpg
Normal file
BIN
images/infnoise_key.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 625 KiB |
@@ -1,7 +1,8 @@
|
||||
all: infnoise infnoise-v1 healthcheck findlongest
|
||||
|
||||
infnoise: infnoise.c infnoise.h healthcheck.c writeentropy.c Keccak/KeccakF-1600-reference.c Keccak/brg_endian.h
|
||||
gcc -Wall -std=c11 -O3 -m64 -march=native -I Keccak -o infnoise infnoise.c healthcheck.c writeentropy.c Keccak/KeccakF-1600-reference.c -lftdi -lm
|
||||
#gcc -Wall -std=c11 -O3 -m64 -march=native -I Keccak -o infnoise infnoise.c healthcheck.c writeentropy.c Keccak/KeccakF-1600-reference.c -lftdi -lm
|
||||
gcc -Wall -std=c11 -g -m64 -march=native -I Keccak -o infnoise infnoise.c healthcheck.c writeentropy.c Keccak/KeccakF-1600-reference.c -lftdi -lm
|
||||
|
||||
infnoise-v1: infnoise.c infnoise.h healthcheck.c writeentropy.c Keccak/KeccakF-1600-reference.c Keccak/brg_endian.h
|
||||
gcc -Wall -std=c11 -O3 -m64 -march=native -DVERSION1 -I Keccak -o infnoise-v1 infnoise.c healthcheck.c writeentropy.c Keccak/KeccakF-1600-reference.c -lftdi -lm
|
||||
|
||||
@@ -28,18 +28,16 @@ confirmed.
|
||||
|
||||
#define INM_MIN_DATA 80000
|
||||
#define INM_MIN_SAMPLE_SIZE 100
|
||||
#define INM_ACCURACY 1.02
|
||||
#define INM_MAX_SEQUENCE 20
|
||||
#define INM_MAX_COUNT (1 << 14)
|
||||
// Matches the Keccac sponge size
|
||||
#define INM_MAX_ENTROPY 1600
|
||||
|
||||
double inmK, inmExpectedEntropyPerBit;
|
||||
|
||||
static uint8_t inmN;
|
||||
static uint32_t inmPrevBits;
|
||||
static uint32_t inmNumBitsSampled;
|
||||
static uint32_t *inmOnesEven, *inmZerosEven;
|
||||
static uint32_t *inmOnesOdd, *inmZerosOdd;
|
||||
static double inmK, inmExpectedEntropyPerBit;
|
||||
// The total probability of generating the string of states we did is
|
||||
// 1/(2^inmNumBitsOfEntropy * inmCurrentProbability).
|
||||
static uint32_t inmNumBitsOfEntropy;
|
||||
@@ -214,7 +212,7 @@ bool inmHealthCheckAddBit(bool evenBit, bool oddBit, bool even) {
|
||||
while(inmCurrentProbability <= 0.5) {
|
||||
inmCurrentProbability *= 2.0;
|
||||
inmNumBitsOfEntropy++;
|
||||
if(inmHealthCheckOkToUseData() && inmEntropyLevel < INM_MAX_ENTROPY) {
|
||||
if(inmHealthCheckOkToUseData()) {
|
||||
inmEntropyLevel++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
#define SWEN1 4
|
||||
#define SWEN2 1
|
||||
#else
|
||||
#define DESIGN_K 1.736
|
||||
#define DESIGN_K 1.82
|
||||
//#define DESIGN_K 1.736
|
||||
#define COMP1 1
|
||||
#define COMP2 4
|
||||
#define SWEN1 2
|
||||
@@ -62,9 +63,12 @@ static uint32_t extractBytes(uint8_t *bytes, uint8_t *inBuf, bool raw) {
|
||||
return inmGetEntropyLevel();
|
||||
}
|
||||
|
||||
// Write the bytes to either stdout, or /dev/random. Cut the entropy estimate in half to
|
||||
// be conservative.
|
||||
// Write the bytes to either stdout, or /dev/random. Use the lower of the measured
|
||||
// entropy and the provable lower bound on average entropy.
|
||||
static void outputBytes(uint8_t *bytes, uint32_t length, uint32_t entropy, bool writeDevRandom) {
|
||||
if(entropy > inmExpectedEntropyPerBit/INM_ACCURACY) {
|
||||
entropy = inmExpectedEntropyPerBit/INM_ACCURACY;
|
||||
}
|
||||
if(!writeDevRandom) {
|
||||
if(fwrite(bytes, 1, length, stdout) != length) {
|
||||
fputs("Unable to write output from Infinite Noise Multiplier\n", stderr);
|
||||
@@ -103,8 +107,7 @@ static void Squeeze(uint8_t *keccakState, uint8_t *dataOut, uint32_t length) {
|
||||
}
|
||||
|
||||
// Send the new bytes through the health checker and also into the Keccak sponge.
|
||||
// Output bytes from the sponge only if the health checker says it's OK, and only
|
||||
// output half the entropy we get from the INM, just to be paranoid.
|
||||
// Output bytes from the sponge only if the health checker says it's OK
|
||||
static void processBytes(uint8_t *keccakState, uint8_t *bytes, uint32_t entropy, bool raw, bool writeDevRandom) {
|
||||
if(raw) {
|
||||
// In raw mode, we just output raw data from the INM.
|
||||
@@ -208,7 +211,7 @@ int main(int argc, char **argv)
|
||||
char *message;
|
||||
if(!initializeUSB(&ftdic, &message)) {
|
||||
// Sometimes have to do it twice - not sure why
|
||||
ftdi_usb_close(&ftdic);
|
||||
//ftdi_usb_close(&ftdic);
|
||||
if(!initializeUSB(&ftdic, &message)) {
|
||||
fputs(message, stderr);
|
||||
return 1;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// Required accuracy of estimated vs measured entropy in health monitor
|
||||
#define INM_ACCURACY 1.02
|
||||
|
||||
bool inmHealthCheckStart(uint8_t N, double K, bool debug);
|
||||
void inmHealthCheckStop(void);
|
||||
bool inmHealthCheckAddBit(bool evenBit, bool oddBit, bool even);
|
||||
@@ -13,3 +16,5 @@ bool inmEntropyOnTarget(uint32_t entropy, uint32_t bits);
|
||||
void inmWriteEntropyStart(uint32_t bufLen, bool debug);
|
||||
void inmWriteEntropyToPool(uint8_t *bytes, uint32_t length, uint32_t entropy);
|
||||
void inmWaitForPoolToHaveRoom(void);
|
||||
|
||||
extern double inmK, inmExpectedEntropyPerBit;
|
||||
|
||||
Reference in New Issue
Block a user