Update more usage of hwGetentropy() (#869)

* Update more usage of hwGetentropy()

* Add hwGetentropy() to Teensy 3.5/3.6
This commit is contained in:
d00616
2017-06-03 21:58:40 +02:00
committed by Olivier
parent 28c4f3f19e
commit e6925f69e8
10 changed files with 49 additions and 36 deletions
@@ -527,13 +527,15 @@ static void halt(bool success)
*/
static bool generate_random_data(uint8_t* data, size_t sz)
{
#ifdef USE_SOFT_SIGNING
#if defined(USE_SOFT_SIGNING) && ! defined(MY_HW_HAS_GETENTROPY)
for (size_t i = 0; i < sz; i++) {
data[i] = random(256) ^ micros();
unsigned long enter = hwMillis();
while (hwMillis() - enter < (unsigned long)2);
}
return true;
#elif defined(USE_SOFT_SIGNING) && defined(MY_HW_HAS_GETENTROPY)
hwGetentropy(&data, sz);
#else
ret_code = sha204.sha204m_random(tx_buffer, rx_buffer, RANDOM_SEED_UPDATE);
if ((ret_code != SHA204_SUCCESS) || (lockConfig != 0x00)) {