X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=crypto%2Fserpent.c;fp=crypto%2Fserpent.c;h=52ad1a492620c09c5f0505f52285514fff68961b;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=de60cdddbf4a162f9a7b19f99e547c7c2081fd17;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/crypto/serpent.c b/crypto/serpent.c index de60cdddb..52ad1a492 100644 --- a/crypto/serpent.c +++ b/crypto/serpent.c @@ -215,11 +215,9 @@ struct serpent_ctx { }; -static int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, - unsigned int keylen, u32 *flags) +static int serpent_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags) { - struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); - u32 *k = ctx->expkey; + u32 *k = ((struct serpent_ctx *)ctx)->expkey; u8 *k8 = (u8 *)k; u32 r0,r1,r2,r3,r4; int i; @@ -367,11 +365,10 @@ static int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, return 0; } -static void serpent_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) +static void serpent_encrypt(void *ctx, u8 *dst, const u8 *src) { - struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); const u32 - *k = ctx->expkey, + *k = ((struct serpent_ctx *)ctx)->expkey, *s = (const u32 *)src; u32 *d = (u32 *)dst, r0, r1, r2, r3, r4; @@ -426,9 +423,8 @@ static void serpent_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) d[3] = cpu_to_le32(r3); } -static void serpent_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) +static void serpent_decrypt(void *ctx, u8 *dst, const u8 *src) { - struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); const u32 *k = ((struct serpent_ctx *)ctx)->expkey, *s = (const u32 *)src; @@ -485,7 +481,6 @@ static struct crypto_alg serpent_alg = { .cra_flags = CRYPTO_ALG_TYPE_CIPHER, .cra_blocksize = SERPENT_BLOCK_SIZE, .cra_ctxsize = sizeof(struct serpent_ctx), - .cra_alignmask = 3, .cra_module = THIS_MODULE, .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list), .cra_u = { .cipher = { @@ -496,8 +491,7 @@ static struct crypto_alg serpent_alg = { .cia_decrypt = serpent_decrypt } } }; -static int tnepres_setkey(struct crypto_tfm *tfm, const u8 *key, - unsigned int keylen, u32 *flags) +static int tnepres_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags) { u8 rev_key[SERPENT_MAX_KEY_SIZE]; int i; @@ -511,10 +505,10 @@ static int tnepres_setkey(struct crypto_tfm *tfm, const u8 *key, for (i = 0; i < keylen; ++i) rev_key[keylen - i - 1] = key[i]; - return serpent_setkey(tfm, rev_key, keylen, flags); + return serpent_setkey(ctx, rev_key, keylen, flags); } -static void tnepres_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) +static void tnepres_encrypt(void *ctx, u8 *dst, const u8 *src) { const u32 * const s = (const u32 * const)src; u32 * const d = (u32 * const)dst; @@ -526,7 +520,7 @@ static void tnepres_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) rs[2] = swab32(s[1]); rs[3] = swab32(s[0]); - serpent_encrypt(tfm, (u8 *)rd, (u8 *)rs); + serpent_encrypt(ctx, (u8 *)rd, (u8 *)rs); d[0] = swab32(rd[3]); d[1] = swab32(rd[2]); @@ -534,7 +528,7 @@ static void tnepres_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) d[3] = swab32(rd[0]); } -static void tnepres_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) +static void tnepres_decrypt(void *ctx, u8 *dst, const u8 *src) { const u32 * const s = (const u32 * const)src; u32 * const d = (u32 * const)dst; @@ -546,7 +540,7 @@ static void tnepres_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) rs[2] = swab32(s[1]); rs[3] = swab32(s[0]); - serpent_decrypt(tfm, (u8 *)rd, (u8 *)rs); + serpent_decrypt(ctx, (u8 *)rd, (u8 *)rs); d[0] = swab32(rd[3]); d[1] = swab32(rd[2]);