This hardware abstracted driver can be used to interact with a external ring-oscillator circutit or any other random bit generator. The hardware layer is fully abstract an can be switched between different plattforms.
drivers/
└── crypto/
└── trng/
├── trng.c
└── trng.h
The library can be downloaded (zip or tar), cloned or used as submodule in a project.
| Type | File | Description |
|---|---|---|
| Library | zip / tar | TRNG crypto library |
mkdir -p ./drivers/crypto/
git clone https://github.com/0x007E/drivers-crypto-trng.git ./drivers/crypto
mv ./drivers/crypto/drivers-crypto-trng ./drivers/crypto/trnggit submodule add https://github.com/0x007E/drivers-crypto-trng.git drivers/crypto/trng#include "../lib/drivers/crypto/trng/trng.h"
// Continously pin status readin (e.g. through timer)
ISR(...)
{
// ... Insert pin status (HIGH/LOW)
trng_next_bit(...);
}
int main(void)
{
// Pin Setup for TRNG
// Timer Setup for TRNG
trng_init();
while(1)
{
if(trng_buffer_status() == TRNG_Buffer_Full)
{
volatile unsigned char *trng_numbers = trng_buffer();
for (unsigned char i=0; i < TRNG_BUFFER_SIZE; i++)
{
// Output -> *(trng_numbers++)
}
trng_reset();
}
}
}| Type | Link | Description |
|---|---|---|
| Ring-Oscillator | Ring-Oscillator circuit with NAND and XOR |
R. GAECHTER
