18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Glue Code for assembler optimized version of Camellia
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2012 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Camellia parts based on code by:
88c2ecf20Sopenharmony_ci *  Copyright (C) 2006 NTT (Nippon Telegraph and Telephone Corporation)
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <asm/unaligned.h>
128c2ecf20Sopenharmony_ci#include <linux/crypto.h>
138c2ecf20Sopenharmony_ci#include <linux/init.h>
148c2ecf20Sopenharmony_ci#include <linux/module.h>
158c2ecf20Sopenharmony_ci#include <linux/types.h>
168c2ecf20Sopenharmony_ci#include <crypto/algapi.h>
178c2ecf20Sopenharmony_ci#include <asm/crypto/camellia.h>
188c2ecf20Sopenharmony_ci#include <asm/crypto/glue_helper.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci/* regular block cipher functions */
218c2ecf20Sopenharmony_ciasmlinkage void __camellia_enc_blk(const void *ctx, u8 *dst, const u8 *src,
228c2ecf20Sopenharmony_ci				   bool xor);
238c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(__camellia_enc_blk);
248c2ecf20Sopenharmony_ciasmlinkage void camellia_dec_blk(const void *ctx, u8 *dst, const u8 *src);
258c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(camellia_dec_blk);
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/* 2-way parallel cipher functions */
288c2ecf20Sopenharmony_ciasmlinkage void __camellia_enc_blk_2way(const void *ctx, u8 *dst, const u8 *src,
298c2ecf20Sopenharmony_ci					bool xor);
308c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(__camellia_enc_blk_2way);
318c2ecf20Sopenharmony_ciasmlinkage void camellia_dec_blk_2way(const void *ctx, u8 *dst, const u8 *src);
328c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(camellia_dec_blk_2way);
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistatic void camellia_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
358c2ecf20Sopenharmony_ci{
368c2ecf20Sopenharmony_ci	camellia_enc_blk(crypto_tfm_ctx(tfm), dst, src);
378c2ecf20Sopenharmony_ci}
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistatic void camellia_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
408c2ecf20Sopenharmony_ci{
418c2ecf20Sopenharmony_ci	camellia_dec_blk(crypto_tfm_ctx(tfm), dst, src);
428c2ecf20Sopenharmony_ci}
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* camellia sboxes */
458c2ecf20Sopenharmony_ci__visible const u64 camellia_sp10011110[256] = {
468c2ecf20Sopenharmony_ci	0x7000007070707000ULL, 0x8200008282828200ULL, 0x2c00002c2c2c2c00ULL,
478c2ecf20Sopenharmony_ci	0xec0000ecececec00ULL, 0xb30000b3b3b3b300ULL, 0x2700002727272700ULL,
488c2ecf20Sopenharmony_ci	0xc00000c0c0c0c000ULL, 0xe50000e5e5e5e500ULL, 0xe40000e4e4e4e400ULL,
498c2ecf20Sopenharmony_ci	0x8500008585858500ULL, 0x5700005757575700ULL, 0x3500003535353500ULL,
508c2ecf20Sopenharmony_ci	0xea0000eaeaeaea00ULL, 0x0c00000c0c0c0c00ULL, 0xae0000aeaeaeae00ULL,
518c2ecf20Sopenharmony_ci	0x4100004141414100ULL, 0x2300002323232300ULL, 0xef0000efefefef00ULL,
528c2ecf20Sopenharmony_ci	0x6b00006b6b6b6b00ULL, 0x9300009393939300ULL, 0x4500004545454500ULL,
538c2ecf20Sopenharmony_ci	0x1900001919191900ULL, 0xa50000a5a5a5a500ULL, 0x2100002121212100ULL,
548c2ecf20Sopenharmony_ci	0xed0000edededed00ULL, 0x0e00000e0e0e0e00ULL, 0x4f00004f4f4f4f00ULL,
558c2ecf20Sopenharmony_ci	0x4e00004e4e4e4e00ULL, 0x1d00001d1d1d1d00ULL, 0x6500006565656500ULL,
568c2ecf20Sopenharmony_ci	0x9200009292929200ULL, 0xbd0000bdbdbdbd00ULL, 0x8600008686868600ULL,
578c2ecf20Sopenharmony_ci	0xb80000b8b8b8b800ULL, 0xaf0000afafafaf00ULL, 0x8f00008f8f8f8f00ULL,
588c2ecf20Sopenharmony_ci	0x7c00007c7c7c7c00ULL, 0xeb0000ebebebeb00ULL, 0x1f00001f1f1f1f00ULL,
598c2ecf20Sopenharmony_ci	0xce0000cececece00ULL, 0x3e00003e3e3e3e00ULL, 0x3000003030303000ULL,
608c2ecf20Sopenharmony_ci	0xdc0000dcdcdcdc00ULL, 0x5f00005f5f5f5f00ULL, 0x5e00005e5e5e5e00ULL,
618c2ecf20Sopenharmony_ci	0xc50000c5c5c5c500ULL, 0x0b00000b0b0b0b00ULL, 0x1a00001a1a1a1a00ULL,
628c2ecf20Sopenharmony_ci	0xa60000a6a6a6a600ULL, 0xe10000e1e1e1e100ULL, 0x3900003939393900ULL,
638c2ecf20Sopenharmony_ci	0xca0000cacacaca00ULL, 0xd50000d5d5d5d500ULL, 0x4700004747474700ULL,
648c2ecf20Sopenharmony_ci	0x5d00005d5d5d5d00ULL, 0x3d00003d3d3d3d00ULL, 0xd90000d9d9d9d900ULL,
658c2ecf20Sopenharmony_ci	0x0100000101010100ULL, 0x5a00005a5a5a5a00ULL, 0xd60000d6d6d6d600ULL,
668c2ecf20Sopenharmony_ci	0x5100005151515100ULL, 0x5600005656565600ULL, 0x6c00006c6c6c6c00ULL,
678c2ecf20Sopenharmony_ci	0x4d00004d4d4d4d00ULL, 0x8b00008b8b8b8b00ULL, 0x0d00000d0d0d0d00ULL,
688c2ecf20Sopenharmony_ci	0x9a00009a9a9a9a00ULL, 0x6600006666666600ULL, 0xfb0000fbfbfbfb00ULL,
698c2ecf20Sopenharmony_ci	0xcc0000cccccccc00ULL, 0xb00000b0b0b0b000ULL, 0x2d00002d2d2d2d00ULL,
708c2ecf20Sopenharmony_ci	0x7400007474747400ULL, 0x1200001212121200ULL, 0x2b00002b2b2b2b00ULL,
718c2ecf20Sopenharmony_ci	0x2000002020202000ULL, 0xf00000f0f0f0f000ULL, 0xb10000b1b1b1b100ULL,
728c2ecf20Sopenharmony_ci	0x8400008484848400ULL, 0x9900009999999900ULL, 0xdf0000dfdfdfdf00ULL,
738c2ecf20Sopenharmony_ci	0x4c00004c4c4c4c00ULL, 0xcb0000cbcbcbcb00ULL, 0xc20000c2c2c2c200ULL,
748c2ecf20Sopenharmony_ci	0x3400003434343400ULL, 0x7e00007e7e7e7e00ULL, 0x7600007676767600ULL,
758c2ecf20Sopenharmony_ci	0x0500000505050500ULL, 0x6d00006d6d6d6d00ULL, 0xb70000b7b7b7b700ULL,
768c2ecf20Sopenharmony_ci	0xa90000a9a9a9a900ULL, 0x3100003131313100ULL, 0xd10000d1d1d1d100ULL,
778c2ecf20Sopenharmony_ci	0x1700001717171700ULL, 0x0400000404040400ULL, 0xd70000d7d7d7d700ULL,
788c2ecf20Sopenharmony_ci	0x1400001414141400ULL, 0x5800005858585800ULL, 0x3a00003a3a3a3a00ULL,
798c2ecf20Sopenharmony_ci	0x6100006161616100ULL, 0xde0000dededede00ULL, 0x1b00001b1b1b1b00ULL,
808c2ecf20Sopenharmony_ci	0x1100001111111100ULL, 0x1c00001c1c1c1c00ULL, 0x3200003232323200ULL,
818c2ecf20Sopenharmony_ci	0x0f00000f0f0f0f00ULL, 0x9c00009c9c9c9c00ULL, 0x1600001616161600ULL,
828c2ecf20Sopenharmony_ci	0x5300005353535300ULL, 0x1800001818181800ULL, 0xf20000f2f2f2f200ULL,
838c2ecf20Sopenharmony_ci	0x2200002222222200ULL, 0xfe0000fefefefe00ULL, 0x4400004444444400ULL,
848c2ecf20Sopenharmony_ci	0xcf0000cfcfcfcf00ULL, 0xb20000b2b2b2b200ULL, 0xc30000c3c3c3c300ULL,
858c2ecf20Sopenharmony_ci	0xb50000b5b5b5b500ULL, 0x7a00007a7a7a7a00ULL, 0x9100009191919100ULL,
868c2ecf20Sopenharmony_ci	0x2400002424242400ULL, 0x0800000808080800ULL, 0xe80000e8e8e8e800ULL,
878c2ecf20Sopenharmony_ci	0xa80000a8a8a8a800ULL, 0x6000006060606000ULL, 0xfc0000fcfcfcfc00ULL,
888c2ecf20Sopenharmony_ci	0x6900006969696900ULL, 0x5000005050505000ULL, 0xaa0000aaaaaaaa00ULL,
898c2ecf20Sopenharmony_ci	0xd00000d0d0d0d000ULL, 0xa00000a0a0a0a000ULL, 0x7d00007d7d7d7d00ULL,
908c2ecf20Sopenharmony_ci	0xa10000a1a1a1a100ULL, 0x8900008989898900ULL, 0x6200006262626200ULL,
918c2ecf20Sopenharmony_ci	0x9700009797979700ULL, 0x5400005454545400ULL, 0x5b00005b5b5b5b00ULL,
928c2ecf20Sopenharmony_ci	0x1e00001e1e1e1e00ULL, 0x9500009595959500ULL, 0xe00000e0e0e0e000ULL,
938c2ecf20Sopenharmony_ci	0xff0000ffffffff00ULL, 0x6400006464646400ULL, 0xd20000d2d2d2d200ULL,
948c2ecf20Sopenharmony_ci	0x1000001010101000ULL, 0xc40000c4c4c4c400ULL, 0x0000000000000000ULL,
958c2ecf20Sopenharmony_ci	0x4800004848484800ULL, 0xa30000a3a3a3a300ULL, 0xf70000f7f7f7f700ULL,
968c2ecf20Sopenharmony_ci	0x7500007575757500ULL, 0xdb0000dbdbdbdb00ULL, 0x8a00008a8a8a8a00ULL,
978c2ecf20Sopenharmony_ci	0x0300000303030300ULL, 0xe60000e6e6e6e600ULL, 0xda0000dadadada00ULL,
988c2ecf20Sopenharmony_ci	0x0900000909090900ULL, 0x3f00003f3f3f3f00ULL, 0xdd0000dddddddd00ULL,
998c2ecf20Sopenharmony_ci	0x9400009494949400ULL, 0x8700008787878700ULL, 0x5c00005c5c5c5c00ULL,
1008c2ecf20Sopenharmony_ci	0x8300008383838300ULL, 0x0200000202020200ULL, 0xcd0000cdcdcdcd00ULL,
1018c2ecf20Sopenharmony_ci	0x4a00004a4a4a4a00ULL, 0x9000009090909000ULL, 0x3300003333333300ULL,
1028c2ecf20Sopenharmony_ci	0x7300007373737300ULL, 0x6700006767676700ULL, 0xf60000f6f6f6f600ULL,
1038c2ecf20Sopenharmony_ci	0xf30000f3f3f3f300ULL, 0x9d00009d9d9d9d00ULL, 0x7f00007f7f7f7f00ULL,
1048c2ecf20Sopenharmony_ci	0xbf0000bfbfbfbf00ULL, 0xe20000e2e2e2e200ULL, 0x5200005252525200ULL,
1058c2ecf20Sopenharmony_ci	0x9b00009b9b9b9b00ULL, 0xd80000d8d8d8d800ULL, 0x2600002626262600ULL,
1068c2ecf20Sopenharmony_ci	0xc80000c8c8c8c800ULL, 0x3700003737373700ULL, 0xc60000c6c6c6c600ULL,
1078c2ecf20Sopenharmony_ci	0x3b00003b3b3b3b00ULL, 0x8100008181818100ULL, 0x9600009696969600ULL,
1088c2ecf20Sopenharmony_ci	0x6f00006f6f6f6f00ULL, 0x4b00004b4b4b4b00ULL, 0x1300001313131300ULL,
1098c2ecf20Sopenharmony_ci	0xbe0000bebebebe00ULL, 0x6300006363636300ULL, 0x2e00002e2e2e2e00ULL,
1108c2ecf20Sopenharmony_ci	0xe90000e9e9e9e900ULL, 0x7900007979797900ULL, 0xa70000a7a7a7a700ULL,
1118c2ecf20Sopenharmony_ci	0x8c00008c8c8c8c00ULL, 0x9f00009f9f9f9f00ULL, 0x6e00006e6e6e6e00ULL,
1128c2ecf20Sopenharmony_ci	0xbc0000bcbcbcbc00ULL, 0x8e00008e8e8e8e00ULL, 0x2900002929292900ULL,
1138c2ecf20Sopenharmony_ci	0xf50000f5f5f5f500ULL, 0xf90000f9f9f9f900ULL, 0xb60000b6b6b6b600ULL,
1148c2ecf20Sopenharmony_ci	0x2f00002f2f2f2f00ULL, 0xfd0000fdfdfdfd00ULL, 0xb40000b4b4b4b400ULL,
1158c2ecf20Sopenharmony_ci	0x5900005959595900ULL, 0x7800007878787800ULL, 0x9800009898989800ULL,
1168c2ecf20Sopenharmony_ci	0x0600000606060600ULL, 0x6a00006a6a6a6a00ULL, 0xe70000e7e7e7e700ULL,
1178c2ecf20Sopenharmony_ci	0x4600004646464600ULL, 0x7100007171717100ULL, 0xba0000babababa00ULL,
1188c2ecf20Sopenharmony_ci	0xd40000d4d4d4d400ULL, 0x2500002525252500ULL, 0xab0000abababab00ULL,
1198c2ecf20Sopenharmony_ci	0x4200004242424200ULL, 0x8800008888888800ULL, 0xa20000a2a2a2a200ULL,
1208c2ecf20Sopenharmony_ci	0x8d00008d8d8d8d00ULL, 0xfa0000fafafafa00ULL, 0x7200007272727200ULL,
1218c2ecf20Sopenharmony_ci	0x0700000707070700ULL, 0xb90000b9b9b9b900ULL, 0x5500005555555500ULL,
1228c2ecf20Sopenharmony_ci	0xf80000f8f8f8f800ULL, 0xee0000eeeeeeee00ULL, 0xac0000acacacac00ULL,
1238c2ecf20Sopenharmony_ci	0x0a00000a0a0a0a00ULL, 0x3600003636363600ULL, 0x4900004949494900ULL,
1248c2ecf20Sopenharmony_ci	0x2a00002a2a2a2a00ULL, 0x6800006868686800ULL, 0x3c00003c3c3c3c00ULL,
1258c2ecf20Sopenharmony_ci	0x3800003838383800ULL, 0xf10000f1f1f1f100ULL, 0xa40000a4a4a4a400ULL,
1268c2ecf20Sopenharmony_ci	0x4000004040404000ULL, 0x2800002828282800ULL, 0xd30000d3d3d3d300ULL,
1278c2ecf20Sopenharmony_ci	0x7b00007b7b7b7b00ULL, 0xbb0000bbbbbbbb00ULL, 0xc90000c9c9c9c900ULL,
1288c2ecf20Sopenharmony_ci	0x4300004343434300ULL, 0xc10000c1c1c1c100ULL, 0x1500001515151500ULL,
1298c2ecf20Sopenharmony_ci	0xe30000e3e3e3e300ULL, 0xad0000adadadad00ULL, 0xf40000f4f4f4f400ULL,
1308c2ecf20Sopenharmony_ci	0x7700007777777700ULL, 0xc70000c7c7c7c700ULL, 0x8000008080808000ULL,
1318c2ecf20Sopenharmony_ci	0x9e00009e9e9e9e00ULL,
1328c2ecf20Sopenharmony_ci};
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci__visible const u64 camellia_sp22000222[256] = {
1358c2ecf20Sopenharmony_ci	0xe0e0000000e0e0e0ULL, 0x0505000000050505ULL, 0x5858000000585858ULL,
1368c2ecf20Sopenharmony_ci	0xd9d9000000d9d9d9ULL, 0x6767000000676767ULL, 0x4e4e0000004e4e4eULL,
1378c2ecf20Sopenharmony_ci	0x8181000000818181ULL, 0xcbcb000000cbcbcbULL, 0xc9c9000000c9c9c9ULL,
1388c2ecf20Sopenharmony_ci	0x0b0b0000000b0b0bULL, 0xaeae000000aeaeaeULL, 0x6a6a0000006a6a6aULL,
1398c2ecf20Sopenharmony_ci	0xd5d5000000d5d5d5ULL, 0x1818000000181818ULL, 0x5d5d0000005d5d5dULL,
1408c2ecf20Sopenharmony_ci	0x8282000000828282ULL, 0x4646000000464646ULL, 0xdfdf000000dfdfdfULL,
1418c2ecf20Sopenharmony_ci	0xd6d6000000d6d6d6ULL, 0x2727000000272727ULL, 0x8a8a0000008a8a8aULL,
1428c2ecf20Sopenharmony_ci	0x3232000000323232ULL, 0x4b4b0000004b4b4bULL, 0x4242000000424242ULL,
1438c2ecf20Sopenharmony_ci	0xdbdb000000dbdbdbULL, 0x1c1c0000001c1c1cULL, 0x9e9e0000009e9e9eULL,
1448c2ecf20Sopenharmony_ci	0x9c9c0000009c9c9cULL, 0x3a3a0000003a3a3aULL, 0xcaca000000cacacaULL,
1458c2ecf20Sopenharmony_ci	0x2525000000252525ULL, 0x7b7b0000007b7b7bULL, 0x0d0d0000000d0d0dULL,
1468c2ecf20Sopenharmony_ci	0x7171000000717171ULL, 0x5f5f0000005f5f5fULL, 0x1f1f0000001f1f1fULL,
1478c2ecf20Sopenharmony_ci	0xf8f8000000f8f8f8ULL, 0xd7d7000000d7d7d7ULL, 0x3e3e0000003e3e3eULL,
1488c2ecf20Sopenharmony_ci	0x9d9d0000009d9d9dULL, 0x7c7c0000007c7c7cULL, 0x6060000000606060ULL,
1498c2ecf20Sopenharmony_ci	0xb9b9000000b9b9b9ULL, 0xbebe000000bebebeULL, 0xbcbc000000bcbcbcULL,
1508c2ecf20Sopenharmony_ci	0x8b8b0000008b8b8bULL, 0x1616000000161616ULL, 0x3434000000343434ULL,
1518c2ecf20Sopenharmony_ci	0x4d4d0000004d4d4dULL, 0xc3c3000000c3c3c3ULL, 0x7272000000727272ULL,
1528c2ecf20Sopenharmony_ci	0x9595000000959595ULL, 0xabab000000abababULL, 0x8e8e0000008e8e8eULL,
1538c2ecf20Sopenharmony_ci	0xbaba000000bababaULL, 0x7a7a0000007a7a7aULL, 0xb3b3000000b3b3b3ULL,
1548c2ecf20Sopenharmony_ci	0x0202000000020202ULL, 0xb4b4000000b4b4b4ULL, 0xadad000000adadadULL,
1558c2ecf20Sopenharmony_ci	0xa2a2000000a2a2a2ULL, 0xacac000000acacacULL, 0xd8d8000000d8d8d8ULL,
1568c2ecf20Sopenharmony_ci	0x9a9a0000009a9a9aULL, 0x1717000000171717ULL, 0x1a1a0000001a1a1aULL,
1578c2ecf20Sopenharmony_ci	0x3535000000353535ULL, 0xcccc000000ccccccULL, 0xf7f7000000f7f7f7ULL,
1588c2ecf20Sopenharmony_ci	0x9999000000999999ULL, 0x6161000000616161ULL, 0x5a5a0000005a5a5aULL,
1598c2ecf20Sopenharmony_ci	0xe8e8000000e8e8e8ULL, 0x2424000000242424ULL, 0x5656000000565656ULL,
1608c2ecf20Sopenharmony_ci	0x4040000000404040ULL, 0xe1e1000000e1e1e1ULL, 0x6363000000636363ULL,
1618c2ecf20Sopenharmony_ci	0x0909000000090909ULL, 0x3333000000333333ULL, 0xbfbf000000bfbfbfULL,
1628c2ecf20Sopenharmony_ci	0x9898000000989898ULL, 0x9797000000979797ULL, 0x8585000000858585ULL,
1638c2ecf20Sopenharmony_ci	0x6868000000686868ULL, 0xfcfc000000fcfcfcULL, 0xecec000000ecececULL,
1648c2ecf20Sopenharmony_ci	0x0a0a0000000a0a0aULL, 0xdada000000dadadaULL, 0x6f6f0000006f6f6fULL,
1658c2ecf20Sopenharmony_ci	0x5353000000535353ULL, 0x6262000000626262ULL, 0xa3a3000000a3a3a3ULL,
1668c2ecf20Sopenharmony_ci	0x2e2e0000002e2e2eULL, 0x0808000000080808ULL, 0xafaf000000afafafULL,
1678c2ecf20Sopenharmony_ci	0x2828000000282828ULL, 0xb0b0000000b0b0b0ULL, 0x7474000000747474ULL,
1688c2ecf20Sopenharmony_ci	0xc2c2000000c2c2c2ULL, 0xbdbd000000bdbdbdULL, 0x3636000000363636ULL,
1698c2ecf20Sopenharmony_ci	0x2222000000222222ULL, 0x3838000000383838ULL, 0x6464000000646464ULL,
1708c2ecf20Sopenharmony_ci	0x1e1e0000001e1e1eULL, 0x3939000000393939ULL, 0x2c2c0000002c2c2cULL,
1718c2ecf20Sopenharmony_ci	0xa6a6000000a6a6a6ULL, 0x3030000000303030ULL, 0xe5e5000000e5e5e5ULL,
1728c2ecf20Sopenharmony_ci	0x4444000000444444ULL, 0xfdfd000000fdfdfdULL, 0x8888000000888888ULL,
1738c2ecf20Sopenharmony_ci	0x9f9f0000009f9f9fULL, 0x6565000000656565ULL, 0x8787000000878787ULL,
1748c2ecf20Sopenharmony_ci	0x6b6b0000006b6b6bULL, 0xf4f4000000f4f4f4ULL, 0x2323000000232323ULL,
1758c2ecf20Sopenharmony_ci	0x4848000000484848ULL, 0x1010000000101010ULL, 0xd1d1000000d1d1d1ULL,
1768c2ecf20Sopenharmony_ci	0x5151000000515151ULL, 0xc0c0000000c0c0c0ULL, 0xf9f9000000f9f9f9ULL,
1778c2ecf20Sopenharmony_ci	0xd2d2000000d2d2d2ULL, 0xa0a0000000a0a0a0ULL, 0x5555000000555555ULL,
1788c2ecf20Sopenharmony_ci	0xa1a1000000a1a1a1ULL, 0x4141000000414141ULL, 0xfafa000000fafafaULL,
1798c2ecf20Sopenharmony_ci	0x4343000000434343ULL, 0x1313000000131313ULL, 0xc4c4000000c4c4c4ULL,
1808c2ecf20Sopenharmony_ci	0x2f2f0000002f2f2fULL, 0xa8a8000000a8a8a8ULL, 0xb6b6000000b6b6b6ULL,
1818c2ecf20Sopenharmony_ci	0x3c3c0000003c3c3cULL, 0x2b2b0000002b2b2bULL, 0xc1c1000000c1c1c1ULL,
1828c2ecf20Sopenharmony_ci	0xffff000000ffffffULL, 0xc8c8000000c8c8c8ULL, 0xa5a5000000a5a5a5ULL,
1838c2ecf20Sopenharmony_ci	0x2020000000202020ULL, 0x8989000000898989ULL, 0x0000000000000000ULL,
1848c2ecf20Sopenharmony_ci	0x9090000000909090ULL, 0x4747000000474747ULL, 0xefef000000efefefULL,
1858c2ecf20Sopenharmony_ci	0xeaea000000eaeaeaULL, 0xb7b7000000b7b7b7ULL, 0x1515000000151515ULL,
1868c2ecf20Sopenharmony_ci	0x0606000000060606ULL, 0xcdcd000000cdcdcdULL, 0xb5b5000000b5b5b5ULL,
1878c2ecf20Sopenharmony_ci	0x1212000000121212ULL, 0x7e7e0000007e7e7eULL, 0xbbbb000000bbbbbbULL,
1888c2ecf20Sopenharmony_ci	0x2929000000292929ULL, 0x0f0f0000000f0f0fULL, 0xb8b8000000b8b8b8ULL,
1898c2ecf20Sopenharmony_ci	0x0707000000070707ULL, 0x0404000000040404ULL, 0x9b9b0000009b9b9bULL,
1908c2ecf20Sopenharmony_ci	0x9494000000949494ULL, 0x2121000000212121ULL, 0x6666000000666666ULL,
1918c2ecf20Sopenharmony_ci	0xe6e6000000e6e6e6ULL, 0xcece000000cececeULL, 0xeded000000edededULL,
1928c2ecf20Sopenharmony_ci	0xe7e7000000e7e7e7ULL, 0x3b3b0000003b3b3bULL, 0xfefe000000fefefeULL,
1938c2ecf20Sopenharmony_ci	0x7f7f0000007f7f7fULL, 0xc5c5000000c5c5c5ULL, 0xa4a4000000a4a4a4ULL,
1948c2ecf20Sopenharmony_ci	0x3737000000373737ULL, 0xb1b1000000b1b1b1ULL, 0x4c4c0000004c4c4cULL,
1958c2ecf20Sopenharmony_ci	0x9191000000919191ULL, 0x6e6e0000006e6e6eULL, 0x8d8d0000008d8d8dULL,
1968c2ecf20Sopenharmony_ci	0x7676000000767676ULL, 0x0303000000030303ULL, 0x2d2d0000002d2d2dULL,
1978c2ecf20Sopenharmony_ci	0xdede000000dededeULL, 0x9696000000969696ULL, 0x2626000000262626ULL,
1988c2ecf20Sopenharmony_ci	0x7d7d0000007d7d7dULL, 0xc6c6000000c6c6c6ULL, 0x5c5c0000005c5c5cULL,
1998c2ecf20Sopenharmony_ci	0xd3d3000000d3d3d3ULL, 0xf2f2000000f2f2f2ULL, 0x4f4f0000004f4f4fULL,
2008c2ecf20Sopenharmony_ci	0x1919000000191919ULL, 0x3f3f0000003f3f3fULL, 0xdcdc000000dcdcdcULL,
2018c2ecf20Sopenharmony_ci	0x7979000000797979ULL, 0x1d1d0000001d1d1dULL, 0x5252000000525252ULL,
2028c2ecf20Sopenharmony_ci	0xebeb000000ebebebULL, 0xf3f3000000f3f3f3ULL, 0x6d6d0000006d6d6dULL,
2038c2ecf20Sopenharmony_ci	0x5e5e0000005e5e5eULL, 0xfbfb000000fbfbfbULL, 0x6969000000696969ULL,
2048c2ecf20Sopenharmony_ci	0xb2b2000000b2b2b2ULL, 0xf0f0000000f0f0f0ULL, 0x3131000000313131ULL,
2058c2ecf20Sopenharmony_ci	0x0c0c0000000c0c0cULL, 0xd4d4000000d4d4d4ULL, 0xcfcf000000cfcfcfULL,
2068c2ecf20Sopenharmony_ci	0x8c8c0000008c8c8cULL, 0xe2e2000000e2e2e2ULL, 0x7575000000757575ULL,
2078c2ecf20Sopenharmony_ci	0xa9a9000000a9a9a9ULL, 0x4a4a0000004a4a4aULL, 0x5757000000575757ULL,
2088c2ecf20Sopenharmony_ci	0x8484000000848484ULL, 0x1111000000111111ULL, 0x4545000000454545ULL,
2098c2ecf20Sopenharmony_ci	0x1b1b0000001b1b1bULL, 0xf5f5000000f5f5f5ULL, 0xe4e4000000e4e4e4ULL,
2108c2ecf20Sopenharmony_ci	0x0e0e0000000e0e0eULL, 0x7373000000737373ULL, 0xaaaa000000aaaaaaULL,
2118c2ecf20Sopenharmony_ci	0xf1f1000000f1f1f1ULL, 0xdddd000000ddddddULL, 0x5959000000595959ULL,
2128c2ecf20Sopenharmony_ci	0x1414000000141414ULL, 0x6c6c0000006c6c6cULL, 0x9292000000929292ULL,
2138c2ecf20Sopenharmony_ci	0x5454000000545454ULL, 0xd0d0000000d0d0d0ULL, 0x7878000000787878ULL,
2148c2ecf20Sopenharmony_ci	0x7070000000707070ULL, 0xe3e3000000e3e3e3ULL, 0x4949000000494949ULL,
2158c2ecf20Sopenharmony_ci	0x8080000000808080ULL, 0x5050000000505050ULL, 0xa7a7000000a7a7a7ULL,
2168c2ecf20Sopenharmony_ci	0xf6f6000000f6f6f6ULL, 0x7777000000777777ULL, 0x9393000000939393ULL,
2178c2ecf20Sopenharmony_ci	0x8686000000868686ULL, 0x8383000000838383ULL, 0x2a2a0000002a2a2aULL,
2188c2ecf20Sopenharmony_ci	0xc7c7000000c7c7c7ULL, 0x5b5b0000005b5b5bULL, 0xe9e9000000e9e9e9ULL,
2198c2ecf20Sopenharmony_ci	0xeeee000000eeeeeeULL, 0x8f8f0000008f8f8fULL, 0x0101000000010101ULL,
2208c2ecf20Sopenharmony_ci	0x3d3d0000003d3d3dULL,
2218c2ecf20Sopenharmony_ci};
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci__visible const u64 camellia_sp03303033[256] = {
2248c2ecf20Sopenharmony_ci	0x0038380038003838ULL, 0x0041410041004141ULL, 0x0016160016001616ULL,
2258c2ecf20Sopenharmony_ci	0x0076760076007676ULL, 0x00d9d900d900d9d9ULL, 0x0093930093009393ULL,
2268c2ecf20Sopenharmony_ci	0x0060600060006060ULL, 0x00f2f200f200f2f2ULL, 0x0072720072007272ULL,
2278c2ecf20Sopenharmony_ci	0x00c2c200c200c2c2ULL, 0x00abab00ab00ababULL, 0x009a9a009a009a9aULL,
2288c2ecf20Sopenharmony_ci	0x0075750075007575ULL, 0x0006060006000606ULL, 0x0057570057005757ULL,
2298c2ecf20Sopenharmony_ci	0x00a0a000a000a0a0ULL, 0x0091910091009191ULL, 0x00f7f700f700f7f7ULL,
2308c2ecf20Sopenharmony_ci	0x00b5b500b500b5b5ULL, 0x00c9c900c900c9c9ULL, 0x00a2a200a200a2a2ULL,
2318c2ecf20Sopenharmony_ci	0x008c8c008c008c8cULL, 0x00d2d200d200d2d2ULL, 0x0090900090009090ULL,
2328c2ecf20Sopenharmony_ci	0x00f6f600f600f6f6ULL, 0x0007070007000707ULL, 0x00a7a700a700a7a7ULL,
2338c2ecf20Sopenharmony_ci	0x0027270027002727ULL, 0x008e8e008e008e8eULL, 0x00b2b200b200b2b2ULL,
2348c2ecf20Sopenharmony_ci	0x0049490049004949ULL, 0x00dede00de00dedeULL, 0x0043430043004343ULL,
2358c2ecf20Sopenharmony_ci	0x005c5c005c005c5cULL, 0x00d7d700d700d7d7ULL, 0x00c7c700c700c7c7ULL,
2368c2ecf20Sopenharmony_ci	0x003e3e003e003e3eULL, 0x00f5f500f500f5f5ULL, 0x008f8f008f008f8fULL,
2378c2ecf20Sopenharmony_ci	0x0067670067006767ULL, 0x001f1f001f001f1fULL, 0x0018180018001818ULL,
2388c2ecf20Sopenharmony_ci	0x006e6e006e006e6eULL, 0x00afaf00af00afafULL, 0x002f2f002f002f2fULL,
2398c2ecf20Sopenharmony_ci	0x00e2e200e200e2e2ULL, 0x0085850085008585ULL, 0x000d0d000d000d0dULL,
2408c2ecf20Sopenharmony_ci	0x0053530053005353ULL, 0x00f0f000f000f0f0ULL, 0x009c9c009c009c9cULL,
2418c2ecf20Sopenharmony_ci	0x0065650065006565ULL, 0x00eaea00ea00eaeaULL, 0x00a3a300a300a3a3ULL,
2428c2ecf20Sopenharmony_ci	0x00aeae00ae00aeaeULL, 0x009e9e009e009e9eULL, 0x00ecec00ec00ececULL,
2438c2ecf20Sopenharmony_ci	0x0080800080008080ULL, 0x002d2d002d002d2dULL, 0x006b6b006b006b6bULL,
2448c2ecf20Sopenharmony_ci	0x00a8a800a800a8a8ULL, 0x002b2b002b002b2bULL, 0x0036360036003636ULL,
2458c2ecf20Sopenharmony_ci	0x00a6a600a600a6a6ULL, 0x00c5c500c500c5c5ULL, 0x0086860086008686ULL,
2468c2ecf20Sopenharmony_ci	0x004d4d004d004d4dULL, 0x0033330033003333ULL, 0x00fdfd00fd00fdfdULL,
2478c2ecf20Sopenharmony_ci	0x0066660066006666ULL, 0x0058580058005858ULL, 0x0096960096009696ULL,
2488c2ecf20Sopenharmony_ci	0x003a3a003a003a3aULL, 0x0009090009000909ULL, 0x0095950095009595ULL,
2498c2ecf20Sopenharmony_ci	0x0010100010001010ULL, 0x0078780078007878ULL, 0x00d8d800d800d8d8ULL,
2508c2ecf20Sopenharmony_ci	0x0042420042004242ULL, 0x00cccc00cc00ccccULL, 0x00efef00ef00efefULL,
2518c2ecf20Sopenharmony_ci	0x0026260026002626ULL, 0x00e5e500e500e5e5ULL, 0x0061610061006161ULL,
2528c2ecf20Sopenharmony_ci	0x001a1a001a001a1aULL, 0x003f3f003f003f3fULL, 0x003b3b003b003b3bULL,
2538c2ecf20Sopenharmony_ci	0x0082820082008282ULL, 0x00b6b600b600b6b6ULL, 0x00dbdb00db00dbdbULL,
2548c2ecf20Sopenharmony_ci	0x00d4d400d400d4d4ULL, 0x0098980098009898ULL, 0x00e8e800e800e8e8ULL,
2558c2ecf20Sopenharmony_ci	0x008b8b008b008b8bULL, 0x0002020002000202ULL, 0x00ebeb00eb00ebebULL,
2568c2ecf20Sopenharmony_ci	0x000a0a000a000a0aULL, 0x002c2c002c002c2cULL, 0x001d1d001d001d1dULL,
2578c2ecf20Sopenharmony_ci	0x00b0b000b000b0b0ULL, 0x006f6f006f006f6fULL, 0x008d8d008d008d8dULL,
2588c2ecf20Sopenharmony_ci	0x0088880088008888ULL, 0x000e0e000e000e0eULL, 0x0019190019001919ULL,
2598c2ecf20Sopenharmony_ci	0x0087870087008787ULL, 0x004e4e004e004e4eULL, 0x000b0b000b000b0bULL,
2608c2ecf20Sopenharmony_ci	0x00a9a900a900a9a9ULL, 0x000c0c000c000c0cULL, 0x0079790079007979ULL,
2618c2ecf20Sopenharmony_ci	0x0011110011001111ULL, 0x007f7f007f007f7fULL, 0x0022220022002222ULL,
2628c2ecf20Sopenharmony_ci	0x00e7e700e700e7e7ULL, 0x0059590059005959ULL, 0x00e1e100e100e1e1ULL,
2638c2ecf20Sopenharmony_ci	0x00dada00da00dadaULL, 0x003d3d003d003d3dULL, 0x00c8c800c800c8c8ULL,
2648c2ecf20Sopenharmony_ci	0x0012120012001212ULL, 0x0004040004000404ULL, 0x0074740074007474ULL,
2658c2ecf20Sopenharmony_ci	0x0054540054005454ULL, 0x0030300030003030ULL, 0x007e7e007e007e7eULL,
2668c2ecf20Sopenharmony_ci	0x00b4b400b400b4b4ULL, 0x0028280028002828ULL, 0x0055550055005555ULL,
2678c2ecf20Sopenharmony_ci	0x0068680068006868ULL, 0x0050500050005050ULL, 0x00bebe00be00bebeULL,
2688c2ecf20Sopenharmony_ci	0x00d0d000d000d0d0ULL, 0x00c4c400c400c4c4ULL, 0x0031310031003131ULL,
2698c2ecf20Sopenharmony_ci	0x00cbcb00cb00cbcbULL, 0x002a2a002a002a2aULL, 0x00adad00ad00adadULL,
2708c2ecf20Sopenharmony_ci	0x000f0f000f000f0fULL, 0x00caca00ca00cacaULL, 0x0070700070007070ULL,
2718c2ecf20Sopenharmony_ci	0x00ffff00ff00ffffULL, 0x0032320032003232ULL, 0x0069690069006969ULL,
2728c2ecf20Sopenharmony_ci	0x0008080008000808ULL, 0x0062620062006262ULL, 0x0000000000000000ULL,
2738c2ecf20Sopenharmony_ci	0x0024240024002424ULL, 0x00d1d100d100d1d1ULL, 0x00fbfb00fb00fbfbULL,
2748c2ecf20Sopenharmony_ci	0x00baba00ba00babaULL, 0x00eded00ed00ededULL, 0x0045450045004545ULL,
2758c2ecf20Sopenharmony_ci	0x0081810081008181ULL, 0x0073730073007373ULL, 0x006d6d006d006d6dULL,
2768c2ecf20Sopenharmony_ci	0x0084840084008484ULL, 0x009f9f009f009f9fULL, 0x00eeee00ee00eeeeULL,
2778c2ecf20Sopenharmony_ci	0x004a4a004a004a4aULL, 0x00c3c300c300c3c3ULL, 0x002e2e002e002e2eULL,
2788c2ecf20Sopenharmony_ci	0x00c1c100c100c1c1ULL, 0x0001010001000101ULL, 0x00e6e600e600e6e6ULL,
2798c2ecf20Sopenharmony_ci	0x0025250025002525ULL, 0x0048480048004848ULL, 0x0099990099009999ULL,
2808c2ecf20Sopenharmony_ci	0x00b9b900b900b9b9ULL, 0x00b3b300b300b3b3ULL, 0x007b7b007b007b7bULL,
2818c2ecf20Sopenharmony_ci	0x00f9f900f900f9f9ULL, 0x00cece00ce00ceceULL, 0x00bfbf00bf00bfbfULL,
2828c2ecf20Sopenharmony_ci	0x00dfdf00df00dfdfULL, 0x0071710071007171ULL, 0x0029290029002929ULL,
2838c2ecf20Sopenharmony_ci	0x00cdcd00cd00cdcdULL, 0x006c6c006c006c6cULL, 0x0013130013001313ULL,
2848c2ecf20Sopenharmony_ci	0x0064640064006464ULL, 0x009b9b009b009b9bULL, 0x0063630063006363ULL,
2858c2ecf20Sopenharmony_ci	0x009d9d009d009d9dULL, 0x00c0c000c000c0c0ULL, 0x004b4b004b004b4bULL,
2868c2ecf20Sopenharmony_ci	0x00b7b700b700b7b7ULL, 0x00a5a500a500a5a5ULL, 0x0089890089008989ULL,
2878c2ecf20Sopenharmony_ci	0x005f5f005f005f5fULL, 0x00b1b100b100b1b1ULL, 0x0017170017001717ULL,
2888c2ecf20Sopenharmony_ci	0x00f4f400f400f4f4ULL, 0x00bcbc00bc00bcbcULL, 0x00d3d300d300d3d3ULL,
2898c2ecf20Sopenharmony_ci	0x0046460046004646ULL, 0x00cfcf00cf00cfcfULL, 0x0037370037003737ULL,
2908c2ecf20Sopenharmony_ci	0x005e5e005e005e5eULL, 0x0047470047004747ULL, 0x0094940094009494ULL,
2918c2ecf20Sopenharmony_ci	0x00fafa00fa00fafaULL, 0x00fcfc00fc00fcfcULL, 0x005b5b005b005b5bULL,
2928c2ecf20Sopenharmony_ci	0x0097970097009797ULL, 0x00fefe00fe00fefeULL, 0x005a5a005a005a5aULL,
2938c2ecf20Sopenharmony_ci	0x00acac00ac00acacULL, 0x003c3c003c003c3cULL, 0x004c4c004c004c4cULL,
2948c2ecf20Sopenharmony_ci	0x0003030003000303ULL, 0x0035350035003535ULL, 0x00f3f300f300f3f3ULL,
2958c2ecf20Sopenharmony_ci	0x0023230023002323ULL, 0x00b8b800b800b8b8ULL, 0x005d5d005d005d5dULL,
2968c2ecf20Sopenharmony_ci	0x006a6a006a006a6aULL, 0x0092920092009292ULL, 0x00d5d500d500d5d5ULL,
2978c2ecf20Sopenharmony_ci	0x0021210021002121ULL, 0x0044440044004444ULL, 0x0051510051005151ULL,
2988c2ecf20Sopenharmony_ci	0x00c6c600c600c6c6ULL, 0x007d7d007d007d7dULL, 0x0039390039003939ULL,
2998c2ecf20Sopenharmony_ci	0x0083830083008383ULL, 0x00dcdc00dc00dcdcULL, 0x00aaaa00aa00aaaaULL,
3008c2ecf20Sopenharmony_ci	0x007c7c007c007c7cULL, 0x0077770077007777ULL, 0x0056560056005656ULL,
3018c2ecf20Sopenharmony_ci	0x0005050005000505ULL, 0x001b1b001b001b1bULL, 0x00a4a400a400a4a4ULL,
3028c2ecf20Sopenharmony_ci	0x0015150015001515ULL, 0x0034340034003434ULL, 0x001e1e001e001e1eULL,
3038c2ecf20Sopenharmony_ci	0x001c1c001c001c1cULL, 0x00f8f800f800f8f8ULL, 0x0052520052005252ULL,
3048c2ecf20Sopenharmony_ci	0x0020200020002020ULL, 0x0014140014001414ULL, 0x00e9e900e900e9e9ULL,
3058c2ecf20Sopenharmony_ci	0x00bdbd00bd00bdbdULL, 0x00dddd00dd00ddddULL, 0x00e4e400e400e4e4ULL,
3068c2ecf20Sopenharmony_ci	0x00a1a100a100a1a1ULL, 0x00e0e000e000e0e0ULL, 0x008a8a008a008a8aULL,
3078c2ecf20Sopenharmony_ci	0x00f1f100f100f1f1ULL, 0x00d6d600d600d6d6ULL, 0x007a7a007a007a7aULL,
3088c2ecf20Sopenharmony_ci	0x00bbbb00bb00bbbbULL, 0x00e3e300e300e3e3ULL, 0x0040400040004040ULL,
3098c2ecf20Sopenharmony_ci	0x004f4f004f004f4fULL,
3108c2ecf20Sopenharmony_ci};
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci__visible const u64 camellia_sp00444404[256] = {
3138c2ecf20Sopenharmony_ci	0x0000707070700070ULL, 0x00002c2c2c2c002cULL, 0x0000b3b3b3b300b3ULL,
3148c2ecf20Sopenharmony_ci	0x0000c0c0c0c000c0ULL, 0x0000e4e4e4e400e4ULL, 0x0000575757570057ULL,
3158c2ecf20Sopenharmony_ci	0x0000eaeaeaea00eaULL, 0x0000aeaeaeae00aeULL, 0x0000232323230023ULL,
3168c2ecf20Sopenharmony_ci	0x00006b6b6b6b006bULL, 0x0000454545450045ULL, 0x0000a5a5a5a500a5ULL,
3178c2ecf20Sopenharmony_ci	0x0000edededed00edULL, 0x00004f4f4f4f004fULL, 0x00001d1d1d1d001dULL,
3188c2ecf20Sopenharmony_ci	0x0000929292920092ULL, 0x0000868686860086ULL, 0x0000afafafaf00afULL,
3198c2ecf20Sopenharmony_ci	0x00007c7c7c7c007cULL, 0x00001f1f1f1f001fULL, 0x00003e3e3e3e003eULL,
3208c2ecf20Sopenharmony_ci	0x0000dcdcdcdc00dcULL, 0x00005e5e5e5e005eULL, 0x00000b0b0b0b000bULL,
3218c2ecf20Sopenharmony_ci	0x0000a6a6a6a600a6ULL, 0x0000393939390039ULL, 0x0000d5d5d5d500d5ULL,
3228c2ecf20Sopenharmony_ci	0x00005d5d5d5d005dULL, 0x0000d9d9d9d900d9ULL, 0x00005a5a5a5a005aULL,
3238c2ecf20Sopenharmony_ci	0x0000515151510051ULL, 0x00006c6c6c6c006cULL, 0x00008b8b8b8b008bULL,
3248c2ecf20Sopenharmony_ci	0x00009a9a9a9a009aULL, 0x0000fbfbfbfb00fbULL, 0x0000b0b0b0b000b0ULL,
3258c2ecf20Sopenharmony_ci	0x0000747474740074ULL, 0x00002b2b2b2b002bULL, 0x0000f0f0f0f000f0ULL,
3268c2ecf20Sopenharmony_ci	0x0000848484840084ULL, 0x0000dfdfdfdf00dfULL, 0x0000cbcbcbcb00cbULL,
3278c2ecf20Sopenharmony_ci	0x0000343434340034ULL, 0x0000767676760076ULL, 0x00006d6d6d6d006dULL,
3288c2ecf20Sopenharmony_ci	0x0000a9a9a9a900a9ULL, 0x0000d1d1d1d100d1ULL, 0x0000040404040004ULL,
3298c2ecf20Sopenharmony_ci	0x0000141414140014ULL, 0x00003a3a3a3a003aULL, 0x0000dededede00deULL,
3308c2ecf20Sopenharmony_ci	0x0000111111110011ULL, 0x0000323232320032ULL, 0x00009c9c9c9c009cULL,
3318c2ecf20Sopenharmony_ci	0x0000535353530053ULL, 0x0000f2f2f2f200f2ULL, 0x0000fefefefe00feULL,
3328c2ecf20Sopenharmony_ci	0x0000cfcfcfcf00cfULL, 0x0000c3c3c3c300c3ULL, 0x00007a7a7a7a007aULL,
3338c2ecf20Sopenharmony_ci	0x0000242424240024ULL, 0x0000e8e8e8e800e8ULL, 0x0000606060600060ULL,
3348c2ecf20Sopenharmony_ci	0x0000696969690069ULL, 0x0000aaaaaaaa00aaULL, 0x0000a0a0a0a000a0ULL,
3358c2ecf20Sopenharmony_ci	0x0000a1a1a1a100a1ULL, 0x0000626262620062ULL, 0x0000545454540054ULL,
3368c2ecf20Sopenharmony_ci	0x00001e1e1e1e001eULL, 0x0000e0e0e0e000e0ULL, 0x0000646464640064ULL,
3378c2ecf20Sopenharmony_ci	0x0000101010100010ULL, 0x0000000000000000ULL, 0x0000a3a3a3a300a3ULL,
3388c2ecf20Sopenharmony_ci	0x0000757575750075ULL, 0x00008a8a8a8a008aULL, 0x0000e6e6e6e600e6ULL,
3398c2ecf20Sopenharmony_ci	0x0000090909090009ULL, 0x0000dddddddd00ddULL, 0x0000878787870087ULL,
3408c2ecf20Sopenharmony_ci	0x0000838383830083ULL, 0x0000cdcdcdcd00cdULL, 0x0000909090900090ULL,
3418c2ecf20Sopenharmony_ci	0x0000737373730073ULL, 0x0000f6f6f6f600f6ULL, 0x00009d9d9d9d009dULL,
3428c2ecf20Sopenharmony_ci	0x0000bfbfbfbf00bfULL, 0x0000525252520052ULL, 0x0000d8d8d8d800d8ULL,
3438c2ecf20Sopenharmony_ci	0x0000c8c8c8c800c8ULL, 0x0000c6c6c6c600c6ULL, 0x0000818181810081ULL,
3448c2ecf20Sopenharmony_ci	0x00006f6f6f6f006fULL, 0x0000131313130013ULL, 0x0000636363630063ULL,
3458c2ecf20Sopenharmony_ci	0x0000e9e9e9e900e9ULL, 0x0000a7a7a7a700a7ULL, 0x00009f9f9f9f009fULL,
3468c2ecf20Sopenharmony_ci	0x0000bcbcbcbc00bcULL, 0x0000292929290029ULL, 0x0000f9f9f9f900f9ULL,
3478c2ecf20Sopenharmony_ci	0x00002f2f2f2f002fULL, 0x0000b4b4b4b400b4ULL, 0x0000787878780078ULL,
3488c2ecf20Sopenharmony_ci	0x0000060606060006ULL, 0x0000e7e7e7e700e7ULL, 0x0000717171710071ULL,
3498c2ecf20Sopenharmony_ci	0x0000d4d4d4d400d4ULL, 0x0000abababab00abULL, 0x0000888888880088ULL,
3508c2ecf20Sopenharmony_ci	0x00008d8d8d8d008dULL, 0x0000727272720072ULL, 0x0000b9b9b9b900b9ULL,
3518c2ecf20Sopenharmony_ci	0x0000f8f8f8f800f8ULL, 0x0000acacacac00acULL, 0x0000363636360036ULL,
3528c2ecf20Sopenharmony_ci	0x00002a2a2a2a002aULL, 0x00003c3c3c3c003cULL, 0x0000f1f1f1f100f1ULL,
3538c2ecf20Sopenharmony_ci	0x0000404040400040ULL, 0x0000d3d3d3d300d3ULL, 0x0000bbbbbbbb00bbULL,
3548c2ecf20Sopenharmony_ci	0x0000434343430043ULL, 0x0000151515150015ULL, 0x0000adadadad00adULL,
3558c2ecf20Sopenharmony_ci	0x0000777777770077ULL, 0x0000808080800080ULL, 0x0000828282820082ULL,
3568c2ecf20Sopenharmony_ci	0x0000ecececec00ecULL, 0x0000272727270027ULL, 0x0000e5e5e5e500e5ULL,
3578c2ecf20Sopenharmony_ci	0x0000858585850085ULL, 0x0000353535350035ULL, 0x00000c0c0c0c000cULL,
3588c2ecf20Sopenharmony_ci	0x0000414141410041ULL, 0x0000efefefef00efULL, 0x0000939393930093ULL,
3598c2ecf20Sopenharmony_ci	0x0000191919190019ULL, 0x0000212121210021ULL, 0x00000e0e0e0e000eULL,
3608c2ecf20Sopenharmony_ci	0x00004e4e4e4e004eULL, 0x0000656565650065ULL, 0x0000bdbdbdbd00bdULL,
3618c2ecf20Sopenharmony_ci	0x0000b8b8b8b800b8ULL, 0x00008f8f8f8f008fULL, 0x0000ebebebeb00ebULL,
3628c2ecf20Sopenharmony_ci	0x0000cececece00ceULL, 0x0000303030300030ULL, 0x00005f5f5f5f005fULL,
3638c2ecf20Sopenharmony_ci	0x0000c5c5c5c500c5ULL, 0x00001a1a1a1a001aULL, 0x0000e1e1e1e100e1ULL,
3648c2ecf20Sopenharmony_ci	0x0000cacacaca00caULL, 0x0000474747470047ULL, 0x00003d3d3d3d003dULL,
3658c2ecf20Sopenharmony_ci	0x0000010101010001ULL, 0x0000d6d6d6d600d6ULL, 0x0000565656560056ULL,
3668c2ecf20Sopenharmony_ci	0x00004d4d4d4d004dULL, 0x00000d0d0d0d000dULL, 0x0000666666660066ULL,
3678c2ecf20Sopenharmony_ci	0x0000cccccccc00ccULL, 0x00002d2d2d2d002dULL, 0x0000121212120012ULL,
3688c2ecf20Sopenharmony_ci	0x0000202020200020ULL, 0x0000b1b1b1b100b1ULL, 0x0000999999990099ULL,
3698c2ecf20Sopenharmony_ci	0x00004c4c4c4c004cULL, 0x0000c2c2c2c200c2ULL, 0x00007e7e7e7e007eULL,
3708c2ecf20Sopenharmony_ci	0x0000050505050005ULL, 0x0000b7b7b7b700b7ULL, 0x0000313131310031ULL,
3718c2ecf20Sopenharmony_ci	0x0000171717170017ULL, 0x0000d7d7d7d700d7ULL, 0x0000585858580058ULL,
3728c2ecf20Sopenharmony_ci	0x0000616161610061ULL, 0x00001b1b1b1b001bULL, 0x00001c1c1c1c001cULL,
3738c2ecf20Sopenharmony_ci	0x00000f0f0f0f000fULL, 0x0000161616160016ULL, 0x0000181818180018ULL,
3748c2ecf20Sopenharmony_ci	0x0000222222220022ULL, 0x0000444444440044ULL, 0x0000b2b2b2b200b2ULL,
3758c2ecf20Sopenharmony_ci	0x0000b5b5b5b500b5ULL, 0x0000919191910091ULL, 0x0000080808080008ULL,
3768c2ecf20Sopenharmony_ci	0x0000a8a8a8a800a8ULL, 0x0000fcfcfcfc00fcULL, 0x0000505050500050ULL,
3778c2ecf20Sopenharmony_ci	0x0000d0d0d0d000d0ULL, 0x00007d7d7d7d007dULL, 0x0000898989890089ULL,
3788c2ecf20Sopenharmony_ci	0x0000979797970097ULL, 0x00005b5b5b5b005bULL, 0x0000959595950095ULL,
3798c2ecf20Sopenharmony_ci	0x0000ffffffff00ffULL, 0x0000d2d2d2d200d2ULL, 0x0000c4c4c4c400c4ULL,
3808c2ecf20Sopenharmony_ci	0x0000484848480048ULL, 0x0000f7f7f7f700f7ULL, 0x0000dbdbdbdb00dbULL,
3818c2ecf20Sopenharmony_ci	0x0000030303030003ULL, 0x0000dadadada00daULL, 0x00003f3f3f3f003fULL,
3828c2ecf20Sopenharmony_ci	0x0000949494940094ULL, 0x00005c5c5c5c005cULL, 0x0000020202020002ULL,
3838c2ecf20Sopenharmony_ci	0x00004a4a4a4a004aULL, 0x0000333333330033ULL, 0x0000676767670067ULL,
3848c2ecf20Sopenharmony_ci	0x0000f3f3f3f300f3ULL, 0x00007f7f7f7f007fULL, 0x0000e2e2e2e200e2ULL,
3858c2ecf20Sopenharmony_ci	0x00009b9b9b9b009bULL, 0x0000262626260026ULL, 0x0000373737370037ULL,
3868c2ecf20Sopenharmony_ci	0x00003b3b3b3b003bULL, 0x0000969696960096ULL, 0x00004b4b4b4b004bULL,
3878c2ecf20Sopenharmony_ci	0x0000bebebebe00beULL, 0x00002e2e2e2e002eULL, 0x0000797979790079ULL,
3888c2ecf20Sopenharmony_ci	0x00008c8c8c8c008cULL, 0x00006e6e6e6e006eULL, 0x00008e8e8e8e008eULL,
3898c2ecf20Sopenharmony_ci	0x0000f5f5f5f500f5ULL, 0x0000b6b6b6b600b6ULL, 0x0000fdfdfdfd00fdULL,
3908c2ecf20Sopenharmony_ci	0x0000595959590059ULL, 0x0000989898980098ULL, 0x00006a6a6a6a006aULL,
3918c2ecf20Sopenharmony_ci	0x0000464646460046ULL, 0x0000babababa00baULL, 0x0000252525250025ULL,
3928c2ecf20Sopenharmony_ci	0x0000424242420042ULL, 0x0000a2a2a2a200a2ULL, 0x0000fafafafa00faULL,
3938c2ecf20Sopenharmony_ci	0x0000070707070007ULL, 0x0000555555550055ULL, 0x0000eeeeeeee00eeULL,
3948c2ecf20Sopenharmony_ci	0x00000a0a0a0a000aULL, 0x0000494949490049ULL, 0x0000686868680068ULL,
3958c2ecf20Sopenharmony_ci	0x0000383838380038ULL, 0x0000a4a4a4a400a4ULL, 0x0000282828280028ULL,
3968c2ecf20Sopenharmony_ci	0x00007b7b7b7b007bULL, 0x0000c9c9c9c900c9ULL, 0x0000c1c1c1c100c1ULL,
3978c2ecf20Sopenharmony_ci	0x0000e3e3e3e300e3ULL, 0x0000f4f4f4f400f4ULL, 0x0000c7c7c7c700c7ULL,
3988c2ecf20Sopenharmony_ci	0x00009e9e9e9e009eULL,
3998c2ecf20Sopenharmony_ci};
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci__visible const u64 camellia_sp02220222[256] = {
4028c2ecf20Sopenharmony_ci	0x00e0e0e000e0e0e0ULL, 0x0005050500050505ULL, 0x0058585800585858ULL,
4038c2ecf20Sopenharmony_ci	0x00d9d9d900d9d9d9ULL, 0x0067676700676767ULL, 0x004e4e4e004e4e4eULL,
4048c2ecf20Sopenharmony_ci	0x0081818100818181ULL, 0x00cbcbcb00cbcbcbULL, 0x00c9c9c900c9c9c9ULL,
4058c2ecf20Sopenharmony_ci	0x000b0b0b000b0b0bULL, 0x00aeaeae00aeaeaeULL, 0x006a6a6a006a6a6aULL,
4068c2ecf20Sopenharmony_ci	0x00d5d5d500d5d5d5ULL, 0x0018181800181818ULL, 0x005d5d5d005d5d5dULL,
4078c2ecf20Sopenharmony_ci	0x0082828200828282ULL, 0x0046464600464646ULL, 0x00dfdfdf00dfdfdfULL,
4088c2ecf20Sopenharmony_ci	0x00d6d6d600d6d6d6ULL, 0x0027272700272727ULL, 0x008a8a8a008a8a8aULL,
4098c2ecf20Sopenharmony_ci	0x0032323200323232ULL, 0x004b4b4b004b4b4bULL, 0x0042424200424242ULL,
4108c2ecf20Sopenharmony_ci	0x00dbdbdb00dbdbdbULL, 0x001c1c1c001c1c1cULL, 0x009e9e9e009e9e9eULL,
4118c2ecf20Sopenharmony_ci	0x009c9c9c009c9c9cULL, 0x003a3a3a003a3a3aULL, 0x00cacaca00cacacaULL,
4128c2ecf20Sopenharmony_ci	0x0025252500252525ULL, 0x007b7b7b007b7b7bULL, 0x000d0d0d000d0d0dULL,
4138c2ecf20Sopenharmony_ci	0x0071717100717171ULL, 0x005f5f5f005f5f5fULL, 0x001f1f1f001f1f1fULL,
4148c2ecf20Sopenharmony_ci	0x00f8f8f800f8f8f8ULL, 0x00d7d7d700d7d7d7ULL, 0x003e3e3e003e3e3eULL,
4158c2ecf20Sopenharmony_ci	0x009d9d9d009d9d9dULL, 0x007c7c7c007c7c7cULL, 0x0060606000606060ULL,
4168c2ecf20Sopenharmony_ci	0x00b9b9b900b9b9b9ULL, 0x00bebebe00bebebeULL, 0x00bcbcbc00bcbcbcULL,
4178c2ecf20Sopenharmony_ci	0x008b8b8b008b8b8bULL, 0x0016161600161616ULL, 0x0034343400343434ULL,
4188c2ecf20Sopenharmony_ci	0x004d4d4d004d4d4dULL, 0x00c3c3c300c3c3c3ULL, 0x0072727200727272ULL,
4198c2ecf20Sopenharmony_ci	0x0095959500959595ULL, 0x00ababab00abababULL, 0x008e8e8e008e8e8eULL,
4208c2ecf20Sopenharmony_ci	0x00bababa00bababaULL, 0x007a7a7a007a7a7aULL, 0x00b3b3b300b3b3b3ULL,
4218c2ecf20Sopenharmony_ci	0x0002020200020202ULL, 0x00b4b4b400b4b4b4ULL, 0x00adadad00adadadULL,
4228c2ecf20Sopenharmony_ci	0x00a2a2a200a2a2a2ULL, 0x00acacac00acacacULL, 0x00d8d8d800d8d8d8ULL,
4238c2ecf20Sopenharmony_ci	0x009a9a9a009a9a9aULL, 0x0017171700171717ULL, 0x001a1a1a001a1a1aULL,
4248c2ecf20Sopenharmony_ci	0x0035353500353535ULL, 0x00cccccc00ccccccULL, 0x00f7f7f700f7f7f7ULL,
4258c2ecf20Sopenharmony_ci	0x0099999900999999ULL, 0x0061616100616161ULL, 0x005a5a5a005a5a5aULL,
4268c2ecf20Sopenharmony_ci	0x00e8e8e800e8e8e8ULL, 0x0024242400242424ULL, 0x0056565600565656ULL,
4278c2ecf20Sopenharmony_ci	0x0040404000404040ULL, 0x00e1e1e100e1e1e1ULL, 0x0063636300636363ULL,
4288c2ecf20Sopenharmony_ci	0x0009090900090909ULL, 0x0033333300333333ULL, 0x00bfbfbf00bfbfbfULL,
4298c2ecf20Sopenharmony_ci	0x0098989800989898ULL, 0x0097979700979797ULL, 0x0085858500858585ULL,
4308c2ecf20Sopenharmony_ci	0x0068686800686868ULL, 0x00fcfcfc00fcfcfcULL, 0x00ececec00ecececULL,
4318c2ecf20Sopenharmony_ci	0x000a0a0a000a0a0aULL, 0x00dadada00dadadaULL, 0x006f6f6f006f6f6fULL,
4328c2ecf20Sopenharmony_ci	0x0053535300535353ULL, 0x0062626200626262ULL, 0x00a3a3a300a3a3a3ULL,
4338c2ecf20Sopenharmony_ci	0x002e2e2e002e2e2eULL, 0x0008080800080808ULL, 0x00afafaf00afafafULL,
4348c2ecf20Sopenharmony_ci	0x0028282800282828ULL, 0x00b0b0b000b0b0b0ULL, 0x0074747400747474ULL,
4358c2ecf20Sopenharmony_ci	0x00c2c2c200c2c2c2ULL, 0x00bdbdbd00bdbdbdULL, 0x0036363600363636ULL,
4368c2ecf20Sopenharmony_ci	0x0022222200222222ULL, 0x0038383800383838ULL, 0x0064646400646464ULL,
4378c2ecf20Sopenharmony_ci	0x001e1e1e001e1e1eULL, 0x0039393900393939ULL, 0x002c2c2c002c2c2cULL,
4388c2ecf20Sopenharmony_ci	0x00a6a6a600a6a6a6ULL, 0x0030303000303030ULL, 0x00e5e5e500e5e5e5ULL,
4398c2ecf20Sopenharmony_ci	0x0044444400444444ULL, 0x00fdfdfd00fdfdfdULL, 0x0088888800888888ULL,
4408c2ecf20Sopenharmony_ci	0x009f9f9f009f9f9fULL, 0x0065656500656565ULL, 0x0087878700878787ULL,
4418c2ecf20Sopenharmony_ci	0x006b6b6b006b6b6bULL, 0x00f4f4f400f4f4f4ULL, 0x0023232300232323ULL,
4428c2ecf20Sopenharmony_ci	0x0048484800484848ULL, 0x0010101000101010ULL, 0x00d1d1d100d1d1d1ULL,
4438c2ecf20Sopenharmony_ci	0x0051515100515151ULL, 0x00c0c0c000c0c0c0ULL, 0x00f9f9f900f9f9f9ULL,
4448c2ecf20Sopenharmony_ci	0x00d2d2d200d2d2d2ULL, 0x00a0a0a000a0a0a0ULL, 0x0055555500555555ULL,
4458c2ecf20Sopenharmony_ci	0x00a1a1a100a1a1a1ULL, 0x0041414100414141ULL, 0x00fafafa00fafafaULL,
4468c2ecf20Sopenharmony_ci	0x0043434300434343ULL, 0x0013131300131313ULL, 0x00c4c4c400c4c4c4ULL,
4478c2ecf20Sopenharmony_ci	0x002f2f2f002f2f2fULL, 0x00a8a8a800a8a8a8ULL, 0x00b6b6b600b6b6b6ULL,
4488c2ecf20Sopenharmony_ci	0x003c3c3c003c3c3cULL, 0x002b2b2b002b2b2bULL, 0x00c1c1c100c1c1c1ULL,
4498c2ecf20Sopenharmony_ci	0x00ffffff00ffffffULL, 0x00c8c8c800c8c8c8ULL, 0x00a5a5a500a5a5a5ULL,
4508c2ecf20Sopenharmony_ci	0x0020202000202020ULL, 0x0089898900898989ULL, 0x0000000000000000ULL,
4518c2ecf20Sopenharmony_ci	0x0090909000909090ULL, 0x0047474700474747ULL, 0x00efefef00efefefULL,
4528c2ecf20Sopenharmony_ci	0x00eaeaea00eaeaeaULL, 0x00b7b7b700b7b7b7ULL, 0x0015151500151515ULL,
4538c2ecf20Sopenharmony_ci	0x0006060600060606ULL, 0x00cdcdcd00cdcdcdULL, 0x00b5b5b500b5b5b5ULL,
4548c2ecf20Sopenharmony_ci	0x0012121200121212ULL, 0x007e7e7e007e7e7eULL, 0x00bbbbbb00bbbbbbULL,
4558c2ecf20Sopenharmony_ci	0x0029292900292929ULL, 0x000f0f0f000f0f0fULL, 0x00b8b8b800b8b8b8ULL,
4568c2ecf20Sopenharmony_ci	0x0007070700070707ULL, 0x0004040400040404ULL, 0x009b9b9b009b9b9bULL,
4578c2ecf20Sopenharmony_ci	0x0094949400949494ULL, 0x0021212100212121ULL, 0x0066666600666666ULL,
4588c2ecf20Sopenharmony_ci	0x00e6e6e600e6e6e6ULL, 0x00cecece00cececeULL, 0x00ededed00edededULL,
4598c2ecf20Sopenharmony_ci	0x00e7e7e700e7e7e7ULL, 0x003b3b3b003b3b3bULL, 0x00fefefe00fefefeULL,
4608c2ecf20Sopenharmony_ci	0x007f7f7f007f7f7fULL, 0x00c5c5c500c5c5c5ULL, 0x00a4a4a400a4a4a4ULL,
4618c2ecf20Sopenharmony_ci	0x0037373700373737ULL, 0x00b1b1b100b1b1b1ULL, 0x004c4c4c004c4c4cULL,
4628c2ecf20Sopenharmony_ci	0x0091919100919191ULL, 0x006e6e6e006e6e6eULL, 0x008d8d8d008d8d8dULL,
4638c2ecf20Sopenharmony_ci	0x0076767600767676ULL, 0x0003030300030303ULL, 0x002d2d2d002d2d2dULL,
4648c2ecf20Sopenharmony_ci	0x00dedede00dededeULL, 0x0096969600969696ULL, 0x0026262600262626ULL,
4658c2ecf20Sopenharmony_ci	0x007d7d7d007d7d7dULL, 0x00c6c6c600c6c6c6ULL, 0x005c5c5c005c5c5cULL,
4668c2ecf20Sopenharmony_ci	0x00d3d3d300d3d3d3ULL, 0x00f2f2f200f2f2f2ULL, 0x004f4f4f004f4f4fULL,
4678c2ecf20Sopenharmony_ci	0x0019191900191919ULL, 0x003f3f3f003f3f3fULL, 0x00dcdcdc00dcdcdcULL,
4688c2ecf20Sopenharmony_ci	0x0079797900797979ULL, 0x001d1d1d001d1d1dULL, 0x0052525200525252ULL,
4698c2ecf20Sopenharmony_ci	0x00ebebeb00ebebebULL, 0x00f3f3f300f3f3f3ULL, 0x006d6d6d006d6d6dULL,
4708c2ecf20Sopenharmony_ci	0x005e5e5e005e5e5eULL, 0x00fbfbfb00fbfbfbULL, 0x0069696900696969ULL,
4718c2ecf20Sopenharmony_ci	0x00b2b2b200b2b2b2ULL, 0x00f0f0f000f0f0f0ULL, 0x0031313100313131ULL,
4728c2ecf20Sopenharmony_ci	0x000c0c0c000c0c0cULL, 0x00d4d4d400d4d4d4ULL, 0x00cfcfcf00cfcfcfULL,
4738c2ecf20Sopenharmony_ci	0x008c8c8c008c8c8cULL, 0x00e2e2e200e2e2e2ULL, 0x0075757500757575ULL,
4748c2ecf20Sopenharmony_ci	0x00a9a9a900a9a9a9ULL, 0x004a4a4a004a4a4aULL, 0x0057575700575757ULL,
4758c2ecf20Sopenharmony_ci	0x0084848400848484ULL, 0x0011111100111111ULL, 0x0045454500454545ULL,
4768c2ecf20Sopenharmony_ci	0x001b1b1b001b1b1bULL, 0x00f5f5f500f5f5f5ULL, 0x00e4e4e400e4e4e4ULL,
4778c2ecf20Sopenharmony_ci	0x000e0e0e000e0e0eULL, 0x0073737300737373ULL, 0x00aaaaaa00aaaaaaULL,
4788c2ecf20Sopenharmony_ci	0x00f1f1f100f1f1f1ULL, 0x00dddddd00ddddddULL, 0x0059595900595959ULL,
4798c2ecf20Sopenharmony_ci	0x0014141400141414ULL, 0x006c6c6c006c6c6cULL, 0x0092929200929292ULL,
4808c2ecf20Sopenharmony_ci	0x0054545400545454ULL, 0x00d0d0d000d0d0d0ULL, 0x0078787800787878ULL,
4818c2ecf20Sopenharmony_ci	0x0070707000707070ULL, 0x00e3e3e300e3e3e3ULL, 0x0049494900494949ULL,
4828c2ecf20Sopenharmony_ci	0x0080808000808080ULL, 0x0050505000505050ULL, 0x00a7a7a700a7a7a7ULL,
4838c2ecf20Sopenharmony_ci	0x00f6f6f600f6f6f6ULL, 0x0077777700777777ULL, 0x0093939300939393ULL,
4848c2ecf20Sopenharmony_ci	0x0086868600868686ULL, 0x0083838300838383ULL, 0x002a2a2a002a2a2aULL,
4858c2ecf20Sopenharmony_ci	0x00c7c7c700c7c7c7ULL, 0x005b5b5b005b5b5bULL, 0x00e9e9e900e9e9e9ULL,
4868c2ecf20Sopenharmony_ci	0x00eeeeee00eeeeeeULL, 0x008f8f8f008f8f8fULL, 0x0001010100010101ULL,
4878c2ecf20Sopenharmony_ci	0x003d3d3d003d3d3dULL,
4888c2ecf20Sopenharmony_ci};
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci__visible const u64 camellia_sp30333033[256] = {
4918c2ecf20Sopenharmony_ci	0x3800383838003838ULL, 0x4100414141004141ULL, 0x1600161616001616ULL,
4928c2ecf20Sopenharmony_ci	0x7600767676007676ULL, 0xd900d9d9d900d9d9ULL, 0x9300939393009393ULL,
4938c2ecf20Sopenharmony_ci	0x6000606060006060ULL, 0xf200f2f2f200f2f2ULL, 0x7200727272007272ULL,
4948c2ecf20Sopenharmony_ci	0xc200c2c2c200c2c2ULL, 0xab00ababab00ababULL, 0x9a009a9a9a009a9aULL,
4958c2ecf20Sopenharmony_ci	0x7500757575007575ULL, 0x0600060606000606ULL, 0x5700575757005757ULL,
4968c2ecf20Sopenharmony_ci	0xa000a0a0a000a0a0ULL, 0x9100919191009191ULL, 0xf700f7f7f700f7f7ULL,
4978c2ecf20Sopenharmony_ci	0xb500b5b5b500b5b5ULL, 0xc900c9c9c900c9c9ULL, 0xa200a2a2a200a2a2ULL,
4988c2ecf20Sopenharmony_ci	0x8c008c8c8c008c8cULL, 0xd200d2d2d200d2d2ULL, 0x9000909090009090ULL,
4998c2ecf20Sopenharmony_ci	0xf600f6f6f600f6f6ULL, 0x0700070707000707ULL, 0xa700a7a7a700a7a7ULL,
5008c2ecf20Sopenharmony_ci	0x2700272727002727ULL, 0x8e008e8e8e008e8eULL, 0xb200b2b2b200b2b2ULL,
5018c2ecf20Sopenharmony_ci	0x4900494949004949ULL, 0xde00dedede00dedeULL, 0x4300434343004343ULL,
5028c2ecf20Sopenharmony_ci	0x5c005c5c5c005c5cULL, 0xd700d7d7d700d7d7ULL, 0xc700c7c7c700c7c7ULL,
5038c2ecf20Sopenharmony_ci	0x3e003e3e3e003e3eULL, 0xf500f5f5f500f5f5ULL, 0x8f008f8f8f008f8fULL,
5048c2ecf20Sopenharmony_ci	0x6700676767006767ULL, 0x1f001f1f1f001f1fULL, 0x1800181818001818ULL,
5058c2ecf20Sopenharmony_ci	0x6e006e6e6e006e6eULL, 0xaf00afafaf00afafULL, 0x2f002f2f2f002f2fULL,
5068c2ecf20Sopenharmony_ci	0xe200e2e2e200e2e2ULL, 0x8500858585008585ULL, 0x0d000d0d0d000d0dULL,
5078c2ecf20Sopenharmony_ci	0x5300535353005353ULL, 0xf000f0f0f000f0f0ULL, 0x9c009c9c9c009c9cULL,
5088c2ecf20Sopenharmony_ci	0x6500656565006565ULL, 0xea00eaeaea00eaeaULL, 0xa300a3a3a300a3a3ULL,
5098c2ecf20Sopenharmony_ci	0xae00aeaeae00aeaeULL, 0x9e009e9e9e009e9eULL, 0xec00ececec00ececULL,
5108c2ecf20Sopenharmony_ci	0x8000808080008080ULL, 0x2d002d2d2d002d2dULL, 0x6b006b6b6b006b6bULL,
5118c2ecf20Sopenharmony_ci	0xa800a8a8a800a8a8ULL, 0x2b002b2b2b002b2bULL, 0x3600363636003636ULL,
5128c2ecf20Sopenharmony_ci	0xa600a6a6a600a6a6ULL, 0xc500c5c5c500c5c5ULL, 0x8600868686008686ULL,
5138c2ecf20Sopenharmony_ci	0x4d004d4d4d004d4dULL, 0x3300333333003333ULL, 0xfd00fdfdfd00fdfdULL,
5148c2ecf20Sopenharmony_ci	0x6600666666006666ULL, 0x5800585858005858ULL, 0x9600969696009696ULL,
5158c2ecf20Sopenharmony_ci	0x3a003a3a3a003a3aULL, 0x0900090909000909ULL, 0x9500959595009595ULL,
5168c2ecf20Sopenharmony_ci	0x1000101010001010ULL, 0x7800787878007878ULL, 0xd800d8d8d800d8d8ULL,
5178c2ecf20Sopenharmony_ci	0x4200424242004242ULL, 0xcc00cccccc00ccccULL, 0xef00efefef00efefULL,
5188c2ecf20Sopenharmony_ci	0x2600262626002626ULL, 0xe500e5e5e500e5e5ULL, 0x6100616161006161ULL,
5198c2ecf20Sopenharmony_ci	0x1a001a1a1a001a1aULL, 0x3f003f3f3f003f3fULL, 0x3b003b3b3b003b3bULL,
5208c2ecf20Sopenharmony_ci	0x8200828282008282ULL, 0xb600b6b6b600b6b6ULL, 0xdb00dbdbdb00dbdbULL,
5218c2ecf20Sopenharmony_ci	0xd400d4d4d400d4d4ULL, 0x9800989898009898ULL, 0xe800e8e8e800e8e8ULL,
5228c2ecf20Sopenharmony_ci	0x8b008b8b8b008b8bULL, 0x0200020202000202ULL, 0xeb00ebebeb00ebebULL,
5238c2ecf20Sopenharmony_ci	0x0a000a0a0a000a0aULL, 0x2c002c2c2c002c2cULL, 0x1d001d1d1d001d1dULL,
5248c2ecf20Sopenharmony_ci	0xb000b0b0b000b0b0ULL, 0x6f006f6f6f006f6fULL, 0x8d008d8d8d008d8dULL,
5258c2ecf20Sopenharmony_ci	0x8800888888008888ULL, 0x0e000e0e0e000e0eULL, 0x1900191919001919ULL,
5268c2ecf20Sopenharmony_ci	0x8700878787008787ULL, 0x4e004e4e4e004e4eULL, 0x0b000b0b0b000b0bULL,
5278c2ecf20Sopenharmony_ci	0xa900a9a9a900a9a9ULL, 0x0c000c0c0c000c0cULL, 0x7900797979007979ULL,
5288c2ecf20Sopenharmony_ci	0x1100111111001111ULL, 0x7f007f7f7f007f7fULL, 0x2200222222002222ULL,
5298c2ecf20Sopenharmony_ci	0xe700e7e7e700e7e7ULL, 0x5900595959005959ULL, 0xe100e1e1e100e1e1ULL,
5308c2ecf20Sopenharmony_ci	0xda00dadada00dadaULL, 0x3d003d3d3d003d3dULL, 0xc800c8c8c800c8c8ULL,
5318c2ecf20Sopenharmony_ci	0x1200121212001212ULL, 0x0400040404000404ULL, 0x7400747474007474ULL,
5328c2ecf20Sopenharmony_ci	0x5400545454005454ULL, 0x3000303030003030ULL, 0x7e007e7e7e007e7eULL,
5338c2ecf20Sopenharmony_ci	0xb400b4b4b400b4b4ULL, 0x2800282828002828ULL, 0x5500555555005555ULL,
5348c2ecf20Sopenharmony_ci	0x6800686868006868ULL, 0x5000505050005050ULL, 0xbe00bebebe00bebeULL,
5358c2ecf20Sopenharmony_ci	0xd000d0d0d000d0d0ULL, 0xc400c4c4c400c4c4ULL, 0x3100313131003131ULL,
5368c2ecf20Sopenharmony_ci	0xcb00cbcbcb00cbcbULL, 0x2a002a2a2a002a2aULL, 0xad00adadad00adadULL,
5378c2ecf20Sopenharmony_ci	0x0f000f0f0f000f0fULL, 0xca00cacaca00cacaULL, 0x7000707070007070ULL,
5388c2ecf20Sopenharmony_ci	0xff00ffffff00ffffULL, 0x3200323232003232ULL, 0x6900696969006969ULL,
5398c2ecf20Sopenharmony_ci	0x0800080808000808ULL, 0x6200626262006262ULL, 0x0000000000000000ULL,
5408c2ecf20Sopenharmony_ci	0x2400242424002424ULL, 0xd100d1d1d100d1d1ULL, 0xfb00fbfbfb00fbfbULL,
5418c2ecf20Sopenharmony_ci	0xba00bababa00babaULL, 0xed00ededed00ededULL, 0x4500454545004545ULL,
5428c2ecf20Sopenharmony_ci	0x8100818181008181ULL, 0x7300737373007373ULL, 0x6d006d6d6d006d6dULL,
5438c2ecf20Sopenharmony_ci	0x8400848484008484ULL, 0x9f009f9f9f009f9fULL, 0xee00eeeeee00eeeeULL,
5448c2ecf20Sopenharmony_ci	0x4a004a4a4a004a4aULL, 0xc300c3c3c300c3c3ULL, 0x2e002e2e2e002e2eULL,
5458c2ecf20Sopenharmony_ci	0xc100c1c1c100c1c1ULL, 0x0100010101000101ULL, 0xe600e6e6e600e6e6ULL,
5468c2ecf20Sopenharmony_ci	0x2500252525002525ULL, 0x4800484848004848ULL, 0x9900999999009999ULL,
5478c2ecf20Sopenharmony_ci	0xb900b9b9b900b9b9ULL, 0xb300b3b3b300b3b3ULL, 0x7b007b7b7b007b7bULL,
5488c2ecf20Sopenharmony_ci	0xf900f9f9f900f9f9ULL, 0xce00cecece00ceceULL, 0xbf00bfbfbf00bfbfULL,
5498c2ecf20Sopenharmony_ci	0xdf00dfdfdf00dfdfULL, 0x7100717171007171ULL, 0x2900292929002929ULL,
5508c2ecf20Sopenharmony_ci	0xcd00cdcdcd00cdcdULL, 0x6c006c6c6c006c6cULL, 0x1300131313001313ULL,
5518c2ecf20Sopenharmony_ci	0x6400646464006464ULL, 0x9b009b9b9b009b9bULL, 0x6300636363006363ULL,
5528c2ecf20Sopenharmony_ci	0x9d009d9d9d009d9dULL, 0xc000c0c0c000c0c0ULL, 0x4b004b4b4b004b4bULL,
5538c2ecf20Sopenharmony_ci	0xb700b7b7b700b7b7ULL, 0xa500a5a5a500a5a5ULL, 0x8900898989008989ULL,
5548c2ecf20Sopenharmony_ci	0x5f005f5f5f005f5fULL, 0xb100b1b1b100b1b1ULL, 0x1700171717001717ULL,
5558c2ecf20Sopenharmony_ci	0xf400f4f4f400f4f4ULL, 0xbc00bcbcbc00bcbcULL, 0xd300d3d3d300d3d3ULL,
5568c2ecf20Sopenharmony_ci	0x4600464646004646ULL, 0xcf00cfcfcf00cfcfULL, 0x3700373737003737ULL,
5578c2ecf20Sopenharmony_ci	0x5e005e5e5e005e5eULL, 0x4700474747004747ULL, 0x9400949494009494ULL,
5588c2ecf20Sopenharmony_ci	0xfa00fafafa00fafaULL, 0xfc00fcfcfc00fcfcULL, 0x5b005b5b5b005b5bULL,
5598c2ecf20Sopenharmony_ci	0x9700979797009797ULL, 0xfe00fefefe00fefeULL, 0x5a005a5a5a005a5aULL,
5608c2ecf20Sopenharmony_ci	0xac00acacac00acacULL, 0x3c003c3c3c003c3cULL, 0x4c004c4c4c004c4cULL,
5618c2ecf20Sopenharmony_ci	0x0300030303000303ULL, 0x3500353535003535ULL, 0xf300f3f3f300f3f3ULL,
5628c2ecf20Sopenharmony_ci	0x2300232323002323ULL, 0xb800b8b8b800b8b8ULL, 0x5d005d5d5d005d5dULL,
5638c2ecf20Sopenharmony_ci	0x6a006a6a6a006a6aULL, 0x9200929292009292ULL, 0xd500d5d5d500d5d5ULL,
5648c2ecf20Sopenharmony_ci	0x2100212121002121ULL, 0x4400444444004444ULL, 0x5100515151005151ULL,
5658c2ecf20Sopenharmony_ci	0xc600c6c6c600c6c6ULL, 0x7d007d7d7d007d7dULL, 0x3900393939003939ULL,
5668c2ecf20Sopenharmony_ci	0x8300838383008383ULL, 0xdc00dcdcdc00dcdcULL, 0xaa00aaaaaa00aaaaULL,
5678c2ecf20Sopenharmony_ci	0x7c007c7c7c007c7cULL, 0x7700777777007777ULL, 0x5600565656005656ULL,
5688c2ecf20Sopenharmony_ci	0x0500050505000505ULL, 0x1b001b1b1b001b1bULL, 0xa400a4a4a400a4a4ULL,
5698c2ecf20Sopenharmony_ci	0x1500151515001515ULL, 0x3400343434003434ULL, 0x1e001e1e1e001e1eULL,
5708c2ecf20Sopenharmony_ci	0x1c001c1c1c001c1cULL, 0xf800f8f8f800f8f8ULL, 0x5200525252005252ULL,
5718c2ecf20Sopenharmony_ci	0x2000202020002020ULL, 0x1400141414001414ULL, 0xe900e9e9e900e9e9ULL,
5728c2ecf20Sopenharmony_ci	0xbd00bdbdbd00bdbdULL, 0xdd00dddddd00ddddULL, 0xe400e4e4e400e4e4ULL,
5738c2ecf20Sopenharmony_ci	0xa100a1a1a100a1a1ULL, 0xe000e0e0e000e0e0ULL, 0x8a008a8a8a008a8aULL,
5748c2ecf20Sopenharmony_ci	0xf100f1f1f100f1f1ULL, 0xd600d6d6d600d6d6ULL, 0x7a007a7a7a007a7aULL,
5758c2ecf20Sopenharmony_ci	0xbb00bbbbbb00bbbbULL, 0xe300e3e3e300e3e3ULL, 0x4000404040004040ULL,
5768c2ecf20Sopenharmony_ci	0x4f004f4f4f004f4fULL,
5778c2ecf20Sopenharmony_ci};
5788c2ecf20Sopenharmony_ci
5798c2ecf20Sopenharmony_ci__visible const u64 camellia_sp44044404[256] = {
5808c2ecf20Sopenharmony_ci	0x7070007070700070ULL, 0x2c2c002c2c2c002cULL, 0xb3b300b3b3b300b3ULL,
5818c2ecf20Sopenharmony_ci	0xc0c000c0c0c000c0ULL, 0xe4e400e4e4e400e4ULL, 0x5757005757570057ULL,
5828c2ecf20Sopenharmony_ci	0xeaea00eaeaea00eaULL, 0xaeae00aeaeae00aeULL, 0x2323002323230023ULL,
5838c2ecf20Sopenharmony_ci	0x6b6b006b6b6b006bULL, 0x4545004545450045ULL, 0xa5a500a5a5a500a5ULL,
5848c2ecf20Sopenharmony_ci	0xeded00ededed00edULL, 0x4f4f004f4f4f004fULL, 0x1d1d001d1d1d001dULL,
5858c2ecf20Sopenharmony_ci	0x9292009292920092ULL, 0x8686008686860086ULL, 0xafaf00afafaf00afULL,
5868c2ecf20Sopenharmony_ci	0x7c7c007c7c7c007cULL, 0x1f1f001f1f1f001fULL, 0x3e3e003e3e3e003eULL,
5878c2ecf20Sopenharmony_ci	0xdcdc00dcdcdc00dcULL, 0x5e5e005e5e5e005eULL, 0x0b0b000b0b0b000bULL,
5888c2ecf20Sopenharmony_ci	0xa6a600a6a6a600a6ULL, 0x3939003939390039ULL, 0xd5d500d5d5d500d5ULL,
5898c2ecf20Sopenharmony_ci	0x5d5d005d5d5d005dULL, 0xd9d900d9d9d900d9ULL, 0x5a5a005a5a5a005aULL,
5908c2ecf20Sopenharmony_ci	0x5151005151510051ULL, 0x6c6c006c6c6c006cULL, 0x8b8b008b8b8b008bULL,
5918c2ecf20Sopenharmony_ci	0x9a9a009a9a9a009aULL, 0xfbfb00fbfbfb00fbULL, 0xb0b000b0b0b000b0ULL,
5928c2ecf20Sopenharmony_ci	0x7474007474740074ULL, 0x2b2b002b2b2b002bULL, 0xf0f000f0f0f000f0ULL,
5938c2ecf20Sopenharmony_ci	0x8484008484840084ULL, 0xdfdf00dfdfdf00dfULL, 0xcbcb00cbcbcb00cbULL,
5948c2ecf20Sopenharmony_ci	0x3434003434340034ULL, 0x7676007676760076ULL, 0x6d6d006d6d6d006dULL,
5958c2ecf20Sopenharmony_ci	0xa9a900a9a9a900a9ULL, 0xd1d100d1d1d100d1ULL, 0x0404000404040004ULL,
5968c2ecf20Sopenharmony_ci	0x1414001414140014ULL, 0x3a3a003a3a3a003aULL, 0xdede00dedede00deULL,
5978c2ecf20Sopenharmony_ci	0x1111001111110011ULL, 0x3232003232320032ULL, 0x9c9c009c9c9c009cULL,
5988c2ecf20Sopenharmony_ci	0x5353005353530053ULL, 0xf2f200f2f2f200f2ULL, 0xfefe00fefefe00feULL,
5998c2ecf20Sopenharmony_ci	0xcfcf00cfcfcf00cfULL, 0xc3c300c3c3c300c3ULL, 0x7a7a007a7a7a007aULL,
6008c2ecf20Sopenharmony_ci	0x2424002424240024ULL, 0xe8e800e8e8e800e8ULL, 0x6060006060600060ULL,
6018c2ecf20Sopenharmony_ci	0x6969006969690069ULL, 0xaaaa00aaaaaa00aaULL, 0xa0a000a0a0a000a0ULL,
6028c2ecf20Sopenharmony_ci	0xa1a100a1a1a100a1ULL, 0x6262006262620062ULL, 0x5454005454540054ULL,
6038c2ecf20Sopenharmony_ci	0x1e1e001e1e1e001eULL, 0xe0e000e0e0e000e0ULL, 0x6464006464640064ULL,
6048c2ecf20Sopenharmony_ci	0x1010001010100010ULL, 0x0000000000000000ULL, 0xa3a300a3a3a300a3ULL,
6058c2ecf20Sopenharmony_ci	0x7575007575750075ULL, 0x8a8a008a8a8a008aULL, 0xe6e600e6e6e600e6ULL,
6068c2ecf20Sopenharmony_ci	0x0909000909090009ULL, 0xdddd00dddddd00ddULL, 0x8787008787870087ULL,
6078c2ecf20Sopenharmony_ci	0x8383008383830083ULL, 0xcdcd00cdcdcd00cdULL, 0x9090009090900090ULL,
6088c2ecf20Sopenharmony_ci	0x7373007373730073ULL, 0xf6f600f6f6f600f6ULL, 0x9d9d009d9d9d009dULL,
6098c2ecf20Sopenharmony_ci	0xbfbf00bfbfbf00bfULL, 0x5252005252520052ULL, 0xd8d800d8d8d800d8ULL,
6108c2ecf20Sopenharmony_ci	0xc8c800c8c8c800c8ULL, 0xc6c600c6c6c600c6ULL, 0x8181008181810081ULL,
6118c2ecf20Sopenharmony_ci	0x6f6f006f6f6f006fULL, 0x1313001313130013ULL, 0x6363006363630063ULL,
6128c2ecf20Sopenharmony_ci	0xe9e900e9e9e900e9ULL, 0xa7a700a7a7a700a7ULL, 0x9f9f009f9f9f009fULL,
6138c2ecf20Sopenharmony_ci	0xbcbc00bcbcbc00bcULL, 0x2929002929290029ULL, 0xf9f900f9f9f900f9ULL,
6148c2ecf20Sopenharmony_ci	0x2f2f002f2f2f002fULL, 0xb4b400b4b4b400b4ULL, 0x7878007878780078ULL,
6158c2ecf20Sopenharmony_ci	0x0606000606060006ULL, 0xe7e700e7e7e700e7ULL, 0x7171007171710071ULL,
6168c2ecf20Sopenharmony_ci	0xd4d400d4d4d400d4ULL, 0xabab00ababab00abULL, 0x8888008888880088ULL,
6178c2ecf20Sopenharmony_ci	0x8d8d008d8d8d008dULL, 0x7272007272720072ULL, 0xb9b900b9b9b900b9ULL,
6188c2ecf20Sopenharmony_ci	0xf8f800f8f8f800f8ULL, 0xacac00acacac00acULL, 0x3636003636360036ULL,
6198c2ecf20Sopenharmony_ci	0x2a2a002a2a2a002aULL, 0x3c3c003c3c3c003cULL, 0xf1f100f1f1f100f1ULL,
6208c2ecf20Sopenharmony_ci	0x4040004040400040ULL, 0xd3d300d3d3d300d3ULL, 0xbbbb00bbbbbb00bbULL,
6218c2ecf20Sopenharmony_ci	0x4343004343430043ULL, 0x1515001515150015ULL, 0xadad00adadad00adULL,
6228c2ecf20Sopenharmony_ci	0x7777007777770077ULL, 0x8080008080800080ULL, 0x8282008282820082ULL,
6238c2ecf20Sopenharmony_ci	0xecec00ececec00ecULL, 0x2727002727270027ULL, 0xe5e500e5e5e500e5ULL,
6248c2ecf20Sopenharmony_ci	0x8585008585850085ULL, 0x3535003535350035ULL, 0x0c0c000c0c0c000cULL,
6258c2ecf20Sopenharmony_ci	0x4141004141410041ULL, 0xefef00efefef00efULL, 0x9393009393930093ULL,
6268c2ecf20Sopenharmony_ci	0x1919001919190019ULL, 0x2121002121210021ULL, 0x0e0e000e0e0e000eULL,
6278c2ecf20Sopenharmony_ci	0x4e4e004e4e4e004eULL, 0x6565006565650065ULL, 0xbdbd00bdbdbd00bdULL,
6288c2ecf20Sopenharmony_ci	0xb8b800b8b8b800b8ULL, 0x8f8f008f8f8f008fULL, 0xebeb00ebebeb00ebULL,
6298c2ecf20Sopenharmony_ci	0xcece00cecece00ceULL, 0x3030003030300030ULL, 0x5f5f005f5f5f005fULL,
6308c2ecf20Sopenharmony_ci	0xc5c500c5c5c500c5ULL, 0x1a1a001a1a1a001aULL, 0xe1e100e1e1e100e1ULL,
6318c2ecf20Sopenharmony_ci	0xcaca00cacaca00caULL, 0x4747004747470047ULL, 0x3d3d003d3d3d003dULL,
6328c2ecf20Sopenharmony_ci	0x0101000101010001ULL, 0xd6d600d6d6d600d6ULL, 0x5656005656560056ULL,
6338c2ecf20Sopenharmony_ci	0x4d4d004d4d4d004dULL, 0x0d0d000d0d0d000dULL, 0x6666006666660066ULL,
6348c2ecf20Sopenharmony_ci	0xcccc00cccccc00ccULL, 0x2d2d002d2d2d002dULL, 0x1212001212120012ULL,
6358c2ecf20Sopenharmony_ci	0x2020002020200020ULL, 0xb1b100b1b1b100b1ULL, 0x9999009999990099ULL,
6368c2ecf20Sopenharmony_ci	0x4c4c004c4c4c004cULL, 0xc2c200c2c2c200c2ULL, 0x7e7e007e7e7e007eULL,
6378c2ecf20Sopenharmony_ci	0x0505000505050005ULL, 0xb7b700b7b7b700b7ULL, 0x3131003131310031ULL,
6388c2ecf20Sopenharmony_ci	0x1717001717170017ULL, 0xd7d700d7d7d700d7ULL, 0x5858005858580058ULL,
6398c2ecf20Sopenharmony_ci	0x6161006161610061ULL, 0x1b1b001b1b1b001bULL, 0x1c1c001c1c1c001cULL,
6408c2ecf20Sopenharmony_ci	0x0f0f000f0f0f000fULL, 0x1616001616160016ULL, 0x1818001818180018ULL,
6418c2ecf20Sopenharmony_ci	0x2222002222220022ULL, 0x4444004444440044ULL, 0xb2b200b2b2b200b2ULL,
6428c2ecf20Sopenharmony_ci	0xb5b500b5b5b500b5ULL, 0x9191009191910091ULL, 0x0808000808080008ULL,
6438c2ecf20Sopenharmony_ci	0xa8a800a8a8a800a8ULL, 0xfcfc00fcfcfc00fcULL, 0x5050005050500050ULL,
6448c2ecf20Sopenharmony_ci	0xd0d000d0d0d000d0ULL, 0x7d7d007d7d7d007dULL, 0x8989008989890089ULL,
6458c2ecf20Sopenharmony_ci	0x9797009797970097ULL, 0x5b5b005b5b5b005bULL, 0x9595009595950095ULL,
6468c2ecf20Sopenharmony_ci	0xffff00ffffff00ffULL, 0xd2d200d2d2d200d2ULL, 0xc4c400c4c4c400c4ULL,
6478c2ecf20Sopenharmony_ci	0x4848004848480048ULL, 0xf7f700f7f7f700f7ULL, 0xdbdb00dbdbdb00dbULL,
6488c2ecf20Sopenharmony_ci	0x0303000303030003ULL, 0xdada00dadada00daULL, 0x3f3f003f3f3f003fULL,
6498c2ecf20Sopenharmony_ci	0x9494009494940094ULL, 0x5c5c005c5c5c005cULL, 0x0202000202020002ULL,
6508c2ecf20Sopenharmony_ci	0x4a4a004a4a4a004aULL, 0x3333003333330033ULL, 0x6767006767670067ULL,
6518c2ecf20Sopenharmony_ci	0xf3f300f3f3f300f3ULL, 0x7f7f007f7f7f007fULL, 0xe2e200e2e2e200e2ULL,
6528c2ecf20Sopenharmony_ci	0x9b9b009b9b9b009bULL, 0x2626002626260026ULL, 0x3737003737370037ULL,
6538c2ecf20Sopenharmony_ci	0x3b3b003b3b3b003bULL, 0x9696009696960096ULL, 0x4b4b004b4b4b004bULL,
6548c2ecf20Sopenharmony_ci	0xbebe00bebebe00beULL, 0x2e2e002e2e2e002eULL, 0x7979007979790079ULL,
6558c2ecf20Sopenharmony_ci	0x8c8c008c8c8c008cULL, 0x6e6e006e6e6e006eULL, 0x8e8e008e8e8e008eULL,
6568c2ecf20Sopenharmony_ci	0xf5f500f5f5f500f5ULL, 0xb6b600b6b6b600b6ULL, 0xfdfd00fdfdfd00fdULL,
6578c2ecf20Sopenharmony_ci	0x5959005959590059ULL, 0x9898009898980098ULL, 0x6a6a006a6a6a006aULL,
6588c2ecf20Sopenharmony_ci	0x4646004646460046ULL, 0xbaba00bababa00baULL, 0x2525002525250025ULL,
6598c2ecf20Sopenharmony_ci	0x4242004242420042ULL, 0xa2a200a2a2a200a2ULL, 0xfafa00fafafa00faULL,
6608c2ecf20Sopenharmony_ci	0x0707000707070007ULL, 0x5555005555550055ULL, 0xeeee00eeeeee00eeULL,
6618c2ecf20Sopenharmony_ci	0x0a0a000a0a0a000aULL, 0x4949004949490049ULL, 0x6868006868680068ULL,
6628c2ecf20Sopenharmony_ci	0x3838003838380038ULL, 0xa4a400a4a4a400a4ULL, 0x2828002828280028ULL,
6638c2ecf20Sopenharmony_ci	0x7b7b007b7b7b007bULL, 0xc9c900c9c9c900c9ULL, 0xc1c100c1c1c100c1ULL,
6648c2ecf20Sopenharmony_ci	0xe3e300e3e3e300e3ULL, 0xf4f400f4f4f400f4ULL, 0xc7c700c7c7c700c7ULL,
6658c2ecf20Sopenharmony_ci	0x9e9e009e9e9e009eULL,
6668c2ecf20Sopenharmony_ci};
6678c2ecf20Sopenharmony_ci
6688c2ecf20Sopenharmony_ci__visible const u64 camellia_sp11101110[256] = {
6698c2ecf20Sopenharmony_ci	0x7070700070707000ULL, 0x8282820082828200ULL, 0x2c2c2c002c2c2c00ULL,
6708c2ecf20Sopenharmony_ci	0xececec00ececec00ULL, 0xb3b3b300b3b3b300ULL, 0x2727270027272700ULL,
6718c2ecf20Sopenharmony_ci	0xc0c0c000c0c0c000ULL, 0xe5e5e500e5e5e500ULL, 0xe4e4e400e4e4e400ULL,
6728c2ecf20Sopenharmony_ci	0x8585850085858500ULL, 0x5757570057575700ULL, 0x3535350035353500ULL,
6738c2ecf20Sopenharmony_ci	0xeaeaea00eaeaea00ULL, 0x0c0c0c000c0c0c00ULL, 0xaeaeae00aeaeae00ULL,
6748c2ecf20Sopenharmony_ci	0x4141410041414100ULL, 0x2323230023232300ULL, 0xefefef00efefef00ULL,
6758c2ecf20Sopenharmony_ci	0x6b6b6b006b6b6b00ULL, 0x9393930093939300ULL, 0x4545450045454500ULL,
6768c2ecf20Sopenharmony_ci	0x1919190019191900ULL, 0xa5a5a500a5a5a500ULL, 0x2121210021212100ULL,
6778c2ecf20Sopenharmony_ci	0xededed00ededed00ULL, 0x0e0e0e000e0e0e00ULL, 0x4f4f4f004f4f4f00ULL,
6788c2ecf20Sopenharmony_ci	0x4e4e4e004e4e4e00ULL, 0x1d1d1d001d1d1d00ULL, 0x6565650065656500ULL,
6798c2ecf20Sopenharmony_ci	0x9292920092929200ULL, 0xbdbdbd00bdbdbd00ULL, 0x8686860086868600ULL,
6808c2ecf20Sopenharmony_ci	0xb8b8b800b8b8b800ULL, 0xafafaf00afafaf00ULL, 0x8f8f8f008f8f8f00ULL,
6818c2ecf20Sopenharmony_ci	0x7c7c7c007c7c7c00ULL, 0xebebeb00ebebeb00ULL, 0x1f1f1f001f1f1f00ULL,
6828c2ecf20Sopenharmony_ci	0xcecece00cecece00ULL, 0x3e3e3e003e3e3e00ULL, 0x3030300030303000ULL,
6838c2ecf20Sopenharmony_ci	0xdcdcdc00dcdcdc00ULL, 0x5f5f5f005f5f5f00ULL, 0x5e5e5e005e5e5e00ULL,
6848c2ecf20Sopenharmony_ci	0xc5c5c500c5c5c500ULL, 0x0b0b0b000b0b0b00ULL, 0x1a1a1a001a1a1a00ULL,
6858c2ecf20Sopenharmony_ci	0xa6a6a600a6a6a600ULL, 0xe1e1e100e1e1e100ULL, 0x3939390039393900ULL,
6868c2ecf20Sopenharmony_ci	0xcacaca00cacaca00ULL, 0xd5d5d500d5d5d500ULL, 0x4747470047474700ULL,
6878c2ecf20Sopenharmony_ci	0x5d5d5d005d5d5d00ULL, 0x3d3d3d003d3d3d00ULL, 0xd9d9d900d9d9d900ULL,
6888c2ecf20Sopenharmony_ci	0x0101010001010100ULL, 0x5a5a5a005a5a5a00ULL, 0xd6d6d600d6d6d600ULL,
6898c2ecf20Sopenharmony_ci	0x5151510051515100ULL, 0x5656560056565600ULL, 0x6c6c6c006c6c6c00ULL,
6908c2ecf20Sopenharmony_ci	0x4d4d4d004d4d4d00ULL, 0x8b8b8b008b8b8b00ULL, 0x0d0d0d000d0d0d00ULL,
6918c2ecf20Sopenharmony_ci	0x9a9a9a009a9a9a00ULL, 0x6666660066666600ULL, 0xfbfbfb00fbfbfb00ULL,
6928c2ecf20Sopenharmony_ci	0xcccccc00cccccc00ULL, 0xb0b0b000b0b0b000ULL, 0x2d2d2d002d2d2d00ULL,
6938c2ecf20Sopenharmony_ci	0x7474740074747400ULL, 0x1212120012121200ULL, 0x2b2b2b002b2b2b00ULL,
6948c2ecf20Sopenharmony_ci	0x2020200020202000ULL, 0xf0f0f000f0f0f000ULL, 0xb1b1b100b1b1b100ULL,
6958c2ecf20Sopenharmony_ci	0x8484840084848400ULL, 0x9999990099999900ULL, 0xdfdfdf00dfdfdf00ULL,
6968c2ecf20Sopenharmony_ci	0x4c4c4c004c4c4c00ULL, 0xcbcbcb00cbcbcb00ULL, 0xc2c2c200c2c2c200ULL,
6978c2ecf20Sopenharmony_ci	0x3434340034343400ULL, 0x7e7e7e007e7e7e00ULL, 0x7676760076767600ULL,
6988c2ecf20Sopenharmony_ci	0x0505050005050500ULL, 0x6d6d6d006d6d6d00ULL, 0xb7b7b700b7b7b700ULL,
6998c2ecf20Sopenharmony_ci	0xa9a9a900a9a9a900ULL, 0x3131310031313100ULL, 0xd1d1d100d1d1d100ULL,
7008c2ecf20Sopenharmony_ci	0x1717170017171700ULL, 0x0404040004040400ULL, 0xd7d7d700d7d7d700ULL,
7018c2ecf20Sopenharmony_ci	0x1414140014141400ULL, 0x5858580058585800ULL, 0x3a3a3a003a3a3a00ULL,
7028c2ecf20Sopenharmony_ci	0x6161610061616100ULL, 0xdedede00dedede00ULL, 0x1b1b1b001b1b1b00ULL,
7038c2ecf20Sopenharmony_ci	0x1111110011111100ULL, 0x1c1c1c001c1c1c00ULL, 0x3232320032323200ULL,
7048c2ecf20Sopenharmony_ci	0x0f0f0f000f0f0f00ULL, 0x9c9c9c009c9c9c00ULL, 0x1616160016161600ULL,
7058c2ecf20Sopenharmony_ci	0x5353530053535300ULL, 0x1818180018181800ULL, 0xf2f2f200f2f2f200ULL,
7068c2ecf20Sopenharmony_ci	0x2222220022222200ULL, 0xfefefe00fefefe00ULL, 0x4444440044444400ULL,
7078c2ecf20Sopenharmony_ci	0xcfcfcf00cfcfcf00ULL, 0xb2b2b200b2b2b200ULL, 0xc3c3c300c3c3c300ULL,
7088c2ecf20Sopenharmony_ci	0xb5b5b500b5b5b500ULL, 0x7a7a7a007a7a7a00ULL, 0x9191910091919100ULL,
7098c2ecf20Sopenharmony_ci	0x2424240024242400ULL, 0x0808080008080800ULL, 0xe8e8e800e8e8e800ULL,
7108c2ecf20Sopenharmony_ci	0xa8a8a800a8a8a800ULL, 0x6060600060606000ULL, 0xfcfcfc00fcfcfc00ULL,
7118c2ecf20Sopenharmony_ci	0x6969690069696900ULL, 0x5050500050505000ULL, 0xaaaaaa00aaaaaa00ULL,
7128c2ecf20Sopenharmony_ci	0xd0d0d000d0d0d000ULL, 0xa0a0a000a0a0a000ULL, 0x7d7d7d007d7d7d00ULL,
7138c2ecf20Sopenharmony_ci	0xa1a1a100a1a1a100ULL, 0x8989890089898900ULL, 0x6262620062626200ULL,
7148c2ecf20Sopenharmony_ci	0x9797970097979700ULL, 0x5454540054545400ULL, 0x5b5b5b005b5b5b00ULL,
7158c2ecf20Sopenharmony_ci	0x1e1e1e001e1e1e00ULL, 0x9595950095959500ULL, 0xe0e0e000e0e0e000ULL,
7168c2ecf20Sopenharmony_ci	0xffffff00ffffff00ULL, 0x6464640064646400ULL, 0xd2d2d200d2d2d200ULL,
7178c2ecf20Sopenharmony_ci	0x1010100010101000ULL, 0xc4c4c400c4c4c400ULL, 0x0000000000000000ULL,
7188c2ecf20Sopenharmony_ci	0x4848480048484800ULL, 0xa3a3a300a3a3a300ULL, 0xf7f7f700f7f7f700ULL,
7198c2ecf20Sopenharmony_ci	0x7575750075757500ULL, 0xdbdbdb00dbdbdb00ULL, 0x8a8a8a008a8a8a00ULL,
7208c2ecf20Sopenharmony_ci	0x0303030003030300ULL, 0xe6e6e600e6e6e600ULL, 0xdadada00dadada00ULL,
7218c2ecf20Sopenharmony_ci	0x0909090009090900ULL, 0x3f3f3f003f3f3f00ULL, 0xdddddd00dddddd00ULL,
7228c2ecf20Sopenharmony_ci	0x9494940094949400ULL, 0x8787870087878700ULL, 0x5c5c5c005c5c5c00ULL,
7238c2ecf20Sopenharmony_ci	0x8383830083838300ULL, 0x0202020002020200ULL, 0xcdcdcd00cdcdcd00ULL,
7248c2ecf20Sopenharmony_ci	0x4a4a4a004a4a4a00ULL, 0x9090900090909000ULL, 0x3333330033333300ULL,
7258c2ecf20Sopenharmony_ci	0x7373730073737300ULL, 0x6767670067676700ULL, 0xf6f6f600f6f6f600ULL,
7268c2ecf20Sopenharmony_ci	0xf3f3f300f3f3f300ULL, 0x9d9d9d009d9d9d00ULL, 0x7f7f7f007f7f7f00ULL,
7278c2ecf20Sopenharmony_ci	0xbfbfbf00bfbfbf00ULL, 0xe2e2e200e2e2e200ULL, 0x5252520052525200ULL,
7288c2ecf20Sopenharmony_ci	0x9b9b9b009b9b9b00ULL, 0xd8d8d800d8d8d800ULL, 0x2626260026262600ULL,
7298c2ecf20Sopenharmony_ci	0xc8c8c800c8c8c800ULL, 0x3737370037373700ULL, 0xc6c6c600c6c6c600ULL,
7308c2ecf20Sopenharmony_ci	0x3b3b3b003b3b3b00ULL, 0x8181810081818100ULL, 0x9696960096969600ULL,
7318c2ecf20Sopenharmony_ci	0x6f6f6f006f6f6f00ULL, 0x4b4b4b004b4b4b00ULL, 0x1313130013131300ULL,
7328c2ecf20Sopenharmony_ci	0xbebebe00bebebe00ULL, 0x6363630063636300ULL, 0x2e2e2e002e2e2e00ULL,
7338c2ecf20Sopenharmony_ci	0xe9e9e900e9e9e900ULL, 0x7979790079797900ULL, 0xa7a7a700a7a7a700ULL,
7348c2ecf20Sopenharmony_ci	0x8c8c8c008c8c8c00ULL, 0x9f9f9f009f9f9f00ULL, 0x6e6e6e006e6e6e00ULL,
7358c2ecf20Sopenharmony_ci	0xbcbcbc00bcbcbc00ULL, 0x8e8e8e008e8e8e00ULL, 0x2929290029292900ULL,
7368c2ecf20Sopenharmony_ci	0xf5f5f500f5f5f500ULL, 0xf9f9f900f9f9f900ULL, 0xb6b6b600b6b6b600ULL,
7378c2ecf20Sopenharmony_ci	0x2f2f2f002f2f2f00ULL, 0xfdfdfd00fdfdfd00ULL, 0xb4b4b400b4b4b400ULL,
7388c2ecf20Sopenharmony_ci	0x5959590059595900ULL, 0x7878780078787800ULL, 0x9898980098989800ULL,
7398c2ecf20Sopenharmony_ci	0x0606060006060600ULL, 0x6a6a6a006a6a6a00ULL, 0xe7e7e700e7e7e700ULL,
7408c2ecf20Sopenharmony_ci	0x4646460046464600ULL, 0x7171710071717100ULL, 0xbababa00bababa00ULL,
7418c2ecf20Sopenharmony_ci	0xd4d4d400d4d4d400ULL, 0x2525250025252500ULL, 0xababab00ababab00ULL,
7428c2ecf20Sopenharmony_ci	0x4242420042424200ULL, 0x8888880088888800ULL, 0xa2a2a200a2a2a200ULL,
7438c2ecf20Sopenharmony_ci	0x8d8d8d008d8d8d00ULL, 0xfafafa00fafafa00ULL, 0x7272720072727200ULL,
7448c2ecf20Sopenharmony_ci	0x0707070007070700ULL, 0xb9b9b900b9b9b900ULL, 0x5555550055555500ULL,
7458c2ecf20Sopenharmony_ci	0xf8f8f800f8f8f800ULL, 0xeeeeee00eeeeee00ULL, 0xacacac00acacac00ULL,
7468c2ecf20Sopenharmony_ci	0x0a0a0a000a0a0a00ULL, 0x3636360036363600ULL, 0x4949490049494900ULL,
7478c2ecf20Sopenharmony_ci	0x2a2a2a002a2a2a00ULL, 0x6868680068686800ULL, 0x3c3c3c003c3c3c00ULL,
7488c2ecf20Sopenharmony_ci	0x3838380038383800ULL, 0xf1f1f100f1f1f100ULL, 0xa4a4a400a4a4a400ULL,
7498c2ecf20Sopenharmony_ci	0x4040400040404000ULL, 0x2828280028282800ULL, 0xd3d3d300d3d3d300ULL,
7508c2ecf20Sopenharmony_ci	0x7b7b7b007b7b7b00ULL, 0xbbbbbb00bbbbbb00ULL, 0xc9c9c900c9c9c900ULL,
7518c2ecf20Sopenharmony_ci	0x4343430043434300ULL, 0xc1c1c100c1c1c100ULL, 0x1515150015151500ULL,
7528c2ecf20Sopenharmony_ci	0xe3e3e300e3e3e300ULL, 0xadadad00adadad00ULL, 0xf4f4f400f4f4f400ULL,
7538c2ecf20Sopenharmony_ci	0x7777770077777700ULL, 0xc7c7c700c7c7c700ULL, 0x8080800080808000ULL,
7548c2ecf20Sopenharmony_ci	0x9e9e9e009e9e9e00ULL,
7558c2ecf20Sopenharmony_ci};
7568c2ecf20Sopenharmony_ci
7578c2ecf20Sopenharmony_ci/* key constants */
7588c2ecf20Sopenharmony_ci#define CAMELLIA_SIGMA1L (0xA09E667FL)
7598c2ecf20Sopenharmony_ci#define CAMELLIA_SIGMA1R (0x3BCC908BL)
7608c2ecf20Sopenharmony_ci#define CAMELLIA_SIGMA2L (0xB67AE858L)
7618c2ecf20Sopenharmony_ci#define CAMELLIA_SIGMA2R (0x4CAA73B2L)
7628c2ecf20Sopenharmony_ci#define CAMELLIA_SIGMA3L (0xC6EF372FL)
7638c2ecf20Sopenharmony_ci#define CAMELLIA_SIGMA3R (0xE94F82BEL)
7648c2ecf20Sopenharmony_ci#define CAMELLIA_SIGMA4L (0x54FF53A5L)
7658c2ecf20Sopenharmony_ci#define CAMELLIA_SIGMA4R (0xF1D36F1CL)
7668c2ecf20Sopenharmony_ci#define CAMELLIA_SIGMA5L (0x10E527FAL)
7678c2ecf20Sopenharmony_ci#define CAMELLIA_SIGMA5R (0xDE682D1DL)
7688c2ecf20Sopenharmony_ci#define CAMELLIA_SIGMA6L (0xB05688C2L)
7698c2ecf20Sopenharmony_ci#define CAMELLIA_SIGMA6R (0xB3E6C1FDL)
7708c2ecf20Sopenharmony_ci
7718c2ecf20Sopenharmony_ci/* macros */
7728c2ecf20Sopenharmony_ci#define ROLDQ(l, r, bits) ({ \
7738c2ecf20Sopenharmony_ci	u64 t = l;					\
7748c2ecf20Sopenharmony_ci	l = (l << bits) | (r >> (64 - bits));		\
7758c2ecf20Sopenharmony_ci	r = (r << bits) | (t >> (64 - bits));		\
7768c2ecf20Sopenharmony_ci})
7778c2ecf20Sopenharmony_ci
7788c2ecf20Sopenharmony_ci#define CAMELLIA_F(x, kl, kr, y) ({ \
7798c2ecf20Sopenharmony_ci	u64 ii = x ^ (((u64)kl << 32) | kr);				\
7808c2ecf20Sopenharmony_ci	y = camellia_sp11101110[(uint8_t)ii];				\
7818c2ecf20Sopenharmony_ci	y ^= camellia_sp44044404[(uint8_t)(ii >> 8)];			\
7828c2ecf20Sopenharmony_ci	ii >>= 16;							\
7838c2ecf20Sopenharmony_ci	y ^= camellia_sp30333033[(uint8_t)ii];				\
7848c2ecf20Sopenharmony_ci	y ^= camellia_sp02220222[(uint8_t)(ii >> 8)];			\
7858c2ecf20Sopenharmony_ci	ii >>= 16;							\
7868c2ecf20Sopenharmony_ci	y ^= camellia_sp00444404[(uint8_t)ii];				\
7878c2ecf20Sopenharmony_ci	y ^= camellia_sp03303033[(uint8_t)(ii >> 8)];			\
7888c2ecf20Sopenharmony_ci	ii >>= 16;							\
7898c2ecf20Sopenharmony_ci	y ^= camellia_sp22000222[(uint8_t)ii];				\
7908c2ecf20Sopenharmony_ci	y ^= camellia_sp10011110[(uint8_t)(ii >> 8)];			\
7918c2ecf20Sopenharmony_ci	y = ror64(y, 32);						\
7928c2ecf20Sopenharmony_ci})
7938c2ecf20Sopenharmony_ci
7948c2ecf20Sopenharmony_ci#define SET_SUBKEY_LR(INDEX, sRL) (subkey[(INDEX)] = ror64((sRL), 32))
7958c2ecf20Sopenharmony_ci
7968c2ecf20Sopenharmony_cistatic void camellia_setup_tail(u64 *subkey, u64 *subRL, int max)
7978c2ecf20Sopenharmony_ci{
7988c2ecf20Sopenharmony_ci	u64 kw4, tt;
7998c2ecf20Sopenharmony_ci	u32 dw, tl, tr;
8008c2ecf20Sopenharmony_ci
8018c2ecf20Sopenharmony_ci	/* absorb kw2 to other subkeys */
8028c2ecf20Sopenharmony_ci	/* round 2 */
8038c2ecf20Sopenharmony_ci	subRL[3] ^= subRL[1];
8048c2ecf20Sopenharmony_ci	/* round 4 */
8058c2ecf20Sopenharmony_ci	subRL[5] ^= subRL[1];
8068c2ecf20Sopenharmony_ci	/* round 6 */
8078c2ecf20Sopenharmony_ci	subRL[7] ^= subRL[1];
8088c2ecf20Sopenharmony_ci
8098c2ecf20Sopenharmony_ci	subRL[1] ^= (subRL[1] & ~subRL[9]) << 32;
8108c2ecf20Sopenharmony_ci	/* modified for FLinv(kl2) */
8118c2ecf20Sopenharmony_ci	dw = (subRL[1] & subRL[9]) >> 32;
8128c2ecf20Sopenharmony_ci	subRL[1] ^= rol32(dw, 1);
8138c2ecf20Sopenharmony_ci
8148c2ecf20Sopenharmony_ci	/* round 8 */
8158c2ecf20Sopenharmony_ci	subRL[11] ^= subRL[1];
8168c2ecf20Sopenharmony_ci	/* round 10 */
8178c2ecf20Sopenharmony_ci	subRL[13] ^= subRL[1];
8188c2ecf20Sopenharmony_ci	/* round 12 */
8198c2ecf20Sopenharmony_ci	subRL[15] ^= subRL[1];
8208c2ecf20Sopenharmony_ci
8218c2ecf20Sopenharmony_ci	subRL[1] ^= (subRL[1] & ~subRL[17]) << 32;
8228c2ecf20Sopenharmony_ci	/* modified for FLinv(kl4) */
8238c2ecf20Sopenharmony_ci	dw = (subRL[1] & subRL[17]) >> 32;
8248c2ecf20Sopenharmony_ci	subRL[1] ^= rol32(dw, 1);
8258c2ecf20Sopenharmony_ci
8268c2ecf20Sopenharmony_ci	/* round 14 */
8278c2ecf20Sopenharmony_ci	subRL[19] ^= subRL[1];
8288c2ecf20Sopenharmony_ci	/* round 16 */
8298c2ecf20Sopenharmony_ci	subRL[21] ^= subRL[1];
8308c2ecf20Sopenharmony_ci	/* round 18 */
8318c2ecf20Sopenharmony_ci	subRL[23] ^= subRL[1];
8328c2ecf20Sopenharmony_ci
8338c2ecf20Sopenharmony_ci	if (max == 24) {
8348c2ecf20Sopenharmony_ci		/* kw3 */
8358c2ecf20Sopenharmony_ci		subRL[24] ^= subRL[1];
8368c2ecf20Sopenharmony_ci
8378c2ecf20Sopenharmony_ci		/* absorb kw4 to other subkeys */
8388c2ecf20Sopenharmony_ci		kw4 = subRL[25];
8398c2ecf20Sopenharmony_ci	} else {
8408c2ecf20Sopenharmony_ci		subRL[1] ^= (subRL[1] & ~subRL[25]) << 32;
8418c2ecf20Sopenharmony_ci		/* modified for FLinv(kl6) */
8428c2ecf20Sopenharmony_ci		dw = (subRL[1] & subRL[25]) >> 32;
8438c2ecf20Sopenharmony_ci		subRL[1] ^= rol32(dw, 1);
8448c2ecf20Sopenharmony_ci
8458c2ecf20Sopenharmony_ci		/* round 20 */
8468c2ecf20Sopenharmony_ci		subRL[27] ^= subRL[1];
8478c2ecf20Sopenharmony_ci		/* round 22 */
8488c2ecf20Sopenharmony_ci		subRL[29] ^= subRL[1];
8498c2ecf20Sopenharmony_ci		/* round 24 */
8508c2ecf20Sopenharmony_ci		subRL[31] ^= subRL[1];
8518c2ecf20Sopenharmony_ci		/* kw3 */
8528c2ecf20Sopenharmony_ci		subRL[32] ^= subRL[1];
8538c2ecf20Sopenharmony_ci
8548c2ecf20Sopenharmony_ci		/* absorb kw4 to other subkeys */
8558c2ecf20Sopenharmony_ci		kw4 = subRL[33];
8568c2ecf20Sopenharmony_ci		/* round 23 */
8578c2ecf20Sopenharmony_ci		subRL[30] ^= kw4;
8588c2ecf20Sopenharmony_ci		/* round 21 */
8598c2ecf20Sopenharmony_ci		subRL[28] ^= kw4;
8608c2ecf20Sopenharmony_ci		/* round 19 */
8618c2ecf20Sopenharmony_ci		subRL[26] ^= kw4;
8628c2ecf20Sopenharmony_ci
8638c2ecf20Sopenharmony_ci		kw4 ^= (kw4 & ~subRL[24]) << 32;
8648c2ecf20Sopenharmony_ci		/* modified for FL(kl5) */
8658c2ecf20Sopenharmony_ci		dw = (kw4 & subRL[24]) >> 32;
8668c2ecf20Sopenharmony_ci		kw4 ^= rol32(dw, 1);
8678c2ecf20Sopenharmony_ci	}
8688c2ecf20Sopenharmony_ci
8698c2ecf20Sopenharmony_ci	/* round 17 */
8708c2ecf20Sopenharmony_ci	subRL[22] ^= kw4;
8718c2ecf20Sopenharmony_ci	/* round 15 */
8728c2ecf20Sopenharmony_ci	subRL[20] ^= kw4;
8738c2ecf20Sopenharmony_ci	/* round 13 */
8748c2ecf20Sopenharmony_ci	subRL[18] ^= kw4;
8758c2ecf20Sopenharmony_ci
8768c2ecf20Sopenharmony_ci	kw4 ^= (kw4 & ~subRL[16]) << 32;
8778c2ecf20Sopenharmony_ci	/* modified for FL(kl3) */
8788c2ecf20Sopenharmony_ci	dw = (kw4 & subRL[16]) >> 32;
8798c2ecf20Sopenharmony_ci	kw4 ^= rol32(dw, 1);
8808c2ecf20Sopenharmony_ci
8818c2ecf20Sopenharmony_ci	/* round 11 */
8828c2ecf20Sopenharmony_ci	subRL[14] ^= kw4;
8838c2ecf20Sopenharmony_ci	/* round 9 */
8848c2ecf20Sopenharmony_ci	subRL[12] ^= kw4;
8858c2ecf20Sopenharmony_ci	/* round 7 */
8868c2ecf20Sopenharmony_ci	subRL[10] ^= kw4;
8878c2ecf20Sopenharmony_ci
8888c2ecf20Sopenharmony_ci	kw4 ^= (kw4 & ~subRL[8]) << 32;
8898c2ecf20Sopenharmony_ci	/* modified for FL(kl1) */
8908c2ecf20Sopenharmony_ci	dw = (kw4 & subRL[8]) >> 32;
8918c2ecf20Sopenharmony_ci	kw4 ^= rol32(dw, 1);
8928c2ecf20Sopenharmony_ci
8938c2ecf20Sopenharmony_ci	/* round 5 */
8948c2ecf20Sopenharmony_ci	subRL[6] ^= kw4;
8958c2ecf20Sopenharmony_ci	/* round 3 */
8968c2ecf20Sopenharmony_ci	subRL[4] ^= kw4;
8978c2ecf20Sopenharmony_ci	/* round 1 */
8988c2ecf20Sopenharmony_ci	subRL[2] ^= kw4;
8998c2ecf20Sopenharmony_ci	/* kw1 */
9008c2ecf20Sopenharmony_ci	subRL[0] ^= kw4;
9018c2ecf20Sopenharmony_ci
9028c2ecf20Sopenharmony_ci	/* key XOR is end of F-function */
9038c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(0, subRL[0] ^ subRL[2]);			/* kw1 */
9048c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(2, subRL[3]);				/* round 1 */
9058c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(3, subRL[2] ^ subRL[4]);			/* round 2 */
9068c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(4, subRL[3] ^ subRL[5]);			/* round 3 */
9078c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(5, subRL[4] ^ subRL[6]);			/* round 4 */
9088c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(6, subRL[5] ^ subRL[7]);			/* round 5 */
9098c2ecf20Sopenharmony_ci
9108c2ecf20Sopenharmony_ci	tl = (subRL[10] >> 32) ^ (subRL[10] & ~subRL[8]);
9118c2ecf20Sopenharmony_ci	dw = tl & (subRL[8] >> 32);				/* FL(kl1) */
9128c2ecf20Sopenharmony_ci	tr = subRL[10] ^ rol32(dw, 1);
9138c2ecf20Sopenharmony_ci	tt = (tr | ((u64)tl << 32));
9148c2ecf20Sopenharmony_ci
9158c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(7, subRL[6] ^ tt);			/* round 6 */
9168c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(8, subRL[8]);				/* FL(kl1) */
9178c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(9, subRL[9]);				/* FLinv(kl2) */
9188c2ecf20Sopenharmony_ci
9198c2ecf20Sopenharmony_ci	tl = (subRL[7] >> 32) ^ (subRL[7] & ~subRL[9]);
9208c2ecf20Sopenharmony_ci	dw = tl & (subRL[9] >> 32);				/* FLinv(kl2) */
9218c2ecf20Sopenharmony_ci	tr = subRL[7] ^ rol32(dw, 1);
9228c2ecf20Sopenharmony_ci	tt = (tr | ((u64)tl << 32));
9238c2ecf20Sopenharmony_ci
9248c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(10, subRL[11] ^ tt);			/* round 7 */
9258c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(11, subRL[10] ^ subRL[12]);		/* round 8 */
9268c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(12, subRL[11] ^ subRL[13]);		/* round 9 */
9278c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(13, subRL[12] ^ subRL[14]);		/* round 10 */
9288c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(14, subRL[13] ^ subRL[15]);		/* round 11 */
9298c2ecf20Sopenharmony_ci
9308c2ecf20Sopenharmony_ci	tl = (subRL[18] >> 32) ^ (subRL[18] & ~subRL[16]);
9318c2ecf20Sopenharmony_ci	dw = tl & (subRL[16] >> 32);				/* FL(kl3) */
9328c2ecf20Sopenharmony_ci	tr = subRL[18] ^ rol32(dw, 1);
9338c2ecf20Sopenharmony_ci	tt = (tr | ((u64)tl << 32));
9348c2ecf20Sopenharmony_ci
9358c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(15, subRL[14] ^ tt);			/* round 12 */
9368c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(16, subRL[16]);				/* FL(kl3) */
9378c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(17, subRL[17]);				/* FLinv(kl4) */
9388c2ecf20Sopenharmony_ci
9398c2ecf20Sopenharmony_ci	tl = (subRL[15] >> 32) ^ (subRL[15] & ~subRL[17]);
9408c2ecf20Sopenharmony_ci	dw = tl & (subRL[17] >> 32);				/* FLinv(kl4) */
9418c2ecf20Sopenharmony_ci	tr = subRL[15] ^ rol32(dw, 1);
9428c2ecf20Sopenharmony_ci	tt = (tr | ((u64)tl << 32));
9438c2ecf20Sopenharmony_ci
9448c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(18, subRL[19] ^ tt);			/* round 13 */
9458c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(19, subRL[18] ^ subRL[20]);		/* round 14 */
9468c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(20, subRL[19] ^ subRL[21]);		/* round 15 */
9478c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(21, subRL[20] ^ subRL[22]);		/* round 16 */
9488c2ecf20Sopenharmony_ci	SET_SUBKEY_LR(22, subRL[21] ^ subRL[23]);		/* round 17 */
9498c2ecf20Sopenharmony_ci
9508c2ecf20Sopenharmony_ci	if (max == 24) {
9518c2ecf20Sopenharmony_ci		SET_SUBKEY_LR(23, subRL[22]);			/* round 18 */
9528c2ecf20Sopenharmony_ci		SET_SUBKEY_LR(24, subRL[24] ^ subRL[23]);	/* kw3 */
9538c2ecf20Sopenharmony_ci	} else {
9548c2ecf20Sopenharmony_ci		tl = (subRL[26] >> 32) ^ (subRL[26] & ~subRL[24]);
9558c2ecf20Sopenharmony_ci		dw = tl & (subRL[24] >> 32);			/* FL(kl5) */
9568c2ecf20Sopenharmony_ci		tr = subRL[26] ^ rol32(dw, 1);
9578c2ecf20Sopenharmony_ci		tt = (tr | ((u64)tl << 32));
9588c2ecf20Sopenharmony_ci
9598c2ecf20Sopenharmony_ci		SET_SUBKEY_LR(23, subRL[22] ^ tt);		/* round 18 */
9608c2ecf20Sopenharmony_ci		SET_SUBKEY_LR(24, subRL[24]);			/* FL(kl5) */
9618c2ecf20Sopenharmony_ci		SET_SUBKEY_LR(25, subRL[25]);			/* FLinv(kl6) */
9628c2ecf20Sopenharmony_ci
9638c2ecf20Sopenharmony_ci		tl = (subRL[23] >> 32) ^ (subRL[23] & ~subRL[25]);
9648c2ecf20Sopenharmony_ci		dw = tl & (subRL[25] >> 32);			/* FLinv(kl6) */
9658c2ecf20Sopenharmony_ci		tr = subRL[23] ^ rol32(dw, 1);
9668c2ecf20Sopenharmony_ci		tt = (tr | ((u64)tl << 32));
9678c2ecf20Sopenharmony_ci
9688c2ecf20Sopenharmony_ci		SET_SUBKEY_LR(26, subRL[27] ^ tt);		/* round 19 */
9698c2ecf20Sopenharmony_ci		SET_SUBKEY_LR(27, subRL[26] ^ subRL[28]);	/* round 20 */
9708c2ecf20Sopenharmony_ci		SET_SUBKEY_LR(28, subRL[27] ^ subRL[29]);	/* round 21 */
9718c2ecf20Sopenharmony_ci		SET_SUBKEY_LR(29, subRL[28] ^ subRL[30]);	/* round 22 */
9728c2ecf20Sopenharmony_ci		SET_SUBKEY_LR(30, subRL[29] ^ subRL[31]);	/* round 23 */
9738c2ecf20Sopenharmony_ci		SET_SUBKEY_LR(31, subRL[30]);			/* round 24 */
9748c2ecf20Sopenharmony_ci		SET_SUBKEY_LR(32, subRL[32] ^ subRL[31]);	/* kw3 */
9758c2ecf20Sopenharmony_ci	}
9768c2ecf20Sopenharmony_ci}
9778c2ecf20Sopenharmony_ci
9788c2ecf20Sopenharmony_cistatic void camellia_setup128(const unsigned char *key, u64 *subkey)
9798c2ecf20Sopenharmony_ci{
9808c2ecf20Sopenharmony_ci	u64 kl, kr, ww;
9818c2ecf20Sopenharmony_ci	u64 subRL[26];
9828c2ecf20Sopenharmony_ci
9838c2ecf20Sopenharmony_ci	/**
9848c2ecf20Sopenharmony_ci	 *  k == kl || kr (|| is concatenation)
9858c2ecf20Sopenharmony_ci	 */
9868c2ecf20Sopenharmony_ci	kl = get_unaligned_be64(key);
9878c2ecf20Sopenharmony_ci	kr = get_unaligned_be64(key + 8);
9888c2ecf20Sopenharmony_ci
9898c2ecf20Sopenharmony_ci	/* generate KL dependent subkeys */
9908c2ecf20Sopenharmony_ci	/* kw1 */
9918c2ecf20Sopenharmony_ci	subRL[0] = kl;
9928c2ecf20Sopenharmony_ci	/* kw2 */
9938c2ecf20Sopenharmony_ci	subRL[1] = kr;
9948c2ecf20Sopenharmony_ci
9958c2ecf20Sopenharmony_ci	/* rotation left shift 15bit */
9968c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 15);
9978c2ecf20Sopenharmony_ci
9988c2ecf20Sopenharmony_ci	/* k3 */
9998c2ecf20Sopenharmony_ci	subRL[4] = kl;
10008c2ecf20Sopenharmony_ci	/* k4 */
10018c2ecf20Sopenharmony_ci	subRL[5] = kr;
10028c2ecf20Sopenharmony_ci
10038c2ecf20Sopenharmony_ci	/* rotation left shift 15+30bit */
10048c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 30);
10058c2ecf20Sopenharmony_ci
10068c2ecf20Sopenharmony_ci	/* k7 */
10078c2ecf20Sopenharmony_ci	subRL[10] = kl;
10088c2ecf20Sopenharmony_ci	/* k8 */
10098c2ecf20Sopenharmony_ci	subRL[11] = kr;
10108c2ecf20Sopenharmony_ci
10118c2ecf20Sopenharmony_ci	/* rotation left shift 15+30+15bit */
10128c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 15);
10138c2ecf20Sopenharmony_ci
10148c2ecf20Sopenharmony_ci	/* k10 */
10158c2ecf20Sopenharmony_ci	subRL[13] = kr;
10168c2ecf20Sopenharmony_ci	/* rotation left shift 15+30+15+17 bit */
10178c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 17);
10188c2ecf20Sopenharmony_ci
10198c2ecf20Sopenharmony_ci	/* kl3 */
10208c2ecf20Sopenharmony_ci	subRL[16] = kl;
10218c2ecf20Sopenharmony_ci	/* kl4 */
10228c2ecf20Sopenharmony_ci	subRL[17] = kr;
10238c2ecf20Sopenharmony_ci
10248c2ecf20Sopenharmony_ci	/* rotation left shift 15+30+15+17+17 bit */
10258c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 17);
10268c2ecf20Sopenharmony_ci
10278c2ecf20Sopenharmony_ci	/* k13 */
10288c2ecf20Sopenharmony_ci	subRL[18] = kl;
10298c2ecf20Sopenharmony_ci	/* k14 */
10308c2ecf20Sopenharmony_ci	subRL[19] = kr;
10318c2ecf20Sopenharmony_ci
10328c2ecf20Sopenharmony_ci	/* rotation left shift 15+30+15+17+17+17 bit */
10338c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 17);
10348c2ecf20Sopenharmony_ci
10358c2ecf20Sopenharmony_ci	/* k17 */
10368c2ecf20Sopenharmony_ci	subRL[22] = kl;
10378c2ecf20Sopenharmony_ci	/* k18 */
10388c2ecf20Sopenharmony_ci	subRL[23] = kr;
10398c2ecf20Sopenharmony_ci
10408c2ecf20Sopenharmony_ci	/* generate KA */
10418c2ecf20Sopenharmony_ci	kl = subRL[0];
10428c2ecf20Sopenharmony_ci	kr = subRL[1];
10438c2ecf20Sopenharmony_ci	CAMELLIA_F(kl, CAMELLIA_SIGMA1L, CAMELLIA_SIGMA1R, ww);
10448c2ecf20Sopenharmony_ci	kr ^= ww;
10458c2ecf20Sopenharmony_ci	CAMELLIA_F(kr, CAMELLIA_SIGMA2L, CAMELLIA_SIGMA2R, kl);
10468c2ecf20Sopenharmony_ci
10478c2ecf20Sopenharmony_ci	/* current status == (kll, klr, w0, w1) */
10488c2ecf20Sopenharmony_ci	CAMELLIA_F(kl, CAMELLIA_SIGMA3L, CAMELLIA_SIGMA3R, kr);
10498c2ecf20Sopenharmony_ci	kr ^= ww;
10508c2ecf20Sopenharmony_ci	CAMELLIA_F(kr, CAMELLIA_SIGMA4L, CAMELLIA_SIGMA4R, ww);
10518c2ecf20Sopenharmony_ci	kl ^= ww;
10528c2ecf20Sopenharmony_ci
10538c2ecf20Sopenharmony_ci	/* generate KA dependent subkeys */
10548c2ecf20Sopenharmony_ci	/* k1, k2 */
10558c2ecf20Sopenharmony_ci	subRL[2] = kl;
10568c2ecf20Sopenharmony_ci	subRL[3] = kr;
10578c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 15);
10588c2ecf20Sopenharmony_ci	/* k5,k6 */
10598c2ecf20Sopenharmony_ci	subRL[6] = kl;
10608c2ecf20Sopenharmony_ci	subRL[7] = kr;
10618c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 15);
10628c2ecf20Sopenharmony_ci	/* kl1, kl2 */
10638c2ecf20Sopenharmony_ci	subRL[8] = kl;
10648c2ecf20Sopenharmony_ci	subRL[9] = kr;
10658c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 15);
10668c2ecf20Sopenharmony_ci	/* k9 */
10678c2ecf20Sopenharmony_ci	subRL[12] = kl;
10688c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 15);
10698c2ecf20Sopenharmony_ci	/* k11, k12 */
10708c2ecf20Sopenharmony_ci	subRL[14] = kl;
10718c2ecf20Sopenharmony_ci	subRL[15] = kr;
10728c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 34);
10738c2ecf20Sopenharmony_ci	/* k15, k16 */
10748c2ecf20Sopenharmony_ci	subRL[20] = kl;
10758c2ecf20Sopenharmony_ci	subRL[21] = kr;
10768c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 17);
10778c2ecf20Sopenharmony_ci	/* kw3, kw4 */
10788c2ecf20Sopenharmony_ci	subRL[24] = kl;
10798c2ecf20Sopenharmony_ci	subRL[25] = kr;
10808c2ecf20Sopenharmony_ci
10818c2ecf20Sopenharmony_ci	camellia_setup_tail(subkey, subRL, 24);
10828c2ecf20Sopenharmony_ci}
10838c2ecf20Sopenharmony_ci
10848c2ecf20Sopenharmony_cistatic void camellia_setup256(const unsigned char *key, u64 *subkey)
10858c2ecf20Sopenharmony_ci{
10868c2ecf20Sopenharmony_ci	u64 kl, kr;			/* left half of key */
10878c2ecf20Sopenharmony_ci	u64 krl, krr;			/* right half of key */
10888c2ecf20Sopenharmony_ci	u64 ww;				/* temporary variables */
10898c2ecf20Sopenharmony_ci	u64 subRL[34];
10908c2ecf20Sopenharmony_ci
10918c2ecf20Sopenharmony_ci	/**
10928c2ecf20Sopenharmony_ci	 *  key = (kl || kr || krl || krr) (|| is concatenation)
10938c2ecf20Sopenharmony_ci	 */
10948c2ecf20Sopenharmony_ci	kl = get_unaligned_be64(key);
10958c2ecf20Sopenharmony_ci	kr = get_unaligned_be64(key + 8);
10968c2ecf20Sopenharmony_ci	krl = get_unaligned_be64(key + 16);
10978c2ecf20Sopenharmony_ci	krr = get_unaligned_be64(key + 24);
10988c2ecf20Sopenharmony_ci
10998c2ecf20Sopenharmony_ci	/* generate KL dependent subkeys */
11008c2ecf20Sopenharmony_ci	/* kw1 */
11018c2ecf20Sopenharmony_ci	subRL[0] = kl;
11028c2ecf20Sopenharmony_ci	/* kw2 */
11038c2ecf20Sopenharmony_ci	subRL[1] = kr;
11048c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 45);
11058c2ecf20Sopenharmony_ci	/* k9 */
11068c2ecf20Sopenharmony_ci	subRL[12] = kl;
11078c2ecf20Sopenharmony_ci	/* k10 */
11088c2ecf20Sopenharmony_ci	subRL[13] = kr;
11098c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 15);
11108c2ecf20Sopenharmony_ci	/* kl3 */
11118c2ecf20Sopenharmony_ci	subRL[16] = kl;
11128c2ecf20Sopenharmony_ci	/* kl4 */
11138c2ecf20Sopenharmony_ci	subRL[17] = kr;
11148c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 17);
11158c2ecf20Sopenharmony_ci	/* k17 */
11168c2ecf20Sopenharmony_ci	subRL[22] = kl;
11178c2ecf20Sopenharmony_ci	/* k18 */
11188c2ecf20Sopenharmony_ci	subRL[23] = kr;
11198c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 34);
11208c2ecf20Sopenharmony_ci	/* k23 */
11218c2ecf20Sopenharmony_ci	subRL[30] = kl;
11228c2ecf20Sopenharmony_ci	/* k24 */
11238c2ecf20Sopenharmony_ci	subRL[31] = kr;
11248c2ecf20Sopenharmony_ci
11258c2ecf20Sopenharmony_ci	/* generate KR dependent subkeys */
11268c2ecf20Sopenharmony_ci	ROLDQ(krl, krr, 15);
11278c2ecf20Sopenharmony_ci	/* k3 */
11288c2ecf20Sopenharmony_ci	subRL[4] = krl;
11298c2ecf20Sopenharmony_ci	/* k4 */
11308c2ecf20Sopenharmony_ci	subRL[5] = krr;
11318c2ecf20Sopenharmony_ci	ROLDQ(krl, krr, 15);
11328c2ecf20Sopenharmony_ci	/* kl1 */
11338c2ecf20Sopenharmony_ci	subRL[8] = krl;
11348c2ecf20Sopenharmony_ci	/* kl2 */
11358c2ecf20Sopenharmony_ci	subRL[9] = krr;
11368c2ecf20Sopenharmony_ci	ROLDQ(krl, krr, 30);
11378c2ecf20Sopenharmony_ci	/* k13 */
11388c2ecf20Sopenharmony_ci	subRL[18] = krl;
11398c2ecf20Sopenharmony_ci	/* k14 */
11408c2ecf20Sopenharmony_ci	subRL[19] = krr;
11418c2ecf20Sopenharmony_ci	ROLDQ(krl, krr, 34);
11428c2ecf20Sopenharmony_ci	/* k19 */
11438c2ecf20Sopenharmony_ci	subRL[26] = krl;
11448c2ecf20Sopenharmony_ci	/* k20 */
11458c2ecf20Sopenharmony_ci	subRL[27] = krr;
11468c2ecf20Sopenharmony_ci	ROLDQ(krl, krr, 34);
11478c2ecf20Sopenharmony_ci
11488c2ecf20Sopenharmony_ci	/* generate KA */
11498c2ecf20Sopenharmony_ci	kl = subRL[0] ^ krl;
11508c2ecf20Sopenharmony_ci	kr = subRL[1] ^ krr;
11518c2ecf20Sopenharmony_ci
11528c2ecf20Sopenharmony_ci	CAMELLIA_F(kl, CAMELLIA_SIGMA1L, CAMELLIA_SIGMA1R, ww);
11538c2ecf20Sopenharmony_ci	kr ^= ww;
11548c2ecf20Sopenharmony_ci	CAMELLIA_F(kr, CAMELLIA_SIGMA2L, CAMELLIA_SIGMA2R, kl);
11558c2ecf20Sopenharmony_ci	kl ^= krl;
11568c2ecf20Sopenharmony_ci	CAMELLIA_F(kl, CAMELLIA_SIGMA3L, CAMELLIA_SIGMA3R, kr);
11578c2ecf20Sopenharmony_ci	kr ^= ww ^ krr;
11588c2ecf20Sopenharmony_ci	CAMELLIA_F(kr, CAMELLIA_SIGMA4L, CAMELLIA_SIGMA4R, ww);
11598c2ecf20Sopenharmony_ci	kl ^= ww;
11608c2ecf20Sopenharmony_ci
11618c2ecf20Sopenharmony_ci	/* generate KB */
11628c2ecf20Sopenharmony_ci	krl ^= kl;
11638c2ecf20Sopenharmony_ci	krr ^= kr;
11648c2ecf20Sopenharmony_ci	CAMELLIA_F(krl, CAMELLIA_SIGMA5L, CAMELLIA_SIGMA5R, ww);
11658c2ecf20Sopenharmony_ci	krr ^= ww;
11668c2ecf20Sopenharmony_ci	CAMELLIA_F(krr, CAMELLIA_SIGMA6L, CAMELLIA_SIGMA6R, ww);
11678c2ecf20Sopenharmony_ci	krl ^= ww;
11688c2ecf20Sopenharmony_ci
11698c2ecf20Sopenharmony_ci	/* generate KA dependent subkeys */
11708c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 15);
11718c2ecf20Sopenharmony_ci	/* k5 */
11728c2ecf20Sopenharmony_ci	subRL[6] = kl;
11738c2ecf20Sopenharmony_ci	/* k6 */
11748c2ecf20Sopenharmony_ci	subRL[7] = kr;
11758c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 30);
11768c2ecf20Sopenharmony_ci	/* k11 */
11778c2ecf20Sopenharmony_ci	subRL[14] = kl;
11788c2ecf20Sopenharmony_ci	/* k12 */
11798c2ecf20Sopenharmony_ci	subRL[15] = kr;
11808c2ecf20Sopenharmony_ci	/* rotation left shift 32bit */
11818c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 32);
11828c2ecf20Sopenharmony_ci	/* kl5 */
11838c2ecf20Sopenharmony_ci	subRL[24] = kl;
11848c2ecf20Sopenharmony_ci	/* kl6 */
11858c2ecf20Sopenharmony_ci	subRL[25] = kr;
11868c2ecf20Sopenharmony_ci	/* rotation left shift 17 from k11,k12 -> k21,k22 */
11878c2ecf20Sopenharmony_ci	ROLDQ(kl, kr, 17);
11888c2ecf20Sopenharmony_ci	/* k21 */
11898c2ecf20Sopenharmony_ci	subRL[28] = kl;
11908c2ecf20Sopenharmony_ci	/* k22 */
11918c2ecf20Sopenharmony_ci	subRL[29] = kr;
11928c2ecf20Sopenharmony_ci
11938c2ecf20Sopenharmony_ci	/* generate KB dependent subkeys */
11948c2ecf20Sopenharmony_ci	/* k1 */
11958c2ecf20Sopenharmony_ci	subRL[2] = krl;
11968c2ecf20Sopenharmony_ci	/* k2 */
11978c2ecf20Sopenharmony_ci	subRL[3] = krr;
11988c2ecf20Sopenharmony_ci	ROLDQ(krl, krr, 30);
11998c2ecf20Sopenharmony_ci	/* k7 */
12008c2ecf20Sopenharmony_ci	subRL[10] = krl;
12018c2ecf20Sopenharmony_ci	/* k8 */
12028c2ecf20Sopenharmony_ci	subRL[11] = krr;
12038c2ecf20Sopenharmony_ci	ROLDQ(krl, krr, 30);
12048c2ecf20Sopenharmony_ci	/* k15 */
12058c2ecf20Sopenharmony_ci	subRL[20] = krl;
12068c2ecf20Sopenharmony_ci	/* k16 */
12078c2ecf20Sopenharmony_ci	subRL[21] = krr;
12088c2ecf20Sopenharmony_ci	ROLDQ(krl, krr, 51);
12098c2ecf20Sopenharmony_ci	/* kw3 */
12108c2ecf20Sopenharmony_ci	subRL[32] = krl;
12118c2ecf20Sopenharmony_ci	/* kw4 */
12128c2ecf20Sopenharmony_ci	subRL[33] = krr;
12138c2ecf20Sopenharmony_ci
12148c2ecf20Sopenharmony_ci	camellia_setup_tail(subkey, subRL, 32);
12158c2ecf20Sopenharmony_ci}
12168c2ecf20Sopenharmony_ci
12178c2ecf20Sopenharmony_cistatic void camellia_setup192(const unsigned char *key, u64 *subkey)
12188c2ecf20Sopenharmony_ci{
12198c2ecf20Sopenharmony_ci	unsigned char kk[32];
12208c2ecf20Sopenharmony_ci	u64 krl, krr;
12218c2ecf20Sopenharmony_ci
12228c2ecf20Sopenharmony_ci	memcpy(kk, key, 24);
12238c2ecf20Sopenharmony_ci	memcpy((unsigned char *)&krl, key+16, 8);
12248c2ecf20Sopenharmony_ci	krr = ~krl;
12258c2ecf20Sopenharmony_ci	memcpy(kk+24, (unsigned char *)&krr, 8);
12268c2ecf20Sopenharmony_ci	camellia_setup256(kk, subkey);
12278c2ecf20Sopenharmony_ci}
12288c2ecf20Sopenharmony_ci
12298c2ecf20Sopenharmony_ciint __camellia_setkey(struct camellia_ctx *cctx, const unsigned char *key,
12308c2ecf20Sopenharmony_ci		      unsigned int key_len)
12318c2ecf20Sopenharmony_ci{
12328c2ecf20Sopenharmony_ci	if (key_len != 16 && key_len != 24 && key_len != 32)
12338c2ecf20Sopenharmony_ci		return -EINVAL;
12348c2ecf20Sopenharmony_ci
12358c2ecf20Sopenharmony_ci	cctx->key_length = key_len;
12368c2ecf20Sopenharmony_ci
12378c2ecf20Sopenharmony_ci	switch (key_len) {
12388c2ecf20Sopenharmony_ci	case 16:
12398c2ecf20Sopenharmony_ci		camellia_setup128(key, cctx->key_table);
12408c2ecf20Sopenharmony_ci		break;
12418c2ecf20Sopenharmony_ci	case 24:
12428c2ecf20Sopenharmony_ci		camellia_setup192(key, cctx->key_table);
12438c2ecf20Sopenharmony_ci		break;
12448c2ecf20Sopenharmony_ci	case 32:
12458c2ecf20Sopenharmony_ci		camellia_setup256(key, cctx->key_table);
12468c2ecf20Sopenharmony_ci		break;
12478c2ecf20Sopenharmony_ci	}
12488c2ecf20Sopenharmony_ci
12498c2ecf20Sopenharmony_ci	return 0;
12508c2ecf20Sopenharmony_ci}
12518c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(__camellia_setkey);
12528c2ecf20Sopenharmony_ci
12538c2ecf20Sopenharmony_cistatic int camellia_setkey(struct crypto_tfm *tfm, const u8 *key,
12548c2ecf20Sopenharmony_ci			   unsigned int key_len)
12558c2ecf20Sopenharmony_ci{
12568c2ecf20Sopenharmony_ci	return __camellia_setkey(crypto_tfm_ctx(tfm), key, key_len);
12578c2ecf20Sopenharmony_ci}
12588c2ecf20Sopenharmony_ci
12598c2ecf20Sopenharmony_cistatic int camellia_setkey_skcipher(struct crypto_skcipher *tfm, const u8 *key,
12608c2ecf20Sopenharmony_ci				    unsigned int key_len)
12618c2ecf20Sopenharmony_ci{
12628c2ecf20Sopenharmony_ci	return camellia_setkey(&tfm->base, key, key_len);
12638c2ecf20Sopenharmony_ci}
12648c2ecf20Sopenharmony_ci
12658c2ecf20Sopenharmony_civoid camellia_decrypt_cbc_2way(const void *ctx, u8 *d, const u8 *s)
12668c2ecf20Sopenharmony_ci{
12678c2ecf20Sopenharmony_ci	u128 *dst = (u128 *)d;
12688c2ecf20Sopenharmony_ci	const u128 *src = (const u128 *)s;
12698c2ecf20Sopenharmony_ci	u128 iv = *src;
12708c2ecf20Sopenharmony_ci
12718c2ecf20Sopenharmony_ci	camellia_dec_blk_2way(ctx, (u8 *)dst, (u8 *)src);
12728c2ecf20Sopenharmony_ci
12738c2ecf20Sopenharmony_ci	u128_xor(&dst[1], &dst[1], &iv);
12748c2ecf20Sopenharmony_ci}
12758c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(camellia_decrypt_cbc_2way);
12768c2ecf20Sopenharmony_ci
12778c2ecf20Sopenharmony_civoid camellia_crypt_ctr(const void *ctx, u8 *d, const u8 *s, le128 *iv)
12788c2ecf20Sopenharmony_ci{
12798c2ecf20Sopenharmony_ci	be128 ctrblk;
12808c2ecf20Sopenharmony_ci	u128 *dst = (u128 *)d;
12818c2ecf20Sopenharmony_ci	const u128 *src = (const u128 *)s;
12828c2ecf20Sopenharmony_ci
12838c2ecf20Sopenharmony_ci	if (dst != src)
12848c2ecf20Sopenharmony_ci		*dst = *src;
12858c2ecf20Sopenharmony_ci
12868c2ecf20Sopenharmony_ci	le128_to_be128(&ctrblk, iv);
12878c2ecf20Sopenharmony_ci	le128_inc(iv);
12888c2ecf20Sopenharmony_ci
12898c2ecf20Sopenharmony_ci	camellia_enc_blk_xor(ctx, (u8 *)dst, (u8 *)&ctrblk);
12908c2ecf20Sopenharmony_ci}
12918c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(camellia_crypt_ctr);
12928c2ecf20Sopenharmony_ci
12938c2ecf20Sopenharmony_civoid camellia_crypt_ctr_2way(const void *ctx, u8 *d, const u8 *s, le128 *iv)
12948c2ecf20Sopenharmony_ci{
12958c2ecf20Sopenharmony_ci	be128 ctrblks[2];
12968c2ecf20Sopenharmony_ci	u128 *dst = (u128 *)d;
12978c2ecf20Sopenharmony_ci	const u128 *src = (const u128 *)s;
12988c2ecf20Sopenharmony_ci
12998c2ecf20Sopenharmony_ci	if (dst != src) {
13008c2ecf20Sopenharmony_ci		dst[0] = src[0];
13018c2ecf20Sopenharmony_ci		dst[1] = src[1];
13028c2ecf20Sopenharmony_ci	}
13038c2ecf20Sopenharmony_ci
13048c2ecf20Sopenharmony_ci	le128_to_be128(&ctrblks[0], iv);
13058c2ecf20Sopenharmony_ci	le128_inc(iv);
13068c2ecf20Sopenharmony_ci	le128_to_be128(&ctrblks[1], iv);
13078c2ecf20Sopenharmony_ci	le128_inc(iv);
13088c2ecf20Sopenharmony_ci
13098c2ecf20Sopenharmony_ci	camellia_enc_blk_xor_2way(ctx, (u8 *)dst, (u8 *)ctrblks);
13108c2ecf20Sopenharmony_ci}
13118c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(camellia_crypt_ctr_2way);
13128c2ecf20Sopenharmony_ci
13138c2ecf20Sopenharmony_cistatic const struct common_glue_ctx camellia_enc = {
13148c2ecf20Sopenharmony_ci	.num_funcs = 2,
13158c2ecf20Sopenharmony_ci	.fpu_blocks_limit = -1,
13168c2ecf20Sopenharmony_ci
13178c2ecf20Sopenharmony_ci	.funcs = { {
13188c2ecf20Sopenharmony_ci		.num_blocks = 2,
13198c2ecf20Sopenharmony_ci		.fn_u = { .ecb = camellia_enc_blk_2way }
13208c2ecf20Sopenharmony_ci	}, {
13218c2ecf20Sopenharmony_ci		.num_blocks = 1,
13228c2ecf20Sopenharmony_ci		.fn_u = { .ecb = camellia_enc_blk }
13238c2ecf20Sopenharmony_ci	} }
13248c2ecf20Sopenharmony_ci};
13258c2ecf20Sopenharmony_ci
13268c2ecf20Sopenharmony_cistatic const struct common_glue_ctx camellia_ctr = {
13278c2ecf20Sopenharmony_ci	.num_funcs = 2,
13288c2ecf20Sopenharmony_ci	.fpu_blocks_limit = -1,
13298c2ecf20Sopenharmony_ci
13308c2ecf20Sopenharmony_ci	.funcs = { {
13318c2ecf20Sopenharmony_ci		.num_blocks = 2,
13328c2ecf20Sopenharmony_ci		.fn_u = { .ctr = camellia_crypt_ctr_2way }
13338c2ecf20Sopenharmony_ci	}, {
13348c2ecf20Sopenharmony_ci		.num_blocks = 1,
13358c2ecf20Sopenharmony_ci		.fn_u = { .ctr = camellia_crypt_ctr }
13368c2ecf20Sopenharmony_ci	} }
13378c2ecf20Sopenharmony_ci};
13388c2ecf20Sopenharmony_ci
13398c2ecf20Sopenharmony_cistatic const struct common_glue_ctx camellia_dec = {
13408c2ecf20Sopenharmony_ci	.num_funcs = 2,
13418c2ecf20Sopenharmony_ci	.fpu_blocks_limit = -1,
13428c2ecf20Sopenharmony_ci
13438c2ecf20Sopenharmony_ci	.funcs = { {
13448c2ecf20Sopenharmony_ci		.num_blocks = 2,
13458c2ecf20Sopenharmony_ci		.fn_u = { .ecb = camellia_dec_blk_2way }
13468c2ecf20Sopenharmony_ci	}, {
13478c2ecf20Sopenharmony_ci		.num_blocks = 1,
13488c2ecf20Sopenharmony_ci		.fn_u = { .ecb = camellia_dec_blk }
13498c2ecf20Sopenharmony_ci	} }
13508c2ecf20Sopenharmony_ci};
13518c2ecf20Sopenharmony_ci
13528c2ecf20Sopenharmony_cistatic const struct common_glue_ctx camellia_dec_cbc = {
13538c2ecf20Sopenharmony_ci	.num_funcs = 2,
13548c2ecf20Sopenharmony_ci	.fpu_blocks_limit = -1,
13558c2ecf20Sopenharmony_ci
13568c2ecf20Sopenharmony_ci	.funcs = { {
13578c2ecf20Sopenharmony_ci		.num_blocks = 2,
13588c2ecf20Sopenharmony_ci		.fn_u = { .cbc = camellia_decrypt_cbc_2way }
13598c2ecf20Sopenharmony_ci	}, {
13608c2ecf20Sopenharmony_ci		.num_blocks = 1,
13618c2ecf20Sopenharmony_ci		.fn_u = { .cbc = camellia_dec_blk }
13628c2ecf20Sopenharmony_ci	} }
13638c2ecf20Sopenharmony_ci};
13648c2ecf20Sopenharmony_ci
13658c2ecf20Sopenharmony_cistatic int ecb_encrypt(struct skcipher_request *req)
13668c2ecf20Sopenharmony_ci{
13678c2ecf20Sopenharmony_ci	return glue_ecb_req_128bit(&camellia_enc, req);
13688c2ecf20Sopenharmony_ci}
13698c2ecf20Sopenharmony_ci
13708c2ecf20Sopenharmony_cistatic int ecb_decrypt(struct skcipher_request *req)
13718c2ecf20Sopenharmony_ci{
13728c2ecf20Sopenharmony_ci	return glue_ecb_req_128bit(&camellia_dec, req);
13738c2ecf20Sopenharmony_ci}
13748c2ecf20Sopenharmony_ci
13758c2ecf20Sopenharmony_cistatic int cbc_encrypt(struct skcipher_request *req)
13768c2ecf20Sopenharmony_ci{
13778c2ecf20Sopenharmony_ci	return glue_cbc_encrypt_req_128bit(camellia_enc_blk, req);
13788c2ecf20Sopenharmony_ci}
13798c2ecf20Sopenharmony_ci
13808c2ecf20Sopenharmony_cistatic int cbc_decrypt(struct skcipher_request *req)
13818c2ecf20Sopenharmony_ci{
13828c2ecf20Sopenharmony_ci	return glue_cbc_decrypt_req_128bit(&camellia_dec_cbc, req);
13838c2ecf20Sopenharmony_ci}
13848c2ecf20Sopenharmony_ci
13858c2ecf20Sopenharmony_cistatic int ctr_crypt(struct skcipher_request *req)
13868c2ecf20Sopenharmony_ci{
13878c2ecf20Sopenharmony_ci	return glue_ctr_req_128bit(&camellia_ctr, req);
13888c2ecf20Sopenharmony_ci}
13898c2ecf20Sopenharmony_ci
13908c2ecf20Sopenharmony_cistatic struct crypto_alg camellia_cipher_alg = {
13918c2ecf20Sopenharmony_ci	.cra_name		= "camellia",
13928c2ecf20Sopenharmony_ci	.cra_driver_name	= "camellia-asm",
13938c2ecf20Sopenharmony_ci	.cra_priority		= 200,
13948c2ecf20Sopenharmony_ci	.cra_flags		= CRYPTO_ALG_TYPE_CIPHER,
13958c2ecf20Sopenharmony_ci	.cra_blocksize		= CAMELLIA_BLOCK_SIZE,
13968c2ecf20Sopenharmony_ci	.cra_ctxsize		= sizeof(struct camellia_ctx),
13978c2ecf20Sopenharmony_ci	.cra_alignmask		= 0,
13988c2ecf20Sopenharmony_ci	.cra_module		= THIS_MODULE,
13998c2ecf20Sopenharmony_ci	.cra_u			= {
14008c2ecf20Sopenharmony_ci		.cipher = {
14018c2ecf20Sopenharmony_ci			.cia_min_keysize = CAMELLIA_MIN_KEY_SIZE,
14028c2ecf20Sopenharmony_ci			.cia_max_keysize = CAMELLIA_MAX_KEY_SIZE,
14038c2ecf20Sopenharmony_ci			.cia_setkey	 = camellia_setkey,
14048c2ecf20Sopenharmony_ci			.cia_encrypt	 = camellia_encrypt,
14058c2ecf20Sopenharmony_ci			.cia_decrypt	 = camellia_decrypt
14068c2ecf20Sopenharmony_ci		}
14078c2ecf20Sopenharmony_ci	}
14088c2ecf20Sopenharmony_ci};
14098c2ecf20Sopenharmony_ci
14108c2ecf20Sopenharmony_cistatic struct skcipher_alg camellia_skcipher_algs[] = {
14118c2ecf20Sopenharmony_ci	{
14128c2ecf20Sopenharmony_ci		.base.cra_name		= "ecb(camellia)",
14138c2ecf20Sopenharmony_ci		.base.cra_driver_name	= "ecb-camellia-asm",
14148c2ecf20Sopenharmony_ci		.base.cra_priority	= 300,
14158c2ecf20Sopenharmony_ci		.base.cra_blocksize	= CAMELLIA_BLOCK_SIZE,
14168c2ecf20Sopenharmony_ci		.base.cra_ctxsize	= sizeof(struct camellia_ctx),
14178c2ecf20Sopenharmony_ci		.base.cra_module	= THIS_MODULE,
14188c2ecf20Sopenharmony_ci		.min_keysize		= CAMELLIA_MIN_KEY_SIZE,
14198c2ecf20Sopenharmony_ci		.max_keysize		= CAMELLIA_MAX_KEY_SIZE,
14208c2ecf20Sopenharmony_ci		.setkey			= camellia_setkey_skcipher,
14218c2ecf20Sopenharmony_ci		.encrypt		= ecb_encrypt,
14228c2ecf20Sopenharmony_ci		.decrypt		= ecb_decrypt,
14238c2ecf20Sopenharmony_ci	}, {
14248c2ecf20Sopenharmony_ci		.base.cra_name		= "cbc(camellia)",
14258c2ecf20Sopenharmony_ci		.base.cra_driver_name	= "cbc-camellia-asm",
14268c2ecf20Sopenharmony_ci		.base.cra_priority	= 300,
14278c2ecf20Sopenharmony_ci		.base.cra_blocksize	= CAMELLIA_BLOCK_SIZE,
14288c2ecf20Sopenharmony_ci		.base.cra_ctxsize	= sizeof(struct camellia_ctx),
14298c2ecf20Sopenharmony_ci		.base.cra_module	= THIS_MODULE,
14308c2ecf20Sopenharmony_ci		.min_keysize		= CAMELLIA_MIN_KEY_SIZE,
14318c2ecf20Sopenharmony_ci		.max_keysize		= CAMELLIA_MAX_KEY_SIZE,
14328c2ecf20Sopenharmony_ci		.ivsize			= CAMELLIA_BLOCK_SIZE,
14338c2ecf20Sopenharmony_ci		.setkey			= camellia_setkey_skcipher,
14348c2ecf20Sopenharmony_ci		.encrypt		= cbc_encrypt,
14358c2ecf20Sopenharmony_ci		.decrypt		= cbc_decrypt,
14368c2ecf20Sopenharmony_ci	}, {
14378c2ecf20Sopenharmony_ci		.base.cra_name		= "ctr(camellia)",
14388c2ecf20Sopenharmony_ci		.base.cra_driver_name	= "ctr-camellia-asm",
14398c2ecf20Sopenharmony_ci		.base.cra_priority	= 300,
14408c2ecf20Sopenharmony_ci		.base.cra_blocksize	= 1,
14418c2ecf20Sopenharmony_ci		.base.cra_ctxsize	= sizeof(struct camellia_ctx),
14428c2ecf20Sopenharmony_ci		.base.cra_module	= THIS_MODULE,
14438c2ecf20Sopenharmony_ci		.min_keysize		= CAMELLIA_MIN_KEY_SIZE,
14448c2ecf20Sopenharmony_ci		.max_keysize		= CAMELLIA_MAX_KEY_SIZE,
14458c2ecf20Sopenharmony_ci		.ivsize			= CAMELLIA_BLOCK_SIZE,
14468c2ecf20Sopenharmony_ci		.chunksize		= CAMELLIA_BLOCK_SIZE,
14478c2ecf20Sopenharmony_ci		.setkey			= camellia_setkey_skcipher,
14488c2ecf20Sopenharmony_ci		.encrypt		= ctr_crypt,
14498c2ecf20Sopenharmony_ci		.decrypt		= ctr_crypt,
14508c2ecf20Sopenharmony_ci	}
14518c2ecf20Sopenharmony_ci};
14528c2ecf20Sopenharmony_ci
14538c2ecf20Sopenharmony_cistatic bool is_blacklisted_cpu(void)
14548c2ecf20Sopenharmony_ci{
14558c2ecf20Sopenharmony_ci	if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
14568c2ecf20Sopenharmony_ci		return false;
14578c2ecf20Sopenharmony_ci
14588c2ecf20Sopenharmony_ci	if (boot_cpu_data.x86 == 0x0f) {
14598c2ecf20Sopenharmony_ci		/*
14608c2ecf20Sopenharmony_ci		 * On Pentium 4, camellia-asm is slower than original assembler
14618c2ecf20Sopenharmony_ci		 * implementation because excessive uses of 64bit rotate and
14628c2ecf20Sopenharmony_ci		 * left-shifts (which are really slow on P4) needed to store and
14638c2ecf20Sopenharmony_ci		 * handle 128bit block in two 64bit registers.
14648c2ecf20Sopenharmony_ci		 */
14658c2ecf20Sopenharmony_ci		return true;
14668c2ecf20Sopenharmony_ci	}
14678c2ecf20Sopenharmony_ci
14688c2ecf20Sopenharmony_ci	return false;
14698c2ecf20Sopenharmony_ci}
14708c2ecf20Sopenharmony_ci
14718c2ecf20Sopenharmony_cistatic int force;
14728c2ecf20Sopenharmony_cimodule_param(force, int, 0);
14738c2ecf20Sopenharmony_ciMODULE_PARM_DESC(force, "Force module load, ignore CPU blacklist");
14748c2ecf20Sopenharmony_ci
14758c2ecf20Sopenharmony_cistatic int __init init(void)
14768c2ecf20Sopenharmony_ci{
14778c2ecf20Sopenharmony_ci	int err;
14788c2ecf20Sopenharmony_ci
14798c2ecf20Sopenharmony_ci	if (!force && is_blacklisted_cpu()) {
14808c2ecf20Sopenharmony_ci		printk(KERN_INFO
14818c2ecf20Sopenharmony_ci			"camellia-x86_64: performance on this CPU "
14828c2ecf20Sopenharmony_ci			"would be suboptimal: disabling "
14838c2ecf20Sopenharmony_ci			"camellia-x86_64.\n");
14848c2ecf20Sopenharmony_ci		return -ENODEV;
14858c2ecf20Sopenharmony_ci	}
14868c2ecf20Sopenharmony_ci
14878c2ecf20Sopenharmony_ci	err = crypto_register_alg(&camellia_cipher_alg);
14888c2ecf20Sopenharmony_ci	if (err)
14898c2ecf20Sopenharmony_ci		return err;
14908c2ecf20Sopenharmony_ci
14918c2ecf20Sopenharmony_ci	err = crypto_register_skciphers(camellia_skcipher_algs,
14928c2ecf20Sopenharmony_ci					ARRAY_SIZE(camellia_skcipher_algs));
14938c2ecf20Sopenharmony_ci	if (err)
14948c2ecf20Sopenharmony_ci		crypto_unregister_alg(&camellia_cipher_alg);
14958c2ecf20Sopenharmony_ci
14968c2ecf20Sopenharmony_ci	return err;
14978c2ecf20Sopenharmony_ci}
14988c2ecf20Sopenharmony_ci
14998c2ecf20Sopenharmony_cistatic void __exit fini(void)
15008c2ecf20Sopenharmony_ci{
15018c2ecf20Sopenharmony_ci	crypto_unregister_alg(&camellia_cipher_alg);
15028c2ecf20Sopenharmony_ci	crypto_unregister_skciphers(camellia_skcipher_algs,
15038c2ecf20Sopenharmony_ci				    ARRAY_SIZE(camellia_skcipher_algs));
15048c2ecf20Sopenharmony_ci}
15058c2ecf20Sopenharmony_ci
15068c2ecf20Sopenharmony_cimodule_init(init);
15078c2ecf20Sopenharmony_cimodule_exit(fini);
15088c2ecf20Sopenharmony_ci
15098c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL");
15108c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Camellia Cipher Algorithm, asm optimized");
15118c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("camellia");
15128c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("camellia-asm");
1513