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
ide-floppy: convert to using the new atapi_flags (take 2)
[safe/jmp/linux-2.6]
/
crypto
/
lrw.c
diff --git
a/crypto/lrw.c
b/crypto/lrw.c
index
5d04315
..
8ef664e
100644
(file)
--- a/
crypto/lrw.c
+++ b/
crypto/lrw.c
@@
-91,11
+91,12
@@
struct sinfo {
static inline void inc(be128 *iv)
{
static inline void inc(be128 *iv)
{
- if (!(iv->b = cpu_to_be64(be64_to_cpu(iv->b) + 1)))
- iv->a = cpu_to_be64(be64_to_cpu(iv->a) + 1);
+ be64_add_cpu(&iv->b, 1);
+ if (!iv->b)
+ be64_add_cpu(&iv->a, 1);
}
}
-static inline void round(struct sinfo *s, void *dst, const void *src)
+static inline void
lrw_
round(struct sinfo *s, void *dst, const void *src)
{
be128_xor(dst, &s->t, src); /* PP <- T xor P */
s->fn(s->tfm, dst, dst); /* CC <- E(Key2,PP) */
{
be128_xor(dst, &s->t, src); /* PP <- T xor P */
s->fn(s->tfm, dst, dst); /* CC <- E(Key2,PP) */
@@
-160,7
+161,7
@@
static int crypt(struct blkcipher_desc *d,
inc(iv);
first:
inc(iv);
first:
- round(&s, wdst, wsrc);
+
lrw_
round(&s, wdst, wsrc);
wsrc += bs;
wdst += bs;
wsrc += bs;
wdst += bs;
@@
-201,21
+202,22
@@
static int decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
static int init_tfm(struct crypto_tfm *tfm)
{
static int init_tfm(struct crypto_tfm *tfm)
{
+ struct crypto_cipher *cipher;
struct crypto_instance *inst = (void *)tfm->__crt_alg;
struct crypto_spawn *spawn = crypto_instance_ctx(inst);
struct priv *ctx = crypto_tfm_ctx(tfm);
u32 *flags = &tfm->crt_flags;
struct crypto_instance *inst = (void *)tfm->__crt_alg;
struct crypto_spawn *spawn = crypto_instance_ctx(inst);
struct priv *ctx = crypto_tfm_ctx(tfm);
u32 *flags = &tfm->crt_flags;
-
tfm = crypto_spawn_tfm
(spawn);
- if (IS_ERR(
tfm
))
- return PTR_ERR(
tfm
);
+
cipher = crypto_spawn_cipher
(spawn);
+ if (IS_ERR(
cipher
))
+ return PTR_ERR(
cipher
);
- if (crypto_
tfm_alg_blocksize(tfm
) != 16) {
+ if (crypto_
cipher_blocksize(cipher
) != 16) {
*flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN;
return -EINVAL;
}
*flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN;
return -EINVAL;
}
- ctx->child = c
rypto_cipher_cast(tfm)
;
+ ctx->child = c
ipher
;
return 0;
}
return 0;
}
@@
-227,15
+229,20
@@
static void exit_tfm(struct crypto_tfm *tfm)
crypto_free_cipher(ctx->child);
}
crypto_free_cipher(ctx->child);
}
-static struct crypto_instance *alloc(
void *param, unsigned int len
)
+static struct crypto_instance *alloc(
struct rtattr **tb
)
{
struct crypto_instance *inst;
struct crypto_alg *alg;
{
struct crypto_instance *inst;
struct crypto_alg *alg;
+ int err;
+
+ err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_BLKCIPHER);
+ if (err)
+ return ERR_PTR(err);
- alg = crypto_get_attr_alg(
param, len
, CRYPTO_ALG_TYPE_CIPHER,
- CRYPTO_ALG_TYPE_MASK
| CRYPTO_ALG_ASYNC
);
+ alg = crypto_get_attr_alg(
tb
, CRYPTO_ALG_TYPE_CIPHER,
+ CRYPTO_ALG_TYPE_MASK);
if (IS_ERR(alg))
if (IS_ERR(alg))
- return ERR_
PTR(PTR_ERR(alg)
);
+ return ERR_
CAST(alg
);
inst = crypto_alloc_instance("lrw", alg);
if (IS_ERR(inst))
inst = crypto_alloc_instance("lrw", alg);
if (IS_ERR(inst))