Arduino Cryptography Library
|
Processes the signal from a ring oscillator based noise source. More...
#include <RingOscillatorNoiseSource.h>
Public Member Functions | |
bool | calibrating () const |
Determine if the noise source is still calibrating itself. More... | |
void | stir () |
Stirs entropy from this noise source into the global random number pool. More... | |
Public Member Functions inherited from NoiseSource | |
NoiseSource () | |
Constructs a new random noise source. | |
virtual | ~NoiseSource () |
Destroys this random noise source. | |
virtual void | added () |
Called when the noise source is added to RNG with RNG.addNoiseSource(). More... | |
Additional Inherited Members | |
Protected Member Functions inherited from NoiseSource | |
virtual void | output (const uint8_t *data, size_t len, unsigned int credit) |
Called from subclasses to output noise to the global random number pool. More... | |
Processes the signal from a ring oscillator based noise source.
This class processes input from a ring oscillator noise source, such as that described here.
The noise is read from an input capture pin on the Arduino and stirred into the random number pool on a regular basis. The following pins are used on different Arduino variants:
Variant | Arduino Pin / AVR Pin | Timer |
Arduino Uno | D8 / PB0 | Timer 1 |
Arduino Leonardo | D4 / PD4 | Timer 1 |
Arduino Mega or Mega 2560 | D49 / PL0 | Timer 4 |
If your board is not pin-compatible with one of the above, then the source for the RingOscillatorNoiseSource class will need to be modified to use a different pin/timer combination. Also, when the timer is in use by this class it cannot be used for other application tasks.
The example below shows how to initialize a ring oscillator based noise source and use it with RNG:
For more information, see the documentation for RNG.
Definition at line 29 of file RingOscillatorNoiseSource.h.
|
virtual |
Determine if the noise source is still calibrating itself.
Noise sources that require calibration start doing so at system startup and then switch over to random data generation once calibration is complete. Since no random data is being generated during calibration, the output from RNG.rand() may be predictable. Use RNG.available() to determine when sufficient entropy is available to generate good random values.
It is possible that the noise source never exits calibration. This can happen if the input voltage is insufficient to trigger noise or if the noise source is not connected. Noise sources may also periodically recalibrate themselves.
Implements NoiseSource.
Definition at line 178 of file RingOscillatorNoiseSource.cpp.
|
virtual |
Stirs entropy from this noise source into the global random number pool.
This function should call output() to add the entropy from this noise source to the global random number pool.
The noise source should batch up the entropy data, providing between 16 and 48 bytes of data each time. If the noise source does not have sufficient entropy data at the moment, it should return without stiring the current data in.
Implements NoiseSource.
Definition at line 201 of file RingOscillatorNoiseSource.cpp.