SRAM PUF

SRAM based physically unclonable function (PUF) More...

Detailed Description

SRAM based physically unclonable function (PUF)

Warning
This feature is experimental!
This API is experimental and in an early state - expect changes!
The SRAM based seed mechanism it not cryptographically secure in its current state.

About

Transistor variations of SRAM memory cells lead to different states after device power-on. The startup state of multiple memory blocks form a device-unique pattern plus additional noise ("weak PUF"). The noise is used to generate random numbers for PRNG seeding.

Preliminaries

High entropy numbers can only be generated when the device starts from power-off (including low-power modes that turn of the RAM partly) and before the memory has been used. That's why the SRAM PUF procedure is implemented even before kernel initialization. Memory properties are hardware specific and can depend on environmental conditions. Thus, they should be evaluated for each individual deployment. A basic testing tool is provided in /RIOT/tests/puf_sram.

Soft-reset detection

In order to detect a software reboot without preceding power-off phase, a soft-reset detection mechanism writes a marker memory PUF_SRAM_MARKER into SRAM. If the marker is still present after a restart, a soft-reset is expected and the PUF procedure is skipped.

Random Seed Generation

Uninitialized memory pattern are compressed by the lightweight DEK hash function to generate a high entropy 32-bit integer which can be used to seed a PRNG. This hash function is not cryptographically secure and as such, adversaries might be able to track parts of the initial SRAM response by analyzing PRNG sequences.

Files

file  puf_sram.h
 

Macros

#define SEED_RAM_LEN   (2048 / sizeof(uint32_t))
 SRAM length considered for seeding.
 
#define PUF_SRAM_MARKER   (0xad3021ff)
 SRAM marker to detect reboot without power-off. More...
 

Functions

void puf_sram_init (const uint8_t *ram, size_t len)
 checks source of reboot by puf_sram_softreset and conditionally calls puf_sram_generate More...
 
void puf_sram_generate (const uint8_t *ram, size_t len)
 builds hash from SEED_RAM_LEN bytes uninitialized SRAM, writes it to the global variable puf_sram_seed and returns the value More...
 
bool puf_sram_softreset (void)
 checks for a memory marker to determine whether memory contains old data. More...
 

Variables

uint32_t puf_sram_seed
 Global seed variable, allocated in puf_sram.c.
 
uint32_t puf_sram_state
 Global seed state, allocated in puf_sram.c 0 means seed was generated from SRAM pattern, 1 means missing power cycle detected, 2 means power cycle detected. More...
 
uint32_t puf_sram_softreset_cnt
 Counter variable allocated in puf_sram.c. More...
 

Macro Definition Documentation

◆ PUF_SRAM_MARKER

#define PUF_SRAM_MARKER   (0xad3021ff)

SRAM marker to detect reboot without power-off.

Source: https://www.random.org/bytes/

Definition at line 76 of file puf_sram.h.

Function Documentation

◆ puf_sram_generate()

void puf_sram_generate ( const uint8_t *  ram,
size_t  len 
)

builds hash from SEED_RAM_LEN bytes uninitialized SRAM, writes it to the global variable puf_sram_seed and returns the value

Parameters
[in]rampointer to SRAM memory
[in]lenlength of the memory to consider

◆ puf_sram_init()

void puf_sram_init ( const uint8_t *  ram,
size_t  len 
)

checks source of reboot by puf_sram_softreset and conditionally calls puf_sram_generate

Parameters
[in]rampointer to SRAM memory
[in]lenlength of the memory to consider

◆ puf_sram_softreset()

bool puf_sram_softreset ( void  )

checks for a memory marker to determine whether memory contains old data.

Otherwise it assumes a reboot from power down mode

Returns
0 when reset with power cycle was detected
1 when reset without power cycle was detected

Variable Documentation

◆ puf_sram_softreset_cnt

uint32_t puf_sram_softreset_cnt

Counter variable allocated in puf_sram.c.

It is incremented during each soft reset when no new PUF measurement was taken and it gets reset to zero after a power cycle was detected.

◆ puf_sram_state

uint32_t puf_sram_state

Global seed state, allocated in puf_sram.c 0 means seed was generated from SRAM pattern, 1 means missing power cycle detected, 2 means power cycle detected.

The state will most likely be overwritten with 0 in the next steps