aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crc32c.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/crc32c.c')
-rw-r--r--crypto/crc32c.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/crypto/crc32c.c b/crypto/crc32c.c
index 953362423a5c..f2660123aeb4 100644
--- a/crypto/crc32c.c
+++ b/crypto/crc32c.c
@@ -31,9 +31,9 @@ struct chksum_ctx {
31 * crc using table. 31 * crc using table.
32 */ 32 */
33 33
34static void chksum_init(void *ctx) 34static void chksum_init(struct crypto_tfm *tfm)
35{ 35{
36 struct chksum_ctx *mctx = ctx; 36 struct chksum_ctx *mctx = crypto_tfm_ctx(tfm);
37 37
38 mctx->crc = ~(u32)0; /* common usage */ 38 mctx->crc = ~(u32)0; /* common usage */
39} 39}
@@ -43,10 +43,10 @@ static void chksum_init(void *ctx)
43 * If your algorithm starts with ~0, then XOR with ~0 before you set 43 * If your algorithm starts with ~0, then XOR with ~0 before you set
44 * the seed. 44 * the seed.
45 */ 45 */
46static int chksum_setkey(void *ctx, const u8 *key, unsigned int keylen, 46static int chksum_setkey(struct crypto_tfm *tfm, const u8 *key,
47 u32 *flags) 47 unsigned int keylen, u32 *flags)
48{ 48{
49 struct chksum_ctx *mctx = ctx; 49 struct chksum_ctx *mctx = crypto_tfm_ctx(tfm);
50 50
51 if (keylen != sizeof(mctx->crc)) { 51 if (keylen != sizeof(mctx->crc)) {
52 if (flags) 52 if (flags)
@@ -57,9 +57,10 @@ static int chksum_setkey(void *ctx, const u8 *key, unsigned int keylen,
57 return 0; 57 return 0;
58} 58}
59 59
60static void chksum_update(void *ctx, const u8 *data, unsigned int length) 60static void chksum_update(struct crypto_tfm *tfm, const u8 *data,
61 unsigned int length)
61{ 62{
62 struct chksum_ctx *mctx = ctx; 63 struct chksum_ctx *mctx = crypto_tfm_ctx(tfm);
63 u32 mcrc; 64 u32 mcrc;
64 65
65 mcrc = crc32c(mctx->crc, data, (size_t)length); 66 mcrc = crc32c(mctx->crc, data, (size_t)length);
@@ -67,9 +68,9 @@ static void chksum_update(void *ctx, const u8 *data, unsigned int length)
67 mctx->crc = mcrc; 68 mctx->crc = mcrc;
68} 69}
69 70
70static void chksum_final(void *ctx, u8 *out) 71static void chksum_final(struct crypto_tfm *tfm, u8 *out)
71{ 72{
72 struct chksum_ctx *mctx = ctx; 73 struct chksum_ctx *mctx = crypto_tfm_ctx(tfm);
73 u32 mcrc = (mctx->crc ^ ~(u32)0); 74 u32 mcrc = (mctx->crc ^ ~(u32)0);
74 75
75 *(u32 *)out = __le32_to_cpu(mcrc); 76 *(u32 *)out = __le32_to_cpu(mcrc);