Re: [PATCH] crypto: CTR DRBG - in-place cipher operation

2018-08-03 Thread Herbert Xu
On Fri, Jul 20, 2018 at 07:42:01PM +0200, Stephan Müller wrote: > The cipher implementations of the kernel crypto API favor in-place > cipher operations. Thus, switch the CTR cipher operation in the DRBG to > perform in-place operations. This is implemented by using the output > buffer as input

Re: [PATCH] crypto: CTR DRBG - in-place cipher operation

2018-07-27 Thread Herbert Xu
On Fri, Jul 27, 2018 at 01:49:08PM +0200, Stephan Mueller wrote: > > This is guaranteed by the invokers of drbg_kcapi_sym_ctr as there are two > only: > > - the one in drbg_ctr_update uses the scratchpad for inbuf > > - the one in drbg_ctr_generate uses NULL which implies that the outscratchpad

Re: [PATCH] crypto: CTR DRBG - in-place cipher operation

2018-07-27 Thread Stephan Mueller
Am Freitag, 27. Juli 2018, 12:53:35 CEST schrieb Herbert Xu: Hi Herbert, > On Fri, Jul 20, 2018 at 07:42:01PM +0200, Stephan Müller wrote: > > @@ -1747,10 +1733,18 @@ static int drbg_kcapi_sym_ctr(struct drbg_state > > *drbg,> > > u8 *outbuf, u32 outlen) > > > > { >

Re: [PATCH] crypto: CTR DRBG - in-place cipher operation

2018-07-27 Thread Herbert Xu
On Fri, Jul 20, 2018 at 07:42:01PM +0200, Stephan Müller wrote: > > @@ -1747,10 +1733,18 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg, > u8 *outbuf, u32 outlen) > { > struct scatterlist *sg_in = >sg_in, *sg_out = >sg_out; > + u32 scratchpad_use =

[PATCH] crypto: CTR DRBG - in-place cipher operation

2018-07-20 Thread Stephan Müller
The cipher implementations of the kernel crypto API favor in-place cipher operations. Thus, switch the CTR cipher operation in the DRBG to perform in-place operations. This is implemented by using the output buffer as input buffer and zeroizing it before the cipher operation to implement a CTR