#include <linux/init.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <crypto/internal/hash.h>
#include <crypto/internal/simd.h>
#include <asm/cpufeatures.h>
#include <asm/cpu_device_id.h>
#include <asm/simd.h>
#define CHKSUM_BLOCK_SIZE …
#define CHKSUM_DIGEST_SIZE …
#define SCALE_F …
#ifdef CONFIG_X86_64
#define CRC32_INST …
#else
#define CRC32_INST …
#endif
#ifdef CONFIG_X86_64
#define CRC32C_PCL_BREAKEVEN …
asmlinkage unsigned int crc_pcl(const u8 *buffer, int len,
unsigned int crc_init);
#endif
static u32 crc32c_intel_le_hw_byte(u32 crc, unsigned char const *data, size_t length)
{ … }
static u32 __pure crc32c_intel_le_hw(u32 crc, unsigned char const *p, size_t len)
{ … }
static int crc32c_intel_setkey(struct crypto_shash *hash, const u8 *key,
unsigned int keylen)
{ … }
static int crc32c_intel_init(struct shash_desc *desc)
{ … }
static int crc32c_intel_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{ … }
static int __crc32c_intel_finup(u32 *crcp, const u8 *data, unsigned int len,
u8 *out)
{ … }
static int crc32c_intel_finup(struct shash_desc *desc, const u8 *data,
unsigned int len, u8 *out)
{ … }
static int crc32c_intel_final(struct shash_desc *desc, u8 *out)
{ … }
static int crc32c_intel_digest(struct shash_desc *desc, const u8 *data,
unsigned int len, u8 *out)
{ … }
static int crc32c_intel_cra_init(struct crypto_tfm *tfm)
{ … }
#ifdef CONFIG_X86_64
static int crc32c_pcl_intel_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{ … }
static int __crc32c_pcl_intel_finup(u32 *crcp, const u8 *data, unsigned int len,
u8 *out)
{ … }
static int crc32c_pcl_intel_finup(struct shash_desc *desc, const u8 *data,
unsigned int len, u8 *out)
{ … }
static int crc32c_pcl_intel_digest(struct shash_desc *desc, const u8 *data,
unsigned int len, u8 *out)
{ … }
#endif
static struct shash_alg alg = …;
static const struct x86_cpu_id crc32c_cpu_id[] = …;
MODULE_DEVICE_TABLE(x86cpu, crc32c_cpu_id);
static int __init crc32c_intel_mod_init(void)
{ … }
static void __exit crc32c_intel_mod_fini(void)
{ … }
module_init(…) …;
module_exit(crc32c_intel_mod_fini);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS_CRYPTO(…) …;
MODULE_ALIAS_CRYPTO(…) …;