Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
612 B

  1. #include <strobe.h>
  2. #include <strobe_rng_init.h>
  3. /*
  4. * Note: rng_save is really REAL_RNG_SAVE_LEN, BUT, we want to use the
  5. * uninitalized SRAM after it as entropy.
  6. */
  7. extern uint8_t rng_save[2*1048];
  8. extern int rng_save_len;
  9. #define REAL_RNG_SAVE_LEN ((int)&rng_save_len)
  10. void
  11. strobe_rng_init(void)
  12. {
  13. int r;
  14. /*
  15. * Seed RNG
  16. * On first boot, SRAM is uninitialized and randomness from
  17. * it is used. On reset, the previously saved state is used.
  18. */
  19. strobe_seed_prng(rng_save, 2*1024);
  20. /*
  21. * Save entropy for next reset.
  22. */
  23. r = strobe_randomize(rng_save, REAL_RNG_SAVE_LEN);
  24. (void)r;
  25. }