Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-12-01 Thread Kamil Konieczny
Hi Herbert, On 01.12.2017 11:36, Herbert Xu wrote: > On Fri, Dec 01, 2017 at 11:18:30AM +0100, Kamil Konieczny wrote: >> >> Herbert, is it possible for every init/update that areq->result can be NULL, >> and only for final/update/digit user set it to actual memory ? >> testmgr.c can check if hash

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-12-01 Thread Antoine Tenart
On Fri, Dec 01, 2017 at 11:43:18AM +0100, Kamil Konieczny wrote: > On 01.12.2017 11:24, Antoine Tenart wrote: > > > > Yes the last_req flag is set for the last request, so when > > digest/finup/final are called. But no we can't copy the result into the > > state based on this as an user might want

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-12-01 Thread Antoine Tenart
Hi Herbert, On Fri, Dec 01, 2017 at 09:35:52PM +1100, Herbert Xu wrote: > On Fri, Dec 01, 2017 at 09:11:57AM +0100, Antoine Tenart wrote: > > > > I agree this should not be the case. > > > > But: > > - Other drivers are doing this check (grep "if (!req->result)" or > > "if (req->result)" to see

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-12-01 Thread Kamil Konieczny
Hi Antoine, On 01.12.2017 11:24, Antoine Tenart wrote: > Hi Kamil, > > On Fri, Dec 01, 2017 at 11:18:30AM +0100, Kamil Konieczny wrote: >> On 01.12.2017 09:11, Antoine Tenart wrote: >>> - Other drivers are doing this check (grep "if (!req->result)" or >>> "if (req->result)" to see some of them)

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-12-01 Thread Herbert Xu
On Fri, Dec 01, 2017 at 11:18:30AM +0100, Kamil Konieczny wrote: > > Herbert, is it possible for every init/update that areq->result can be NULL, > and only for final/update/digit user set it to actual memory ? > testmgr.c can check if hash update writes into areq->result and if yes, > then test f

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-12-01 Thread Herbert Xu
On Fri, Dec 01, 2017 at 09:11:57AM +0100, Antoine Tenart wrote: > > I agree this should not be the case. > > But: > - Other drivers are doing this check (grep "if (!req->result)" or > "if (req->result)" to see some of them). > - I see at least one commit fixing the exact same issue I'm facing he

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-12-01 Thread Antoine Tenart
Hi Kamil, On Fri, Dec 01, 2017 at 11:18:30AM +0100, Kamil Konieczny wrote: > On 01.12.2017 09:11, Antoine Tenart wrote: > > - Other drivers are doing this check (grep "if (!req->result)" or > > "if (req->result)" to see some of them). > > - I see at least one commit fixing the exact same issue I

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-12-01 Thread Kamil Konieczny
Hi All, On 01.12.2017 09:11, Antoine Tenart wrote: > Hi Herbert, > > On Fri, Dec 01, 2017 at 11:31:09AM +1100, Herbert Xu wrote: >> On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote: >>> >>> can the driver get request for final/finup/digest with null req->result ? >>> If yes (?), su

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-12-01 Thread Antoine Tenart
Hi Herbert, On Fri, Dec 01, 2017 at 11:31:09AM +1100, Herbert Xu wrote: > On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote: > > > > can the driver get request for final/finup/digest with null req->result ? > > If yes (?), such checks can be done before any hardware processing, savin

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Herbert Xu
On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote: > > can the driver get request for final/finup/digest with null req->result ? > If yes (?), such checks can be done before any hardware processing, saving > time, > for example: This should not be possible through any user-space fac

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Antoine Tenart
Hi Kamil, On Thu, Nov 30, 2017 at 03:10:28PM +0100, Kamil Konieczny wrote: > On 30.11.2017 13:41, Antoine Tenart wrote: > > > > No, if we do this we'll lose the ability to export the current state. > > So maybe save it into request context: > > result_sz = crypto_ahash_digestsize(ahash);

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Kamil Konieczny
On 30.11.2017 13:41, Antoine Tenart wrote: > On Thu, Nov 30, 2017 at 12:52:42PM +0100, Kamil Konieczny wrote: >> On 30.11.2017 10:29, Antoine Tenart wrote: >>> On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote: can the driver get request for final/finup/digest with null req->re

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Antoine Tenart
On Thu, Nov 30, 2017 at 12:52:42PM +0100, Kamil Konieczny wrote: > On 30.11.2017 10:29, Antoine Tenart wrote: > > On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote: > >> can the driver get request for final/finup/digest with null req->result ? > > > > I don't think that can happen. B

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Kamil Konieczny
Hi Antoine, On 30.11.2017 10:29, Antoine Tenart wrote: > Hi Kamil, > > On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote: >> On 28.11.2017 16:42, Antoine Tenart wrote: >>> The patch fixes the ahash support by only updating the result buffer >>> when provided. Otherwise the driver co

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Antoine Tenart
Hi Kamil, On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote: > On 28.11.2017 16:42, Antoine Tenart wrote: > > The patch fixes the ahash support by only updating the result buffer > > when provided. Otherwise the driver could crash with NULL pointer > > exceptions, because the ahash c

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Kamil Konieczny
Hi Antoine, On 28.11.2017 16:42, Antoine Tenart wrote: > The patch fixes the ahash support by only updating the result buffer > when provided. Otherwise the driver could crash with NULL pointer > exceptions, because the ahash caller isn't required to supply a result > buffer on all calls. Can you

[PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-28 Thread Antoine Tenart
The patch fixes the ahash support by only updating the result buffer when provided. Otherwise the driver could crash with NULL pointer exceptions, because the ahash caller isn't required to supply a result buffer on all calls. Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypt