* cipher implementations allowed to sleep?
@ 2016-03-31 9:18 Stephan Mueller
2016-03-31 9:21 ` Herbert Xu
0 siblings, 1 reply; 6+ messages in thread
From: Stephan Mueller @ 2016-03-31 9:18 UTC (permalink / raw)
To: Herbert Xu; +Cc: linux-crypto
Hi Herbert,
is it allowed that cipher implementations sleep? The driver of my question is
whether I can use spin_lock_irqsave() as a lock around a cipher operation.
The cipher operations in question are hashing, HMACing and symmetric ciphers.
Thank you
Stephan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cipher implementations allowed to sleep?
2016-03-31 9:18 cipher implementations allowed to sleep? Stephan Mueller
@ 2016-03-31 9:21 ` Herbert Xu
2016-03-31 9:39 ` Stephan Mueller
2016-03-31 11:47 ` Stephan Mueller
0 siblings, 2 replies; 6+ messages in thread
From: Herbert Xu @ 2016-03-31 9:21 UTC (permalink / raw)
To: Stephan Mueller; +Cc: linux-crypto
On Thu, Mar 31, 2016 at 11:18:48AM +0200, Stephan Mueller wrote:
> Hi Herbert,
>
> is it allowed that cipher implementations sleep? The driver of my question is
> whether I can use spin_lock_irqsave() as a lock around a cipher operation.
>
> The cipher operations in question are hashing, HMACing and symmetric ciphers.
Whether they can sleep is controlled by the MAY_SLEEP flag.
Of course, even if they can't sleep, if you invoke an async op
then it may return -EINPROGRESS and continue the processing in
the background.
Cheers,
--
Email: Herbert Xu <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] 6+ messages in thread
* Re: cipher implementations allowed to sleep?
2016-03-31 9:21 ` Herbert Xu
@ 2016-03-31 9:39 ` Stephan Mueller
2016-03-31 11:47 ` Stephan Mueller
1 sibling, 0 replies; 6+ messages in thread
From: Stephan Mueller @ 2016-03-31 9:39 UTC (permalink / raw)
To: Herbert Xu; +Cc: linux-crypto
Am Donnerstag, 31. März 2016, 17:21:06 schrieb Herbert Xu:
Hi Herbert,
> On Thu, Mar 31, 2016 at 11:18:48AM +0200, Stephan Mueller wrote:
> > Hi Herbert,
> >
> > is it allowed that cipher implementations sleep? The driver of my question
> > is whether I can use spin_lock_irqsave() as a lock around a cipher
> > operation.
> >
> > The cipher operations in question are hashing, HMACing and symmetric
> > ciphers.
> Whether they can sleep is controlled by the MAY_SLEEP flag.
>
> Of course, even if they can't sleep, if you invoke an async op
> then it may return -EINPROGRESS and continue the processing in
> the background.
Right, I was always thinking about sync invocations.
Thanks.
Ciao
Stephan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cipher implementations allowed to sleep?
2016-03-31 9:21 ` Herbert Xu
2016-03-31 9:39 ` Stephan Mueller
@ 2016-03-31 11:47 ` Stephan Mueller
2016-03-31 12:58 ` Herbert Xu
1 sibling, 1 reply; 6+ messages in thread
From: Stephan Mueller @ 2016-03-31 11:47 UTC (permalink / raw)
To: Herbert Xu; +Cc: linux-crypto
Am Donnerstag, 31. März 2016, 17:21:06 schrieb Herbert Xu:
Hi Herbert,
> On Thu, Mar 31, 2016 at 11:18:48AM +0200, Stephan Mueller wrote:
> > Hi Herbert,
> >
> > is it allowed that cipher implementations sleep? The driver of my question
> > is whether I can use spin_lock_irqsave() as a lock around a cipher
> > operation.
> >
> > The cipher operations in question are hashing, HMACing and symmetric
> > ciphers.
> Whether they can sleep is controlled by the MAY_SLEEP flag.
>
> Of course, even if they can't sleep, if you invoke an async op
> then it may return -EINPROGRESS and continue the processing in
> the background.
Considering the implementation in ansi_cprng.c, is it allowed to use
spin_lock_bh with the sync operations assuming that a cipher implementation
may sleep?
Thanks
Stephan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cipher implementations allowed to sleep?
2016-03-31 11:47 ` Stephan Mueller
@ 2016-03-31 12:58 ` Herbert Xu
2016-03-31 13:02 ` Stephan Mueller
0 siblings, 1 reply; 6+ messages in thread
From: Herbert Xu @ 2016-03-31 12:58 UTC (permalink / raw)
To: Stephan Mueller; +Cc: linux-crypto
On Thu, Mar 31, 2016 at 01:47:50PM +0200, Stephan Mueller wrote:
>
> Considering the implementation in ansi_cprng.c, is it allowed to use
> spin_lock_bh with the sync operations assuming that a cipher implementation
> may sleep?
As I said, it's only allowed to sleep if you set the MAY_SLEEP
flag.
Cheers,
--
Email: Herbert Xu <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] 6+ messages in thread
* Re: cipher implementations allowed to sleep?
2016-03-31 12:58 ` Herbert Xu
@ 2016-03-31 13:02 ` Stephan Mueller
0 siblings, 0 replies; 6+ messages in thread
From: Stephan Mueller @ 2016-03-31 13:02 UTC (permalink / raw)
To: Herbert Xu; +Cc: linux-crypto
Am Donnerstag, 31. März 2016, 20:58:25 schrieb Herbert Xu:
Hi Herbert,
> On Thu, Mar 31, 2016 at 01:47:50PM +0200, Stephan Mueller wrote:
> > Considering the implementation in ansi_cprng.c, is it allowed to use
> > spin_lock_bh with the sync operations assuming that a cipher
> > implementation
> > may sleep?
>
> As I said, it's only allowed to sleep if you set the MAY_SLEEP
> flag.
Now I see, I as a caller can controll whether it can sleep. Thank you.
Ciao
Stephan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-03-31 13:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-31 9:18 cipher implementations allowed to sleep? Stephan Mueller
2016-03-31 9:21 ` Herbert Xu
2016-03-31 9:39 ` Stephan Mueller
2016-03-31 11:47 ` Stephan Mueller
2016-03-31 12:58 ` Herbert Xu
2016-03-31 13:02 ` Stephan Mueller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox