18c2ecf20Sopenharmony_ci/* FCrypt encryption algorithm 28c2ecf20Sopenharmony_ci * 38c2ecf20Sopenharmony_ci * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. 48c2ecf20Sopenharmony_ci * Written by David Howells (dhowells@redhat.com) 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or 78c2ecf20Sopenharmony_ci * modify it under the terms of the GNU General Public License 88c2ecf20Sopenharmony_ci * as published by the Free Software Foundation; either version 98c2ecf20Sopenharmony_ci * 2 of the License, or (at your option) any later version. 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * Based on code: 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan 148c2ecf20Sopenharmony_ci * (Royal Institute of Technology, Stockholm, Sweden). 158c2ecf20Sopenharmony_ci * All rights reserved. 168c2ecf20Sopenharmony_ci * 178c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 188c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions 198c2ecf20Sopenharmony_ci * are met: 208c2ecf20Sopenharmony_ci * 218c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright 228c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright 258c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer in the 268c2ecf20Sopenharmony_ci * documentation and/or other materials provided with the distribution. 278c2ecf20Sopenharmony_ci * 288c2ecf20Sopenharmony_ci * 3. Neither the name of the Institute nor the names of its contributors 298c2ecf20Sopenharmony_ci * may be used to endorse or promote products derived from this software 308c2ecf20Sopenharmony_ci * without specific prior written permission. 318c2ecf20Sopenharmony_ci * 328c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 338c2ecf20Sopenharmony_ci * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 348c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 358c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 368c2ecf20Sopenharmony_ci * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 378c2ecf20Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 388c2ecf20Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 398c2ecf20Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 408c2ecf20Sopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 418c2ecf20Sopenharmony_ci * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 428c2ecf20Sopenharmony_ci * SUCH DAMAGE. 438c2ecf20Sopenharmony_ci */ 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#include <asm/byteorder.h> 468c2ecf20Sopenharmony_ci#include <linux/bitops.h> 478c2ecf20Sopenharmony_ci#include <linux/init.h> 488c2ecf20Sopenharmony_ci#include <linux/module.h> 498c2ecf20Sopenharmony_ci#include <linux/crypto.h> 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#define ROUNDS 16 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_cistruct fcrypt_ctx { 548c2ecf20Sopenharmony_ci __be32 sched[ROUNDS]; 558c2ecf20Sopenharmony_ci}; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci/* Rotate right two 32 bit numbers as a 56 bit number */ 588c2ecf20Sopenharmony_ci#define ror56(hi, lo, n) \ 598c2ecf20Sopenharmony_cido { \ 608c2ecf20Sopenharmony_ci u32 t = lo & ((1 << n) - 1); \ 618c2ecf20Sopenharmony_ci lo = (lo >> n) | ((hi & ((1 << n) - 1)) << (32 - n)); \ 628c2ecf20Sopenharmony_ci hi = (hi >> n) | (t << (24-n)); \ 638c2ecf20Sopenharmony_ci} while (0) 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci/* Rotate right one 64 bit number as a 56 bit number */ 668c2ecf20Sopenharmony_ci#define ror56_64(k, n) \ 678c2ecf20Sopenharmony_cido { \ 688c2ecf20Sopenharmony_ci k = (k >> n) | ((k & ((1 << n) - 1)) << (56 - n)); \ 698c2ecf20Sopenharmony_ci} while (0) 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci/* 728c2ecf20Sopenharmony_ci * Sboxes for Feistel network derived from 738c2ecf20Sopenharmony_ci * /afs/transarc.com/public/afsps/afs.rel31b.export-src/rxkad/sboxes.h 748c2ecf20Sopenharmony_ci */ 758c2ecf20Sopenharmony_ci#undef Z 768c2ecf20Sopenharmony_ci#define Z(x) cpu_to_be32(x << 3) 778c2ecf20Sopenharmony_cistatic const __be32 sbox0[256] = { 788c2ecf20Sopenharmony_ci Z(0xea), Z(0x7f), Z(0xb2), Z(0x64), Z(0x9d), Z(0xb0), Z(0xd9), Z(0x11), 798c2ecf20Sopenharmony_ci Z(0xcd), Z(0x86), Z(0x86), Z(0x91), Z(0x0a), Z(0xb2), Z(0x93), Z(0x06), 808c2ecf20Sopenharmony_ci Z(0x0e), Z(0x06), Z(0xd2), Z(0x65), Z(0x73), Z(0xc5), Z(0x28), Z(0x60), 818c2ecf20Sopenharmony_ci Z(0xf2), Z(0x20), Z(0xb5), Z(0x38), Z(0x7e), Z(0xda), Z(0x9f), Z(0xe3), 828c2ecf20Sopenharmony_ci Z(0xd2), Z(0xcf), Z(0xc4), Z(0x3c), Z(0x61), Z(0xff), Z(0x4a), Z(0x4a), 838c2ecf20Sopenharmony_ci Z(0x35), Z(0xac), Z(0xaa), Z(0x5f), Z(0x2b), Z(0xbb), Z(0xbc), Z(0x53), 848c2ecf20Sopenharmony_ci Z(0x4e), Z(0x9d), Z(0x78), Z(0xa3), Z(0xdc), Z(0x09), Z(0x32), Z(0x10), 858c2ecf20Sopenharmony_ci Z(0xc6), Z(0x6f), Z(0x66), Z(0xd6), Z(0xab), Z(0xa9), Z(0xaf), Z(0xfd), 868c2ecf20Sopenharmony_ci Z(0x3b), Z(0x95), Z(0xe8), Z(0x34), Z(0x9a), Z(0x81), Z(0x72), Z(0x80), 878c2ecf20Sopenharmony_ci Z(0x9c), Z(0xf3), Z(0xec), Z(0xda), Z(0x9f), Z(0x26), Z(0x76), Z(0x15), 888c2ecf20Sopenharmony_ci Z(0x3e), Z(0x55), Z(0x4d), Z(0xde), Z(0x84), Z(0xee), Z(0xad), Z(0xc7), 898c2ecf20Sopenharmony_ci Z(0xf1), Z(0x6b), Z(0x3d), Z(0xd3), Z(0x04), Z(0x49), Z(0xaa), Z(0x24), 908c2ecf20Sopenharmony_ci Z(0x0b), Z(0x8a), Z(0x83), Z(0xba), Z(0xfa), Z(0x85), Z(0xa0), Z(0xa8), 918c2ecf20Sopenharmony_ci Z(0xb1), Z(0xd4), Z(0x01), Z(0xd8), Z(0x70), Z(0x64), Z(0xf0), Z(0x51), 928c2ecf20Sopenharmony_ci Z(0xd2), Z(0xc3), Z(0xa7), Z(0x75), Z(0x8c), Z(0xa5), Z(0x64), Z(0xef), 938c2ecf20Sopenharmony_ci Z(0x10), Z(0x4e), Z(0xb7), Z(0xc6), Z(0x61), Z(0x03), Z(0xeb), Z(0x44), 948c2ecf20Sopenharmony_ci Z(0x3d), Z(0xe5), Z(0xb3), Z(0x5b), Z(0xae), Z(0xd5), Z(0xad), Z(0x1d), 958c2ecf20Sopenharmony_ci Z(0xfa), Z(0x5a), Z(0x1e), Z(0x33), Z(0xab), Z(0x93), Z(0xa2), Z(0xb7), 968c2ecf20Sopenharmony_ci Z(0xe7), Z(0xa8), Z(0x45), Z(0xa4), Z(0xcd), Z(0x29), Z(0x63), Z(0x44), 978c2ecf20Sopenharmony_ci Z(0xb6), Z(0x69), Z(0x7e), Z(0x2e), Z(0x62), Z(0x03), Z(0xc8), Z(0xe0), 988c2ecf20Sopenharmony_ci Z(0x17), Z(0xbb), Z(0xc7), Z(0xf3), Z(0x3f), Z(0x36), Z(0xba), Z(0x71), 998c2ecf20Sopenharmony_ci Z(0x8e), Z(0x97), Z(0x65), Z(0x60), Z(0x69), Z(0xb6), Z(0xf6), Z(0xe6), 1008c2ecf20Sopenharmony_ci Z(0x6e), Z(0xe0), Z(0x81), Z(0x59), Z(0xe8), Z(0xaf), Z(0xdd), Z(0x95), 1018c2ecf20Sopenharmony_ci Z(0x22), Z(0x99), Z(0xfd), Z(0x63), Z(0x19), Z(0x74), Z(0x61), Z(0xb1), 1028c2ecf20Sopenharmony_ci Z(0xb6), Z(0x5b), Z(0xae), Z(0x54), Z(0xb3), Z(0x70), Z(0xff), Z(0xc6), 1038c2ecf20Sopenharmony_ci Z(0x3b), Z(0x3e), Z(0xc1), Z(0xd7), Z(0xe1), Z(0x0e), Z(0x76), Z(0xe5), 1048c2ecf20Sopenharmony_ci Z(0x36), Z(0x4f), Z(0x59), Z(0xc7), Z(0x08), Z(0x6e), Z(0x82), Z(0xa6), 1058c2ecf20Sopenharmony_ci Z(0x93), Z(0xc4), Z(0xaa), Z(0x26), Z(0x49), Z(0xe0), Z(0x21), Z(0x64), 1068c2ecf20Sopenharmony_ci Z(0x07), Z(0x9f), Z(0x64), Z(0x81), Z(0x9c), Z(0xbf), Z(0xf9), Z(0xd1), 1078c2ecf20Sopenharmony_ci Z(0x43), Z(0xf8), Z(0xb6), Z(0xb9), Z(0xf1), Z(0x24), Z(0x75), Z(0x03), 1088c2ecf20Sopenharmony_ci Z(0xe4), Z(0xb0), Z(0x99), Z(0x46), Z(0x3d), Z(0xf5), Z(0xd1), Z(0x39), 1098c2ecf20Sopenharmony_ci Z(0x72), Z(0x12), Z(0xf6), Z(0xba), Z(0x0c), Z(0x0d), Z(0x42), Z(0x2e) 1108c2ecf20Sopenharmony_ci}; 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci#undef Z 1138c2ecf20Sopenharmony_ci#define Z(x) cpu_to_be32(((x & 0x1f) << 27) | (x >> 5)) 1148c2ecf20Sopenharmony_cistatic const __be32 sbox1[256] = { 1158c2ecf20Sopenharmony_ci Z(0x77), Z(0x14), Z(0xa6), Z(0xfe), Z(0xb2), Z(0x5e), Z(0x8c), Z(0x3e), 1168c2ecf20Sopenharmony_ci Z(0x67), Z(0x6c), Z(0xa1), Z(0x0d), Z(0xc2), Z(0xa2), Z(0xc1), Z(0x85), 1178c2ecf20Sopenharmony_ci Z(0x6c), Z(0x7b), Z(0x67), Z(0xc6), Z(0x23), Z(0xe3), Z(0xf2), Z(0x89), 1188c2ecf20Sopenharmony_ci Z(0x50), Z(0x9c), Z(0x03), Z(0xb7), Z(0x73), Z(0xe6), Z(0xe1), Z(0x39), 1198c2ecf20Sopenharmony_ci Z(0x31), Z(0x2c), Z(0x27), Z(0x9f), Z(0xa5), Z(0x69), Z(0x44), Z(0xd6), 1208c2ecf20Sopenharmony_ci Z(0x23), Z(0x83), Z(0x98), Z(0x7d), Z(0x3c), Z(0xb4), Z(0x2d), Z(0x99), 1218c2ecf20Sopenharmony_ci Z(0x1c), Z(0x1f), Z(0x8c), Z(0x20), Z(0x03), Z(0x7c), Z(0x5f), Z(0xad), 1228c2ecf20Sopenharmony_ci Z(0xf4), Z(0xfa), Z(0x95), Z(0xca), Z(0x76), Z(0x44), Z(0xcd), Z(0xb6), 1238c2ecf20Sopenharmony_ci Z(0xb8), Z(0xa1), Z(0xa1), Z(0xbe), Z(0x9e), Z(0x54), Z(0x8f), Z(0x0b), 1248c2ecf20Sopenharmony_ci Z(0x16), Z(0x74), Z(0x31), Z(0x8a), Z(0x23), Z(0x17), Z(0x04), Z(0xfa), 1258c2ecf20Sopenharmony_ci Z(0x79), Z(0x84), Z(0xb1), Z(0xf5), Z(0x13), Z(0xab), Z(0xb5), Z(0x2e), 1268c2ecf20Sopenharmony_ci Z(0xaa), Z(0x0c), Z(0x60), Z(0x6b), Z(0x5b), Z(0xc4), Z(0x4b), Z(0xbc), 1278c2ecf20Sopenharmony_ci Z(0xe2), Z(0xaf), Z(0x45), Z(0x73), Z(0xfa), Z(0xc9), Z(0x49), Z(0xcd), 1288c2ecf20Sopenharmony_ci Z(0x00), Z(0x92), Z(0x7d), Z(0x97), Z(0x7a), Z(0x18), Z(0x60), Z(0x3d), 1298c2ecf20Sopenharmony_ci Z(0xcf), Z(0x5b), Z(0xde), Z(0xc6), Z(0xe2), Z(0xe6), Z(0xbb), Z(0x8b), 1308c2ecf20Sopenharmony_ci Z(0x06), Z(0xda), Z(0x08), Z(0x15), Z(0x1b), Z(0x88), Z(0x6a), Z(0x17), 1318c2ecf20Sopenharmony_ci Z(0x89), Z(0xd0), Z(0xa9), Z(0xc1), Z(0xc9), Z(0x70), Z(0x6b), Z(0xe5), 1328c2ecf20Sopenharmony_ci Z(0x43), Z(0xf4), Z(0x68), Z(0xc8), Z(0xd3), Z(0x84), Z(0x28), Z(0x0a), 1338c2ecf20Sopenharmony_ci Z(0x52), Z(0x66), Z(0xa3), Z(0xca), Z(0xf2), Z(0xe3), Z(0x7f), Z(0x7a), 1348c2ecf20Sopenharmony_ci Z(0x31), Z(0xf7), Z(0x88), Z(0x94), Z(0x5e), Z(0x9c), Z(0x63), Z(0xd5), 1358c2ecf20Sopenharmony_ci Z(0x24), Z(0x66), Z(0xfc), Z(0xb3), Z(0x57), Z(0x25), Z(0xbe), Z(0x89), 1368c2ecf20Sopenharmony_ci Z(0x44), Z(0xc4), Z(0xe0), Z(0x8f), Z(0x23), Z(0x3c), Z(0x12), Z(0x52), 1378c2ecf20Sopenharmony_ci Z(0xf5), Z(0x1e), Z(0xf4), Z(0xcb), Z(0x18), Z(0x33), Z(0x1f), Z(0xf8), 1388c2ecf20Sopenharmony_ci Z(0x69), Z(0x10), Z(0x9d), Z(0xd3), Z(0xf7), Z(0x28), Z(0xf8), Z(0x30), 1398c2ecf20Sopenharmony_ci Z(0x05), Z(0x5e), Z(0x32), Z(0xc0), Z(0xd5), Z(0x19), Z(0xbd), Z(0x45), 1408c2ecf20Sopenharmony_ci Z(0x8b), Z(0x5b), Z(0xfd), Z(0xbc), Z(0xe2), Z(0x5c), Z(0xa9), Z(0x96), 1418c2ecf20Sopenharmony_ci Z(0xef), Z(0x70), Z(0xcf), Z(0xc2), Z(0x2a), Z(0xb3), Z(0x61), Z(0xad), 1428c2ecf20Sopenharmony_ci Z(0x80), Z(0x48), Z(0x81), Z(0xb7), Z(0x1d), Z(0x43), Z(0xd9), Z(0xd7), 1438c2ecf20Sopenharmony_ci Z(0x45), Z(0xf0), Z(0xd8), Z(0x8a), Z(0x59), Z(0x7c), Z(0x57), Z(0xc1), 1448c2ecf20Sopenharmony_ci Z(0x79), Z(0xc7), Z(0x34), Z(0xd6), Z(0x43), Z(0xdf), Z(0xe4), Z(0x78), 1458c2ecf20Sopenharmony_ci Z(0x16), Z(0x06), Z(0xda), Z(0x92), Z(0x76), Z(0x51), Z(0xe1), Z(0xd4), 1468c2ecf20Sopenharmony_ci Z(0x70), Z(0x03), Z(0xe0), Z(0x2f), Z(0x96), Z(0x91), Z(0x82), Z(0x80) 1478c2ecf20Sopenharmony_ci}; 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci#undef Z 1508c2ecf20Sopenharmony_ci#define Z(x) cpu_to_be32(x << 11) 1518c2ecf20Sopenharmony_cistatic const __be32 sbox2[256] = { 1528c2ecf20Sopenharmony_ci Z(0xf0), Z(0x37), Z(0x24), Z(0x53), Z(0x2a), Z(0x03), Z(0x83), Z(0x86), 1538c2ecf20Sopenharmony_ci Z(0xd1), Z(0xec), Z(0x50), Z(0xf0), Z(0x42), Z(0x78), Z(0x2f), Z(0x6d), 1548c2ecf20Sopenharmony_ci Z(0xbf), Z(0x80), Z(0x87), Z(0x27), Z(0x95), Z(0xe2), Z(0xc5), Z(0x5d), 1558c2ecf20Sopenharmony_ci Z(0xf9), Z(0x6f), Z(0xdb), Z(0xb4), Z(0x65), Z(0x6e), Z(0xe7), Z(0x24), 1568c2ecf20Sopenharmony_ci Z(0xc8), Z(0x1a), Z(0xbb), Z(0x49), Z(0xb5), Z(0x0a), Z(0x7d), Z(0xb9), 1578c2ecf20Sopenharmony_ci Z(0xe8), Z(0xdc), Z(0xb7), Z(0xd9), Z(0x45), Z(0x20), Z(0x1b), Z(0xce), 1588c2ecf20Sopenharmony_ci Z(0x59), Z(0x9d), Z(0x6b), Z(0xbd), Z(0x0e), Z(0x8f), Z(0xa3), Z(0xa9), 1598c2ecf20Sopenharmony_ci Z(0xbc), Z(0x74), Z(0xa6), Z(0xf6), Z(0x7f), Z(0x5f), Z(0xb1), Z(0x68), 1608c2ecf20Sopenharmony_ci Z(0x84), Z(0xbc), Z(0xa9), Z(0xfd), Z(0x55), Z(0x50), Z(0xe9), Z(0xb6), 1618c2ecf20Sopenharmony_ci Z(0x13), Z(0x5e), Z(0x07), Z(0xb8), Z(0x95), Z(0x02), Z(0xc0), Z(0xd0), 1628c2ecf20Sopenharmony_ci Z(0x6a), Z(0x1a), Z(0x85), Z(0xbd), Z(0xb6), Z(0xfd), Z(0xfe), Z(0x17), 1638c2ecf20Sopenharmony_ci Z(0x3f), Z(0x09), Z(0xa3), Z(0x8d), Z(0xfb), Z(0xed), Z(0xda), Z(0x1d), 1648c2ecf20Sopenharmony_ci Z(0x6d), Z(0x1c), Z(0x6c), Z(0x01), Z(0x5a), Z(0xe5), Z(0x71), Z(0x3e), 1658c2ecf20Sopenharmony_ci Z(0x8b), Z(0x6b), Z(0xbe), Z(0x29), Z(0xeb), Z(0x12), Z(0x19), Z(0x34), 1668c2ecf20Sopenharmony_ci Z(0xcd), Z(0xb3), Z(0xbd), Z(0x35), Z(0xea), Z(0x4b), Z(0xd5), Z(0xae), 1678c2ecf20Sopenharmony_ci Z(0x2a), Z(0x79), Z(0x5a), Z(0xa5), Z(0x32), Z(0x12), Z(0x7b), Z(0xdc), 1688c2ecf20Sopenharmony_ci Z(0x2c), Z(0xd0), Z(0x22), Z(0x4b), Z(0xb1), Z(0x85), Z(0x59), Z(0x80), 1698c2ecf20Sopenharmony_ci Z(0xc0), Z(0x30), Z(0x9f), Z(0x73), Z(0xd3), Z(0x14), Z(0x48), Z(0x40), 1708c2ecf20Sopenharmony_ci Z(0x07), Z(0x2d), Z(0x8f), Z(0x80), Z(0x0f), Z(0xce), Z(0x0b), Z(0x5e), 1718c2ecf20Sopenharmony_ci Z(0xb7), Z(0x5e), Z(0xac), Z(0x24), Z(0x94), Z(0x4a), Z(0x18), Z(0x15), 1728c2ecf20Sopenharmony_ci Z(0x05), Z(0xe8), Z(0x02), Z(0x77), Z(0xa9), Z(0xc7), Z(0x40), Z(0x45), 1738c2ecf20Sopenharmony_ci Z(0x89), Z(0xd1), Z(0xea), Z(0xde), Z(0x0c), Z(0x79), Z(0x2a), Z(0x99), 1748c2ecf20Sopenharmony_ci Z(0x6c), Z(0x3e), Z(0x95), Z(0xdd), Z(0x8c), Z(0x7d), Z(0xad), Z(0x6f), 1758c2ecf20Sopenharmony_ci Z(0xdc), Z(0xff), Z(0xfd), Z(0x62), Z(0x47), Z(0xb3), Z(0x21), Z(0x8a), 1768c2ecf20Sopenharmony_ci Z(0xec), Z(0x8e), Z(0x19), Z(0x18), Z(0xb4), Z(0x6e), Z(0x3d), Z(0xfd), 1778c2ecf20Sopenharmony_ci Z(0x74), Z(0x54), Z(0x1e), Z(0x04), Z(0x85), Z(0xd8), Z(0xbc), Z(0x1f), 1788c2ecf20Sopenharmony_ci Z(0x56), Z(0xe7), Z(0x3a), Z(0x56), Z(0x67), Z(0xd6), Z(0xc8), Z(0xa5), 1798c2ecf20Sopenharmony_ci Z(0xf3), Z(0x8e), Z(0xde), Z(0xae), Z(0x37), Z(0x49), Z(0xb7), Z(0xfa), 1808c2ecf20Sopenharmony_ci Z(0xc8), Z(0xf4), Z(0x1f), Z(0xe0), Z(0x2a), Z(0x9b), Z(0x15), Z(0xd1), 1818c2ecf20Sopenharmony_ci Z(0x34), Z(0x0e), Z(0xb5), Z(0xe0), Z(0x44), Z(0x78), Z(0x84), Z(0x59), 1828c2ecf20Sopenharmony_ci Z(0x56), Z(0x68), Z(0x77), Z(0xa5), Z(0x14), Z(0x06), Z(0xf5), Z(0x2f), 1838c2ecf20Sopenharmony_ci Z(0x8c), Z(0x8a), Z(0x73), Z(0x80), Z(0x76), Z(0xb4), Z(0x10), Z(0x86) 1848c2ecf20Sopenharmony_ci}; 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci#undef Z 1878c2ecf20Sopenharmony_ci#define Z(x) cpu_to_be32(x << 19) 1888c2ecf20Sopenharmony_cistatic const __be32 sbox3[256] = { 1898c2ecf20Sopenharmony_ci Z(0xa9), Z(0x2a), Z(0x48), Z(0x51), Z(0x84), Z(0x7e), Z(0x49), Z(0xe2), 1908c2ecf20Sopenharmony_ci Z(0xb5), Z(0xb7), Z(0x42), Z(0x33), Z(0x7d), Z(0x5d), Z(0xa6), Z(0x12), 1918c2ecf20Sopenharmony_ci Z(0x44), Z(0x48), Z(0x6d), Z(0x28), Z(0xaa), Z(0x20), Z(0x6d), Z(0x57), 1928c2ecf20Sopenharmony_ci Z(0xd6), Z(0x6b), Z(0x5d), Z(0x72), Z(0xf0), Z(0x92), Z(0x5a), Z(0x1b), 1938c2ecf20Sopenharmony_ci Z(0x53), Z(0x80), Z(0x24), Z(0x70), Z(0x9a), Z(0xcc), Z(0xa7), Z(0x66), 1948c2ecf20Sopenharmony_ci Z(0xa1), Z(0x01), Z(0xa5), Z(0x41), Z(0x97), Z(0x41), Z(0x31), Z(0x82), 1958c2ecf20Sopenharmony_ci Z(0xf1), Z(0x14), Z(0xcf), Z(0x53), Z(0x0d), Z(0xa0), Z(0x10), Z(0xcc), 1968c2ecf20Sopenharmony_ci Z(0x2a), Z(0x7d), Z(0xd2), Z(0xbf), Z(0x4b), Z(0x1a), Z(0xdb), Z(0x16), 1978c2ecf20Sopenharmony_ci Z(0x47), Z(0xf6), Z(0x51), Z(0x36), Z(0xed), Z(0xf3), Z(0xb9), Z(0x1a), 1988c2ecf20Sopenharmony_ci Z(0xa7), Z(0xdf), Z(0x29), Z(0x43), Z(0x01), Z(0x54), Z(0x70), Z(0xa4), 1998c2ecf20Sopenharmony_ci Z(0xbf), Z(0xd4), Z(0x0b), Z(0x53), Z(0x44), Z(0x60), Z(0x9e), Z(0x23), 2008c2ecf20Sopenharmony_ci Z(0xa1), Z(0x18), Z(0x68), Z(0x4f), Z(0xf0), Z(0x2f), Z(0x82), Z(0xc2), 2018c2ecf20Sopenharmony_ci Z(0x2a), Z(0x41), Z(0xb2), Z(0x42), Z(0x0c), Z(0xed), Z(0x0c), Z(0x1d), 2028c2ecf20Sopenharmony_ci Z(0x13), Z(0x3a), Z(0x3c), Z(0x6e), Z(0x35), Z(0xdc), Z(0x60), Z(0x65), 2038c2ecf20Sopenharmony_ci Z(0x85), Z(0xe9), Z(0x64), Z(0x02), Z(0x9a), Z(0x3f), Z(0x9f), Z(0x87), 2048c2ecf20Sopenharmony_ci Z(0x96), Z(0xdf), Z(0xbe), Z(0xf2), Z(0xcb), Z(0xe5), Z(0x6c), Z(0xd4), 2058c2ecf20Sopenharmony_ci Z(0x5a), Z(0x83), Z(0xbf), Z(0x92), Z(0x1b), Z(0x94), Z(0x00), Z(0x42), 2068c2ecf20Sopenharmony_ci Z(0xcf), Z(0x4b), Z(0x00), Z(0x75), Z(0xba), Z(0x8f), Z(0x76), Z(0x5f), 2078c2ecf20Sopenharmony_ci Z(0x5d), Z(0x3a), Z(0x4d), Z(0x09), Z(0x12), Z(0x08), Z(0x38), Z(0x95), 2088c2ecf20Sopenharmony_ci Z(0x17), Z(0xe4), Z(0x01), Z(0x1d), Z(0x4c), Z(0xa9), Z(0xcc), Z(0x85), 2098c2ecf20Sopenharmony_ci Z(0x82), Z(0x4c), Z(0x9d), Z(0x2f), Z(0x3b), Z(0x66), Z(0xa1), Z(0x34), 2108c2ecf20Sopenharmony_ci Z(0x10), Z(0xcd), Z(0x59), Z(0x89), Z(0xa5), Z(0x31), Z(0xcf), Z(0x05), 2118c2ecf20Sopenharmony_ci Z(0xc8), Z(0x84), Z(0xfa), Z(0xc7), Z(0xba), Z(0x4e), Z(0x8b), Z(0x1a), 2128c2ecf20Sopenharmony_ci Z(0x19), Z(0xf1), Z(0xa1), Z(0x3b), Z(0x18), Z(0x12), Z(0x17), Z(0xb0), 2138c2ecf20Sopenharmony_ci Z(0x98), Z(0x8d), Z(0x0b), Z(0x23), Z(0xc3), Z(0x3a), Z(0x2d), Z(0x20), 2148c2ecf20Sopenharmony_ci Z(0xdf), Z(0x13), Z(0xa0), Z(0xa8), Z(0x4c), Z(0x0d), Z(0x6c), Z(0x2f), 2158c2ecf20Sopenharmony_ci Z(0x47), Z(0x13), Z(0x13), Z(0x52), Z(0x1f), Z(0x2d), Z(0xf5), Z(0x79), 2168c2ecf20Sopenharmony_ci Z(0x3d), Z(0xa2), Z(0x54), Z(0xbd), Z(0x69), Z(0xc8), Z(0x6b), Z(0xf3), 2178c2ecf20Sopenharmony_ci Z(0x05), Z(0x28), Z(0xf1), Z(0x16), Z(0x46), Z(0x40), Z(0xb0), Z(0x11), 2188c2ecf20Sopenharmony_ci Z(0xd3), Z(0xb7), Z(0x95), Z(0x49), Z(0xcf), Z(0xc3), Z(0x1d), Z(0x8f), 2198c2ecf20Sopenharmony_ci Z(0xd8), Z(0xe1), Z(0x73), Z(0xdb), Z(0xad), Z(0xc8), Z(0xc9), Z(0xa9), 2208c2ecf20Sopenharmony_ci Z(0xa1), Z(0xc2), Z(0xc5), Z(0xe3), Z(0xba), Z(0xfc), Z(0x0e), Z(0x25) 2218c2ecf20Sopenharmony_ci}; 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci/* 2248c2ecf20Sopenharmony_ci * This is a 16 round Feistel network with permutation F_ENCRYPT 2258c2ecf20Sopenharmony_ci */ 2268c2ecf20Sopenharmony_ci#define F_ENCRYPT(R, L, sched) \ 2278c2ecf20Sopenharmony_cido { \ 2288c2ecf20Sopenharmony_ci union lc4 { __be32 l; u8 c[4]; } u; \ 2298c2ecf20Sopenharmony_ci u.l = sched ^ R; \ 2308c2ecf20Sopenharmony_ci L ^= sbox0[u.c[0]] ^ sbox1[u.c[1]] ^ sbox2[u.c[2]] ^ sbox3[u.c[3]]; \ 2318c2ecf20Sopenharmony_ci} while (0) 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci/* 2348c2ecf20Sopenharmony_ci * encryptor 2358c2ecf20Sopenharmony_ci */ 2368c2ecf20Sopenharmony_cistatic void fcrypt_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) 2378c2ecf20Sopenharmony_ci{ 2388c2ecf20Sopenharmony_ci const struct fcrypt_ctx *ctx = crypto_tfm_ctx(tfm); 2398c2ecf20Sopenharmony_ci struct { 2408c2ecf20Sopenharmony_ci __be32 l, r; 2418c2ecf20Sopenharmony_ci } X; 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci memcpy(&X, src, sizeof(X)); 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0x0]); 2468c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0x1]); 2478c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0x2]); 2488c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0x3]); 2498c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0x4]); 2508c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0x5]); 2518c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0x6]); 2528c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0x7]); 2538c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0x8]); 2548c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0x9]); 2558c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0xa]); 2568c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0xb]); 2578c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0xc]); 2588c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0xd]); 2598c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0xe]); 2608c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0xf]); 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci memcpy(dst, &X, sizeof(X)); 2638c2ecf20Sopenharmony_ci} 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci/* 2668c2ecf20Sopenharmony_ci * decryptor 2678c2ecf20Sopenharmony_ci */ 2688c2ecf20Sopenharmony_cistatic void fcrypt_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) 2698c2ecf20Sopenharmony_ci{ 2708c2ecf20Sopenharmony_ci const struct fcrypt_ctx *ctx = crypto_tfm_ctx(tfm); 2718c2ecf20Sopenharmony_ci struct { 2728c2ecf20Sopenharmony_ci __be32 l, r; 2738c2ecf20Sopenharmony_ci } X; 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci memcpy(&X, src, sizeof(X)); 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0xf]); 2788c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0xe]); 2798c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0xd]); 2808c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0xc]); 2818c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0xb]); 2828c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0xa]); 2838c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0x9]); 2848c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0x8]); 2858c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0x7]); 2868c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0x6]); 2878c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0x5]); 2888c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0x4]); 2898c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0x3]); 2908c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0x2]); 2918c2ecf20Sopenharmony_ci F_ENCRYPT(X.l, X.r, ctx->sched[0x1]); 2928c2ecf20Sopenharmony_ci F_ENCRYPT(X.r, X.l, ctx->sched[0x0]); 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ci memcpy(dst, &X, sizeof(X)); 2958c2ecf20Sopenharmony_ci} 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci/* 2988c2ecf20Sopenharmony_ci * Generate a key schedule from key, the least significant bit in each key byte 2998c2ecf20Sopenharmony_ci * is parity and shall be ignored. This leaves 56 significant bits in the key 3008c2ecf20Sopenharmony_ci * to scatter over the 16 key schedules. For each schedule extract the low 3018c2ecf20Sopenharmony_ci * order 32 bits and use as schedule, then rotate right by 11 bits. 3028c2ecf20Sopenharmony_ci */ 3038c2ecf20Sopenharmony_cistatic int fcrypt_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) 3048c2ecf20Sopenharmony_ci{ 3058c2ecf20Sopenharmony_ci struct fcrypt_ctx *ctx = crypto_tfm_ctx(tfm); 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci#if BITS_PER_LONG == 64 /* the 64-bit version can also be used for 32-bit 3088c2ecf20Sopenharmony_ci * kernels - it seems to be faster but the code is 3098c2ecf20Sopenharmony_ci * larger */ 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci u64 k; /* k holds all 56 non-parity bits */ 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci /* discard the parity bits */ 3148c2ecf20Sopenharmony_ci k = (*key++) >> 1; 3158c2ecf20Sopenharmony_ci k <<= 7; 3168c2ecf20Sopenharmony_ci k |= (*key++) >> 1; 3178c2ecf20Sopenharmony_ci k <<= 7; 3188c2ecf20Sopenharmony_ci k |= (*key++) >> 1; 3198c2ecf20Sopenharmony_ci k <<= 7; 3208c2ecf20Sopenharmony_ci k |= (*key++) >> 1; 3218c2ecf20Sopenharmony_ci k <<= 7; 3228c2ecf20Sopenharmony_ci k |= (*key++) >> 1; 3238c2ecf20Sopenharmony_ci k <<= 7; 3248c2ecf20Sopenharmony_ci k |= (*key++) >> 1; 3258c2ecf20Sopenharmony_ci k <<= 7; 3268c2ecf20Sopenharmony_ci k |= (*key++) >> 1; 3278c2ecf20Sopenharmony_ci k <<= 7; 3288c2ecf20Sopenharmony_ci k |= (*key) >> 1; 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ci /* Use lower 32 bits for schedule, rotate by 11 each round (16 times) */ 3318c2ecf20Sopenharmony_ci ctx->sched[0x0] = cpu_to_be32(k); ror56_64(k, 11); 3328c2ecf20Sopenharmony_ci ctx->sched[0x1] = cpu_to_be32(k); ror56_64(k, 11); 3338c2ecf20Sopenharmony_ci ctx->sched[0x2] = cpu_to_be32(k); ror56_64(k, 11); 3348c2ecf20Sopenharmony_ci ctx->sched[0x3] = cpu_to_be32(k); ror56_64(k, 11); 3358c2ecf20Sopenharmony_ci ctx->sched[0x4] = cpu_to_be32(k); ror56_64(k, 11); 3368c2ecf20Sopenharmony_ci ctx->sched[0x5] = cpu_to_be32(k); ror56_64(k, 11); 3378c2ecf20Sopenharmony_ci ctx->sched[0x6] = cpu_to_be32(k); ror56_64(k, 11); 3388c2ecf20Sopenharmony_ci ctx->sched[0x7] = cpu_to_be32(k); ror56_64(k, 11); 3398c2ecf20Sopenharmony_ci ctx->sched[0x8] = cpu_to_be32(k); ror56_64(k, 11); 3408c2ecf20Sopenharmony_ci ctx->sched[0x9] = cpu_to_be32(k); ror56_64(k, 11); 3418c2ecf20Sopenharmony_ci ctx->sched[0xa] = cpu_to_be32(k); ror56_64(k, 11); 3428c2ecf20Sopenharmony_ci ctx->sched[0xb] = cpu_to_be32(k); ror56_64(k, 11); 3438c2ecf20Sopenharmony_ci ctx->sched[0xc] = cpu_to_be32(k); ror56_64(k, 11); 3448c2ecf20Sopenharmony_ci ctx->sched[0xd] = cpu_to_be32(k); ror56_64(k, 11); 3458c2ecf20Sopenharmony_ci ctx->sched[0xe] = cpu_to_be32(k); ror56_64(k, 11); 3468c2ecf20Sopenharmony_ci ctx->sched[0xf] = cpu_to_be32(k); 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_ci return 0; 3498c2ecf20Sopenharmony_ci#else 3508c2ecf20Sopenharmony_ci u32 hi, lo; /* hi is upper 24 bits and lo lower 32, total 56 */ 3518c2ecf20Sopenharmony_ci 3528c2ecf20Sopenharmony_ci /* discard the parity bits */ 3538c2ecf20Sopenharmony_ci lo = (*key++) >> 1; 3548c2ecf20Sopenharmony_ci lo <<= 7; 3558c2ecf20Sopenharmony_ci lo |= (*key++) >> 1; 3568c2ecf20Sopenharmony_ci lo <<= 7; 3578c2ecf20Sopenharmony_ci lo |= (*key++) >> 1; 3588c2ecf20Sopenharmony_ci lo <<= 7; 3598c2ecf20Sopenharmony_ci lo |= (*key++) >> 1; 3608c2ecf20Sopenharmony_ci hi = lo >> 4; 3618c2ecf20Sopenharmony_ci lo &= 0xf; 3628c2ecf20Sopenharmony_ci lo <<= 7; 3638c2ecf20Sopenharmony_ci lo |= (*key++) >> 1; 3648c2ecf20Sopenharmony_ci lo <<= 7; 3658c2ecf20Sopenharmony_ci lo |= (*key++) >> 1; 3668c2ecf20Sopenharmony_ci lo <<= 7; 3678c2ecf20Sopenharmony_ci lo |= (*key++) >> 1; 3688c2ecf20Sopenharmony_ci lo <<= 7; 3698c2ecf20Sopenharmony_ci lo |= (*key) >> 1; 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci /* Use lower 32 bits for schedule, rotate by 11 each round (16 times) */ 3728c2ecf20Sopenharmony_ci ctx->sched[0x0] = cpu_to_be32(lo); ror56(hi, lo, 11); 3738c2ecf20Sopenharmony_ci ctx->sched[0x1] = cpu_to_be32(lo); ror56(hi, lo, 11); 3748c2ecf20Sopenharmony_ci ctx->sched[0x2] = cpu_to_be32(lo); ror56(hi, lo, 11); 3758c2ecf20Sopenharmony_ci ctx->sched[0x3] = cpu_to_be32(lo); ror56(hi, lo, 11); 3768c2ecf20Sopenharmony_ci ctx->sched[0x4] = cpu_to_be32(lo); ror56(hi, lo, 11); 3778c2ecf20Sopenharmony_ci ctx->sched[0x5] = cpu_to_be32(lo); ror56(hi, lo, 11); 3788c2ecf20Sopenharmony_ci ctx->sched[0x6] = cpu_to_be32(lo); ror56(hi, lo, 11); 3798c2ecf20Sopenharmony_ci ctx->sched[0x7] = cpu_to_be32(lo); ror56(hi, lo, 11); 3808c2ecf20Sopenharmony_ci ctx->sched[0x8] = cpu_to_be32(lo); ror56(hi, lo, 11); 3818c2ecf20Sopenharmony_ci ctx->sched[0x9] = cpu_to_be32(lo); ror56(hi, lo, 11); 3828c2ecf20Sopenharmony_ci ctx->sched[0xa] = cpu_to_be32(lo); ror56(hi, lo, 11); 3838c2ecf20Sopenharmony_ci ctx->sched[0xb] = cpu_to_be32(lo); ror56(hi, lo, 11); 3848c2ecf20Sopenharmony_ci ctx->sched[0xc] = cpu_to_be32(lo); ror56(hi, lo, 11); 3858c2ecf20Sopenharmony_ci ctx->sched[0xd] = cpu_to_be32(lo); ror56(hi, lo, 11); 3868c2ecf20Sopenharmony_ci ctx->sched[0xe] = cpu_to_be32(lo); ror56(hi, lo, 11); 3878c2ecf20Sopenharmony_ci ctx->sched[0xf] = cpu_to_be32(lo); 3888c2ecf20Sopenharmony_ci return 0; 3898c2ecf20Sopenharmony_ci#endif 3908c2ecf20Sopenharmony_ci} 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_cistatic struct crypto_alg fcrypt_alg = { 3938c2ecf20Sopenharmony_ci .cra_name = "fcrypt", 3948c2ecf20Sopenharmony_ci .cra_driver_name = "fcrypt-generic", 3958c2ecf20Sopenharmony_ci .cra_flags = CRYPTO_ALG_TYPE_CIPHER, 3968c2ecf20Sopenharmony_ci .cra_blocksize = 8, 3978c2ecf20Sopenharmony_ci .cra_ctxsize = sizeof(struct fcrypt_ctx), 3988c2ecf20Sopenharmony_ci .cra_module = THIS_MODULE, 3998c2ecf20Sopenharmony_ci .cra_alignmask = 3, 4008c2ecf20Sopenharmony_ci .cra_u = { .cipher = { 4018c2ecf20Sopenharmony_ci .cia_min_keysize = 8, 4028c2ecf20Sopenharmony_ci .cia_max_keysize = 8, 4038c2ecf20Sopenharmony_ci .cia_setkey = fcrypt_setkey, 4048c2ecf20Sopenharmony_ci .cia_encrypt = fcrypt_encrypt, 4058c2ecf20Sopenharmony_ci .cia_decrypt = fcrypt_decrypt } } 4068c2ecf20Sopenharmony_ci}; 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_cistatic int __init fcrypt_mod_init(void) 4098c2ecf20Sopenharmony_ci{ 4108c2ecf20Sopenharmony_ci return crypto_register_alg(&fcrypt_alg); 4118c2ecf20Sopenharmony_ci} 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_cistatic void __exit fcrypt_mod_fini(void) 4148c2ecf20Sopenharmony_ci{ 4158c2ecf20Sopenharmony_ci crypto_unregister_alg(&fcrypt_alg); 4168c2ecf20Sopenharmony_ci} 4178c2ecf20Sopenharmony_ci 4188c2ecf20Sopenharmony_cisubsys_initcall(fcrypt_mod_init); 4198c2ecf20Sopenharmony_cimodule_exit(fcrypt_mod_fini); 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_ciMODULE_LICENSE("Dual BSD/GPL"); 4228c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("FCrypt Cipher Algorithm"); 4238c2ecf20Sopenharmony_ciMODULE_AUTHOR("David Howells <dhowells@redhat.com>"); 4248c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("fcrypt"); 425