Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/opencrypto whan compressing, set the Z_FINISH flag to zl...



details:   https://anonhg.NetBSD.org/src/rev/e54c82448553
branches:  trunk
changeset: 761925:e54c82448553
user:      drochner <drochner%NetBSD.org@localhost>
date:      Thu Feb 10 21:17:49 2011 +0000

description:
whan compressing, set the Z_FINISH flag to zlib to tell that
the data chunk is the final one, which makes that zlib issues the
proper termination marker
(KAME IPSEC does this, but doesn't check eagerly in the receive
path, so the missing termination didn't cause problems so far)
closes my PR kern/44539
being here, replace the Z_PARTIAL_FLUSH flag which is marked
deprecated by zlib by Z_SYNC_FLUSH in the decompression path
(tested with IPv4 IPCOMP on i386)

diffstat:

 sys/opencrypto/deflate.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 6ef64d99bbbb -r e54c82448553 sys/opencrypto/deflate.c
--- a/sys/opencrypto/deflate.c  Thu Feb 10 21:05:52 2011 +0000
+++ b/sys/opencrypto/deflate.c  Thu Feb 10 21:17:49 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: deflate.c,v 1.13 2009/03/25 01:26:13 darran Exp $ */
+/*     $NetBSD: deflate.c,v 1.14 2011/02/10 21:17:49 drochner Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/deflate.c,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $  */
 /* $OpenBSD: deflate.c,v 1.3 2001/08/20 02:45:22 hugh Exp $ */
 
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: deflate.c,v 1.13 2009/03/25 01:26:13 darran Exp $");
+__KERNEL_RCSID(0, "$NetBSD: deflate.c,v 1.14 2011/02/10 21:17:49 drochner Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -132,8 +132,8 @@
        if (error != Z_OK)
                goto bad;
        for (;;) {
-               error = decomp ? inflate(&zbuf, Z_PARTIAL_FLUSH) :
-                                deflate(&zbuf, Z_PARTIAL_FLUSH);
+               error = decomp ? inflate(&zbuf, Z_SYNC_FLUSH) :
+                                deflate(&zbuf, Z_FINISH);
                if (error != Z_OK && error != Z_STREAM_END)
                        goto bad;
                else if (zbuf.avail_in == 0 && zbuf.avail_out != 0)
@@ -354,8 +354,8 @@
        for (;;) {
                DPRINTF(("pre: %s in:%d out:%d\n", decomp ? "deflate()" : "inflate()", 
                                zbuf.avail_in, zbuf.avail_out));
-               error = decomp ? inflate(&zbuf, Z_PARTIAL_FLUSH) :
-                                deflate(&zbuf, Z_PARTIAL_FLUSH);
+               error = decomp ? inflate(&zbuf, Z_SYNC_FLUSH) :
+                                deflate(&zbuf, Z_FINISH);
                DPRINTF(("post: %s in:%d out:%d\n", decomp ? "deflate()" : "inflate()", 
                                zbuf.avail_in, zbuf.avail_out));
                if (error != Z_OK && error != Z_STREAM_END) {



Home | Main Index | Thread Index | Old Index