blake2b_generic.c (22164fbe274c2dd96d2887fe121896d321000a61) blake2b_generic.c (674f368a952c48ede71784935a799a5205b92b6c)
1// SPDX-License-Identifier: (GPL-2.0-only OR Apache-2.0)
2/*
3 * BLAKE2b reference source code package - reference C implementations
4 *
5 * Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
6 * terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
7 * your option. The terms of these licenses can be found at:
8 *

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

142 unsigned int keylen;
143};
144
145static int blake2b_setkey(struct crypto_shash *tfm, const u8 *key,
146 unsigned int keylen)
147{
148 struct blake2b_tfm_ctx *tctx = crypto_shash_ctx(tfm);
149
1// SPDX-License-Identifier: (GPL-2.0-only OR Apache-2.0)
2/*
3 * BLAKE2b reference source code package - reference C implementations
4 *
5 * Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
6 * terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
7 * your option. The terms of these licenses can be found at:
8 *

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

142 unsigned int keylen;
143};
144
145static int blake2b_setkey(struct crypto_shash *tfm, const u8 *key,
146 unsigned int keylen)
147{
148 struct blake2b_tfm_ctx *tctx = crypto_shash_ctx(tfm);
149
150 if (keylen == 0 || keylen > BLAKE2B_KEYBYTES) {
151 crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
150 if (keylen == 0 || keylen > BLAKE2B_KEYBYTES)
152 return -EINVAL;
151 return -EINVAL;
153 }
154
155 memcpy(tctx->key, key, keylen);
156 tctx->keylen = keylen;
157
158 return 0;
159}
160
161static int blake2b_init(struct shash_desc *desc)

--- 159 unchanged lines hidden ---
152
153 memcpy(tctx->key, key, keylen);
154 tctx->keylen = keylen;
155
156 return 0;
157}
158
159static int blake2b_init(struct shash_desc *desc)

--- 159 unchanged lines hidden ---