Re: [PATCH] crypto: use list to stage async seeding requests

2015-06-08 Thread Herbert Xu
On Sat, Jun 06, 2015 at 04:16:54AM +0200, Stephan Mueller wrote: > This patch uses a list to track the asynchronous seeding requests until > the nonblocking pool is fully initialized. The random.c is provided with > two API calls: the get_blocking_random_bytes_cb allows the caller to > provide a ca

Re: nios2: Export get_cycles

2015-06-08 Thread Herbert Xu
On Tue, Jun 09, 2015 at 03:19:32PM +1000, Stephen Rothwell wrote: > Hi Herbert, > > On Tue, 9 Jun 2015 12:46:46 +0800 Herbert Xu > wrote: > > > > On Mon, Jun 08, 2015 at 09:31:54PM -0700, Guenter Roeck wrote: > > > > > > nios2 still fails to build with > > > > > > ERROR: "get_cycles" [crypto/j

Re: nios2: Export get_cycles

2015-06-08 Thread Stephen Rothwell
Hi Herbert, On Tue, 9 Jun 2015 12:46:46 +0800 Herbert Xu wrote: > > On Mon, Jun 08, 2015 at 09:31:54PM -0700, Guenter Roeck wrote: > > > > nios2 still fails to build with > > > > ERROR: "get_cycles" [crypto/jitterentropy.ko] undefined! > > It's the only arch that doesn't inline get_cycles and

nios2: Export get_cycles

2015-06-08 Thread Herbert Xu
On Mon, Jun 08, 2015 at 09:31:54PM -0700, Guenter Roeck wrote: > > nios2 still fails to build with > > ERROR: "get_cycles" [crypto/jitterentropy.ko] undefined! It's the only arch that doesn't inline get_cycles and doesn't export it. ---8<--- nios2 is the only architecture that does not inline g

Re: [PATCH] crypto: drbg - use pragmas for disabling optimization

2015-06-08 Thread Guenter Roeck
On 06/08/2015 07:08 PM, Stephan Mueller wrote: Hi, I performed measurements of the upper and lower boundary of the minimum and Shannon entropy for the RNG before the patch and after the patch. The values are very similar which demonstrates that the change does not affect the cryptographic charac

Re: [PATCH] crypto: drbg - use pragmas for disabling optimization

2015-06-08 Thread Stephen Rothwell
Hi Stephan, On Tue, 09 Jun 2015 04:08:49 +0200 Stephan Mueller wrote: > > Replace the global -O0 compiler flag from the Makefile with GCC > pragmas to mark only the functions required to be compiled without > optimizations. > > This patch also adds a comment describing the rationale for the > fu

[PATCH] crypto: drbg - use pragmas for disabling optimization

2015-06-08 Thread Stephan Mueller
Hi, I performed measurements of the upper and lower boundary of the minimum and Shannon entropy for the RNG before the patch and after the patch. The values are very similar which demonstrates that the change does not affect the cryptographic characteristics of the RNG. The tests are available at

Re: randconfig build error with next-20150529, in crypto/jitterentropy.c

2015-06-08 Thread Stephan Mueller
Am Monday 08 June 2015, 16:51:24 schrieb Guenter Roeck: Hi Guenter, > >Yes, that fixes the problem (after I also removed the associated #error from >jitterentropy.c). Thank you for the confirmation. The patch will come tonight on this issue as I tested the cryptographic impact already. Thanks

Re: randconfig build error with next-20150529, in crypto/jitterentropy.c

2015-06-08 Thread Guenter Roeck
On 06/08/2015 04:33 PM, Stephan Mueller wrote: Am Monday 08 June 2015, 16:30:09 schrieb Guenter Roeck: Hi Guenter, get_cycles is implemented as static inline which executes mfspr(SPR_TTCR). SPR_TTCR is a constant. Normally that information seems to be passed on, but not when get_cycles() is c

Re: randconfig build error with next-20150529, in crypto/jitterentropy.c

2015-06-08 Thread Stephan Mueller
Am Monday 08 June 2015, 16:30:09 schrieb Guenter Roeck: Hi Guenter, > >get_cycles is implemented as static inline which executes mfspr(SPR_TTCR). >SPR_TTCR is a constant. Normally that information seems to be passed on, >but not when get_cycles() is compiled through jitterentropy. > >Any idea wha

Re: randconfig build error with next-20150529, in crypto/jitterentropy.c

2015-06-08 Thread Guenter Roeck
On 06/08/2015 03:36 PM, Stephan Mueller wrote: Am Monday 08 June 2015, 12:54:12 schrieb Guenter Roeck: Hi Guenter, Thanks for the note. ... --- openrisc:defconfig: In file included from ./arch/openrisc/include/asm/timex.h:23:0, ... from crypto/jitterentropy.c:52: ./arch/ope

Re: randconfig build error with next-20150529, in crypto/jitterentropy.c

2015-06-08 Thread Stephan Mueller
Am Monday 08 June 2015, 12:54:12 schrieb Guenter Roeck: Hi Guenter, Thanks for the note. ... > >--- > >openrisc:defconfig: > >In file included from ./arch/openrisc/include/asm/timex.h:23:0, > ... > from crypto/jitterentropy.c:52: >./arch/openrisc/include/asm/spr.h: In function 'jent_

Re: randconfig build error with next-20150529, in crypto/jitterentropy.c

2015-06-08 Thread Guenter Roeck
On Mon, Jun 08, 2015 at 03:21:09PM +0300, Andy Shevchenko wrote: > On Fri, May 29, 2015 at 10:14 PM, Jim Davis wrote: > > Building with the attached random configuration file, > > Hit the very same error against next-20150605. > There are also several failing default configurations. Guenter -

Re: [PATCH RFC v2 1/2] crypto: add PKE API

2015-06-08 Thread Kees Cook
On Wed, May 6, 2015 at 12:36 PM, Tadeusz Struk wrote: > Add Public Key Encryption API. > > Signed-off-by: Tadeusz Struk > --- > crypto/Kconfig |6 + > crypto/Makefile|1 > crypto/crypto_user.c | 24 +++ > crypto/pkey.c | 125 ++ >

Re: randconfig build error with next-20150529, in crypto/jitterentropy.c

2015-06-08 Thread Peter Zijlstra
On Mon, 2015-06-08 at 17:52 +0200, Stephan Mueller wrote: > Am Monday 08 June 2015, 14:36:30 schrieb Peter Zijlstra: > > Hi Peter, > > > >Would something like > > > >#pragma GCC push_options > >#pragma GCC optimize ("-O0") > >static __u64 jent_fold_time(struct rand_data *ec, __u64 time, > >

Re: randconfig build error with next-20150529, in crypto/jitterentropy.c

2015-06-08 Thread Stephan Mueller
Am Monday 08 June 2015, 14:36:30 schrieb Peter Zijlstra: Hi Peter, > >Would something like > >#pragma GCC push_options >#pragma GCC optimize ("-O0") >static __u64 jent_fold_time(struct rand_data *ec, __u64 time, > __u64 *folded, __u64 loop_cnt) >{ > ... >} >#pragma

Re: crypto: caam - Clamp AEAD SG list by input length

2015-06-08 Thread Tadeusz Struk
On 06/08/2015 06:53 AM, Herbert Xu wrote: > On Mon, Jun 08, 2015 at 06:46:14AM -0700, Tadeusz Struk wrote: >> On 06/08/2015 01:38 AM, Herbert Xu wrote: >>> +static inline struct sec4_sg_entry *sg_to_sec4_sg_len( >>> + struct scatterlist *sg, unsigned int total, >>> + struct sec4_sg_entry *sec4_

Re: crypto: caam - Clamp AEAD SG list by input length

2015-06-08 Thread Herbert Xu
On Mon, Jun 08, 2015 at 06:46:14AM -0700, Tadeusz Struk wrote: > On 06/08/2015 01:38 AM, Herbert Xu wrote: > > +static inline struct sec4_sg_entry *sg_to_sec4_sg_len( > > + struct scatterlist *sg, unsigned int total, > > + struct sec4_sg_entry *sec4_sg_ptr) > > +{ > > + do { > > + u

Re: crypto: caam - Clamp AEAD SG list by input length

2015-06-08 Thread Tadeusz Struk
On 06/08/2015 01:38 AM, Herbert Xu wrote: > +static inline struct sec4_sg_entry *sg_to_sec4_sg_len( > + struct scatterlist *sg, unsigned int total, > + struct sec4_sg_entry *sec4_sg_ptr) > +{ > + do { > + unsigned int len = min(sg_dma_len(sg), total); > + > + dma

Re: randconfig build error with next-20150529, in crypto/jitterentropy.c

2015-06-08 Thread Stephan Mueller
Am Montag, 8. Juni 2015, 14:36:30 schrieb Peter Zijlstra: Hi Peter, > Adding Stephan to Cc. > > On Mon, 2015-06-08 at 20:25 +0800, Herbert Xu wrote: > > On Mon, Jun 08, 2015 at 03:21:09PM +0300, Andy Shevchenko wrote: > > > On Fri, May 29, 2015 at 10:14 PM, Jim Davis wrote: > > > > Building wit

[PATCH v2] crypto: drbg - initialize in subsys_initcall

2015-06-08 Thread Stephan Mueller
When compiling the DRBG statically into the kernel, the testmgr allocation of the DRBG may be done at a time the Jitter RNG is not available as it is registered later. The patch changes the initialization to be invoked in subsys_initcall. Signed-off-by: Stephan Mueller --- crypto/jitterentropy.c

Re: randconfig build error with next-20150529, in crypto/jitterentropy.c

2015-06-08 Thread Peter Zijlstra
Adding Stephan to Cc. On Mon, 2015-06-08 at 20:25 +0800, Herbert Xu wrote: > On Mon, Jun 08, 2015 at 03:21:09PM +0300, Andy Shevchenko wrote: > > On Fri, May 29, 2015 at 10:14 PM, Jim Davis wrote: > > > Building with the attached random configuration file, > > > > Hit the very same error against

Re: randconfig build error with next-20150529, in crypto/jitterentropy.c

2015-06-08 Thread Herbert Xu
On Mon, Jun 08, 2015 at 03:21:09PM +0300, Andy Shevchenko wrote: > On Fri, May 29, 2015 at 10:14 PM, Jim Davis wrote: > > Building with the attached random configuration file, > > Hit the very same error against next-20150605. > > The issue with that file we have no compiler optimization enabled

Re: randconfig build error with next-20150529, in crypto/jitterentropy.c

2015-06-08 Thread Andy Shevchenko
On Fri, May 29, 2015 at 10:14 PM, Jim Davis wrote: > Building with the attached random configuration file, Hit the very same error against next-20150605. The issue with that file we have no compiler optimization enabled. So, guys, how you would recommend to fix it? By the way, I'm building the

Re: [PATCH] crypto: drbg - decrease verbosity

2015-06-08 Thread Stephan Mueller
Am Montag, 8. Juni 2015, 09:33:55 schrieb Herbert Xu: Hi Herbert, > On Sat, Jun 06, 2015 at 04:20:35AM +0200, Stephan Mueller wrote: > > When compiling the DRBG statically into the kernel, the testmgr > > allocation of the DRBG may be done at a time the Jitter RNG is > > not available. The testmg

Re: Crypto driver -DCP

2015-06-08 Thread Marek Vasut
On Monday, June 08, 2015 at 06:52:00 AM, Herbert Xu wrote: > On Fri, Jun 05, 2015 at 04:38:03PM +0200, Marek Vasut wrote: > > In general, it would probably make sense to add a flag to .setkey() to > > store the key in a keyslot. The keyslot allocation would be up to the > > driver. In case all keys

crypto: caam - Clamp AEAD SG list by input length

2015-06-08 Thread Herbert Xu
Currently caam assumes that the SG list contains exactly the number of bytes required. This assumption is incorrect. Up until now this has been harmless. However with the new AEAD interface this now breaks as the AD SG list contains more bytes than just the AD. This patch fixes this by always c