Re: [RFC] CryptoAPI & Compression

Herbert Xu
2005-04-19T22:11:34Z

On Tue, Apr 19, 2005 at 04:51:56PM +0400, Artem B. Bityuckiy wrote:
>
> JFFS2 wants the following from pcompress():
> 1. compressible data: compress it; the offered formerly algorithm works
> just fine here.

Yes but the existing JFFS algorithm does a lot more than that. It tries
to pack as much data as possible into the output buffer.

> 2. non-compressible data: do not compress it, leave it uncompressed; the
> offered algorithm works fine here too - it returns an error.

If all you need is to compress what's compressible you don't need
pcompress at all. You just need to call the normal compress method
with the input length clamped by the output buffer size. If the
function returns OK then it's compressible, otherwise it isn't.

You can even do the existing JFFS loop this way too.
--
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