|
@@ -33,18 +33,14 @@ |
|
|
|
|
|
|
|
|
#include <utilities.h> |
|
|
#include <utilities.h> |
|
|
|
|
|
|
|
|
|
|
|
#include <unistd.h> |
|
|
|
|
|
|
|
|
#define nitems(x) (sizeof(x) / sizeof *(x)) |
|
|
#define nitems(x) (sizeof(x) / sizeof *(x)) |
|
|
#define DEFINE_RNG_SAVE 1 |
|
|
#define DEFINE_RNG_SAVE 1 |
|
|
#if DEFINE_RNG_SAVE |
|
|
#if DEFINE_RNG_SAVE |
|
|
const rng_word_t rng_save[roundup(32, sizeof(rng_word_t)) / sizeof(rng_word_t)] __attribute__ ((section (".eeprom"))); |
|
|
const rng_word_t rng_save[roundup(32, sizeof(rng_word_t)) / sizeof(rng_word_t)] __attribute__ ((section (".eeprom"))); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
* Note: This is the end of allocated SRAM, aka, the begining of |
|
|
|
|
|
* uninitalized SRAM. |
|
|
|
|
|
*/ |
|
|
|
|
|
extern uint8_t end; |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
void |
|
|
strobe_rng_init(void) |
|
|
strobe_rng_init(void) |
|
|
{ |
|
|
{ |
|
@@ -58,8 +54,10 @@ strobe_rng_init(void) |
|
|
/* |
|
|
/* |
|
|
* On first boot, SRAM is uninitialized and randomness from |
|
|
* On first boot, SRAM is uninitialized and randomness from |
|
|
* it is used. |
|
|
* it is used. |
|
|
|
|
|
* |
|
|
|
|
|
* Note: This depends upon sbrk pointing to uinitalized SRAM. |
|
|
*/ |
|
|
*/ |
|
|
strobe_seed_prng(&end, 2*1024); |
|
|
|
|
|
|
|
|
strobe_seed_prng(sbrk(0), 2*1024); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|