linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] crypto: passing configuration parameters to comp algos
@ 2024-04-30  3:04 Sergey Senozhatsky
  2024-04-30  3:18 ` Eric Biggers
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Senozhatsky @ 2024-04-30  3:04 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: linux-crypto, linux-kernel

Hi,

	We'd like to be able to pass algorithm-specific parameters to
comp backends. As of this moment, crypto usees hard-coded default
values and does not permit any run-time algorithm configuration,
which in some cases simply disables the most interesting functionality.
E.g. zstd can be configured to use a pre-trained (in the user-space)
compression dictionary, which significantly changes algorithms
characteristics. Another, obvious and trivial example, is algorithms
compression level.

The problem is that we need to pass params to cra_init() function,
because for some algorithms that's the only place where configuration
can take place (e.g. zstd). Changing cra_init() to accept additional
`struct crypto_comp_params` looks to be a little intrusive so before
I write any patches I'd like to hear your thoughts.

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

* Re: [RFC] crypto: passing configuration parameters to comp algos
  2024-04-30  3:04 [RFC] crypto: passing configuration parameters to comp algos Sergey Senozhatsky
@ 2024-04-30  3:18 ` Eric Biggers
  2024-04-30  3:28   ` Sergey Senozhatsky
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Biggers @ 2024-04-30  3:18 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Herbert Xu, David S. Miller, linux-crypto, linux-kernel

On Tue, Apr 30, 2024 at 12:04:47PM +0900, Sergey Senozhatsky wrote:
> Hi,
> 
> 	We'd like to be able to pass algorithm-specific parameters to
> comp backends. As of this moment, crypto usees hard-coded default
> values and does not permit any run-time algorithm configuration,
> which in some cases simply disables the most interesting functionality.
> E.g. zstd can be configured to use a pre-trained (in the user-space)
> compression dictionary, which significantly changes algorithms
> characteristics. Another, obvious and trivial example, is algorithms
> compression level.
> 
> The problem is that we need to pass params to cra_init() function,
> because for some algorithms that's the only place where configuration
> can take place (e.g. zstd). Changing cra_init() to accept additional
> `struct crypto_comp_params` looks to be a little intrusive so before
> I write any patches I'd like to hear your thoughts.
> 

Have you considered just using the zstd library (<linux/zstd.h>) directly?

Which kernel subsystem are you working on that uses compression?

- Eric

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

* Re: [RFC] crypto: passing configuration parameters to comp algos
  2024-04-30  3:18 ` Eric Biggers
@ 2024-04-30  3:28   ` Sergey Senozhatsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Senozhatsky @ 2024-04-30  3:28 UTC (permalink / raw)
  To: Eric Biggers
  Cc: Sergey Senozhatsky, Herbert Xu, David S. Miller, linux-crypto,
	linux-kernel

On (24/04/29 20:18), Eric Biggers wrote:
> On Tue, Apr 30, 2024 at 12:04:47PM +0900, Sergey Senozhatsky wrote:
> > Hi,
> > 
> > 	We'd like to be able to pass algorithm-specific parameters to
> > comp backends. As of this moment, crypto usees hard-coded default
> > values and does not permit any run-time algorithm configuration,
> > which in some cases simply disables the most interesting functionality.
> > E.g. zstd can be configured to use a pre-trained (in the user-space)
> > compression dictionary, which significantly changes algorithms
> > characteristics. Another, obvious and trivial example, is algorithms
> > compression level.
> > 
> > The problem is that we need to pass params to cra_init() function,
> > because for some algorithms that's the only place where configuration
> > can take place (e.g. zstd). Changing cra_init() to accept additional
> > `struct crypto_comp_params` looks to be a little intrusive so before
> > I write any patches I'd like to hear your thoughts.
> > 
> 
> Have you considered just using the zstd library (<linux/zstd.h>) directly?

Yes, sort of.

> Which kernel subsystem are you working on that uses compression?

Forgot to mention - this is for zram primarily (and potentially for zswap).
Both of which take advantage of crypto API and can be configured to use
various compression algorithms (per-device).

So, on the zram side, in theory, I can stop using crypto API and start
calling lzo/zstd/lz4/etc. compression/decompression functions directly
(in fact we used to do that many many years ago, before we switched to
cypto API).

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

end of thread, other threads:[~2024-04-30  3:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-30  3:04 [RFC] crypto: passing configuration parameters to comp algos Sergey Senozhatsky
2024-04-30  3:18 ` Eric Biggers
2024-04-30  3:28   ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).