From: Herbert Xu <herbert@gondor.apana.org.au>
To: "Artem B. Bityuckiy" <dedekind@infradead.org>
Cc: dwmw2@infradead.org, linux-kernel@vger.kernel.org,
linux-crypto@vger.kernel.org, jmorris@redhat.com,
svenning@post5.tele.dk,
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Subject: Re: [RFC] CryptoAPI & Compression
Date: Thu, 31 Mar 2005 19:51:51 +1000 [thread overview]
Message-ID: <20050331095151.GA13992@gondor.apana.org.au> (raw)
In-Reply-To: <1112030556.17983.35.camel@sauron.oktetlabs.ru>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=unknown-8bit, Size: 2127 bytes --]
On Mon, Mar 28, 2005 at 05:22:36PM +0000, Artem B. Bityuckiy wrote:
>
> I made the changes to deflate_decompr() because the old version doesn't
> work properly for me. There are 2 changes.
>
> 1. I've added the following code:
>
> ------------------------------------------------------------------------
> if (slen > 2 && !(src[1] & PRESET_DICT) /* No preset dictionary */
> && ((src[0] & 0x0f) == Z_DEFLATED) /* Comp. method byte is OK */
> && !(((src[0] << 8) + src[1]) % 31)) { /* CMF*256 + FLG */
> stream->next_in += 2;
> stream->avail_in -= 2;
> }
> ------------------------------------------------------------------------
The reason you need to add this is because the window bits that
was used to produce the compressed data is positive while the window
bits crypto/deflate is using to perform the decompression isn't.
So what we should do here is turn window bits into a configurable
parameter.
Once you supply the correct window bits information, the above is
then simply an optimisation.
Rather than keeping the above optimisation, JFFS should simply do
the compression with a negative window bits value.
Of course to maintain backwards compatibility you'll need to do this
as a new compression type.
> 2. I've removed the "strange" (for me) uncompress sequence:
>
> ------------------------------------------------------------------------
> ret = zlib_inflate(stream, Z_SYNC_FLUSH);
> /*
> * Work around a bug in zlib, which sometimes wants to taste an extra
> * byte when being used in the (undocumented) raw deflate mode.
> * (From USAGI).
> */
I believe this bit of code originally came from FreeS/WAN and was
written by Svenning Sørensen. Maybe he or Yoshifuji-san can tell
us why?
Unless we're sure that zlib has been fixed we should leave it in.
It should be a no-op if zlib has been fixed. So this probably
isn't causing the breakage that you saw.
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:[~2005-03-31 9:57 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-25 16:08 Artem B. Bityuckiy
2005-03-26 4:44 ` Herbert Xu
2005-03-26 11:32 ` Artem B. Bityuckiy
2005-03-28 17:22 ` Artem B. Bityuckiy
2005-03-29 10:35 ` Herbert Xu
2005-03-29 11:55 ` Artem B. Bityuckiy
2005-03-31 2:19 ` Herbert Xu
2005-03-31 10:43 ` Artem B. Bityuckiy
2005-03-31 11:11 ` Herbert Xu
2005-04-01 14:36 ` Artem B. Bityuckiy
2005-04-01 14:44 ` David Woodhouse
2005-04-01 14:57 ` Artem B. Bityuckiy
2005-04-01 15:05 ` David Woodhouse
2005-04-01 15:22 ` Artem B. Bityuckiy
2005-04-01 15:33 ` Jörn Engel
2005-04-03 8:47 ` Artem B. Bityuckiy
2005-04-01 15:23 ` Herbert Xu
2005-04-01 15:41 ` Artem B. Bityuckiy
2005-04-01 22:13 ` Herbert Xu
2005-04-03 8:22 ` Artem B. Bityuckiy
2005-04-03 8:27 ` Artem B. Bityuckiy
2005-04-03 8:29 ` Artem B. Bityuckiy
2005-04-03 8:44 ` Herbert Xu
2005-04-03 8:59 ` Artem B. Bityuckiy
2005-04-03 9:30 ` Herbert Xu
2005-04-03 9:45 ` Artem B. Bityuckiy
2005-04-03 10:00 ` Herbert Xu
2005-04-03 10:06 ` David Woodhouse
2005-04-03 10:17 ` Herbert Xu
2005-04-03 10:23 ` Artem B. Bityuckiy
2005-04-03 11:42 ` Herbert Xu
2005-04-03 15:24 ` Artem B. Bityuckiy
2005-04-03 11:19 ` David Woodhouse
2005-04-03 11:40 ` Herbert Xu
[not found] ` <4250175D.5070704@yandex.ru>
[not found] ` <20050403213207.GA24462@gondor.apana.org.au>
2005-04-18 15:09 ` Artem B. Bityuckiy
2005-04-19 9:25 ` Herbert Xu
2005-04-19 12:51 ` Artem B. Bityuckiy
2005-04-19 22:10 ` Herbert Xu
2005-04-03 10:19 ` Artem B. Bityuckiy
2005-04-03 9:20 ` Artem B. Bityuckiy
2005-03-31 9:51 ` Herbert Xu [this message]
2005-04-03 11:41 ` Artem B. Bityuckiy
2005-04-03 11:47 ` Herbert Xu
2005-04-03 11:53 ` Artem B. Bityuckiy
2005-04-03 12:00 ` Herbert Xu
2005-04-03 12:01 ` Artem B. Bityuckiy
2005-04-03 12:07 ` Herbert Xu
2005-04-03 12:18 ` Artem B. Bityuckiy
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=20050331095151.GA13992@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=dedekind@infradead.org \
--cc=dwmw2@infradead.org \
--cc=jmorris@redhat.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=svenning@post5.tele.dk \
--cc=yoshfuji@linux-ipv6.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®