diff options
author | Alex Porosanu <alexandru.porosanu@freescale.com> | 2015-05-05 16:48:35 +0300 |
---|---|---|
committer | York Sun <yorksun@freescale.com> | 2015-08-03 12:06:37 -0700 |
commit | c4065517362ae9132ceaaec4103ed5ad6c9cfe92 (patch) | |
tree | 8097d230210383abf9e40d1b036d1de01c0f8a31 /drivers/crypto | |
parent | 17649e1b94b450f1ab0de7fa14553f390285f291 (diff) |
drivers/crypto/fsl: enable raw data instead of von Neumann data
The sampling of the oscillator can be done in multiple modes for
generating the entropy value. By default, this is set to von
Neumann. This patch changes the sampling to raw data, since it
has been discovered that the generated entropy has a better
'quality'.
Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com>
Acked-by: Ruchika Gupta<ruchika.gupta@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/fsl/jr.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c index aa527ec954..35606688af 100644 --- a/drivers/crypto/fsl/jr.c +++ b/drivers/crypto/fsl/jr.c @@ -408,8 +408,17 @@ static void kick_trng(int ent_delay) sec_out32(&rng->rtfreqmin, ent_delay >> 2); /* disable maximum frequency count */ sec_out32(&rng->rtfreqmax, RTFRQMAX_DISABLE); + /* read the control register */ + val = sec_in32(&rng->rtmctl); + /* + * select raw sampling in both entropy shifter + * and statistical checker + */ + sec_setbits32(&val, RTMCTL_SAMP_MODE_RAW_ES_SC); /* put RNG4 into run mode */ - sec_clrbits32(&rng->rtmctl, RTMCTL_PRGM); + sec_clrbits32(&val, RTMCTL_PRGM); + /* write back the control register */ + sec_out32(&rng->rtmctl, val); } static int rng_init(void) |