aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/blowfish.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/blowfish.c')
-rw-r--r--crypto/blowfish.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/crypto/blowfish.c b/crypto/blowfish.c
index 7f710b201f20..490265f42b3b 100644
--- a/crypto/blowfish.c
+++ b/crypto/blowfish.c
@@ -349,7 +349,7 @@ static void encrypt_block(struct bf_ctx *bctx, u32 *dst, u32 *src)
349 dst[1] = yl; 349 dst[1] = yl;
350} 350}
351 351
352static void bf_encrypt(void *ctx, u8 *dst, const u8 *src) 352static void bf_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
353{ 353{
354 const __be32 *in_blk = (const __be32 *)src; 354 const __be32 *in_blk = (const __be32 *)src;
355 __be32 *const out_blk = (__be32 *)dst; 355 __be32 *const out_blk = (__be32 *)dst;
@@ -357,17 +357,18 @@ static void bf_encrypt(void *ctx, u8 *dst, const u8 *src)
357 357
358 in32[0] = be32_to_cpu(in_blk[0]); 358 in32[0] = be32_to_cpu(in_blk[0]);
359 in32[1] = be32_to_cpu(in_blk[1]); 359 in32[1] = be32_to_cpu(in_blk[1]);
360 encrypt_block(ctx, out32, in32); 360 encrypt_block(crypto_tfm_ctx(tfm), out32, in32);
361 out_blk[0] = cpu_to_be32(out32[0]); 361 out_blk[0] = cpu_to_be32(out32[0]);
362 out_blk[1] = cpu_to_be32(out32[1]); 362 out_blk[1] = cpu_to_be32(out32[1]);
363} 363}
364 364
365static void bf_decrypt(void *ctx, u8 *dst, const u8 *src) 365static void bf_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
366{ 366{
367 struct bf_ctx *ctx = crypto_tfm_ctx(tfm);
367 const __be32 *in_blk = (const __be32 *)src; 368 const __be32 *in_blk = (const __be32 *)src;
368 __be32 *const out_blk = (__be32 *)dst; 369 __be32 *const out_blk = (__be32 *)dst;
369 const u32 *P = ((struct bf_ctx *)ctx)->p; 370 const u32 *P = ctx->p;
370 const u32 *S = ((struct bf_ctx *)ctx)->s; 371 const u32 *S = ctx->s;
371 u32 yl = be32_to_cpu(in_blk[0]); 372 u32 yl = be32_to_cpu(in_blk[0]);
372 u32 yr = be32_to_cpu(in_blk[1]); 373 u32 yr = be32_to_cpu(in_blk[1]);
373 374
@@ -398,12 +399,14 @@ static void bf_decrypt(void *ctx, u8 *dst, const u8 *src)
398/* 399/*
399 * Calculates the blowfish S and P boxes for encryption and decryption. 400 * Calculates the blowfish S and P boxes for encryption and decryption.
400 */ 401 */
401static int bf_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags) 402static int bf_setkey(struct crypto_tfm *tfm, const u8 *key,
403 unsigned int keylen, u32 *flags)
402{ 404{
405 struct bf_ctx *ctx = crypto_tfm_ctx(tfm);
406 u32 *P = ctx->p;
407 u32 *S = ctx->s;
403 short i, j, count; 408 short i, j, count;
404 u32 data[2], temp; 409 u32 data[2], temp;
405 u32 *P = ((struct bf_ctx *)ctx)->p;
406 u32 *S = ((struct bf_ctx *)ctx)->s;
407 410
408 /* Copy the initialization s-boxes */ 411 /* Copy the initialization s-boxes */
409 for (i = 0, count = 0; i < 256; i++) 412 for (i = 0, count = 0; i < 256; i++)