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

Version: 1.0 Release Build License GPLv3

RNG90 Crypto Driver

Ask DeepWiki

This hardware abstracted driver can be used to interact with an RNG90 over TWI/I2C. The hardware layer is fully abstract an can be switched between different plattforms. The TWI/I2C library has to impelement the twi.h-header used in this repository.

File Structure

File Structure

drivers/
└── crypto/
└── rng90/
├── rng90.c
└── rng90.h
hal/
├── common/
| ├── defines/
| | └── TWI_defines.h
| └── enums/
| └── TWI_enums.h
└── avr0/
└── twi/
├── twi.c
└── twi.h
utils/
├── macros/
| └── stringify.h
├── crc/
| ├── crc16.c
| └── crc16.h
└── systick/
├── systick.c
└── systick.h

The plattform avr0 can completely be exchanged with any other hardware abstraction library.

Downloads

The library can be downloaded (zip or tar), cloned or used as submodule in a project.

Type File Description
Library zip / tar RNG90 crypto library including all required libraries (including hal-avr0-twi).

Using with git clone

mkdir -p ./drivers/crypto/
git clone https://github.com/0x007E/drivers-crypto-rng90.git ./drivers/crypto/
mv ./drivers/crypto/drivers-crypto-rng90 ./drivers/crypto/rng90
mkdir -p ./hal/
git clone https://github.com/0x007E/hal-common.git ./hal
mv ./hal/hal-common ./hal/common
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# Hardware abstraction layer of TWI (Must fit the used plattform)
mkdir -p ./hal/avr0/
git clone https://github.com/0x007E/hal-avr0-twi.git ./hal/avr0
mv ./hal/avr0/hal-avr0-twi ./hal/avr0/twi
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
mkdir -p ./utils/
git clone https://github.com/0x007E/utils-macros.git ./utils
git clone https://github.com/0x007E/utils-crc.git ./utils
git clone https://github.com/0x007E/utils-systick.git ./utils
mv ./utils/utils-macros ./utils/macros
mv ./utils/utils-crc ./utils/crc
mv ./utils/utils-systick ./utils/systick

Using as git submodule

git submodule add https://github.com/0x007E/drivers-crypto-rng90.git drivers/crypto/rng90
git submodule add https://github.com/0x007E/hal-common.git hal/common
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# Hardware abstraction layer of TWI (Must fit the used plattform)
git submodule add https://github.com/0x007E/hal-avr0-twi.git hal/avr0/twi
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
git submodule add https://github.com/0x007E/utils-macros.git utils/macros
git submodule add https://github.com/0x007E/utils-crc.git utils/crc
git submodule add https://github.com/0x007E/utils-systick.git utils/systick

Programming

#include "../hal/PLATFORM/twi/twi.h"
#include "../lib/drivers/crypto/rng90/rng90.h"
#include "../lib/utils/systick/systick.h"
// Called every ~ milli-/microsecond!
ISR(...)
{
}
void systick_timer_wait_ms(unsigned int ms)
{
}
int main(void)
{
// Serial Number:
unsigned char serial[RNG90_OPERATION_READ_SERIAL_SIZE];
{
// Output -> serial
}
// Device Info:
RNG90_Info info;
{
// Output:
// -> info.DeviceID
// -> info.Revision
// -> info.RFU
// -> info.SiliconID
}
// Read random numbers into buffer
status = rng90_random(rng_numbers);
for (unsigned char i=0; i < RNG90_OPERATION_RANDOM_RNG_SIZE; i++)
{
// Output -> rng_numbers[i]
}
}
RNG90_Status rng90_info(RNG90_Info *info)
Requests device information from the RNG90 and fills an info structure.
Definition rng90.c:178
RNG90_Status rng90_serial(unsigned char *serial)
Reads the device serial number from the RNG90 and stores it in a buffer.
Definition rng90.c:285
RNG90_Status rng90_random(unsigned char *numbers)
Requests random numbers from the RNG90 device and stores them in a buffer.
Definition rng90.c:224
RNG90_Status rng90_init(void)
#define RNG90_OPERATION_RANDOM_RNG_SIZE
Defines the size of the RNG state or seed used by the RNG90 device.
Definition rng90.h:216
struct RNG90_Info_t RNG90_Info
Alias for struct RNG90_Info_t representing RNG90 device information.
Definition rng90.h:832
@ RNG90_Status_Success
Definition rng90.h:748
enum RNG90_Status_t RNG90_Status
Alias for enum RNG90_Status_t representing RNG90 status codes.
Definition rng90.h:762
#define RNG90_OPERATION_READ_SERIAL_SIZE
Defines the size of the serial number data read from the RNG90 device.
Definition rng90.h:281
void systick_init(void)
Initializes the SysTick timer module.
Definition systick.c:35
void systick_tick(void)
Increments the SysTick timer tick counter.
Definition systick.c:61
void systick_timer_wait(unsigned int ticks)
Blocks execution for a specified number of SysTick ticks.
Definition systick.c:168
void systick_timer_wait_ms(unsigned int ms)
unsigned char twi_init(void)
Initialize the TWI (I2C) hardware interface in master mode.
Definition twi.c:36

Additional Information

Type Link Description
RNG90 pdf RNG90 CryptoAuthentication

R. GAECHTER