crc32-mips.c (c1144d29f405ce1f4e6ede6482beb3d0d09750c6) crc32-mips.c (674f368a952c48ede71784935a799a5205b92b6c)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * crc32-mips.c - CRC32 and CRC32C using optional MIPSr6 instructions
4 *
5 * Module based on arm64/crypto/crc32-arm.c
6 *
7 * Copyright (C) 2014 Linaro Ltd <yazen.ghannam@linaro.org>
8 * Copyright (C) 2018 MIPS Tech, LLC

--- 163 unchanged lines hidden (view full) ---

172 * If your algorithm starts with ~0, then XOR with ~0 before you set
173 * the seed.
174 */
175static int chksum_setkey(struct crypto_shash *tfm, const u8 *key,
176 unsigned int keylen)
177{
178 struct chksum_ctx *mctx = crypto_shash_ctx(tfm);
179
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * crc32-mips.c - CRC32 and CRC32C using optional MIPSr6 instructions
4 *
5 * Module based on arm64/crypto/crc32-arm.c
6 *
7 * Copyright (C) 2014 Linaro Ltd <yazen.ghannam@linaro.org>
8 * Copyright (C) 2018 MIPS Tech, LLC

--- 163 unchanged lines hidden (view full) ---

172 * If your algorithm starts with ~0, then XOR with ~0 before you set
173 * the seed.
174 */
175static int chksum_setkey(struct crypto_shash *tfm, const u8 *key,
176 unsigned int keylen)
177{
178 struct chksum_ctx *mctx = crypto_shash_ctx(tfm);
179
180 if (keylen != sizeof(mctx->key)) {
181 crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
180 if (keylen != sizeof(mctx->key))
182 return -EINVAL;
181 return -EINVAL;
183 }
184 mctx->key = get_unaligned_le32(key);
185 return 0;
186}
187
188static int chksum_update(struct shash_desc *desc, const u8 *data,
189 unsigned int length)
190{
191 struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);

--- 157 unchanged lines hidden ---
182 mctx->key = get_unaligned_le32(key);
183 return 0;
184}
185
186static int chksum_update(struct shash_desc *desc, const u8 *data,
187 unsigned int length)
188{
189 struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);

--- 157 unchanged lines hidden ---