Re: [PATCH] crypto: akcipher - default implementations for setting private/public keys

From: Ignat Korchagin
Date: Mon Aug 29 2022 - 06:48:46 EST


On Fri, Aug 19, 2022 at 10:54 AM Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, Jul 29, 2022 at 05:59:54PM +0100, Ignat Korchagin wrote:
> >
> > @@ -132,6 +138,10 @@ int crypto_register_akcipher(struct akcipher_alg *alg)
> > alg->encrypt = akcipher_default_op;
> > if (!alg->decrypt)
> > alg->decrypt = akcipher_default_op;
> > + if (!alg->set_priv_key)
> > + alg->set_priv_key = akcipher_default_set_key;
> > + if (!alg->set_pub_key)
> > + alg->set_pub_key = akcipher_default_set_key;
>
> Under what circumstances could we have an algorithm without a
> set_pub_key function?

I can only elaborate here as I didn't encounter any real-world
use-cases, but may assume some limited crypto hardware device, which
may somehow "encourage" doing public key operations in software and
providing only "private-key" operations due to its limited resources.

Ignat

> Cheers,
> --
> Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt