Re: [PATCH 2/4] crypto: drbg - do not create shadow copy

2015-04-18 Thread Herbert Xu
On Fri, Apr 17, 2015 at 02:54:58PM +0200, Stephan Mueller wrote: > The creation of a shadow copy is intended to only hold a short term > lock. But the drawback is that parallel users have a very similar DRBG > state which only differs by a high-resolution time stamp. > > As the locking is changed

Re: [PATCH 3/4] crypto: drbg - replace spinlock with mutex

2015-04-18 Thread Herbert Xu
On Fri, Apr 17, 2015 at 02:55:28PM +0200, Stephan Mueller wrote: > > @@ -1349,7 +1348,9 @@ static int drbg_generate_long(struct drbg_state *drbg, > unsigned int chunk = 0; > slice = ((buflen - len) / drbg_max_request_bytes(drbg)); > chunk = slice ? drbg_max

Re: [PATCH 1/4] cryoto: drbg - clear all temporary memory

2015-04-18 Thread Herbert Xu
On Fri, Apr 17, 2015 at 02:54:08PM +0200, Stephan Mueller wrote: > The buffer uses for temporary data must be cleared entirely. In AES192 > the used buffer is drbg_statelen(drbg) + drbg_blocklen(drbg) as > documented in the comment above drbg_ctr_df. > > This patch ensures that the temp buffer is

Re: [PATCH] crypto: ensure backlog is initialised

2015-04-18 Thread Herbert Xu
On Tue, Apr 14, 2015 at 11:51:29AM -0500, Colin King wrote: > From: Colin Ian King > > backlog is not initialised so in the case where > cpg->eng_st != ENGINE_IDLE it is never initialised and > hence which could lead to an illegal memory dereference > in the statement: > > backlog->complete(ba

Re: [PATCH 3/4] crypto: drbg - replace spinlock with mutex

2015-04-18 Thread Stephan Mueller
Am Samstag, 18. April 2015, 18:55:23 schrieb Herbert Xu: Hi Herbert, > > Incidentally the whole reset concept seems redundant as you could > always free and allocate a new RNG instead. So I'm planning on > replacing it with a seed/reseed function instead. IOW it will > keep the existing state

Re: [PATCH 2/4] crypto: drbg - do not create shadow copy

2015-04-18 Thread Stephan Mueller
Am Samstag, 18. April 2015, 18:49:43 schrieb Herbert Xu: Hi Herbert, > On Fri, Apr 17, 2015 at 02:54:58PM +0200, Stephan Mueller wrote: > > The creation of a shadow copy is intended to only hold a short term > > lock. But the drawback is that parallel users have a very similar DRBG > > state whic

[PATCH v2 3/3] crypto: drbg - leave cipher handles operational

2015-04-18 Thread Stephan Mueller
As the DRBG does not operate on shadow copies of the DRBG instance any more, the cipher handles only need to be allocated once during initalization time and deallocated during uninstantiate time. Signed-off-by: Stephan Mueller --- crypto/drbg.c | 12 1 file changed, 4 insertions(+),

[PATCH v2 1/3] crypto: drbg - fix drbg_generate return val check

2015-04-18 Thread Stephan Mueller
The drbg_generate returns 0 in success case. That means that drbg_generate_long will always only generate drbg_max_request_bytes at most. Longer requests will be truncated to drbg_max_request_bytes. Reported-by: Herbert Xu Signed-off-by: Stephan Mueller --- crypto/drbg.c | 2 +- 1 file changed,

[PATCH v2 0/3] crypto: drbg - revamp locking

2015-04-18 Thread Stephan Mueller
Hi, the current implementation of the DRBG generates a shadow copy of its DRBG state for each incoming request. The idea is that only a short term lock is needed to spawn the shadow copy. The drawback is that if multiple parallel requests come in, the generated DRBG shadow states only differ by a

[PATCH v2 2/3] crypto: drbg - replace spinlock with mutex

2015-04-18 Thread Stephan Mueller
The creation of a shadow copy is intended to only hold a short term lock. But the drawback is that parallel users have a very similar DRBG state which only differs by a high-resolution time stamp. The DRBG will now hold a long term lock. Therefore, the lock is changed to a mutex which implies that

Re: [PATCH v2 1/3] crypto: drbg - fix drbg_generate return val check

2015-04-18 Thread Stephan Mueller
Am Samstag, 18. April 2015, 16:42:20 schrieb Stephan Mueller: Hi Stephan, > The drbg_generate returns 0 in success case. That means that > drbg_generate_long will always only generate drbg_max_request_bytes at > most. Longer requests will be truncated to drbg_max_request_bytes. > > Reported-by:

[PATCH v3 1/3] crypto: drbg - fix drbg_generate return val check

2015-04-18 Thread Stephan Mueller
The drbg_generate returns 0 in success case. That means that drbg_generate_long will always only generate drbg_max_request_bytes at most. Longer requests will be truncated to drbg_max_request_bytes. Reported-by: Herbert Xu Signed-off-by: Stephan Mueller --- crypto/drbg.c | 14 +++--- 1

[PATCH v3 3/3] crypto: drbg - leave cipher handles operational

2015-04-18 Thread Stephan Mueller
As the DRBG does not operate on shadow copies of the DRBG instance any more, the cipher handles only need to be allocated once during initalization time and deallocated during uninstantiate time. Signed-off-by: Stephan Mueller --- crypto/drbg.c | 12 1 file changed, 4 insertions(+),

[PATCH v3 2/3] crypto: drbg - replace spinlock with mutex

2015-04-18 Thread Stephan Mueller
The creation of a shadow copy is intended to only hold a short term lock. But the drawback is that parallel users have a very similar DRBG state which only differs by a high-resolution time stamp. The DRBG will now hold a long term lock. Therefore, the lock is changed to a mutex which implies that

[PATCH v3 0/3] crypto: drbg - revamp locking

2015-04-18 Thread Stephan Mueller
Hi, the current implementation of the DRBG generates a shadow copy of its DRBG state for each incoming request. The idea is that only a short term lock is needed to spawn the shadow copy. The drawback is that if multiple parallel requests come in, the generated DRBG shadow states only differ by a

Re: [PATCH 3/4] crypto: drbg - replace spinlock with mutex

2015-04-18 Thread Herbert Xu
On Sat, Apr 18, 2015 at 01:35:40PM +0200, Stephan Mueller wrote: > > When you do that, may I ask you to also update the crypto_alloc_rng. This > function has one major drawback at the moment: we are wasting precious > entropy. The testmgr must allocate the RNG for performing its testing using >

Re: [PATCH v3 0/3] crypto: drbg - revamp locking

2015-04-18 Thread Herbert Xu
On Sat, Apr 18, 2015 at 07:35:11PM +0200, Stephan Mueller wrote: > Hi, > > the current implementation of the DRBG generates a shadow copy of its > DRBG state for each incoming request. The idea is that only a short > term lock is needed to spawn the shadow copy. The drawback is that > if multiple

Re: [PATCH v3 00/17] crypto: talitos - Add support for SEC1

2015-04-18 Thread Herbert Xu
On Fri, Apr 17, 2015 at 04:31:47PM +0200, Christophe Leroy wrote: > The purpose of this set of patchs is to add to talitos crypto driver > the support for the SEC1 version of the security engine, which is > found in mpc885 and mpc8272 processors. > > v3 is a complete rework of the patchset. Since