From: Herbert Xu <herbert@gondor.apana.org.au>
To: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: compress - Add pcomp interface
Date: Wed, 14 Jan 2009 14:16:13 +1100 [thread overview]
Message-ID: <20090114031613.GA7429@gondor.apana.org.au> (raw)
In-Reply-To: <1231862386-11128-2-git-send-email-Geert.Uytterhoeven@sonycom.com>
Hi Geert:
On Tue, Jan 13, 2009 at 04:59:40PM +0100, Geert Uytterhoeven wrote:
> The current "comp" crypto interface supports one-shot (de)compression only,
> i.e. the whole data buffer to be (de)compressed must be passed at once, and
> the whole (de)compressed data buffer will be received at once.
> In several use-cases (e.g. compressed file systems that store files in big
> compressed blocks), this workflow is not suitable.
> Furthermore, the "comp" type doesn't provide for the configuration of
> (de)compression parameters, and always allocates workspace memory for both
> compression and decompression, which may waste memory.
Thanks for the patch-set!
> diff --git a/crypto/pcompress.c b/crypto/pcompress.c
> new file mode 100644
> index 0000000..b9e3724
> --- /dev/null
> +++ b/crypto/pcompress.c
> @@ -0,0 +1,94 @@
> +/*
> + * Cryptographic API.
> + *
> + * Partial compression operations.
> + *
> + * Copyright 2008 Sony Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 2 of the License.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software Foundation,
> + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
> + */
> +
> +#define pr_fmt(fmt) "%s: " fmt, __func__
This appears to be unused?
> +static int crypto_pcomp_init_tfm(struct crypto_tfm *tfm,
> + const struct crypto_type *frontend)
> +{
> + if (frontend->type != CRYPTO_ALG_TYPE_PCOMPRESS)
> + return -EINVAL;
This is my fault. The check is redundant so you can remove it.
I'll kill it in shash too.
> +struct pcomp_alg {
> + int (*setup)(struct crypto_tfm *tfm, const void *params);
Actually I was thinking of separate alloc functions for compress
and decompress so that
1) We know what the user wants to do without every algorithm
reinventing their own signalling for it;
2) The parameters can be separated.
Also, this is something that we'll potentially export to user-space,
so we need to ensure that it is invariant to word length.
So something like this would be good
int (*setup_comp)(struct crypto_pcomp *tfm, const void *params,
unsigned int length);
int (*setup_decomp)(struct crypto_pcomp *tfm, const void *params,
unsigned int length);
The actual parameters should be formatted using the netlink helpers
(nla_*). So each parameter that you want to set should show up as
a netlink attribute. If a paramter is absent then you'd just use
the default, etc.
> + int (*compress_init)(struct crypto_tfm *tfm);
That should be struct crypto_pcomp.
> +static inline struct crypto_pcomp *crypto_alloc_pcomp(const char *alg_name,
> + u32 type, u32 mask)
> +{
> + type &= ~CRYPTO_ALG_TYPE_MASK;
> + type |= CRYPTO_ALG_TYPE_PCOMPRESS;
> + mask |= CRYPTO_ALG_TYPE_MASK;
> +
> + return __crypto_pcomp_cast(crypto_alloc_base(alg_name, type, mask));
> +}
That's the old way to allocate tfm's which won't work since pcomp
is using the new type API. You should do it the way that shash
does it.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2009-01-14 3:16 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-13 15:59 [PATCH/RFC 0/7] Partial (de)compression API Geert Uytterhoeven
2009-01-13 15:59 ` [PATCH] crypto: compress - Add pcomp interface Geert Uytterhoeven
2009-01-13 15:59 ` [PATCH] crypto: testmgr - Add support for the " Geert Uytterhoeven
2009-01-13 15:59 ` [PATCH] crypto: api - Add type init function to crypto_tfm Geert Uytterhoeven
2009-01-13 15:59 ` [PATCH] crypto: api - Export pcomp through comp Geert Uytterhoeven
2009-01-13 15:59 ` [PATCH] crypto: deflate - switch to pcomp Geert Uytterhoeven
2009-01-13 15:59 ` [PATCH] crypto: testmgr - swith deflate test " Geert Uytterhoeven
2009-01-13 15:59 ` [PATCH] squashfs: Make SquashFS 4 use the new pcomp crypto interface Geert Uytterhoeven
2009-01-14 3:16 ` Herbert Xu [this message]
2009-01-14 15:01 ` [PATCH] crypto: compress - Add pcomp interface Geert Uytterhoeven
2009-01-15 3:05 ` Herbert Xu
2009-01-15 10:54 ` Geert Uytterhoeven
2009-01-16 4:27 ` Herbert Xu
2009-02-05 16:24 ` Geert Uytterhoeven
2009-02-10 6:18 ` Herbert Xu
2009-02-12 15:19 ` Geert Uytterhoeven
2009-02-19 4:08 ` Herbert Xu
2009-02-19 9:12 ` Geert Uytterhoeven
2009-02-19 10:42 ` Herbert Xu
2009-02-23 17:32 ` Geert Uytterhoeven
2009-02-25 2:56 ` Herbert Xu
2009-02-25 13:26 ` Geert Uytterhoeven
2009-01-14 16:45 ` Jaswinder Singh Rajput
2009-01-14 16:54 ` Geert Uytterhoeven
2009-01-14 17:08 ` Jaswinder Singh Rajput
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090114031613.GA7429@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=Geert.Uytterhoeven@sonycom.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®