lkml.org 
[lkml]   [2006]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH] crypto: fix unaligned access in khazad module
From
Ping.  This patch can be applied cleanly to 2.6.17-rc1.


On 64-bit platform, reading directly from keys (which supposed to be
32-bit aligned) will result in unaligned access.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

diff --git a/crypto/khazad.c b/crypto/khazad.c
index 807f2bf..c7e1d25 100644
--- a/crypto/khazad.c
+++ b/crypto/khazad.c
@@ -26,6 +26,7 @@
#include <asm/scatterlist.h>
#include <linux/crypto.h>
#include <linux/types.h>
+#include <asm/unaligned.h>

#define KHAZAD_KEY_SIZE 16
#define KHAZAD_BLOCK_SIZE 8
@@ -769,8 +770,8 @@ static int khazad_setkey(void *ctx_arg,
return -EINVAL;
}

- K2 = be64_to_cpu(key[0]);
- K1 = be64_to_cpu(key[1]);
+ K2 = be64_to_cpu(get_unaligned(&key[0]));
+ K1 = be64_to_cpu(get_unaligned(&key[1]));

/* setup the encrypt key */
for (r = 0; r <= KHAZAD_ROUNDS; r++) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-04-03 17:07    [W:0.084 / U:0.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site