All of lore.kernel.org
 help / color / mirror / Atom feed
* Async Crypto API
@ 2010-01-22  8:45 Dmitry Kasatkin
  2010-01-23  3:20 ` Herbert Xu
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Kasatkin @ 2010-01-22  8:45 UTC (permalink / raw)
  To: linux-crypto@vger.kernel.org

Hello,

I have one question about async api.

I work on AHASH driver and wonder about one thing.

while calculating hash, client might call many times

ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_update(req);
..
..
ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_finup(req);

right?

But because it is async and driver does not wait_for_completion,
 previous request may not be completed before client will call next update.

But what should be the behavior of the driver?

Thanks,
Dmitry


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Async Crypto API
  2010-01-22  8:45 Async Crypto API Dmitry Kasatkin
@ 2010-01-23  3:20 ` Herbert Xu
  2010-01-27  6:45   ` Dmitry Kasatkin
  2010-02-02 12:17   ` Dmitry Kasatkin
  0 siblings, 2 replies; 9+ messages in thread
From: Herbert Xu @ 2010-01-23  3:20 UTC (permalink / raw)
  To: Dmitry Kasatkin; +Cc: linux-crypto

Dmitry Kasatkin <dmitry.kasatkin@nokia.com> wrote:
> Hello,
> 
> I have one question about async api.
> 
> I work on AHASH driver and wonder about one thing.
> 
> while calculating hash, client might call many times
> 
> ahash_request_set_crypt(req, &sg, sha1, len);
> crypto_ahash_update(req);
> ..
> ..
> ahash_request_set_crypt(req, &sg, sha1, len);
> crypto_ahash_finup(req);
> 
> right?
> 
> But because it is async and driver does not wait_for_completion,
> previous request may not be completed before client will call next update.
> 
> But what should be the behavior of the driver?

If any async operation returns EINPROGRESS, the client must not
proceed until that operation has completed.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Async Crypto API
  2010-01-23  3:20 ` Herbert Xu
@ 2010-01-27  6:45   ` Dmitry Kasatkin
  2010-01-29  9:03     ` Herbert Xu
  2010-02-02 12:17   ` Dmitry Kasatkin
  1 sibling, 1 reply; 9+ messages in thread
From: Dmitry Kasatkin @ 2010-01-27  6:45 UTC (permalink / raw)
  To: ext Herbert Xu; +Cc: linux-crypto@vger.kernel.org

Hi,

1 more question.

>From what context "crypto_completion_t" can be called?
irq/tasklet/process
or something else?


Thanks,
Dmitry



ext Herbert Xu wrote:
> Dmitry Kasatkin <dmitry.kasatkin@nokia.com> wrote:
>   
>> Hello,
>>
>> I have one question about async api.
>>
>> I work on AHASH driver and wonder about one thing.
>>
>> while calculating hash, client might call many times
>>
>> ahash_request_set_crypt(req, &sg, sha1, len);
>> crypto_ahash_update(req);
>> ..
>> ..
>> ahash_request_set_crypt(req, &sg, sha1, len);
>> crypto_ahash_finup(req);
>>
>> right?
>>
>> But because it is async and driver does not wait_for_completion,
>> previous request may not be completed before client will call next update.
>>
>> But what should be the behavior of the driver?
>>     
>
> If any async operation returns EINPROGRESS, the client must not
> proceed until that operation has completed.
>
> Cheers,
>   

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Async Crypto API
  2010-01-27  6:45   ` Dmitry Kasatkin
@ 2010-01-29  9:03     ` Herbert Xu
  0 siblings, 0 replies; 9+ messages in thread
From: Herbert Xu @ 2010-01-29  9:03 UTC (permalink / raw)
  To: Dmitry Kasatkin; +Cc: linux-crypto@vger.kernel.org

On Wed, Jan 27, 2010 at 08:45:12AM +0200, Dmitry Kasatkin wrote:
> Hi,
> 
> 1 more question.
> 
> >From what context "crypto_completion_t" can be called?
> irq/tasklet/process
> or something else?

