Lines Matching +full:loongson +full:- +full:1 +full:b

1 // SPDX-License-Identifier: GPL-2.0
3 * crc32.c - CRC32 and CRC32C using LoongArch crc* instructions
5 * Module based on mips/crypto/crc32-mips.c
9 * Copyright (C) 2020-2023 Loongson Technology Corporation Limited
15 #include <asm/cpu-features.h>
21 #type ".w." #size ".w" " %0, %1, %0\n\t"\
39 len -= sizeof(u64); in crc32_loongarch_hw()
47 len -= sizeof(u32); in crc32_loongarch_hw()
60 CRC32(crc, value, b); in crc32_loongarch_hw()
75 len -= sizeof(u64); in crc32c_loongarch_hw()
83 len -= sizeof(u32); in crc32c_loongarch_hw()
96 CRC32C(crc, value, b); in crc32c_loongarch_hw()
102 #define CHKSUM_BLOCK_SIZE 1
115 struct chksum_ctx *mctx = crypto_shash_ctx(desc->tfm); in chksum_init()
118 ctx->crc = mctx->key; in chksum_init()
131 if (keylen != sizeof(mctx->key)) in chksum_setkey()
132 return -EINVAL; in chksum_setkey()
134 mctx->key = get_unaligned_le32(key); in chksum_setkey()
143 ctx->crc = crc32_loongarch_hw(ctx->crc, data, length); in chksum_update()
151 ctx->crc = crc32c_loongarch_hw(ctx->crc, data, length); in chksumc_update()
159 put_unaligned_le32(ctx->crc, out); in chksum_final()
167 put_unaligned_le32(~ctx->crc, out); in chksumc_final()
187 return __chksum_finup(ctx->crc, data, len, out); in chksum_finup()
194 return __chksumc_finup(ctx->crc, data, len, out); in chksumc_finup()
199 struct chksum_ctx *mctx = crypto_shash_ctx(desc->tfm); in chksum_digest()
201 return __chksum_finup(mctx->key, data, length, out); in chksum_digest()
206 struct chksum_ctx *mctx = crypto_shash_ctx(desc->tfm); in chksumc_digest()
208 return __chksumc_finup(mctx->key, data, length, out); in chksumc_digest()
215 mctx->key = 0; in chksum_cra_init()
223 mctx->key = ~0; in chksumc_cra_init()
238 .cra_driver_name = "crc32-loongarch",
259 .cra_driver_name = "crc32c-loongarch",
299 MODULE_AUTHOR("Min Zhou <zhoumin@loongson.cn>");
300 MODULE_AUTHOR("Huacai Chen <chenhuacai@loongson.cn>");