ACPI / LPSS: Make acpi_lpss_find_device() also find PCI devices
[linux/fpc-iii.git] / arch / x86 / include / asm / crypto / camellia.h
bloba5d86fc0593f28f7e7030e11c460bc3e9ca262b5
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef ASM_X86_CAMELLIA_H
3 #define ASM_X86_CAMELLIA_H
5 #include <crypto/b128ops.h>
6 #include <linux/crypto.h>
7 #include <linux/kernel.h>
9 #define CAMELLIA_MIN_KEY_SIZE 16
10 #define CAMELLIA_MAX_KEY_SIZE 32
11 #define CAMELLIA_BLOCK_SIZE 16
12 #define CAMELLIA_TABLE_BYTE_LEN 272
13 #define CAMELLIA_PARALLEL_BLOCKS 2
15 struct crypto_skcipher;
17 struct camellia_ctx {
18 u64 key_table[CAMELLIA_TABLE_BYTE_LEN / sizeof(u64)];
19 u32 key_length;
22 struct camellia_xts_ctx {
23 struct camellia_ctx tweak_ctx;
24 struct camellia_ctx crypt_ctx;
27 extern int __camellia_setkey(struct camellia_ctx *cctx,
28 const unsigned char *key,
29 unsigned int key_len, u32 *flags);
31 extern int xts_camellia_setkey(struct crypto_skcipher *tfm, const u8 *key,
32 unsigned int keylen);
34 /* regular block cipher functions */
35 asmlinkage void __camellia_enc_blk(struct camellia_ctx *ctx, u8 *dst,
36 const u8 *src, bool xor);
37 asmlinkage void camellia_dec_blk(struct camellia_ctx *ctx, u8 *dst,
38 const u8 *src);
40 /* 2-way parallel cipher functions */
41 asmlinkage void __camellia_enc_blk_2way(struct camellia_ctx *ctx, u8 *dst,
42 const u8 *src, bool xor);
43 asmlinkage void camellia_dec_blk_2way(struct camellia_ctx *ctx, u8 *dst,
44 const u8 *src);
46 /* 16-way parallel cipher functions (avx/aes-ni) */
47 asmlinkage void camellia_ecb_enc_16way(struct camellia_ctx *ctx, u8 *dst,
48 const u8 *src);
49 asmlinkage void camellia_ecb_dec_16way(struct camellia_ctx *ctx, u8 *dst,
50 const u8 *src);
52 asmlinkage void camellia_cbc_dec_16way(struct camellia_ctx *ctx, u8 *dst,
53 const u8 *src);
54 asmlinkage void camellia_ctr_16way(struct camellia_ctx *ctx, u8 *dst,
55 const u8 *src, le128 *iv);
57 asmlinkage void camellia_xts_enc_16way(struct camellia_ctx *ctx, u8 *dst,
58 const u8 *src, le128 *iv);
59 asmlinkage void camellia_xts_dec_16way(struct camellia_ctx *ctx, u8 *dst,
60 const u8 *src, le128 *iv);
62 static inline void camellia_enc_blk(struct camellia_ctx *ctx, u8 *dst,
63 const u8 *src)
65 __camellia_enc_blk(ctx, dst, src, false);
68 static inline void camellia_enc_blk_xor(struct camellia_ctx *ctx, u8 *dst,
69 const u8 *src)
71 __camellia_enc_blk(ctx, dst, src, true);
74 static inline void camellia_enc_blk_2way(struct camellia_ctx *ctx, u8 *dst,
75 const u8 *src)
77 __camellia_enc_blk_2way(ctx, dst, src, false);
80 static inline void camellia_enc_blk_xor_2way(struct camellia_ctx *ctx, u8 *dst,
81 const u8 *src)
83 __camellia_enc_blk_2way(ctx, dst, src, true);
86 /* glue helpers */
87 extern void camellia_decrypt_cbc_2way(void *ctx, u128 *dst, const u128 *src);
88 extern void camellia_crypt_ctr(void *ctx, u128 *dst, const u128 *src,
89 le128 *iv);
90 extern void camellia_crypt_ctr_2way(void *ctx, u128 *dst, const u128 *src,
91 le128 *iv);
93 extern void camellia_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv);
94 extern void camellia_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv);
96 #endif /* ASM_X86_CAMELLIA_H */