All of lore.kernel.org
 help / color / mirror / Atom feed
* Extending CRYPTO_ALG_OPTIONAL_KEY for cipher algorithms
@ 2021-07-23 10:13 Thara Gopinath
  2021-07-23 16:20 ` Eric Biggers
  0 siblings, 1 reply; 4+ messages in thread
From: Thara Gopinath @ 2021-07-23 10:13 UTC (permalink / raw)
  To: Herbert Xu, Eric Biggers; +Cc: linux-crypto

Hi

I have a requirement where the keys for the crypto cipher algorithms are 
already programmed in the h/w pipes/channels and thus the ->encrypt()
and ->decrypt() can be called without set_key being called first.
I see that CRYPTO_ALG_OPTIONAL_KEY has been added to take care of
such requirements for CRC-32. My question is can the usage of this flag
be extended for cipher and other crypto algorithms as well. Can setting 
of this flag indicate that the algorithm can be used without calling 
set_key first and then the individual drivers can handle cases where
both h/w keys and s/w keys need to be supported.



-- 
Warm Regards
Thara (She/Her/Hers)

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

* Re: Extending CRYPTO_ALG_OPTIONAL_KEY for cipher algorithms
  2021-07-23 10:13 Extending CRYPTO_ALG_OPTIONAL_KEY for cipher algorithms Thara Gopinath
@ 2021-07-23 16:20 ` Eric Biggers
  2021-07-24  9:42   ` Gilad Ben-Yossef
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Biggers @ 2021-07-23 16:20 UTC (permalink / raw)
  To: Thara Gopinath; +Cc: Herbert Xu, linux-crypto

On Fri, Jul 23, 2021 at 06:13:50AM -0400, Thara Gopinath wrote:
> Hi
> 
> I have a requirement where the keys for the crypto cipher algorithms are
> already programmed in the h/w pipes/channels and thus the ->encrypt()
> and ->decrypt() can be called without set_key being called first.
> I see that CRYPTO_ALG_OPTIONAL_KEY has been added to take care of
> such requirements for CRC-32. My question is can the usage of this flag
> be extended for cipher and other crypto algorithms as well. Can setting of
> this flag indicate that the algorithm can be used without calling set_key
> first and then the individual drivers can handle cases where
> both h/w keys and s/w keys need to be supported.

CRYPTO_ALG_OPTIONAL_KEY isn't meant for this use case, but rather for algorithms
that have both keyed and unkeyed versions such as BLAKE2b and BLAKE2s, and also
for algorithms where the "key" isn't actually a key but rather is an initial
value that has a default value, such as CRC-32 and xxHash.

It appears that that the case you're asking about is handled by using a
different algorithm name, e.g. see the "paes" algorithms in
drivers/crypto/ccree/cc_cipher.c.

- Eric

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

* Re: Extending CRYPTO_ALG_OPTIONAL_KEY for cipher algorithms
  2021-07-23 16:20 ` Eric Biggers
@ 2021-07-24  9:42   ` Gilad Ben-Yossef
  2021-07-29 10:32     ` Thara Gopinath
  0 siblings, 1 reply; 4+ messages in thread
From: Gilad Ben-Yossef @ 2021-07-24  9:42 UTC (permalink / raw)
  To: Eric Biggers; +Cc: Thara Gopinath, Herbert Xu, Linux Crypto Mailing List

On Fri, Jul 23, 2021 at 7:20 PM Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Fri, Jul 23, 2021 at 06:13:50AM -0400, Thara Gopinath wrote:
> > Hi
> >
> > I have a requirement where the keys for the crypto cipher algorithms are
> > already programmed in the h/w pipes/channels and thus the ->encrypt()
> > and ->decrypt() can be called without set_key being called first.
> > I see that CRYPTO_ALG_OPTIONAL_KEY has been added to take care of
> > such requirements for CRC-32. My question is can the usage of this flag
> > be extended for cipher and other crypto algorithms as well. Can setting of
> > this flag indicate that the algorithm can be used without calling set_key
> > first and then the individual drivers can handle cases where
> > both h/w keys and s/w keys need to be supported.
>
> CRYPTO_ALG_OPTIONAL_KEY isn't meant for this use case, but rather for algorithms
> that have both keyed and unkeyed versions such as BLAKE2b and BLAKE2s, and also
> for algorithms where the "key" isn't actually a key but rather is an initial
> value that has a default value, such as CRC-32 and xxHash.
>
> It appears that that the case you're asking about is handled by using a
> different algorithm name, e.g. see the "paes" algorithms in
> drivers/crypto/ccree/cc_cipher.c.

