git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
nfsd4: support putpubfh operation
[safe/jmp/linux-2.6]
/
crypto
/
cast6.c
diff --git
a/crypto/cast6.c
b/crypto/cast6.c
index
d317fff
..
007d02b
100644
(file)
--- a/
crypto/cast6.c
+++ b/
crypto/cast6.c
@@
-369,7
+369,7
@@
static const u8 Tr[4][8] = {
};
/* forward octave */
};
/* forward octave */
-static
inline
void W(u32 *key, unsigned int i) {
+static void W(u32 *key, unsigned int i) {
u32 I;
key[6] ^= F1(key[7], Tr[i % 4][0], Tm[i][0]);
key[5] ^= F2(key[6], Tr[i % 4][1], Tm[i][1]);
u32 I;
key[6] ^= F1(key[7], Tr[i % 4][0], Tm[i][0]);
key[5] ^= F2(key[6], Tr[i % 4][1], Tm[i][1]);
@@
-381,15
+381,16
@@
static inline void W(u32 *key, unsigned int i) {
key[7] ^= F2(key[0], Tr[i % 4][7], Tm[i][7]);
}
key[7] ^= F2(key[0], Tr[i % 4][7], Tm[i][7]);
}
-static int
-
cast6_setkey(void *ctx, const u8 * in_key, unsigned key_len, u32 * flags
)
+static int
cast6_setkey(struct crypto_tfm *tfm, const u8 *in_key,
+
unsigned key_len
)
{
int i;
u32 key[8];
__be32 p_key[8]; /* padded key */
{
int i;
u32 key[8];
__be32 p_key[8]; /* padded key */
- struct cast6_ctx *c = (struct cast6_ctx *) ctx;
+ struct cast6_ctx *c = crypto_tfm_ctx(tfm);
+ u32 *flags = &tfm->crt_flags;
- if (key_len
< 16 || key_len > 32 || key_len
% 4 != 0) {
+ if (key_len % 4 != 0) {
*flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
return -EINVAL;
}
*flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
return -EINVAL;
}
@@
-427,7
+428,7
@@
cast6_setkey(void *ctx, const u8 * in_key, unsigned key_len, u32 * flags)
}
/*forward quad round*/
}
/*forward quad round*/
-static
inline
void Q (u32 * block, u8 * Kr, u32 * Km) {
+static void Q (u32 * block, u8 * Kr, u32 * Km) {
u32 I;
block[2] ^= F1(block[3], Kr[0], Km[0]);
block[1] ^= F2(block[2], Kr[1], Km[1]);
u32 I;
block[2] ^= F1(block[3], Kr[0], Km[0]);
block[1] ^= F2(block[2], Kr[1], Km[1]);
@@
-436,7
+437,7
@@
static inline void Q (u32 * block, u8 * Kr, u32 * Km) {
}
/*reverse quad round*/
}
/*reverse quad round*/
-static
inline
void QBAR (u32 * block, u8 * Kr, u32 * Km) {
+static void QBAR (u32 * block, u8 * Kr, u32 * Km) {
u32 I;
block[3] ^= F1(block[0], Kr[3], Km[3]);
block[0] ^= F3(block[1], Kr[2], Km[2]);
u32 I;
block[3] ^= F1(block[0], Kr[3], Km[3]);
block[0] ^= F3(block[1], Kr[2], Km[2]);
@@
-444,8
+445,9
@@
static inline void QBAR (u32 * block, u8 * Kr, u32 * Km) {
block[2] ^= F1(block[3], Kr[0], Km[0]);
}
block[2] ^= F1(block[3], Kr[0], Km[0]);
}
-static void cast6_encrypt (void * ctx, u8 * outbuf, const u8 * inbuf) {
- struct cast6_ctx * c = (struct cast6_ctx *)ctx;
+static void cast6_encrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf)
+{
+ struct cast6_ctx *c = crypto_tfm_ctx(tfm);
const __be32 *src = (const __be32 *)inbuf;
__be32 *dst = (__be32 *)outbuf;
u32 block[4];
const __be32 *src = (const __be32 *)inbuf;
__be32 *dst = (__be32 *)outbuf;
u32 block[4];
@@
-476,8
+478,8
@@
static void cast6_encrypt (void * ctx, u8 * outbuf, const u8 * inbuf) {
dst[3] = cpu_to_be32(block[3]);
}
dst[3] = cpu_to_be32(block[3]);
}
-static void cast6_decrypt
(void * ctx, u8 * outbuf, const u8 *
inbuf) {
- struct cast6_ctx * c =
(struct cast6_ctx *)ctx
;
+static void cast6_decrypt
(struct crypto_tfm *tfm, u8 *outbuf, const u8 *
inbuf) {
+ struct cast6_ctx * c =
crypto_tfm_ctx(tfm)
;
const __be32 *src = (const __be32 *)inbuf;
__be32 *dst = (__be32 *)outbuf;
u32 block[4];
const __be32 *src = (const __be32 *)inbuf;
__be32 *dst = (__be32 *)outbuf;
u32 block[4];
@@
-513,6
+515,7
@@
static struct crypto_alg alg = {
.cra_flags = CRYPTO_ALG_TYPE_CIPHER,
.cra_blocksize = CAST6_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct cast6_ctx),
.cra_flags = CRYPTO_ALG_TYPE_CIPHER,
.cra_blocksize = CAST6_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct cast6_ctx),
+ .cra_alignmask = 3,
.cra_module = THIS_MODULE,
.cra_list = LIST_HEAD_INIT(alg.cra_list),
.cra_u = {
.cra_module = THIS_MODULE,
.cra_list = LIST_HEAD_INIT(alg.cra_list),
.cra_u = {
@@
-525,18
+528,18
@@
static struct crypto_alg alg = {
}
};
}
};
-static int __init init(void)
+static int __init
cast6_mod_
init(void)
{
return crypto_register_alg(&alg);
}
{
return crypto_register_alg(&alg);
}
-static void __exit fini(void)
+static void __exit
cast6_mod_
fini(void)
{
crypto_unregister_alg(&alg);
}
{
crypto_unregister_alg(&alg);
}
-module_init(init);
-module_exit(fini);
+module_init(
cast6_mod_
init);
+module_exit(
cast6_mod_
fini);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Cast6 Cipher Algorithm");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Cast6 Cipher Algorithm");