| #
191f2ed4 |
| 30-Apr-2022 |
Andrew Davis <afd@ti.com> |
core: rng_hw: Remove __weak attribute from HW RNG functions
These function are no longer overridden by platform HW RNG drivers. Drivers only need implement hw_get_random_bytes().
Signed-off-by: And
core: rng_hw: Remove __weak attribute from HW RNG functions
These function are no longer overridden by platform HW RNG drivers. Drivers only need implement hw_get_random_bytes().
Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| #
4a3e6b90 |
| 29-Apr-2022 |
Andrew Davis <afd@ti.com> |
core: rng_hw: Remove hw_get_random_byte()
Now that all everyone is moved over to hw_get_random_bytes() we can remove the stub hw_get_random_byte() and the weak default hw_get_random_bytes().
Signed
core: rng_hw: Remove hw_get_random_byte()
Now that all everyone is moved over to hw_get_random_bytes() we can remove the stub hw_get_random_byte() and the weak default hw_get_random_bytes().
Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| #
60296dff |
| 29-Apr-2022 |
Andrew Davis <afd@ti.com> |
core: rng_hw: Add dummy hw_get_random_byte()
This is only used so we can start removing hw_get_random_byte() from platforms without causing compile errors. It is never called.
Signed-off-by: Andrew
core: rng_hw: Add dummy hw_get_random_byte()
This is only used so we can start removing hw_get_random_byte() from platforms without causing compile errors. It is never called.
Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
391a3854 |
| 29-Apr-2022 |
Andrew Davis <afd@ti.com> |
core: Add hw_get_random_bytes()
Currently there are two options for supporting hardware RNG, implementing hw_get_random_byte() or overriding crypto_rng_read().
crypto_rng_read() is provided by eith
core: Add hw_get_random_bytes()
Currently there are two options for supporting hardware RNG, implementing hw_get_random_byte() or overriding crypto_rng_read().
crypto_rng_read() is provided by either a software PRNG or by a hardware RNG through a weak function in rng_hw.c. This weak function repeatedly calls hw_get_random_byte(). This can be an unneeded slowdown for platforms that fetch more than one byte of randomness per call to their HW RNG (all of them). The usual pattern is to store these extra bytes in a FIFO and feed them out one at a time. But since the only two callers of hw_get_random_byte() are themselves users of more than one byte this indirection is unnecessary. To get around this some platforms have also started overriding crypto_rng_read() which makes the API flow a bit less intuitive than it could be.
Plan here is that platforms only need to implement hw_get_random_bytes(). This can be called with length = 1 if we only need a single byte. But in the more common case we get a performance boost and simplify the RNG call flow.
To start we keep hw_get_random_byte() and have the new hw_get_random_bytes() use it to get platform HW RNG byte at a time. When we finish moving all plats over to hw_get_random_bytes() then hw_get_random_byte() can be removed.
Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
ea6cd913 |
| 14-Jun-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
Remove get_rng_array()
Removes get_rng_array() in favor of crypto_rng_read() which always uses the configured RNG implementation to draw random.
Reviewed-by: Jerome Forissier <jerome.forissier@lina
Remove get_rng_array()
Removes get_rng_array() in favor of crypto_rng_read() which always uses the configured RNG implementation to draw random.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
6e954a6e |
| 14-Jun-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add new RNG implementation
Adds a new cryptographically secure pseudo random number generator known as Fortuna. The implementation is based on the description in [0]. This implementation repla
core: add new RNG implementation
Adds a new cryptographically secure pseudo random number generator known as Fortuna. The implementation is based on the description in [0]. This implementation replaces the implementation in LTC which was used until now.
Gathering of entropy has been refined with crypto_rng_add_event() to better match how entropy is added to Fortuna. A enum crypto_rng_src identifies the source of the event. The source also controls how the event is added. There are two options available, queue it in a circular buffer for later processing or adding it directly to a pool. The former option is suitable when being called from an interrupt handler or some other place where RPC to normal world is forbidden.
plat_prng_add_jitter_entropy_norpc() is removed and plat_prng_add_jitter_entropy() is updated to use this new entropy source scheme.
The configuration of LTC is simplified by this, now PRNG is always drawn via prng_mpa_desc.
plat_rng_init() takes care of initializing the PRNG in order to allow platforms to override or enhance the Fortuna integration.
[0] Link:https://www.schneier.com/academic/paperfiles/fortuna.pdf
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|