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()
59 CRC32(crc, value, b); in crc32_loongarch_hw()
74 len -= sizeof(u64); in crc32c_loongarch_hw()
94 CRC32C(crc, value, b); in crc32c_loongarch_hw()
100 #define CHKSUM_BLOCK_SIZE 1
113 struct chksum_ctx *mctx = crypto_shash_ctx(desc->tfm); in chksum_init()
116 ctx->crc = mctx->key; in chksum_init()
129 if (keylen != sizeof(mctx->key)) in chksum_setkey()
130 return -EINVAL; in chksum_setkey()
132 mctx->key = get_unaligned_le32(key); in chksum_setkey()
141 ctx->crc = crc32_loongarch_hw(ctx->crc, data, length); in chksum_update()
149 ctx->crc = crc32c_loongarch_hw(ctx->crc, data, length); in chksumc_update()
157 put_unaligned_le32(ctx->crc, out); in chksum_final()
165 put_unaligned_le32(~ctx->crc, out); in chksumc_final()
185 return __chksum_finup(ctx->crc, data, len, out); in chksum_finup()
192 return __chksumc_finup(ctx->crc, data, len, out); in chksumc_finup()
197 struct chksum_ctx *mctx = crypto_shash_ctx(desc->tfm); in chksum_digest()
199 return __chksum_finup(mctx->key, data, length, out); in chksum_digest()
204 struct chksum_ctx *mctx = crypto_shash_ctx(desc->tfm); in chksumc_digest()
206 return __chksumc_finup(mctx->key, data, length, out); in chksumc_digest()
213 mctx->key = 0; in chksum_cra_init()
221 mctx->key = ~0; in chksumc_cra_init()
236 .cra_driver_name = "crc32-loongarch",
257 .cra_driver_name = "crc32c-loongarch",
297 MODULE_AUTHOR("Min Zhou <zhoumin@loongson.cn>");
298 MODULE_AUTHOR("Huacai Chen <chenhuacai@loongson.cn>");