From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net, wens@csie.org,
linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] crypto: sun4i-ss: support the Security System PRNG
Date: Tue, 20 Jun 2017 13:45:36 +0200 [thread overview]
Message-ID: <20170620114536.GA4766@Red> (raw)
In-Reply-To: <20170620095947.i3r3iym2cxz5jciw@flea.lan>
On Tue, Jun 20, 2017 at 11:59:47AM +0200, Maxime Ripard wrote:
> Hi,
>
> On Tue, Jun 20, 2017 at 10:58:19AM +0200, Corentin Labbe wrote:
> > The Security System have a PRNG, this patch add support for it via
> > crypto_rng.
>
> This might be a dumb question, but is the CRYPTO_RNG code really
> supposed to be used with PRNG?
>
Yes, see recently added drivers/crypto/exynos-rng.c
[...]
> > --- a/drivers/crypto/sunxi-ss/sun4i-ss.h
> > +++ b/drivers/crypto/sunxi-ss/sun4i-ss.h
> > @@ -32,6 +32,7 @@
> > #include <crypto/aes.h>
> > #include <crypto/des.h>
> > #include <crypto/internal/rng.h>
> > +#include <crypto/rng.h>
> >
> > #define SS_CTL 0x00
> > #define SS_KEY0 0x04
> > @@ -127,6 +128,9 @@
> > #define SS_RXFIFO_EMP_INT_ENABLE (1 << 2)
> > #define SS_TXFIFO_AVA_INT_ENABLE (1 << 0)
> >
> > +#define SS_SEED_LEN (192 / 8)
> > +#define SS_DATA_LEN (160 / 8)
> > +
> > struct sun4i_ss_ctx {
> > void __iomem *base;
> > int irq;
> > @@ -136,6 +140,7 @@ struct sun4i_ss_ctx {
> > struct device *dev;
> > struct resource *res;
> > spinlock_t slock; /* control the use of the device */
> > + u32 seed[SS_SEED_LEN / 4];
>
> Shouldn't you define SS_SEED_LEN in bits, and then use either
> BITS_PER_BYTE and BITS_PER_LONG so that it's obvious what you're doing
> ?
>
> And you could also make that variable defined based on the option,
> otherwise you'll always allocate that array, even if you're not using
> it.
I will do that
Thanks
WARNING: multiple messages have this Message-ID (diff)
From: clabbe.montjoie@gmail.com (Corentin Labbe)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] crypto: sun4i-ss: support the Security System PRNG
Date: Tue, 20 Jun 2017 13:45:36 +0200 [thread overview]
Message-ID: <20170620114536.GA4766@Red> (raw)
In-Reply-To: <20170620095947.i3r3iym2cxz5jciw@flea.lan>
On Tue, Jun 20, 2017 at 11:59:47AM +0200, Maxime Ripard wrote:
> Hi,
>
> On Tue, Jun 20, 2017 at 10:58:19AM +0200, Corentin Labbe wrote:
> > The Security System have a PRNG, this patch add support for it via
> > crypto_rng.
>
> This might be a dumb question, but is the CRYPTO_RNG code really
> supposed to be used with PRNG?
>
Yes, see recently added drivers/crypto/exynos-rng.c
[...]
> > --- a/drivers/crypto/sunxi-ss/sun4i-ss.h
> > +++ b/drivers/crypto/sunxi-ss/sun4i-ss.h
> > @@ -32,6 +32,7 @@
> > #include <crypto/aes.h>
> > #include <crypto/des.h>
> > #include <crypto/internal/rng.h>
> > +#include <crypto/rng.h>
> >
> > #define SS_CTL 0x00
> > #define SS_KEY0 0x04
> > @@ -127,6 +128,9 @@
> > #define SS_RXFIFO_EMP_INT_ENABLE (1 << 2)
> > #define SS_TXFIFO_AVA_INT_ENABLE (1 << 0)
> >
> > +#define SS_SEED_LEN (192 / 8)
> > +#define SS_DATA_LEN (160 / 8)
> > +
> > struct sun4i_ss_ctx {
> > void __iomem *base;
> > int irq;
> > @@ -136,6 +140,7 @@ struct sun4i_ss_ctx {
> > struct device *dev;
> > struct resource *res;
> > spinlock_t slock; /* control the use of the device */
> > + u32 seed[SS_SEED_LEN / 4];
>
> Shouldn't you define SS_SEED_LEN in bits, and then use either
> BITS_PER_BYTE and BITS_PER_LONG so that it's obvious what you're doing
> ?
>
> And you could also make that variable defined based on the option,
> otherwise you'll always allocate that array, even if you're not using
> it.
I will do that
Thanks
next prev parent reply other threads:[~2017-06-20 11:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-20 8:58 [PATCH] crypto: sun4i-ss: support the Security System PRNG Corentin Labbe
2017-06-20 8:58 ` Corentin Labbe
2017-06-20 8:58 ` Corentin Labbe
2017-06-20 9:59 ` Maxime Ripard
2017-06-20 9:59 ` Maxime Ripard
2017-06-20 11:45 ` Corentin Labbe [this message]
2017-06-20 11:45 ` Corentin Labbe
2017-06-21 6:48 ` Maxime Ripard
2017-06-21 6:48 ` Maxime Ripard
2017-06-21 23:47 ` Herbert Xu
2017-06-21 23:47 ` Herbert Xu
-- strict thread matches above, loose matches on Subject: below --
2016-10-18 12:34 Corentin Labbe
2016-10-18 12:34 ` Corentin Labbe
2016-10-18 14:24 ` Stephan Mueller
2016-10-18 14:24 ` Stephan Mueller
2016-11-17 8:07 ` Corentin Labbe
2016-11-17 8:07 ` Corentin Labbe
2016-11-17 8:18 ` Stephan Mueller
2016-11-17 8:18 ` Stephan Mueller
2016-10-18 16:09 ` PrasannaKumar Muralidharan
2016-10-18 16:09 ` PrasannaKumar Muralidharan
2016-11-17 8:05 ` Corentin Labbe
2016-11-17 8:05 ` Corentin Labbe
2016-11-18 1:07 ` Sandy Harris
2016-11-18 1:07 ` Sandy Harris
2016-11-18 7:55 ` Corentin Labbe
2016-11-18 7:55 ` Corentin Labbe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170620114536.GA4766@Red \
--to=clabbe.montjoie@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.ripard@free-electrons.com \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.