All of lore.kernel.org
 help / color / mirror / Atom feed
* What should be the algo priority
@ 2017-04-04  7:53 Harsh Jain
  2017-04-04 12:37 ` Stephan Müller
  0 siblings, 1 reply; 5+ messages in thread
From: Harsh Jain @ 2017-04-04  7:53 UTC (permalink / raw)
  To: linux-crypto

Hi,

Do we have any guidelines documented to decide what should be the
algorithm priority. Specially for authenc implementation.Most of the
drivers have fixed priority for all algos. Problem comes in when we
have cbc(aes), hmac(sha1) and authenc(cbc(aes),hmac(sha1))
implementation in driver. Base authenc driver gets more precedence
because of higher priority(enc->base.cra_priority * 10 +
auth_base->cra_priority;)

What should be the priority of
cbc(aes),
hmac(sha1)
authenc(cbc(aes),hmac(sha1))


Regards
Harsh Jain

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

* Re: What should be the algo priority
  2017-04-04  7:53 What should be the algo priority Harsh Jain
@ 2017-04-04 12:37 ` Stephan Müller
  2017-04-06  5:26   ` Harsh Jain
  0 siblings, 1 reply; 5+ messages in thread
From: Stephan Müller @ 2017-04-04 12:37 UTC (permalink / raw)
  To: Harsh Jain; +Cc: linux-crypto

Am Dienstag, 4. April 2017, 09:53:17 CEST schrieb Harsh Jain:

Hi Harsh,

> Hi,
> 
> Do we have any guidelines documented to decide what should be the
> algorithm priority. Specially for authenc implementation.Most of the
> drivers have fixed priority for all algos. Problem comes in when we
> have cbc(aes), hmac(sha1) and authenc(cbc(aes),hmac(sha1))
> implementation in driver. Base authenc driver gets more precedence
> because of higher priority(enc->base.cra_priority * 10 +
> auth_base->cra_priority;)
> 
> What should be the priority of
> cbc(aes),
> hmac(sha1)
> authenc(cbc(aes),hmac(sha1))

There is no general rule about the actual numbers. But commonly, the prios are 
set such that the prios of C implementations < ASM implementations < hardware 
accelerators. The idea is to give users the fastest implementation there is 
for his particular system.

Ciao
Stephan

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

* Re: What should be the algo priority
  2017-04-04 12:37 ` Stephan Müller
@ 2017-04-06  5:26   ` Harsh Jain
  2017-04-07 18:13     ` Hamid Nassiby
  2017-04-10 11:25     ` Herbert Xu
  0 siblings, 2 replies; 5+ messages in thread
From: Harsh Jain @ 2017-04-06  5:26 UTC (permalink / raw)
  To: Stephan Müller; +Cc: linux-crypto

On Tue, Apr 4, 2017 at 6:07 PM, Stephan Müller <smueller@chronox.de> wrote:
> Am Dienstag, 4. April 2017, 09:53:17 CEST schrieb Harsh Jain:
>
> Hi Harsh,
>
>> Hi,
>>
>> Do we have any guidelines documented to decide what should be the
>> algorithm priority. Specially for authenc implementation.Most of the
>> drivers have fixed priority for all algos. Problem comes in when we
>> have cbc(aes), hmac(sha1) and authenc(cbc(aes),hmac(sha1))
>> implementation in driver. Base authenc driver gets more precedence
>> because of higher priority(enc->base.cra_priority * 10 +
>> auth_base->cra_priority;)
>>
>> What should be the priority of
>> cbc(aes),
>> hmac(sha1)
>> authenc(cbc(aes),hmac(sha1))
>
> There is no general rule about the actual numbers. But commonly, the prios are
> set such that the prios of C implementations < ASM implementations < hardware
> accelerators. The idea is to give users the fastest implementation there is
> for his particular system.

It means cbc, hmac should have smaller(nearly 10 times less) priority
than their authenc implementation otherwise request will not offload
to driver because sw authenc priority is (aes * 10 + hmac).

>
> Ciao
> Stephan

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

* Re: What should be the algo priority
  2017-04-06  5:26   ` Harsh Jain
@ 2017-04-07 18:13     ` Hamid Nassiby
  2017-04-10 11:25     ` Herbert Xu
  1 sibling, 0 replies; 5+ messages in thread
From: Hamid Nassiby @ 2017-04-07 18:13 UTC (permalink / raw)
  To: Harsh Jain; +Cc: Stephan Müller, linux-crypto

"authenc" and "hmac" are templates, not different implementations of a cipher.

Please take a look at:
https://kernel.readthedocs.io/en/sphinx-samples/crypto-API.html#terminology


On Thu, Apr 6, 2017 at 9:56 AM, Harsh Jain <harshjain.prof@gmail.com> wrote:
> On Tue, Apr 4, 2017 at 6:07 PM, Stephan Müller <smueller@chronox.de> wrote:
>> Am Dienstag, 4. April 2017, 09:53:17 CEST schrieb Harsh Jain:
>>
>> Hi Harsh,
>>
>>> Hi,
>>>
>>> Do we have any guidelines documented to decide what should be the
>>> algorithm priority. Specially for authenc implementation.Most of the
>>> drivers have fixed priority for all algos. Problem comes in when we
>>> have cbc(aes), hmac(sha1) and authenc(cbc(aes),hmac(sha1))
>>> implementation in driver. Base authenc driver gets more precedence
>>> because of higher priority(enc->base.cra_priority * 10 +
>>> auth_base->cra_priority;)
>>>
>>> What should be the priority of
>>> cbc(aes),
>>> hmac(sha1)
>>> authenc(cbc(aes),hmac(sha1))
>>
>> There is no general rule about the actual numbers. But commonly, the prios are
>> set such that the prios of C implementations < ASM implementations < hardware
>> accelerators. The idea is to give users the fastest implementation there is
>> for his particular system.
>
> It means cbc, hmac should have smaller(nearly 10 times less) priority
> than their authenc implementation otherwise request will not offload
> to driver because sw authenc priority is (aes * 10 + hmac).
>
>>
>> Ciao
>> Stephan

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

* Re: What should be the algo priority
  2017-04-06  5:26   ` Harsh Jain
  2017-04-07 18:13     ` Hamid Nassiby
@ 2017-04-10 11:25     ` Herbert Xu
  1 sibling, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2017-04-10 11:25 UTC (permalink / raw)
  To: Harsh Jain; +Cc: smueller, linux-crypto

Harsh Jain <harshjain.prof@gmail.com> wrote:
>
> It means cbc, hmac should have smaller(nearly 10 times less) priority
> than their authenc implementation otherwise request will not offload
> to driver because sw authenc priority is (aes * 10 + hmac).

I think you should look at it the other way.  The priority of
your hardware authenc should be greater than (aes * 10 + hmac)
where aes is the priority of your hardware aes and hmac is the
priority of your hardware hmac.

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] 5+ messages in thread

end of thread, other threads:[~2017-04-10 11:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04  7:53 What should be the algo priority Harsh Jain
2017-04-04 12:37 ` Stephan Müller
2017-04-06  5:26   ` Harsh Jain
2017-04-07 18:13     ` Hamid Nassiby
2017-04-10 11:25     ` 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.