projects
/
linux-2.6-microblaze.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
math: make RATIONAL tristate
[linux-2.6-microblaze.git]
/
crypto
/
blowfish_generic.c
diff --git
a/crypto/blowfish_generic.c
b/crypto/blowfish_generic.c
index
c3c2041
..
003b52c
100644
(file)
--- a/
crypto/blowfish_generic.c
+++ b/
crypto/blowfish_generic.c
@@
-14,7
+14,7
@@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
-#include <asm/
byteorder
.h>
+#include <asm/
unaligned
.h>
#include <linux/crypto.h>
#include <linux/types.h>
#include <crypto/blowfish.h>
#include <linux/crypto.h>
#include <linux/types.h>
#include <crypto/blowfish.h>
@@
-36,12
+36,10
@@
static void bf_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
struct bf_ctx *ctx = crypto_tfm_ctx(tfm);
static void bf_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
struct bf_ctx *ctx = crypto_tfm_ctx(tfm);
- const __be32 *in_blk = (const __be32 *)src;
- __be32 *const out_blk = (__be32 *)dst;
const u32 *P = ctx->p;
const u32 *S = ctx->s;
const u32 *P = ctx->p;
const u32 *S = ctx->s;
- u32 yl =
be32_to_cpu(in_blk[0]
);
- u32 yr =
be32_to_cpu(in_blk[1]
);
+ u32 yl =
get_unaligned_be32(src
);
+ u32 yr =
get_unaligned_be32(src + 4
);
ROUND(yr, yl, 0);
ROUND(yl, yr, 1);
ROUND(yr, yl, 0);
ROUND(yl, yr, 1);
@@
-63,19
+61,17
@@
static void bf_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
yl ^= P[16];
yr ^= P[17];
yl ^= P[16];
yr ^= P[17];
-
out_blk[0] = cpu_to_be32(yr
);
-
out_blk[1] = cpu_to_be32(yl
);
+
put_unaligned_be32(yr, dst
);
+
put_unaligned_be32(yl, dst + 4
);
}
static void bf_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
struct bf_ctx *ctx = crypto_tfm_ctx(tfm);
}
static void bf_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
struct bf_ctx *ctx = crypto_tfm_ctx(tfm);
- const __be32 *in_blk = (const __be32 *)src;
- __be32 *const out_blk = (__be32 *)dst;
const u32 *P = ctx->p;
const u32 *S = ctx->s;
const u32 *P = ctx->p;
const u32 *S = ctx->s;
- u32 yl =
be32_to_cpu(in_blk[0]
);
- u32 yr =
be32_to_cpu(in_blk[1]
);
+ u32 yl =
get_unaligned_be32(src
);
+ u32 yr =
get_unaligned_be32(src + 4
);
ROUND(yr, yl, 17);
ROUND(yl, yr, 16);
ROUND(yr, yl, 17);
ROUND(yl, yr, 16);
@@
-97,8
+93,8
@@
static void bf_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
yl ^= P[1];
yr ^= P[0];
yl ^= P[1];
yr ^= P[0];
-
out_blk[0] = cpu_to_be32(yr
);
-
out_blk[1] = cpu_to_be32(yl
);
+
put_unaligned_be32(yr, dst
);
+
put_unaligned_be32(yl, dst + 4
);
}
static struct crypto_alg alg = {
}
static struct crypto_alg alg = {
@@
-108,7
+104,6
@@
static struct crypto_alg alg = {
.cra_flags = CRYPTO_ALG_TYPE_CIPHER,
.cra_blocksize = BF_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct bf_ctx),
.cra_flags = CRYPTO_ALG_TYPE_CIPHER,
.cra_blocksize = BF_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct bf_ctx),
- .cra_alignmask = 3,
.cra_module = THIS_MODULE,
.cra_u = { .cipher = {
.cia_min_keysize = BF_MIN_KEY_SIZE,
.cra_module = THIS_MODULE,
.cra_u = { .cipher = {
.cia_min_keysize = BF_MIN_KEY_SIZE,