Yeap, seems like another use case for "protected keys" like CryptoCell
and the IBM mainframe.
I gave a talk about this you might find useful -
https://www.youtube.com/watch?v=GbcpwUBFGDw

Feel free to contact me if you have questions.

Cheers,
Gilad

-- 
Gilad Ben-Yossef
Chief Coffee Drinker

values of β will give rise to dom!

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

* Re: Extending CRYPTO_ALG_OPTIONAL_KEY for cipher algorithms
  2021-07-24  9:42   ` Gilad Ben-Yossef
@ 2021-07-29 10:32     ` Thara Gopinath
  0 siblings, 0 replies; 4+ messages in thread
From: Thara Gopinath @ 2021-07-29 10:32 UTC (permalink / raw)
  To: Gilad Ben-Yossef, Eric Biggers; +Cc: Herbert Xu, Linux Crypto Mailing List



On 7/24/21 5:42 AM, Gilad Ben-Yossef wrote:
> On Fri, Jul 23, 2021 at 7:20 PM Eric Biggers <ebiggers@kernel.org> wrote:
>>
>> On Fri, Jul 23, 2021 at 06:13:50AM -0400, Thara Gopinath wrote:
>>> Hi
>>>
>>> I have a requirement where the keys for the crypto cipher algorithms are
>>> already programmed in the h/w pipes/channels and thus the ->encrypt()
>>> and ->decrypt() can be called without set_key being called first.
>>> I see that CRYPTO_ALG_OPTIONAL_KEY has been added to take care of
>>> such requirements for CRC-32. My question is can the usage of this flag
>>> be extended for cipher and other crypto algorithms as well. Can setting of
>>> this flag indicate that the algorithm can be used without calling set_key
>>> first and then the individual drivers can handle cases where
>>> both h/w keys and s/w keys need to be supported.
>>
>> CRYPTO_ALG_OPTIONAL_KEY isn't meant for this use case, but rather for algorithms
>> that have both keyed and unkeyed versions such as BLAKE2b and BLAKE2s, and also
>> for algorithms where the "key" isn't actually a key but rather is an initial
>> value that has a default value, such as CRC-32 and xxHash.
>>
>> It appears that that the case you're asking about is handled by using a
>> different algorithm name, e.g. see the "paes" algorithms in
>> drivers/crypto/ccree/cc_cipher.c.
> 
> Yeap, seems like another use case for "protected keys" like CryptoCell
> and the IBM mainframe.
> I gave a talk about this you might find useful -
> https://www.youtube.com/watch?v=GbcpwUBFGDw
> 
> Feel free to contact me if you have questions.

Thanks Eric and Gilad for the pointers. Gilad, the talk is great. I wish 
I had seen it prior to telling my manager that we will have to "invent" 
something new for this! This should mostly suffice for my use-case. 
Although, I see that all the protected implementations are for aes 
algorithms. Is it fair to say that it can be extended to other cipher 
algorithms and/or hash algorithms if needed ?

> 
> Cheers,
> Gilad
> 

-- 
Warm Regards
Thara (She/Her/Hers)

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

end of thread, other threads:[~2021-07-29 10:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23 10:13 Extending CRYPTO_ALG_OPTIONAL_KEY for cipher algorithms Thara Gopinath
2021-07-23 16:20 ` Eric Biggers
2021-07-24  9:42   ` Gilad Ben-Yossef
2021-07-29 10:32     ` Thara Gopinath

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.