mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Fruhwirth Clemens <clemens@endorphin.org>
Cc: James Morris <jmorris@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	cryptoapi@lists.logix.cz
Subject: Re: [5/5] [CRYPTO] Optimise kmap calls in crypt()
Date: Tue, 22 Mar 2005 12:13:08 +1100	[thread overview]
Message-ID: <20050322011308.GA15734@gondor.apana.org.au> (raw)
In-Reply-To: <1111404659.12532.9.camel@ghanima>

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

On Mon, Mar 21, 2005 at 12:30:59PM +0100, Fruhwirth Clemens wrote:
> 
> Applying all patches results in a "does not work for me". The decryption
> result is different from the original and my LUKS managed partition
> refuses to mount.

Thanks for testing this Fruhwirth.  The problem is that walk->data wasn't
being incremented anymore after my last change.  This patch should fix it
up.

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

[-- Attachment #2: sg-6 --]
[-- Type: text/plain, Size: 2177 bytes --]

===== crypto/scatterwalk.c 1.4 vs edited =====
--- 1.4/crypto/scatterwalk.c	2005-03-20 22:18:58 +11:00
+++ edited/crypto/scatterwalk.c	2005-03-22 11:06:11 +11:00
@@ -17,6 +17,7 @@
 #include <linux/mm.h>
 #include <linux/pagemap.h>
 #include <linux/highmem.h>
+#include <asm/bug.h>
 #include <asm/scatterlist.h>
 #include "internal.h"
 #include "scatterwalk.h"
@@ -45,6 +46,8 @@
 	walk->page = sg->page;
 	walk->len_this_segment = sg->length;
 
+	BUG_ON(!sg->length);
+
 	rest_of_page = PAGE_CACHE_SIZE - (sg->offset & (PAGE_CACHE_SIZE - 1));
 	walk->len_this_page = min(sg->length, rest_of_page);
 	walk->offset = sg->offset;
@@ -55,13 +58,17 @@
 	walk->data = crypto_kmap(walk->page, out) + walk->offset;
 }
 
-static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
-				 unsigned int more)
+static inline void scatterwalk_unmap(struct scatter_walk *walk, int out)
 {
 	/* walk->data may be pointing the first byte of the next page;
 	   however, we know we transfered at least one byte.  So,
 	   walk->data - 1 will be a virtual address in the mapped page. */
+	crypto_kunmap(walk->data - 1, out);
+}
 
+static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
+				 unsigned int more)
+{
 	if (out)
 		flush_dcache_page(walk->page);
 
@@ -81,7 +88,7 @@
 
 void scatterwalk_done(struct scatter_walk *walk, int out, int more)
 {
-	crypto_kunmap(walk->data, out);
+	scatterwalk_unmap(walk, out);
 	if (walk->len_this_page == 0 || !more)
 		scatterwalk_pagedone(walk, out, more);
 }
@@ -98,7 +105,7 @@
 		buf += walk->len_this_page;
 		nbytes -= walk->len_this_page;
 
-		crypto_kunmap(walk->data, out);
+		scatterwalk_unmap(walk, out);
 		scatterwalk_pagedone(walk, out, 1);
 		scatterwalk_map(walk, out);
 	} while (nbytes > walk->len_this_page);
===== crypto/scatterwalk.h 1.6 vs edited =====
--- 1.6/crypto/scatterwalk.h	2005-03-20 22:18:58 +11:00
+++ edited/crypto/scatterwalk.h	2005-03-22 10:57:07 +11:00
@@ -49,6 +49,7 @@
 static inline void scatterwalk_advance(struct scatter_walk *walk,
 				       unsigned int nbytes)
 {
+	walk->data += nbytes;
 	walk->offset += nbytes;
 	walk->len_this_page -= nbytes;
 	walk->len_this_segment -= nbytes;

  reply	other threads:[~2005-03-22  1:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-21  9:40 [0/5] [CRYPTO] Speed up crypt() Herbert Xu
2005-03-21  9:48 ` [1/5] [CRYPTO] Do scatterwalk_whichbuf inline Herbert Xu
2005-03-21  9:49   ` [2/5] [CRYPTO] Handle in_place flag in crypt() Herbert Xu
2005-03-21  9:50     ` [3/5] [CRYPTO] Split src/dst handling out from crypt() Herbert Xu
2005-03-21  9:52       ` [4/5] [CRYPTO] Eliminate most calls to scatterwalk_copychunks " Herbert Xu
2005-03-21  9:53         ` [5/5] [CRYPTO] Optimise kmap calls in crypt() Herbert Xu
2005-03-21 11:30           ` Fruhwirth Clemens
2005-03-22  1:13             ` Herbert Xu [this message]
2005-03-22 10:24               ` Fruhwirth Clemens
2005-03-22 11:22 ` [7/*] [CRYPTO] Kill obsolete iv check in cbc_process() Herbert Xu
2005-03-22 11:24   ` [8/*] [CRYPTO] Split cbc_process into encrypt/decrypt Herbert Xu
2005-03-22 11:25     ` [9/*] [CRYPTO] Remap when walk_out crosses page in crypt() Herbert Xu
2005-03-23 20:17       ` David S. Miller

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=20050322011308.GA15734@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=clemens@endorphin.org \
    --cc=cryptoapi@lists.logix.cz \
    --cc=jmorris@redhat.com \
    --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®