1 // SPDX-License-Identifier: GPL-2.0
3 * Common values for the Speck algorithm
6 #ifndef _CRYPTO_SPECK_H
7 #define _CRYPTO_SPECK_H
9 #include <linux/types.h>
13 #define SPECK128_BLOCK_SIZE 16
15 #define SPECK128_128_KEY_SIZE 16
16 #define SPECK128_128_NROUNDS 32
18 #define SPECK128_192_KEY_SIZE 24
19 #define SPECK128_192_NROUNDS 33
21 #define SPECK128_256_KEY_SIZE 32
22 #define SPECK128_256_NROUNDS 34
24 struct speck128_tfm_ctx
{
25 u64 round_keys
[SPECK128_256_NROUNDS
];
29 void crypto_speck128_encrypt(const struct speck128_tfm_ctx
*ctx
,
30 u8
*out
, const u8
*in
);
32 void crypto_speck128_decrypt(const struct speck128_tfm_ctx
*ctx
,
33 u8
*out
, const u8
*in
);
35 int crypto_speck128_setkey(struct speck128_tfm_ctx
*ctx
, const u8
*key
,
36 unsigned int keysize
);
40 #define SPECK64_BLOCK_SIZE 8
42 #define SPECK64_96_KEY_SIZE 12
43 #define SPECK64_96_NROUNDS 26
45 #define SPECK64_128_KEY_SIZE 16
46 #define SPECK64_128_NROUNDS 27
48 struct speck64_tfm_ctx
{
49 u32 round_keys
[SPECK64_128_NROUNDS
];
53 void crypto_speck64_encrypt(const struct speck64_tfm_ctx
*ctx
,
54 u8
*out
, const u8
*in
);
56 void crypto_speck64_decrypt(const struct speck64_tfm_ctx
*ctx
,
57 u8
*out
, const u8
*in
);
59 int crypto_speck64_setkey(struct speck64_tfm_ctx
*ctx
, const u8
*key
,
60 unsigned int keysize
);
62 #endif /* _CRYPTO_SPECK_H */