tasklet or process with BH off.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Async Crypto API
  2010-01-23  3:20 ` Herbert Xu
  2010-01-27  6:45   ` Dmitry Kasatkin
@ 2010-02-02 12:17   ` Dmitry Kasatkin
  2010-02-02 12:26     ` Dmitry Kasatkin
  2010-02-09  7:31     ` Herbert Xu
  1 sibling, 2 replies; 9+ messages in thread
From: Dmitry Kasatkin @ 2010-02-02 12:17 UTC (permalink / raw)
  To: ext Herbert Xu; +Cc: linux-crypto@vger.kernel.org

Hi,

In the case when finup() is not used, just update/update/../final
driver finalize calculation from the final function.

It takes a time and if it may not sleep, can final() also return
EINPROGRESS?

Thanks,
Dmitry


ext Herbert Xu wrote:
> Dmitry Kasatkin <dmitry.kasatkin@nokia.com> wrote:
>   
>> Hello,
>>
>> I have one question about async api.
>>
>> I work on AHASH driver and wonder about one thing.
>>
>> while calculating hash, client might call many times
>>
>> ahash_request_set_crypt(req, &sg, sha1, len);
>> crypto_ahash_update(req);
>> ..
>> ..
>> ahash_request_set_crypt(req, &sg, sha1, len);
>> crypto_ahash_finup(req);
>>
>> right?
>>
>> But because it is async and driver does not wait_for_completion,
>> previous request may not be completed before client will call next update.
>>
>> But what should be the behavior of the driver?
>>     
>
> If any async operation returns EINPROGRESS, the client must not
> proceed until that operation has completed.
>
> Cheers,
>   

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Async Crypto API
  2010-02-02 12:17   ` Dmitry Kasatkin
@ 2010-02-02 12:26     ` Dmitry Kasatkin
  2010-02-02 13:46       ` Dmitry Kasatkin
  2010-02-09  7:31     ` Herbert Xu
  1 sibling, 1 reply; 9+ messages in thread
From: Dmitry Kasatkin @ 2010-02-02 12:26 UTC (permalink / raw)
  To: ext Herbert Xu; +Cc: linux-crypto@vger.kernel.org

Hi,

It actually would not make sense as final() suppose to cleanup
everything and in the case of EINPROGRESS we can not do it.

So the question how then to "wait for completion" of the hash by HW if
not to use finup()

- Dmitry


Kasatkin Dmitry (Nokia-D/Helsinki) wrote:
> Hi,
>
> In the case when finup() is not used, just update/update/../final
> driver finalize calculation from the final function.
>
> It takes a time and if it may not sleep, can final() also return
> EINPROGRESS?
>
> Thanks,
> Dmitry
>
>
> ext Herbert Xu wrote:
>   
>> Dmitry Kasatkin <dmitry.kasatkin@nokia.com> wrote:
>>   
>>     
>>> Hello,
>>>
>>> I have one question about async api.
>>>
>>> I work on AHASH driver and wonder about one thing.
>>>
>>> while calculating hash, client might call many times
>>>
>>> ahash_request_set_crypt(req, &sg, sha1, len);
>>> crypto_ahash_update(req);
>>> ..
>>> ..
>>> ahash_request_set_crypt(req, &sg, sha1, len);
>>> crypto_ahash_finup(req);
>>>
>>> right?
>>>
>>> But because it is async and driver does not wait_for_completion,
>>> previous request may not be completed before client will call next update.
>>>
>>> But what should be the behavior of the driver?
>>>     
>>>       
>> If any async operation returns EINPROGRESS, the client must not
>> proceed until that operation has completed.
>>
>> Cheers,
>>   
>>     
> --
> To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>   

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Async Crypto API
  2010-02-02 12:26     ` Dmitry Kasatkin
@ 2010-02-02 13:46       ` Dmitry Kasatkin
  2010-02-09  7:32         ` Herbert Xu
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Kasatkin @ 2010-02-02 13:46 UTC (permalink / raw)
  To: ext Herbert Xu; +Cc: linux-crypto@vger.kernel.org

