aboutsummaryrefslogtreecommitdiff
path: root/core/drivers
diff options
context:
space:
mode:
authorJens Wiklander <jens.wiklander@linaro.org>2018-06-14 11:12:00 +0200
committerJérôme Forissier <jerome.forissier@linaro.org>2018-06-18 10:01:13 +0200
commit6e954a6e42bd37911605d3b4cd22e4d1d23c2372 (patch)
tree1c305f414f6c5eccc142cbf6d76bf8784836d569 /core/drivers
parentb8d0b26e700584b85819b33306d93811deb48800 (diff)
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>
Diffstat (limited to 'core/drivers')
-rw-r--r--core/drivers/imx_snvs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/drivers/imx_snvs.c b/core/drivers/imx_snvs.c
index bf5a7df6..278d42f9 100644
--- a/core/drivers/imx_snvs.c
+++ b/core/drivers/imx_snvs.c
@@ -157,7 +157,7 @@ TEE_Result snvs_srtc_enable(void)
}
/* Reused from tee_time_arm_cntpct.c */
-void plat_prng_add_jitter_entropy(void)
+void plat_prng_add_jitter_entropy(enum crypto_rng_src sid, unsigned int *pnum)
{
uint64_t tsc = snvs_srtc_read_lp_counter();
int bytes = 0, n;
@@ -181,6 +181,6 @@ void plat_prng_add_jitter_entropy(void)
if (bytes) {
FMSG("%s: 0x%02" PRIX16, __func__,
acc & GENMASK_32(bytes * 8, 0));
- tee_prng_add_entropy((uint8_t *)&acc, bytes);
+ crypto_rng_add_event(sid, pnum, (uint8_t *)&acc, bytes);
}
}