* Re: [PATCH -next] crypto: gcm - Fix error return code in crypto_gcm_create_common()
From: Herbert Xu @ 2016-10-25 3:39 UTC (permalink / raw)
To: Wei Yongjun; +Cc: Wei Yongjun, linux-crypto
In-Reply-To: <1476717006-10086-1-git-send-email-weiyj.lk@gmail.com>
On Mon, Oct 17, 2016 at 03:10:06PM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> Fix to return error code -EINVAL from the invalid alg ivsize error
> handling case instead of 0, as done elsewhere in this function.
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [PATCH -next] crypto: ccp - Fix non static symbol warning
From: Herbert Xu @ 2016-10-25 3:39 UTC (permalink / raw)
To: Wei Yongjun; +Cc: Tom Lendacky, Gary Hook, Wei Yongjun, linux-crypto
In-Reply-To: <1476716930-9831-1-git-send-email-weiyj.lk@gmail.com>
On Mon, Oct 17, 2016 at 03:08:50PM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> Fixes the following sparse warning:
>
> drivers/crypto/ccp/ccp-dev.c:44:6: warning:
> symbol 'ccp_error_codes' was not declared. Should it be static?
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [RESEND][PATCH] crypto: caam: add support for iMX6UL
From: Herbert Xu @ 2016-10-25 3:39 UTC (permalink / raw)
To: Marcus Folkesson
Cc: David S . Miller, Rob Herring, Mark Rutland, Horia Geanta,
Arnd Bergmann, Alex Porosanu, Srinivas Kandagatla, Baoyou Xie,
Russell King, linux-crypto-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1476703680-22676-1-git-send-email-marcus.folkesson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
On Mon, Oct 17, 2016 at 01:28:00PM +0200, Marcus Folkesson wrote:
> i.MX6UL does only require three clocks to enable CAAM module.
>
> Signed-off-by: Marcus Folkesson <marcus.folkesson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Reviewed-by: Horia Geantă <horia.geanta-3arQi8VN3Tc@public.gmane.org>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] padata: Remove unused but set variables
From: Herbert Xu @ 2016-10-25 3:38 UTC (permalink / raw)
To: Steffen Klassert; +Cc: tklauser, linux-crypto, linux-kernel
In-Reply-To: <20161021090047.GO19080@gauss.secunet.com>
Steffen Klassert <steffen.klassert@secunet.com> wrote:
> On Mon, Oct 17, 2016 at 12:16:08PM +0200, Tobias Klauser wrote:
>> Remove the unused but set variable pinst in padata_parallel_worker to
>> fix the following warning when building with 'W=1':
>>
>> kernel/padata.c: In function ‘padata_parallel_worker’:
>> kernel/padata.c:68:26: warning: variable ‘pinst’ set but not used [-Wunused-but-set-variable]
>>
>> Also remove the now unused variable pd which is only used to set pinst.
>>
>> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
>
> Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [PATCH] crypto: Move RSA+MPI constructs into an #include file
From: Herbert Xu @ 2016-10-25 2:48 UTC (permalink / raw)
To: Gary R Hook; +Cc: linux-crypto, thomas.lendacky, davem
In-Reply-To: <20161014193559.4342.74036.stgit@taos>
On Fri, Oct 14, 2016 at 02:36:00PM -0500, Gary R Hook wrote:
> Move RSA support of general use into internal/rsa.h.
> This allows reuse of, e.g. RSA MPI keys and support
> functions.
>
> Signed-off-by: Gary R Hook <gary.hook@amd.com>
Please fold this patch into the series that makes use of it.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [PATCH v2 0/8] Conversion crypto API documentation to Sphinx
From: Herbert Xu @ 2016-10-25 2:35 UTC (permalink / raw)
To: Stephan Mueller; +Cc: Jonathan Corbet, linux-crypto, linux-doc
In-Reply-To: <1645861.DSRXbPG5tl@positron.chronox.de>
On Sun, Oct 23, 2016 at 06:46:12PM +0200, Stephan Mueller wrote:
> Am Sonntag, 23. Oktober 2016, 10:32:38 CEST schrieb Jonathan Corbet:
>
> Hi Jonathan,
>
> > On Fri, 21 Oct 2016 04:53:45 +0200
> >
> > Stephan Mueller <smueller@chronox.de> wrote:
> > > the attached patch set converts the existing crypto API documentation
> > > from DocBook to Sphinx.
> >
> > This looks generally good to me - thanks for doing it!
> >
> > Is there any chance of running the Documentation/ parts through the docs
> > tree? Documentation/index.rst has become a bit of a conflict point
> > otherwise...
>
> Unless Herbert objects, I would not see any reason why we should not push it
> through the docs tree.
No objections from me.
> Yet we should wait for Herbert's ack as I have added also new information in
> the patch set (the KPP API documentation and the change in the AEAD
> documentation).
Looks good to me.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Crypto Fixes for 4.9
From: Herbert Xu @ 2016-10-25 2:34 UTC (permalink / raw)
To: Linus Torvalds, David S. Miller, Linux Kernel Mailing List,
Linux Crypto Mailing List
In-Reply-To: <20160801095821.GA1260@gondor.apana.org.au>
Hi Linus:
This push fixes a regression caused by the stack vmalloc change.
Please pull from
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git linus
Andrew Lutomirski (1):
hwrng: core - Don't use a stack buffer in add_early_randomness()
drivers/char/hw_random/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* ARM-CE aes encryption on uneven blocks
From: Cata Vasile @ 2016-10-24 14:41 UTC (permalink / raw)
To: linux-crypto@vger.kernel.org
Hi,
I'm trying to understand the code for AES encryption from ARM-CE.
>From the aes-glue.S calls I understand that the encryption primitives receive the number of blocks, but have no way of determining the number of bytes to encrypt, if for example the plaintext does not have a length of a multiple of AES block size.
How does, for example, ecb_encrypt() also encrypt the last remaining bytes in the plaintext if it is not a multiple of AES block size if It can never deduce the full plaintext size?
Catalin Vasile
^ permalink raw reply
* [PATCH v2] char: hw_random: atmel-rng: disable TRNG during suspend
From: Wenyou Yang @ 2016-10-25 0:56 UTC (permalink / raw)
To: Herbert Xu, Matt Mackall
Cc: linux-crypto, Wenyou Yang, linux-arm-kernel, Nicolas Ferre,
Wenyou Yang
To fix the over consumption on the VDDCore due to the TRNG enabled,
disable the TRNG during suspend, not only disable the user interface
clock (which is controlled by PMC). Because the user interface clock
is independent from any clock that may be used in the entropy source
logic circuitry.
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---
Changes in v2:
- Enable the user interface first, then enable the internal clock
when resume.
drivers/char/hw_random/atmel-rng.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
index 0fcc9e6..ae7cae5 100644
--- a/drivers/char/hw_random/atmel-rng.c
+++ b/drivers/char/hw_random/atmel-rng.c
@@ -48,6 +48,16 @@ static int atmel_trng_read(struct hwrng *rng, void *buf, size_t max,
return 0;
}
+static void atmel_trng_enable(struct atmel_trng *trng)
+{
+ writel(TRNG_KEY | 1, trng->base + TRNG_CR);
+}
+
+static void atmel_trng_disable(struct atmel_trng *trng)
+{
+ writel(TRNG_KEY, trng->base + TRNG_CR);
+}
+
static int atmel_trng_probe(struct platform_device *pdev)
{
struct atmel_trng *trng;
@@ -71,7 +81,7 @@ static int atmel_trng_probe(struct platform_device *pdev)
if (ret)
return ret;
- writel(TRNG_KEY | 1, trng->base + TRNG_CR);
+ atmel_trng_enable(trng);
trng->rng.name = pdev->name;
trng->rng.read = atmel_trng_read;
@@ -94,7 +104,7 @@ static int atmel_trng_remove(struct platform_device *pdev)
hwrng_unregister(&trng->rng);
- writel(TRNG_KEY, trng->base + TRNG_CR);
+ atmel_trng_disable(trng);
clk_disable_unprepare(trng->clk);
return 0;
@@ -105,6 +115,7 @@ static int atmel_trng_suspend(struct device *dev)
{
struct atmel_trng *trng = dev_get_drvdata(dev);
+ atmel_trng_disable(trng);
clk_disable_unprepare(trng->clk);
return 0;
@@ -113,8 +124,15 @@ static int atmel_trng_suspend(struct device *dev)
static int atmel_trng_resume(struct device *dev)
{
struct atmel_trng *trng = dev_get_drvdata(dev);
+ int ret;
+
+ ret = clk_prepare_enable(trng->clk);
+ if (ret)
+ return ret;
- return clk_prepare_enable(trng->clk);
+ atmel_trng_enable(trng);
+
+ return 0;
}
static const struct dev_pm_ops atmel_trng_pm_ops = {
--
2.7.4
^ permalink raw reply related
* RE: [PATCH v1] char: hw_random: atmel-rng: disable TRNG during suspend
From: Wenyou.Yang @ 2016-10-25 0:48 UTC (permalink / raw)
To: nicolas.ferre, herbert, mpm; +Cc: linux-crypto, linux-arm-kernel
In-Reply-To: <b0554c1e-e13a-9fe3-ebf4-5d8b0aa16b15@atmel.com>
> -----Original Message-----
> From: Nicolas Ferre [mailto:nicolas.ferre@atmel.com]
> Sent: 2016年10月24日 20:07
> To: Wenyou Yang - A41535 <Wenyou.Yang@microchip.com>; Herbert Xu
> <herbert@gondor.apana.org.au>; Matt Mackall <mpm@selenic.com>
> Cc: linux-crypto@vger.kernel.org; Wenyou Yang - A41535
> <Wenyou.Yang@microchip.com>; linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH v1] char: hw_random: atmel-rng: disable TRNG during
> suspend
>
> Le 24/10/2016 à 10:03, Wenyou Yang a écrit :
> > To fix the over consumption on the VDDCore due to the TRNG enabled,
> > disable the TRNG during suspend, not only disable the user interface
> > clock (which is controlled by PMC). Because the user interface clock
> > is independent from any clock that may be used in the entropy source
> > logic circuitry.
> >
> > Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
> > ---
> >
> > drivers/char/hw_random/atmel-rng.c | 16 ++++++++++++++--
> > 1 file changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/char/hw_random/atmel-rng.c
> > b/drivers/char/hw_random/atmel-rng.c
> > index 0fcc9e6..2e2d09a 100644
> > --- a/drivers/char/hw_random/atmel-rng.c
> > +++ b/drivers/char/hw_random/atmel-rng.c
> > @@ -48,6 +48,16 @@ static int atmel_trng_read(struct hwrng *rng, void *buf,
> size_t max,
> > return 0;
> > }
> >
> > +static void atmel_trng_enable(struct atmel_trng *trng) {
> > + writel(TRNG_KEY | 1, trng->base + TRNG_CR); }
> > +
> > +static void atmel_trng_disable(struct atmel_trng *trng) {
> > + writel(TRNG_KEY, trng->base + TRNG_CR); }
> > +
> > static int atmel_trng_probe(struct platform_device *pdev) {
> > struct atmel_trng *trng;
> > @@ -71,7 +81,7 @@ static int atmel_trng_probe(struct platform_device *pdev)
> > if (ret)
> > return ret;
> >
> > - writel(TRNG_KEY | 1, trng->base + TRNG_CR);
> > + atmel_trng_enable(trng);
> > trng->rng.name = pdev->name;
> > trng->rng.read = atmel_trng_read;
> >
> > @@ -94,7 +104,7 @@ static int atmel_trng_remove(struct platform_device
> > *pdev)
> >
> > hwrng_unregister(&trng->rng);
> >
> > - writel(TRNG_KEY, trng->base + TRNG_CR);
> > + atmel_trng_disable(trng);
> > clk_disable_unprepare(trng->clk);
> >
> > return 0;
> > @@ -105,6 +115,7 @@ static int atmel_trng_suspend(struct device *dev)
> > {
> > struct atmel_trng *trng = dev_get_drvdata(dev);
> >
> > + atmel_trng_disable(trng);
> > clk_disable_unprepare(trng->clk);
> >
> > return 0;
> > @@ -114,6 +125,7 @@ static int atmel_trng_resume(struct device *dev)
> > {
> > struct atmel_trng *trng = dev_get_drvdata(dev);
> >
> > + atmel_trng_enable(trng);
> > return clk_prepare_enable(trng->clk);
>
> Isn't it the other way around:
> enable the user interface first, then enable the internal clock? like:
>
> clk_prepare_enable(trng->clk);
> atmel_trng_enable(trng);
Yes, I thought so.
But the datasheet said, "The user interface clock is independent from any clock that may be used in the entropy source logic circuitry.
The source of entropy can be enabled before enabling the user interface clock."
It seems the TRNG can be enabled before enabling the peripheral clock.
Best Regards,
Wenyou Yang
^ permalink raw reply
* Re: [PATCH v2] crypto: mxs-dcp - Remove hash support
From: Fabio Estevam @ 2016-10-24 21:33 UTC (permalink / raw)
To: Marek Vasut
Cc: Herbert Xu, gianfranco.costamagna, linux-crypto, Fabio Estevam
In-Reply-To: <423fc7f0-fcab-eee6-6e7b-9ba2261fd0b3@denx.de>
On Mon, Oct 24, 2016 at 6:39 PM, Marek Vasut <marex@denx.de> wrote:
> Can't you rather fix it?
I would love to have this fixed, but I don't know how.
Any volunteers?
^ permalink raw reply
* Re: [PATCH v2] crypto: mxs-dcp - Remove hash support
From: Marek Vasut @ 2016-10-24 20:39 UTC (permalink / raw)
To: Fabio Estevam, herbert; +Cc: gianfranco.costamagna, linux-crypto, Fabio Estevam
In-Reply-To: <1477327394-2976-1-git-send-email-festevam@gmail.com>
On 10/24/2016 06:43 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> mxs-dcp driver does not probe for a long time:
>
> mxs-dcp 80028000.dcp: Failed to register sha1 hash!
> mxs-dcp: probe of 80028000.dcp failed with error -22
>
> There were some previous attempts to fix this, and the following
> feedback was given by Herbert Xu [1]:
>
> "This driver is hopelessly broken as its request context doesn't
> contain the hash state at all. Unless someone can fix that we
> should probably just remove the hash implementations altogether."
This comment looks real unhelpful. I'd really appreciate a bit more
detail on how to fix it.
> [1] http://www.spinics.net/lists/linux-crypto/msg18187.html
>
> So remove the hash support for now.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
> Changes since v1:
> - Fix typo in commit log
>
Can't you rather fix it?
--
Best regards,
Marek Vasut
^ permalink raw reply
* Equivalent of blkciper_walk for skcipher
From: Alex Cope @ 2016-10-24 20:39 UTC (permalink / raw)
To: linux-crypto; +Cc: Michael Halcrow, Eric Biggers
How should an algorithm implementing the skcipher api walk over the
scatterlist? blkcipher_walk seems to be what I need, but the API is
not compatible with skciper at the moment. Repeatedly calling
scatterwalk_map_and_copy looks like it will work, but would be less
performant than using something akin to blkciper_walk.
^ permalink raw reply
* Re: [PATCH] nvmem: sunxi-sid: SID content is not a valid source of randomness
From: Maxime Ripard @ 2016-10-24 20:10 UTC (permalink / raw)
To: Corentin Labbe
Cc: srinivas.kandagatla, wens, linux-kernel, linux-arm-kernel,
linux-crypto
In-Reply-To: <1477144408-15896-1-git-send-email-clabbe.montjoie@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 538 bytes --]
On Sat, Oct 22, 2016 at 03:53:28PM +0200, Corentin Labbe wrote:
> Since SID's content is constant over reboot,
That's not true, at least not across all the Allwinner SoCs, and
especially not on the A10 and A20 that this driver supports.
> it must not be used as source of randomness.
And I don't think that's true either. A constant entropy provider will
not add any entropy, but will not remove any, would it?
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* [PATCH v2] crypto: mxs-dcp - Remove hash support
From: Fabio Estevam @ 2016-10-24 16:43 UTC (permalink / raw)
To: herbert; +Cc: marex, gianfranco.costamagna, linux-crypto, Fabio Estevam
From: Fabio Estevam <fabio.estevam@nxp.com>
mxs-dcp driver does not probe for a long time:
mxs-dcp 80028000.dcp: Failed to register sha1 hash!
mxs-dcp: probe of 80028000.dcp failed with error -22
There were some previous attempts to fix this, and the following
feedback was given by Herbert Xu [1]:
"This driver is hopelessly broken as its request context doesn't
contain the hash state at all. Unless someone can fix that we
should probably just remove the hash implementations altogether."
[1] http://www.spinics.net/lists/linux-crypto/msg18187.html
So remove the hash support for now.
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Changes since v1:
- Fix typo in commit log
drivers/crypto/mxs-dcp.c | 367 +----------------------------------------------
1 file changed, 2 insertions(+), 365 deletions(-)
diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
index 625ee50..b1b1dda 100644
--- a/drivers/crypto/mxs-dcp.c
+++ b/drivers/crypto/mxs-dcp.c
@@ -498,278 +498,6 @@ static void mxs_dcp_aes_fallback_exit(struct crypto_tfm *tfm)
crypto_free_skcipher(actx->fallback);
}
-/*
- * Hashing (SHA1/SHA256)
- */
-static int mxs_dcp_run_sha(struct ahash_request *req)
-{
- struct dcp *sdcp = global_sdcp;
- int ret;
-
- struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
- struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
- struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
- struct hash_alg_common *halg = crypto_hash_alg_common(tfm);
-
- struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
-
- dma_addr_t digest_phys = 0;
- dma_addr_t buf_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_in_buf,
- DCP_BUF_SZ, DMA_TO_DEVICE);
-
- /* Fill in the DMA descriptor. */
- desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE |
- MXS_DCP_CONTROL0_INTERRUPT |
- MXS_DCP_CONTROL0_ENABLE_HASH;
- if (rctx->init)
- desc->control0 |= MXS_DCP_CONTROL0_HASH_INIT;
-
- desc->control1 = actx->alg;
- desc->next_cmd_addr = 0;
- desc->source = buf_phys;
- desc->destination = 0;
- desc->size = actx->fill;
- desc->payload = 0;
- desc->status = 0;
-
- /* Set HASH_TERM bit for last transfer block. */
- if (rctx->fini) {
- digest_phys = dma_map_single(sdcp->dev, req->result,
- halg->digestsize, DMA_FROM_DEVICE);
- desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM;
- desc->payload = digest_phys;
- }
-
- ret = mxs_dcp_start_dma(actx);
-
- if (rctx->fini)
- dma_unmap_single(sdcp->dev, digest_phys, halg->digestsize,
- DMA_FROM_DEVICE);
-
- dma_unmap_single(sdcp->dev, buf_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
-
- return ret;
-}
-
-static int dcp_sha_req_to_buf(struct crypto_async_request *arq)
-{
- struct dcp *sdcp = global_sdcp;
-
- struct ahash_request *req = ahash_request_cast(arq);
- struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
- struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
- struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
- struct hash_alg_common *halg = crypto_hash_alg_common(tfm);
- const int nents = sg_nents(req->src);
-
- uint8_t *in_buf = sdcp->coh->sha_in_buf;
-
- uint8_t *src_buf;
-
- struct scatterlist *src;
-
- unsigned int i, len, clen;
- int ret;
-
- int fin = rctx->fini;
- if (fin)
- rctx->fini = 0;
-
- for_each_sg(req->src, src, nents, i) {
- src_buf = sg_virt(src);
- len = sg_dma_len(src);
-
- do {
- if (actx->fill + len > DCP_BUF_SZ)
- clen = DCP_BUF_SZ - actx->fill;
- else
- clen = len;
-
- memcpy(in_buf + actx->fill, src_buf, clen);
- len -= clen;
- src_buf += clen;
- actx->fill += clen;
-
- /*
- * If we filled the buffer and still have some
- * more data, submit the buffer.
- */
- if (len && actx->fill == DCP_BUF_SZ) {
- ret = mxs_dcp_run_sha(req);
- if (ret)
- return ret;
- actx->fill = 0;
- rctx->init = 0;
- }
- } while (len);
- }
-
- if (fin) {
- rctx->fini = 1;
-
- /* Submit whatever is left. */
- if (!req->result)
- return -EINVAL;
-
- ret = mxs_dcp_run_sha(req);
- if (ret)
- return ret;
-
- actx->fill = 0;
-
- /* For some reason, the result is flipped. */
- for (i = 0; i < halg->digestsize / 2; i++) {
- swap(req->result[i],
- req->result[halg->digestsize - i - 1]);
- }
- }
-
- return 0;
-}
-
-static int dcp_chan_thread_sha(void *data)
-{
- struct dcp *sdcp = global_sdcp;
- const int chan = DCP_CHAN_HASH_SHA;
-
- struct crypto_async_request *backlog;
- struct crypto_async_request *arq;
-
- struct dcp_sha_req_ctx *rctx;
-
- struct ahash_request *req;
- int ret, fini;
-
- do {
- __set_current_state(TASK_INTERRUPTIBLE);
-
- mutex_lock(&sdcp->mutex[chan]);
- backlog = crypto_get_backlog(&sdcp->queue[chan]);
- arq = crypto_dequeue_request(&sdcp->queue[chan]);
- mutex_unlock(&sdcp->mutex[chan]);
-
- if (backlog)
- backlog->complete(backlog, -EINPROGRESS);
-
- if (arq) {
- req = ahash_request_cast(arq);
- rctx = ahash_request_ctx(req);
-
- ret = dcp_sha_req_to_buf(arq);
- fini = rctx->fini;
- arq->complete(arq, ret);
- if (!fini)
- continue;
- }
-
- schedule();
- } while (!kthread_should_stop());
-
- return 0;
-}
-
-static int dcp_sha_init(struct ahash_request *req)
-{
- struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
- struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
-
- struct hash_alg_common *halg = crypto_hash_alg_common(tfm);
-
- /*
- * Start hashing session. The code below only inits the
- * hashing session context, nothing more.
- */
- memset(actx, 0, sizeof(*actx));
-
- if (strcmp(halg->base.cra_name, "sha1") == 0)
- actx->alg = MXS_DCP_CONTROL1_HASH_SELECT_SHA1;
- else
- actx->alg = MXS_DCP_CONTROL1_HASH_SELECT_SHA256;
-
- actx->fill = 0;
- actx->hot = 0;
- actx->chan = DCP_CHAN_HASH_SHA;
-
- mutex_init(&actx->mutex);
-
- return 0;
-}
-
-static int dcp_sha_update_fx(struct ahash_request *req, int fini)
-{
- struct dcp *sdcp = global_sdcp;
-
- struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
- struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
- struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
-
- int ret;
-
- /*
- * Ignore requests that have no data in them and are not
- * the trailing requests in the stream of requests.
- */
- if (!req->nbytes && !fini)
- return 0;
-
- mutex_lock(&actx->mutex);
-
- rctx->fini = fini;
-
- if (!actx->hot) {
- actx->hot = 1;
- rctx->init = 1;
- }
-
- mutex_lock(&sdcp->mutex[actx->chan]);
- ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base);
- mutex_unlock(&sdcp->mutex[actx->chan]);
-
- wake_up_process(sdcp->thread[actx->chan]);
- mutex_unlock(&actx->mutex);
-
- return -EINPROGRESS;
-}
-
-static int dcp_sha_update(struct ahash_request *req)
-{
- return dcp_sha_update_fx(req, 0);
-}
-
-static int dcp_sha_final(struct ahash_request *req)
-{
- ahash_request_set_crypt(req, NULL, req->result, 0);
- req->nbytes = 0;
- return dcp_sha_update_fx(req, 1);
-}
-
-static int dcp_sha_finup(struct ahash_request *req)
-{
- return dcp_sha_update_fx(req, 1);
-}
-
-static int dcp_sha_digest(struct ahash_request *req)
-{
- int ret;
-
- ret = dcp_sha_init(req);
- if (ret)
- return ret;
-
- return dcp_sha_finup(req);
-}
-
-static int dcp_sha_cra_init(struct crypto_tfm *tfm)
-{
- crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
- sizeof(struct dcp_sha_req_ctx));
- return 0;
-}
-
-static void dcp_sha_cra_exit(struct crypto_tfm *tfm)
-{
-}
-
/* AES 128 ECB and AES 128 CBC */
static struct crypto_alg dcp_aes_algs[] = {
{
@@ -822,54 +550,6 @@ static struct crypto_alg dcp_aes_algs[] = {
},
};
-/* SHA1 */
-static struct ahash_alg dcp_sha1_alg = {
- .init = dcp_sha_init,
- .update = dcp_sha_update,
- .final = dcp_sha_final,
- .finup = dcp_sha_finup,
- .digest = dcp_sha_digest,
- .halg = {
- .digestsize = SHA1_DIGEST_SIZE,
- .base = {
- .cra_name = "sha1",
- .cra_driver_name = "sha1-dcp",
- .cra_priority = 400,
- .cra_alignmask = 63,
- .cra_flags = CRYPTO_ALG_ASYNC,
- .cra_blocksize = SHA1_BLOCK_SIZE,
- .cra_ctxsize = sizeof(struct dcp_async_ctx),
- .cra_module = THIS_MODULE,
- .cra_init = dcp_sha_cra_init,
- .cra_exit = dcp_sha_cra_exit,
- },
- },
-};
-
-/* SHA256 */
-static struct ahash_alg dcp_sha256_alg = {
- .init = dcp_sha_init,
- .update = dcp_sha_update,
- .final = dcp_sha_final,
- .finup = dcp_sha_finup,
- .digest = dcp_sha_digest,
- .halg = {
- .digestsize = SHA256_DIGEST_SIZE,
- .base = {
- .cra_name = "sha256",
- .cra_driver_name = "sha256-dcp",
- .cra_priority = 400,
- .cra_alignmask = 63,
- .cra_flags = CRYPTO_ALG_ASYNC,
- .cra_blocksize = SHA256_BLOCK_SIZE,
- .cra_ctxsize = sizeof(struct dcp_async_ctx),
- .cra_module = THIS_MODULE,
- .cra_init = dcp_sha_cra_init,
- .cra_exit = dcp_sha_cra_exit,
- },
- },
-};
-
static irqreturn_t mxs_dcp_irq(int irq, void *context)
{
struct dcp *sdcp = context;
@@ -984,20 +664,12 @@ static int mxs_dcp_probe(struct platform_device *pdev)
crypto_init_queue(&sdcp->queue[i], 50);
}
- /* Create the SHA and AES handler threads. */
- sdcp->thread[DCP_CHAN_HASH_SHA] = kthread_run(dcp_chan_thread_sha,
- NULL, "mxs_dcp_chan/sha");
- if (IS_ERR(sdcp->thread[DCP_CHAN_HASH_SHA])) {
- dev_err(dev, "Error starting SHA thread!\n");
- return PTR_ERR(sdcp->thread[DCP_CHAN_HASH_SHA]);
- }
-
+ /* Create the AES handler threads. */
sdcp->thread[DCP_CHAN_CRYPTO] = kthread_run(dcp_chan_thread_aes,
NULL, "mxs_dcp_chan/aes");
if (IS_ERR(sdcp->thread[DCP_CHAN_CRYPTO])) {
dev_err(dev, "Error starting SHA thread!\n");
- ret = PTR_ERR(sdcp->thread[DCP_CHAN_CRYPTO]);
- goto err_destroy_sha_thread;
+ return PTR_ERR(sdcp->thread[DCP_CHAN_CRYPTO]);
}
/* Register the various crypto algorithms. */
@@ -1013,39 +685,10 @@ static int mxs_dcp_probe(struct platform_device *pdev)
}
}
- if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA1) {
- ret = crypto_register_ahash(&dcp_sha1_alg);
- if (ret) {
- dev_err(dev, "Failed to register %s hash!\n",
- dcp_sha1_alg.halg.base.cra_name);
- goto err_unregister_aes;
- }
- }
-
- if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA256) {
- ret = crypto_register_ahash(&dcp_sha256_alg);
- if (ret) {
- dev_err(dev, "Failed to register %s hash!\n",
- dcp_sha256_alg.halg.base.cra_name);
- goto err_unregister_sha1;
- }
- }
-
return 0;
-err_unregister_sha1:
- if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA1)
- crypto_unregister_ahash(&dcp_sha1_alg);
-
-err_unregister_aes:
- if (sdcp->caps & MXS_DCP_CAPABILITY1_AES128)
- crypto_unregister_algs(dcp_aes_algs, ARRAY_SIZE(dcp_aes_algs));
-
err_destroy_aes_thread:
kthread_stop(sdcp->thread[DCP_CHAN_CRYPTO]);
-
-err_destroy_sha_thread:
- kthread_stop(sdcp->thread[DCP_CHAN_HASH_SHA]);
return ret;
}
@@ -1053,12 +696,6 @@ static int mxs_dcp_remove(struct platform_device *pdev)
{
struct dcp *sdcp = platform_get_drvdata(pdev);
- if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA256)
- crypto_unregister_ahash(&dcp_sha256_alg);
-
- if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA1)
- crypto_unregister_ahash(&dcp_sha1_alg);
-
if (sdcp->caps & MXS_DCP_CAPABILITY1_AES128)
crypto_unregister_algs(dcp_aes_algs, ARRAY_SIZE(dcp_aes_algs));
--
2.7.4
^ permalink raw reply related
* [PATCH] crypto: mxs-dcp - Remove hash support
From: Fabio Estevam @ 2016-10-24 16:40 UTC (permalink / raw)
To: herbert; +Cc: marex, gianfranco.costamagna, linux-crypto, Fabio Estevam
From: Fabio Estevam <fabio.estevam@nxp.com>
mxs-dcp driver does not probe for a long time:
mxs-dcp 80028000.dcp: Failed to register sha1 hash!
mxs-dcp: probe of 80028000.dcp failed with error -22
There were some previous attempts to fix this, and the following
feedback was given by Herbert Xu's [1]:
"This driver is hopelessly broken as its request context doesn't
contain the hash state at all. Unless someone can fix that we
should probably just remove the hash implementations altogether."
[1] http://www.spinics.net/lists/linux-crypto/msg18187.html
So remove the hash support for now.
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
drivers/crypto/mxs-dcp.c | 367 +----------------------------------------------
1 file changed, 2 insertions(+), 365 deletions(-)
diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
index 625ee50..b1b1dda 100644
--- a/drivers/crypto/mxs-dcp.c
+++ b/drivers/crypto/mxs-dcp.c
@@ -498,278 +498,6 @@ static void mxs_dcp_aes_fallback_exit(struct crypto_tfm *tfm)
crypto_free_skcipher(actx->fallback);
}
-/*
- * Hashing (SHA1/SHA256)
- */
-static int mxs_dcp_run_sha(struct ahash_request *req)
-{
- struct dcp *sdcp = global_sdcp;
- int ret;
-
- struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
- struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
- struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
- struct hash_alg_common *halg = crypto_hash_alg_common(tfm);
-
- struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
-
- dma_addr_t digest_phys = 0;
- dma_addr_t buf_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_in_buf,
- DCP_BUF_SZ, DMA_TO_DEVICE);
-
- /* Fill in the DMA descriptor. */
- desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE |
- MXS_DCP_CONTROL0_INTERRUPT |
- MXS_DCP_CONTROL0_ENABLE_HASH;
- if (rctx->init)
- desc->control0 |= MXS_DCP_CONTROL0_HASH_INIT;
-
- desc->control1 = actx->alg;
- desc->next_cmd_addr = 0;
- desc->source = buf_phys;
- desc->destination = 0;
- desc->size = actx->fill;
- desc->payload = 0;
- desc->status = 0;
-
- /* Set HASH_TERM bit for last transfer block. */
- if (rctx->fini) {
- digest_phys = dma_map_single(sdcp->dev, req->result,
- halg->digestsize, DMA_FROM_DEVICE);
- desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM;
- desc->payload = digest_phys;
- }
-
- ret = mxs_dcp_start_dma(actx);
-
- if (rctx->fini)
- dma_unmap_single(sdcp->dev, digest_phys, halg->digestsize,
- DMA_FROM_DEVICE);
-
- dma_unmap_single(sdcp->dev, buf_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
-
- return ret;
-}
-
-static int dcp_sha_req_to_buf(struct crypto_async_request *arq)
-{
- struct dcp *sdcp = global_sdcp;
-
- struct ahash_request *req = ahash_request_cast(arq);
- struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
- struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
- struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
- struct hash_alg_common *halg = crypto_hash_alg_common(tfm);
- const int nents = sg_nents(req->src);
-
- uint8_t *in_buf = sdcp->coh->sha_in_buf;
-
- uint8_t *src_buf;
-
- struct scatterlist *src;
-
- unsigned int i, len, clen;
- int ret;
-
- int fin = rctx->fini;
- if (fin)
- rctx->fini = 0;
-
- for_each_sg(req->src, src, nents, i) {
- src_buf = sg_virt(src);
- len = sg_dma_len(src);
-
- do {
- if (actx->fill + len > DCP_BUF_SZ)
- clen = DCP_BUF_SZ - actx->fill;
- else
- clen = len;
-
- memcpy(in_buf + actx->fill, src_buf, clen);
- len -= clen;
- src_buf += clen;
- actx->fill += clen;
-
- /*
- * If we filled the buffer and still have some
- * more data, submit the buffer.
- */
- if (len && actx->fill == DCP_BUF_SZ) {
- ret = mxs_dcp_run_sha(req);
- if (ret)
- return ret;
- actx->fill = 0;
- rctx->init = 0;
- }
- } while (len);
- }
-
- if (fin) {
- rctx->fini = 1;
-
- /* Submit whatever is left. */
- if (!req->result)
- return -EINVAL;
-
- ret = mxs_dcp_run_sha(req);
- if (ret)
- return ret;
-
- actx->fill = 0;
-
- /* For some reason, the result is flipped. */
- for (i = 0; i < halg->digestsize / 2; i++) {
- swap(req->result[i],
- req->result[halg->digestsize - i - 1]);
- }
- }
-
- return 0;
-}
-
-static int dcp_chan_thread_sha(void *data)
-{
- struct dcp *sdcp = global_sdcp;
- const int chan = DCP_CHAN_HASH_SHA;
-
- struct crypto_async_request *backlog;
- struct crypto_async_request *arq;
-
- struct dcp_sha_req_ctx *rctx;
-
- struct ahash_request *req;
- int ret, fini;
-
- do {
- __set_current_state(TASK_INTERRUPTIBLE);
-
- mutex_lock(&sdcp->mutex[chan]);
- backlog = crypto_get_backlog(&sdcp->queue[chan]);
- arq = crypto_dequeue_request(&sdcp->queue[chan]);
- mutex_unlock(&sdcp->mutex[chan]);
-
- if (backlog)
- backlog->complete(backlog, -EINPROGRESS);
-
- if (arq) {
- req = ahash_request_cast(arq);
- rctx = ahash_request_ctx(req);
-
- ret = dcp_sha_req_to_buf(arq);
- fini = rctx->fini;
- arq->complete(arq, ret);
- if (!fini)
- continue;
- }
-
- schedule();
- } while (!kthread_should_stop());
-
- return 0;
-}
-
-static int dcp_sha_init(struct ahash_request *req)
-{
- struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
- struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
-
- struct hash_alg_common *halg = crypto_hash_alg_common(tfm);
-
- /*
- * Start hashing session. The code below only inits the
- * hashing session context, nothing more.
- */
- memset(actx, 0, sizeof(*actx));
-
- if (strcmp(halg->base.cra_name, "sha1") == 0)
- actx->alg = MXS_DCP_CONTROL1_HASH_SELECT_SHA1;
- else
- actx->alg = MXS_DCP_CONTROL1_HASH_SELECT_SHA256;
-
- actx->fill = 0;
- actx->hot = 0;
- actx->chan = DCP_CHAN_HASH_SHA;
-
- mutex_init(&actx->mutex);
-
- return 0;
-}
-
-static int dcp_sha_update_fx(struct ahash_request *req, int fini)
-{
- struct dcp *sdcp = global_sdcp;
-
- struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
- struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
- struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
-
- int ret;
-
- /*
- * Ignore requests that have no data in them and are not
- * the trailing requests in the stream of requests.
- */
- if (!req->nbytes && !fini)
- return 0;
-
- mutex_lock(&actx->mutex);
-
- rctx->fini = fini;
-
- if (!actx->hot) {
- actx->hot = 1;
- rctx->init = 1;
- }
-
- mutex_lock(&sdcp->mutex[actx->chan]);
- ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base);
- mutex_unlock(&sdcp->mutex[actx->chan]);
-
- wake_up_process(sdcp->thread[actx->chan]);
- mutex_unlock(&actx->mutex);
-
- return -EINPROGRESS;
-}
-
-static int dcp_sha_update(struct ahash_request *req)
-{
- return dcp_sha_update_fx(req, 0);
-}
-
-static int dcp_sha_final(struct ahash_request *req)
-{
- ahash_request_set_crypt(req, NULL, req->result, 0);
- req->nbytes = 0;
- return dcp_sha_update_fx(req, 1);
-}
-
-static int dcp_sha_finup(struct ahash_request *req)
-{
- return dcp_sha_update_fx(req, 1);
-}
-
-static int dcp_sha_digest(struct ahash_request *req)
-{
- int ret;
-
- ret = dcp_sha_init(req);
- if (ret)
- return ret;
-
- return dcp_sha_finup(req);
-}
-
-static int dcp_sha_cra_init(struct crypto_tfm *tfm)
-{
- crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
- sizeof(struct dcp_sha_req_ctx));
- return 0;
-}
-
-static void dcp_sha_cra_exit(struct crypto_tfm *tfm)
-{
-}
-
/* AES 128 ECB and AES 128 CBC */
static struct crypto_alg dcp_aes_algs[] = {
{
@@ -822,54 +550,6 @@ static struct crypto_alg dcp_aes_algs[] = {
},
};
-/* SHA1 */
-static struct ahash_alg dcp_sha1_alg = {
- .init = dcp_sha_init,
- .update = dcp_sha_update,
- .final = dcp_sha_final,
- .finup = dcp_sha_finup,
- .digest = dcp_sha_digest,
- .halg = {
- .digestsize = SHA1_DIGEST_SIZE,
- .base = {
- .cra_name = "sha1",
- .cra_driver_name = "sha1-dcp",
- .cra_priority = 400,
- .cra_alignmask = 63,
- .cra_flags = CRYPTO_ALG_ASYNC,
- .cra_blocksize = SHA1_BLOCK_SIZE,
- .cra_ctxsize = sizeof(struct dcp_async_ctx),
- .cra_module = THIS_MODULE,
- .cra_init = dcp_sha_cra_init,
- .cra_exit = dcp_sha_cra_exit,
- },
- },
-};
-
-/* SHA256 */
-static struct ahash_alg dcp_sha256_alg = {
- .init = dcp_sha_init,
- .update = dcp_sha_update,
- .final = dcp_sha_final,
- .finup = dcp_sha_finup,
- .digest = dcp_sha_digest,
- .halg = {
- .digestsize = SHA256_DIGEST_SIZE,
- .base = {
- .cra_name = "sha256",
- .cra_driver_name = "sha256-dcp",
- .cra_priority = 400,
- .cra_alignmask = 63,
- .cra_flags = CRYPTO_ALG_ASYNC,
- .cra_blocksize = SHA256_BLOCK_SIZE,
- .cra_ctxsize = sizeof(struct dcp_async_ctx),
- .cra_module = THIS_MODULE,
- .cra_init = dcp_sha_cra_init,
- .cra_exit = dcp_sha_cra_exit,
- },
- },
-};
-
static irqreturn_t mxs_dcp_irq(int irq, void *context)
{
struct dcp *sdcp = context;
@@ -984,20 +664,12 @@ static int mxs_dcp_probe(struct platform_device *pdev)
crypto_init_queue(&sdcp->queue[i], 50);
}
- /* Create the SHA and AES handler threads. */
- sdcp->thread[DCP_CHAN_HASH_SHA] = kthread_run(dcp_chan_thread_sha,
- NULL, "mxs_dcp_chan/sha");
- if (IS_ERR(sdcp->thread[DCP_CHAN_HASH_SHA])) {
- dev_err(dev, "Error starting SHA thread!\n");
- return PTR_ERR(sdcp->thread[DCP_CHAN_HASH_SHA]);
- }
-
+ /* Create the AES handler threads. */
sdcp->thread[DCP_CHAN_CRYPTO] = kthread_run(dcp_chan_thread_aes,
NULL, "mxs_dcp_chan/aes");
if (IS_ERR(sdcp->thread[DCP_CHAN_CRYPTO])) {
dev_err(dev, "Error starting SHA thread!\n");
- ret = PTR_ERR(sdcp->thread[DCP_CHAN_CRYPTO]);
- goto err_destroy_sha_thread;
+ return PTR_ERR(sdcp->thread[DCP_CHAN_CRYPTO]);
}
/* Register the various crypto algorithms. */
@@ -1013,39 +685,10 @@ static int mxs_dcp_probe(struct platform_device *pdev)
}
}
- if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA1) {
- ret = crypto_register_ahash(&dcp_sha1_alg);
- if (ret) {
- dev_err(dev, "Failed to register %s hash!\n",
- dcp_sha1_alg.halg.base.cra_name);
- goto err_unregister_aes;
- }
- }
-
- if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA256) {
- ret = crypto_register_ahash(&dcp_sha256_alg);
- if (ret) {
- dev_err(dev, "Failed to register %s hash!\n",
- dcp_sha256_alg.halg.base.cra_name);
- goto err_unregister_sha1;
- }
- }
-
return 0;
-err_unregister_sha1:
- if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA1)
- crypto_unregister_ahash(&dcp_sha1_alg);
-
-err_unregister_aes:
- if (sdcp->caps & MXS_DCP_CAPABILITY1_AES128)
- crypto_unregister_algs(dcp_aes_algs, ARRAY_SIZE(dcp_aes_algs));
-
err_destroy_aes_thread:
kthread_stop(sdcp->thread[DCP_CHAN_CRYPTO]);
-
-err_destroy_sha_thread:
- kthread_stop(sdcp->thread[DCP_CHAN_HASH_SHA]);
return ret;
}
@@ -1053,12 +696,6 @@ static int mxs_dcp_remove(struct platform_device *pdev)
{
struct dcp *sdcp = platform_get_drvdata(pdev);
- if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA256)
- crypto_unregister_ahash(&dcp_sha256_alg);
-
- if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA1)
- crypto_unregister_ahash(&dcp_sha1_alg);
-
if (sdcp->caps & MXS_DCP_CAPABILITY1_AES128)
crypto_unregister_algs(dcp_aes_algs, ARRAY_SIZE(dcp_aes_algs));
--
2.7.4
^ permalink raw reply related
* [PATCH -next] crypto: drop pointless static qualifier in atmel_aes_probe()
From: Wei Yongjun @ 2016-10-24 14:51 UTC (permalink / raw)
To: Herbert Xu; +Cc: Wei Yongjun, linux-crypto
From: Wei Yongjun <weiyongjun1@huawei.com>
There is no need to have the 'struct atmel_aes_dev *aes_dd' variable
static since new value always be assigned before use it.
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/crypto/atmel-aes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index 6b656f4..0e3d0d6 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -2311,7 +2311,7 @@ static int atmel_aes_probe(struct platform_device *pdev)
static int atmel_aes_remove(struct platform_device *pdev)
{
- static struct atmel_aes_dev *aes_dd;
+ struct atmel_aes_dev *aes_dd;
aes_dd = platform_get_drvdata(pdev);
if (!aes_dd)
^ permalink raw reply related
* Re: [PATCH v1] char: hw_random: atmel-rng: disable TRNG during suspend
From: Nicolas Ferre @ 2016-10-24 12:07 UTC (permalink / raw)
To: Wenyou Yang, Herbert Xu, Matt Mackall
Cc: linux-crypto, Wenyou Yang, linux-arm-kernel
In-Reply-To: <1477296208-28335-1-git-send-email-wenyou.yang@atmel.com>
Le 24/10/2016 à 10:03, Wenyou Yang a écrit :
> To fix the over consumption on the VDDCore due to the TRNG enabled,
> disable the TRNG during suspend, not only disable the user interface
> clock (which is controlled by PMC). Because the user interface clock
> is independent from any clock that may be used in the entropy source
> logic circuitry.
>
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
> ---
>
> drivers/char/hw_random/atmel-rng.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
> index 0fcc9e6..2e2d09a 100644
> --- a/drivers/char/hw_random/atmel-rng.c
> +++ b/drivers/char/hw_random/atmel-rng.c
> @@ -48,6 +48,16 @@ static int atmel_trng_read(struct hwrng *rng, void *buf, size_t max,
> return 0;
> }
>
> +static void atmel_trng_enable(struct atmel_trng *trng)
> +{
> + writel(TRNG_KEY | 1, trng->base + TRNG_CR);
> +}
> +
> +static void atmel_trng_disable(struct atmel_trng *trng)
> +{
> + writel(TRNG_KEY, trng->base + TRNG_CR);
> +}
> +
> static int atmel_trng_probe(struct platform_device *pdev)
> {
> struct atmel_trng *trng;
> @@ -71,7 +81,7 @@ static int atmel_trng_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - writel(TRNG_KEY | 1, trng->base + TRNG_CR);
> + atmel_trng_enable(trng);
> trng->rng.name = pdev->name;
> trng->rng.read = atmel_trng_read;
>
> @@ -94,7 +104,7 @@ static int atmel_trng_remove(struct platform_device *pdev)
>
> hwrng_unregister(&trng->rng);
>
> - writel(TRNG_KEY, trng->base + TRNG_CR);
> + atmel_trng_disable(trng);
> clk_disable_unprepare(trng->clk);
>
> return 0;
> @@ -105,6 +115,7 @@ static int atmel_trng_suspend(struct device *dev)
> {
> struct atmel_trng *trng = dev_get_drvdata(dev);
>
> + atmel_trng_disable(trng);
> clk_disable_unprepare(trng->clk);
>
> return 0;
> @@ -114,6 +125,7 @@ static int atmel_trng_resume(struct device *dev)
> {
> struct atmel_trng *trng = dev_get_drvdata(dev);
>
> + atmel_trng_enable(trng);
> return clk_prepare_enable(trng->clk);
Isn't it the other way around:
enable the user interface first, then enable the internal clock? like:
clk_prepare_enable(trng->clk);
atmel_trng_enable(trng);
Regards,
--
Nicolas Ferre
^ permalink raw reply
* [PATCH v1] char: hw_random: atmel-rng: disable TRNG during suspend
From: Wenyou Yang @ 2016-10-24 8:03 UTC (permalink / raw)
To: Herbert Xu, Matt Mackall
Cc: linux-crypto, Wenyou Yang, linux-arm-kernel, Nicolas Ferre,
Wenyou Yang
To fix the over consumption on the VDDCore due to the TRNG enabled,
disable the TRNG during suspend, not only disable the user interface
clock (which is controlled by PMC). Because the user interface clock
is independent from any clock that may be used in the entropy source
logic circuitry.
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---
drivers/char/hw_random/atmel-rng.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
index 0fcc9e6..2e2d09a 100644
--- a/drivers/char/hw_random/atmel-rng.c
+++ b/drivers/char/hw_random/atmel-rng.c
@@ -48,6 +48,16 @@ static int atmel_trng_read(struct hwrng *rng, void *buf, size_t max,
return 0;
}
+static void atmel_trng_enable(struct atmel_trng *trng)
+{
+ writel(TRNG_KEY | 1, trng->base + TRNG_CR);
+}
+
+static void atmel_trng_disable(struct atmel_trng *trng)
+{
+ writel(TRNG_KEY, trng->base + TRNG_CR);
+}
+
static int atmel_trng_probe(struct platform_device *pdev)
{
struct atmel_trng *trng;
@@ -71,7 +81,7 @@ static int atmel_trng_probe(struct platform_device *pdev)
if (ret)
return ret;
- writel(TRNG_KEY | 1, trng->base + TRNG_CR);
+ atmel_trng_enable(trng);
trng->rng.name = pdev->name;
trng->rng.read = atmel_trng_read;
@@ -94,7 +104,7 @@ static int atmel_trng_remove(struct platform_device *pdev)
hwrng_unregister(&trng->rng);
- writel(TRNG_KEY, trng->base + TRNG_CR);
+ atmel_trng_disable(trng);
clk_disable_unprepare(trng->clk);
return 0;
@@ -105,6 +115,7 @@ static int atmel_trng_suspend(struct device *dev)
{
struct atmel_trng *trng = dev_get_drvdata(dev);
+ atmel_trng_disable(trng);
clk_disable_unprepare(trng->clk);
return 0;
@@ -114,6 +125,7 @@ static int atmel_trng_resume(struct device *dev)
{
struct atmel_trng *trng = dev_get_drvdata(dev);
+ atmel_trng_enable(trng);
return clk_prepare_enable(trng->clk);
}
--
2.7.4
^ permalink raw reply related
* Re: [PATCH v2 0/8] Conversion crypto API documentation to Sphinx
From: Stephan Mueller @ 2016-10-23 16:46 UTC (permalink / raw)
To: Jonathan Corbet; +Cc: herbert, linux-crypto, linux-doc
In-Reply-To: <20161023103238.4fceddac@lwn.net>
Am Sonntag, 23. Oktober 2016, 10:32:38 CEST schrieb Jonathan Corbet:
Hi Jonathan,
> On Fri, 21 Oct 2016 04:53:45 +0200
>
> Stephan Mueller <smueller@chronox.de> wrote:
> > the attached patch set converts the existing crypto API documentation
> > from DocBook to Sphinx.
>
> This looks generally good to me - thanks for doing it!
>
> Is there any chance of running the Documentation/ parts through the docs
> tree? Documentation/index.rst has become a bit of a conflict point
> otherwise...
Unless Herbert objects, I would not see any reason why we should not push it
through the docs tree.
Yet we should wait for Herbert's ack as I have added also new information in
the patch set (the KPP API documentation and the change in the AEAD
documentation).
Ciao
Stephan
^ permalink raw reply
* Re: [PATCH v2 0/8] Conversion crypto API documentation to Sphinx
From: Jonathan Corbet @ 2016-10-23 16:32 UTC (permalink / raw)
To: Stephan Mueller; +Cc: herbert, linux-crypto, linux-doc
In-Reply-To: <2053893.WjF01BJSDF@positron.chronox.de>
On Fri, 21 Oct 2016 04:53:45 +0200
Stephan Mueller <smueller@chronox.de> wrote:
> the attached patch set converts the existing crypto API documentation
> from DocBook to Sphinx.
This looks generally good to me - thanks for doing it!
Is there any chance of running the Documentation/ parts through the docs
tree? Documentation/index.rst has become a bit of a conflict point
otherwise...
Thanks,
jon
^ permalink raw reply
* [ANNOUNCE] /dev/random - a new approach code for 4.9-rc1
From: Stephan Mueller @ 2016-10-22 23:54 UTC (permalink / raw)
To: linux-crypto, linux-kernel
Hi,
The patch set that can be downloaded at [1] provides a different approach to /
dev/random which I call Linux Random Number Generator (LRNG) to collect
entropy within the Linux kernel. The main improvements compared to the legacy
/dev/random is to provide sufficient entropy during boot time as well as in
virtual environments and when using SSDs or Device Mapper targets. A secondary
design goal is to limit the impact of the entropy collection on massive
parallel systems and also allow the use accelerated cryptographic primitives.
Also, all steps of the entropic data processing are testable. Finally
performance improvements are visible at /dev/urandom and get_random_bytes.
The design and implementation is driven by a set of goals described in [2]
that the LRNG completely implements. Furthermore, [2] includes a
comparison with RNG design suggestions such as SP800-90B, SP800-90C, and
AIS20/31.
[1] http://www.chronox.de/lrng.html
[2] http://www.chronox.de/lrng/doc/lrng.pdf
Ciao
Stephan
^ permalink raw reply
* Talent Scout
From: Camilia Brunnet @ 2016-10-22 17:31 UTC (permalink / raw)
To: Recipients
Dear Concern,
I am Talent Scout For BLUE SKY FILM STUDIO, Present Blue sky Studio a
Film Corporation Located in the United State, is Soliciting for the
Right to use Your Photo/Face and Personality as One of the Semi -Major
Role/ Character in our Upcoming ANIMATED Stereoscope 3D Movie-The Story
of Ferdinand (Ferdinand 2017) The Movie is Currently Filming (In
Production) Please Note That There Will Be No Auditions, Traveling or
Any Special / Professional Acting Skills, Since the Production of This
Movie Will Be Done with our State of Art Computer -Generating Imagery
Equipment. We Are Prepared to Pay the Total Sum of $620,000.00 USD. For
More Information/Understanding, Please Write us on the E-Mail Below.
CONTACT EMAIL: blueskystudios@usa.com
All Reply to: blueskystudios@usa.com
Note: Only the Response send to this mail will be Given a Prior
Consideration.
Talent Scout
Camilia Brunnet
^ permalink raw reply
* Talent Scout
From: Camilia Brunnet @ 2016-10-22 17:27 UTC (permalink / raw)
To: Recipients
Dear Concern,
I am Talent Scout For BLUE SKY FILM STUDIO, Present Blue sky Studio a
Film Corporation Located in the United State, is Soliciting for the
Right to use Your Photo/Face and Personality as One of the Semi -Major
Role/ Character in our Upcoming ANIMATED Stereoscope 3D Movie-The Story
of Ferdinand (Ferdinand 2017) The Movie is Currently Filming (In
Production) Please Note That There Will Be No Auditions, Traveling or
Any Special / Professional Acting Skills, Since the Production of This
Movie Will Be Done with our State of Art Computer -Generating Imagery
Equipment. We Are Prepared to Pay the Total Sum of $620,000.00 USD. For
More Information/Understanding, Please Write us on the E-Mail Below.
CONTACT EMAIL: blueskystudios@usa.com
All Reply to: blueskystudios@usa.com
Note: Only the Response send to this mail will be Given a Prior
Consideration.
Talent Scout
Camilia Brunnet
^ permalink raw reply
* [PATCH] hwrng: core - zeroize buffers with random data
From: Stephan Mueller @ 2016-10-22 13:57 UTC (permalink / raw)
To: herbert; +Cc: linux-crypto, Andy Lutomirski
Hi Herbert,
As requested by Andy, I have created the following patch. This patch is against the cryptodev-2.6 tree and applies cleanly. However, due to Andy's patch to Linus' tree, the patch will fail to apply to that tree.
How would you want to proceed? Do you want to pull Andy's patch into your cryptodev-2.6 tree which means I will rework the patch?
Thanks
Stephan
---8<---
The HWRNG core allocates two buffers during initialization which are
used to obtain random data. After that data is processed, it is now
zeroized as it is possible that the HWRNG core will not be asked to
produce more random data for a long time. This prevents leaving such
sensitive data in memory.
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
drivers/char/hw_random/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index d2d2c89..f976641 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -92,6 +92,7 @@ static void add_early_randomness(struct hwrng *rng)
mutex_unlock(&reading_mutex);
if (bytes_read > 0)
add_device_randomness(rng_buffer, bytes_read);
+ memset(rng_buffer, 0, size);
}
static inline void cleanup_rng(struct kref *kref)
@@ -287,6 +288,7 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,
}
}
out:
+ memset(rng_buffer, 0, rng_buffer_size());
return ret ? : err;
out_unlock_reading:
@@ -425,6 +427,7 @@ static int hwrng_fillfn(void *unused)
/* Outside lock, sure, but y'know: randomness. */
add_hwgenerator_randomness((void *)rng_fillbuf, rc,
rc * current_quality * 8 >> 10);
+ memset(rng_fillbuf, 0, rng_buffer_size());
}
hwrng_fill = NULL;
return 0;
--
2.7.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox