diff options
author | Alex Porosanu <alexandru.porosanu@freescale.com> | 2014-08-11 11:40:17 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-08-25 20:32:37 +0800 |
commit | e5ffbfc182bc148f44840bdd3970ea4c8bf80c3c (patch) | |
tree | 0e9673d21a24695118b8ac4d15907f92b5e11b9f /drivers/crypto/caam/ctrl.c | |
parent | eeaa1724a2e9c8958a8621b3c10d5ca0667e78fa (diff) | |
download | lwn-e5ffbfc182bc148f44840bdd3970ea4c8bf80c3c.tar.gz lwn-e5ffbfc182bc148f44840bdd3970ea4c8bf80c3c.zip |
crypto: caam - 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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/caam/ctrl.c')
-rw-r--r-- | drivers/crypto/caam/ctrl.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 111ac1ffbc11..c6210373b1be 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -357,8 +357,17 @@ static void kick_trng(struct platform_device *pdev, int ent_delay) wr_reg32(&r4tst->rtfrqmin, ent_delay >> 2); /* disable maximum frequency count */ wr_reg32(&r4tst->rtfrqmax, RTFRQMAX_DISABLE); + /* read the control register */ + val = rd_reg32(&r4tst->rtmctl); + /* + * select raw sampling in both entropy shifter + * and statistical checker + */ + setbits32(&val, RTMCTL_SAMP_MODE_RAW_ES_SC); /* put RNG4 into run mode */ - clrbits32(&r4tst->rtmctl, RTMCTL_PRGM); + clrbits32(&val, RTMCTL_PRGM); + /* write back the control register */ + wr_reg32(&r4tst->rtmctl, val); } /** |