diff options
author | Gary R Hook <gary.hook@amd.com> | 2016-07-26 19:10:31 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-08-09 18:47:17 +0800 |
commit | 084935b208f6507ef5214fd67052a67a700bc6cf (patch) | |
tree | 5b617289cb4807fd950c9028f8c18a26f2949f3c /drivers/crypto/ccp/ccp-dev.c | |
parent | 4b394a232df78414442778b02ca4a388d947d059 (diff) | |
download | linux-084935b208f6507ef5214fd67052a67a700bc6cf.tar.gz linux-084935b208f6507ef5214fd67052a67a700bc6cf.tar.bz2 linux-084935b208f6507ef5214fd67052a67a700bc6cf.zip |
crypto: ccp - Add support for the RNG in a version 5 CCP
Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccp/ccp-dev.c')
-rw-r--r-- | drivers/crypto/ccp/ccp-dev.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index 6b44730ef9d6..38a98d879f82 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c @@ -119,6 +119,29 @@ void ccp_del_device(struct ccp_device *ccp) write_unlock_irqrestore(&ccp_unit_lock, flags); } + + +int ccp_register_rng(struct ccp_device *ccp) +{ + int ret = 0; + + dev_dbg(ccp->dev, "Registering RNG...\n"); + /* Register an RNG */ + ccp->hwrng.name = ccp->rngname; + ccp->hwrng.read = ccp_trng_read; + ret = hwrng_register(&ccp->hwrng); + if (ret) + dev_err(ccp->dev, "error registering hwrng (%d)\n", ret); + + return ret; +} + +void ccp_unregister_rng(struct ccp_device *ccp) +{ + if (ccp->hwrng.name) + hwrng_unregister(&ccp->hwrng); +} + static struct ccp_device *ccp_get_device(void) { unsigned long flags; |