summaryrefslogtreecommitdiffstats
path: root/sys/opencrypto
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2009-11-29 17:53:57 +0000
committerbz <bz@FreeBSD.org>2009-11-29 17:53:57 +0000
commitd4d8859e1ebaf0a42c1560ac30d2a8001f069f3b (patch)
treee35d95ecb8619dba02f6979ffdfebd85ffbbfba1 /sys/opencrypto
parenta8256824b80cce72ba41b83c19f3368286c52297 (diff)
downloadFreeBSD-src-d4d8859e1ebaf0a42c1560ac30d2a8001f069f3b.zip
FreeBSD-src-d4d8859e1ebaf0a42c1560ac30d2a8001f069f3b.tar.gz
In case the compression result is the same size as the orignal version,
the compression was useless as well. Make sure to not update the data and return, else we would waste resources when decompressing. This also avoids the copyback() changing data other consumers like xform_ipcomp.c would have ignored because of no win and sent out without noting that compression was used, resulting in invalid packets at the receiver. MFC after: 5 days
Diffstat (limited to 'sys/opencrypto')
-rw-r--r--sys/opencrypto/cryptosoft.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c
index 2769be6..97b73a2 100644
--- a/sys/opencrypto/cryptosoft.c
+++ b/sys/opencrypto/cryptosoft.c
@@ -552,7 +552,7 @@ swcr_compdec(struct cryptodesc *crd, struct swcr_data *sw,
sw->sw_size = result;
/* Check the compressed size when doing compression */
if (crd->crd_flags & CRD_F_COMP) {
- if (result > crd->crd_len) {
+ if (result >= crd->crd_len) {
/* Compression was useless, we lost time */
free(out, M_CRYPTO_DATA);
return 0;
OpenPOWER on IntegriCloud