linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 02/21] crypto: use aligned-endian get/put helpers
Date: Tue, 20 May 2008 11:05:27 -0700	[thread overview]
Message-ID: <1211306727.5915.168.camel@brick> (raw)

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 crypto/ccm.c         |    6 +++---
 crypto/crc32c.c      |    4 ++--
 crypto/lrw.c         |    2 +-
 crypto/michael_mic.c |    4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/crypto/ccm.c b/crypto/ccm.c
index 7cf7e5a..9fdc2db 100644
--- a/crypto/ccm.c
+++ b/crypto/ccm.c
@@ -150,11 +150,11 @@ static int format_adata(u8 *adata, unsigned int a)
 	 * RFC 3610 and NIST Special Publication 800-38C
 	 */
 	if (a < 65280) {
-		*(__be16 *)adata = cpu_to_be16(a);
+		put_be16(a, adata);
 		len = 2;
 	} else  {
-		*(__be16 *)adata = cpu_to_be16(0xfffe);
-		*(__be32 *)&adata[2] = cpu_to_be32(a);
+		put_be16(0xfffe, adata);
+		put_be32(a, &adata[2]);
 		len = 6;
 	}
 
diff --git a/crypto/crc32c.c b/crypto/crc32c.c
index 0dcf64a..c86c89b 100644
--- a/crypto/crc32c.c
+++ b/crypto/crc32c.c
@@ -52,7 +52,7 @@ static int chksum_setkey(struct crypto_tfm *tfm, const u8 *key,
 		tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
 		return -EINVAL;
 	}
-	mctx->key = le32_to_cpu(*(__le32 *)key);
+	mctx->key = get_le32(key);
 	return 0;
 }
 
@@ -68,7 +68,7 @@ static void chksum_final(struct crypto_tfm *tfm, u8 *out)
 {
 	struct chksum_ctx *mctx = crypto_tfm_ctx(tfm);
 	
-	*(__le32 *)out = ~cpu_to_le32(mctx->crc);
+	put_le32(~mctx->crc, out);
 }
 
 static int crc32c_cra_init(struct crypto_tfm *tfm)
diff --git a/crypto/lrw.c b/crypto/lrw.c
index 8ef664e..42a4533 100644
--- a/crypto/lrw.c
+++ b/crypto/lrw.c
@@ -111,7 +111,7 @@ static inline int get_index128(be128 *block)
 	__be32 *p = (__be32 *) block;
 
 	for (p += 3, x = 0; x < 128; p--, x += 32) {
-		u32 val = be32_to_cpup(p);
+		u32 val = get_be32(p);
 
 		if (!~val)
 			continue;
diff --git a/crypto/michael_mic.c b/crypto/michael_mic.c
index 9e917b8..8aab62f 100644
--- a/crypto/michael_mic.c
+++ b/crypto/michael_mic.c
@@ -71,7 +71,7 @@ static void michael_update(struct crypto_tfm *tfm, const u8 *data,
 			return;
 
 		src = (const __le32 *)mctx->pending;
-		mctx->l ^= le32_to_cpup(src);
+		mctx->l ^= get_le32(src);
 		michael_block(mctx->l, mctx->r);
 		mctx->pending_len = 0;
 	}
@@ -79,7 +79,7 @@ static void michael_update(struct crypto_tfm *tfm, const u8 *data,
 	src = (const __le32 *)data;
 
 	while (len >= 4) {
-		mctx->l ^= le32_to_cpup(src++);
+		mctx->l ^= get_le32(src++);
 		michael_block(mctx->l, mctx->r);
 		len -= 4;
 	}
-- 
1.5.5.1.570.g26b5e



                 reply	other threads:[~2008-05-20 18:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1211306727.5915.168.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=akpm@linux-foundation.org \
    --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;
as well as URLs for NNTP newsgroup(s).