40 #include <linux/module.h>
41 #include <linux/string.h>
42 #include <linux/kernel.h>
45 #define CHKSUM_BLOCK_SIZE 1
46 #define CHKSUM_DIGEST_SIZE 4
79 struct chksum_ctx *mctx = crypto_shash_ctx(tfm);
81 if (keylen !=
sizeof(mctx->
key)) {
106 static int __chksum_finup(
u32 *crcp,
const u8 *
data,
unsigned int len,
u8 *out)
112 static int chksum_finup(
struct shash_desc *desc,
const u8 *data,
113 unsigned int len,
u8 *out)
117 return __chksum_finup(&ctx->
crc, data, len, out);
120 static int chksum_digest(
struct shash_desc *desc,
const u8 *data,
125 return __chksum_finup(&mctx->
key, data, length, out);
128 static int crc32c_cra_init(
struct crypto_tfm *tfm)
130 struct chksum_ctx *mctx = crypto_tfm_ctx(tfm);
138 .setkey = chksum_setkey,
140 .update = chksum_update,
141 .final = chksum_final,
142 .finup = chksum_finup,
143 .digest = chksum_digest,
146 .cra_name =
"crc32c",
147 .cra_driver_name =
"crc32c-generic",
153 .cra_init = crc32c_cra_init,
157 static int __init crc32c_mod_init(
void)
162 static void __exit crc32c_mod_fini(
void)