48#define SRAM_BYTES 1024
51static const uint8_t *sram_pointer = (uint8_t *)0x20001FFF;
71 uint8_t sram_snapshot[SRAM_BYTES];
82 memcpy(sram_snapshot, sram_pointer, SRAM_BYTES);
86 for(i = 0; i < SRAM_BYTES; i++) {
87 for(j = 0; j < 8; j++) {
88 bit1 = (1 << j) & sram_snapshot[i];
89 bit2 = (1 << j) & sram_pointer[i];
91 seed.
u8[byte_pos] |= 1 << bit_pos++;
92 }
else if(bit1 > bit2) {
93 seed.
u8[byte_pos] &= ~(1 << bit_pos++);
99 if(byte_pos == CSPRNG_SEED_LEN) {
SRAM-based CSPRNG seeder.
void rtimer_arch_schedule(rtimer_clock_t t)
Schedules an rtimer task to be triggered at time t.
void csprng_feed(struct csprng_seed *new_seed)
Mixes a new seed with the current one.
void cc2538_sram_seeder_seed(void)
This function will feed the CSPRNG with a new seed.
#define RTIMER_NOW()
Get the current clock time.
Header file for the real-time timer module.
This is the structure of a seed.
uint8_t u8[CSPRNG_SEED_LEN]
for convenience