puf_sram.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
54 #ifndef PUF_SRAM_H
55 #define PUF_SRAM_H
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 #include "hashes.h"
62 #include "thread.h"
63 
67 #ifndef SEED_RAM_LEN
68 #define SEED_RAM_LEN (2048 / sizeof(uint32_t))
69 #endif
70 
76 #define PUF_SRAM_MARKER (0xad3021ff)
77 
81 extern uint32_t puf_sram_seed;
82 
90 extern uint32_t puf_sram_state;
91 
97 extern uint32_t puf_sram_softreset_cnt;
98 
107 void puf_sram_init(const uint8_t *ram, size_t len);
108 
116 void puf_sram_generate(const uint8_t *ram, size_t len);
117 
125 bool puf_sram_softreset(void);
126 
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif /* PUF_SRAM_H */
bool puf_sram_softreset(void)
checks for a memory marker to determine whether memory contains old data.
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.
uint32_t puf_sram_seed
Global seed variable, allocated in puf_sram.c.
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 ...
Hash function API.
uint32_t puf_sram_softreset_cnt
Counter variable allocated in puf_sram.c.
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_see...