xxhash_generic.c (0898782247ae533d1f4e47a06bc5d4870931b284) xxhash_generic.c (674f368a952c48ede71784935a799a5205b92b6c)
1// SPDX-License-Identifier: GPL-2.0
2
3#include <crypto/internal/hash.h>
4#include <linux/init.h>
5#include <linux/module.h>
6#include <linux/xxhash.h>
7#include <asm/unaligned.h>
8

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

17 struct xxh64_state xxhstate;
18};
19
20static int xxhash64_setkey(struct crypto_shash *tfm, const u8 *key,
21 unsigned int keylen)
22{
23 struct xxhash64_tfm_ctx *tctx = crypto_shash_ctx(tfm);
24
1// SPDX-License-Identifier: GPL-2.0
2
3#include <crypto/internal/hash.h>
4#include <linux/init.h>
5#include <linux/module.h>
6#include <linux/xxhash.h>
7#include <asm/unaligned.h>
8

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

17 struct xxh64_state xxhstate;
18};
19
20static int xxhash64_setkey(struct crypto_shash *tfm, const u8 *key,
21 unsigned int keylen)
22{
23 struct xxhash64_tfm_ctx *tctx = crypto_shash_ctx(tfm);
24
25 if (keylen != sizeof(tctx->seed)) {
26 crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
25 if (keylen != sizeof(tctx->seed))
27 return -EINVAL;
26 return -EINVAL;
28 }
29 tctx->seed = get_unaligned_le64(key);
30 return 0;
31}
32
33static int xxhash64_init(struct shash_desc *desc)
34{
35 struct xxhash64_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm);
36 struct xxhash64_desc_ctx *dctx = shash_desc_ctx(desc);

--- 72 unchanged lines hidden ---
27 tctx->seed = get_unaligned_le64(key);
28 return 0;
29}
30
31static int xxhash64_init(struct shash_desc *desc)
32{
33 struct xxhash64_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm);
34 struct xxhash64_desc_ctx *dctx = shash_desc_ctx(desc);

--- 72 unchanged lines hidden ---