mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
![Valdis Klētnieks](/assets/img/avatar_default.png)
Building with W=1 causes a warning: CC [M] arch/x86/crypto/chacha_glue.o In file included from arch/x86/crypto/chacha_glue.c:10: ./include/crypto/internal/chacha.h:37:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] 37 | static int inline chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key, | ^~~~~~ Straighten out the order to match the rest of the header file. Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
43 lines
969 B
C
43 lines
969 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef _CRYPTO_INTERNAL_CHACHA_H
|
|
#define _CRYPTO_INTERNAL_CHACHA_H
|
|
|
|
#include <crypto/chacha.h>
|
|
#include <crypto/internal/skcipher.h>
|
|
#include <linux/crypto.h>
|
|
|
|
struct chacha_ctx {
|
|
u32 key[8];
|
|
int nrounds;
|
|
};
|
|
|
|
static inline int chacha_setkey(struct crypto_skcipher *tfm, const u8 *key,
|
|
unsigned int keysize, int nrounds)
|
|
{
|
|
struct chacha_ctx *ctx = crypto_skcipher_ctx(tfm);
|
|
int i;
|
|
|
|
if (keysize != CHACHA_KEY_SIZE)
|
|
return -EINVAL;
|
|
|
|
for (i = 0; i < ARRAY_SIZE(ctx->key); i++)
|
|
ctx->key[i] = get_unaligned_le32(key + i * sizeof(u32));
|
|
|
|
ctx->nrounds = nrounds;
|
|
return 0;
|
|
}
|
|
|
|
static inline int chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key,
|
|
unsigned int keysize)
|
|
{
|
|
return chacha_setkey(tfm, key, keysize, 20);
|
|
}
|
|
|
|
static inline int chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key,
|
|
unsigned int keysize)
|
|
{
|
|
return chacha_setkey(tfm, key, keysize, 12);
|
|
}
|
|
|
|
#endif /* _CRYPTO_CHACHA_H */
|