in sync API final() does not have any data.

Is async driver also should ignore req->src in final() call?

- Dmitry


Kasatkin Dmitry (Nokia-D/Helsinki) wrote:
> Hi,
>
> It actually would not make sense as final() suppose to cleanup
> everything and in the case of EINPROGRESS we can not do it.
>
> So the question how then to "wait for completion" of the hash by HW if
> not to use finup()
>
> - Dmitry
>
>
> Kasatkin Dmitry (Nokia-D/Helsinki) wrote:
>   
>> Hi,
>>
>> In the case when finup() is not used, just update/update/../final
>> driver finalize calculation from the final function.
>>
>> It takes a time and if it may not sleep, can final() also return
>> EINPROGRESS?
>>
>> Thanks,
>> Dmitry
>>
>>
>> ext Herbert Xu wrote:
>>   
>>     
>>> Dmitry Kasatkin <dmitry.kasatkin@nokia.com> wrote:
>>>   
>>>     
>>>       
>>>> Hello,
>>>>
>>>> I have one question about async api.
>>>>
>>>> I work on AHASH driver and wonder about one thing.
>>>>
>>>> while calculating hash, client might call many times
>>>>
>>>> ahash_request_set_crypt(req, &sg, sha1, len);
>>>> crypto_ahash_update(req);
>>>> ..
>>>> ..
>>>> ahash_request_set_crypt(req, &sg, sha1, len);
>>>> crypto_ahash_finup(req);
>>>>
>>>> right?
>>>>
>>>> But because it is async and driver does not wait_for_completion,
>>>> previous request may not be completed before client will call next update.
>>>>
>>>> But what should be the behavior of the driver?
>>>>     
>>>>       
>>>>         
>>> If any async operation returns EINPROGRESS, the client must not
>>> proceed until that operation has completed.
>>>
>>> Cheers,
>>>   
>>>     
>>>       
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>   
>>     
> --
> To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>   

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Async Crypto API
  2010-02-02 12:17   ` Dmitry Kasatkin
  2010-02-02 12:26     ` Dmitry Kasatkin
@ 2010-02-09  7:31     ` Herbert Xu
  1 sibling, 0 replies; 9+ messages in thread
From: Herbert Xu @ 2010-02-09  7:31 UTC (permalink / raw)
  To: Dmitry Kasatkin; +Cc: linux-crypto@vger.kernel.org

On Tue, Feb 02, 2010 at 02:17:51PM +0200, Dmitry Kasatkin wrote:
> Hi,
> 
> In the case when finup() is not used, just update/update/../final
> driver finalize calculation from the final function.
> 
> It takes a time and if it may not sleep, can final() also return
> EINPROGRESS?

Sure, final can certainly return EINPROGRESS.
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Async Crypto API
  2010-02-02 13:46       ` Dmitry Kasatkin
@ 2010-02-09  7:32         ` Herbert Xu
  0 siblings, 0 replies; 9+ messages in thread
From: Herbert Xu @ 2010-02-09  7:32 UTC (permalink / raw)
  To: Dmitry Kasatkin; +Cc: linux-crypto@vger.kernel.org

On Tue, Feb 02, 2010 at 03:46:58PM +0200, Dmitry Kasatkin wrote:
> in sync API final() does not have any data.
> 
> Is async driver also should ignore req->src in final() call?

Yes req->src can be ignored in final.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-02-09  7:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-22  8:45 Async Crypto API Dmitry Kasatkin
2010-01-23  3:20 ` Herbert Xu
2010-01-27  6:45   ` Dmitry Kasatkin
2010-01-29  9:03     ` Herbert Xu
2010-02-02 12:17   ` Dmitry Kasatkin
2010-02-02 12:26     ` Dmitry Kasatkin
2010-02-02 13:46       ` Dmitry Kasatkin
2010-02-09  7:32         ` Herbert Xu
2010-02-09  7:31     ` Herbert Xu

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.