trng 1.0
trng driver library
Loading...
Searching...
No Matches
trng

Version: 1.0 Release Build License GPLv3

TRNG Crypto Driver

Ask DeepWiki

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.

File Structure

File Structure

drivers/
└── crypto/
└── trng/
├── trng.c
└── trng.h

Downloads

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

Using with git clone

mkdir -p ./drivers/crypto/
git clone https://github.com/0x007E/drivers-crypto-trng.git ./drivers/crypto
mv ./drivers/crypto/drivers-crypto-trng ./drivers/crypto/trng

Using as git submodule

git submodule add https://github.com/0x007E/drivers-crypto-trng.git drivers/crypto/trng

Programming

#include "../lib/drivers/crypto/trng/trng.h"
// Continously pin status readin (e.g. through timer)
ISR(...)
{
// ... Insert pin status (HIGH/LOW)
}
int main(void)
{
// Pin Setup for TRNG
// Timer Setup for TRNG
while(1)
{
{
volatile unsigned char *trng_numbers = trng_buffer();
for (unsigned char i=0; i < TRNG_BUFFER_SIZE; i++)
{
// Output -> *(trng_numbers++)
}
}
}
}
void trng_next_bit(unsigned char bit)
Processes a single entropy bit and adds it to the TRNG buffer.
Definition trng.c:62
TRNG_Buffer trng_buffer_status(void)
Returns the current fill status of the TRNG buffer.
Definition trng.c:124
void trng_reset(void)
Returns a pointer to the internal TRNG buffer.
Definition trng.c:173
volatile unsigned char * trng_buffer(void)
Returns a pointer to the internal TRNG buffer.
Definition trng.c:154
void trng_init(void)
Initializes the True Random Number Generator (TRNG) module.
Definition trng.c:38
@ TRNG_Buffer_Full
Definition trng.h:51
#define TRNG_BUFFER_SIZE
Size of the internal random data buffer in bytes.
Definition trng.h:37

Additional Information

Type Link Description
Ring-Oscillator pdf Ring-Oscillator circuit with NAND and XOR

R. GAECHTER