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
+3 -3
View File
@@ -149,9 +149,9 @@ bool signerAtsha204SoftGetNonce(MyMessage &msg)
return false;
}
#ifdef MY_HW_HAS_GETRANDOM
// Try to get MAX_PAYLOAD (or 32) random bytes
while (hwGetentropy(&_signing_verifying_nonce, MIN(MAX_PAYLOAD, 32)) != MIN(MAX_PAYLOAD, 32));
#ifdef MY_HW_HAS_GETENTROPY
// Try to get MAX_PAYLOAD random bytes
while (hwGetentropy(&_signing_verifying_nonce, MAX_PAYLOAD) != MAX_PAYLOAD);
#else
// We used a basic whitening technique that XORs a random byte with the current hwMillis() counter
// and then the byte is hashed (SHA256) to produce the resulting nonce