1 /* 1 2 * Cryptographic API. 3 * 4 * Khazad Algorithm 5 * 6 * The Khazad algorithm was developed by Paulo 7 * Vincent Rijmen. It was a finalist in the N 8 * 9 * The original authors have disclaimed all co 10 * code and thus put it in the public domain. 11 * have put this under the GNU General Public 12 * 13 * By Aaron Grothe ajgrothe@yahoo.com, August 14 * 15 * This program is free software; you can redi 16 * it under the terms of the GNU General Publi 17 * the Free Software Foundation; either versio 18 * (at your option) any later version. 19 * 20 */ 21 22 #include <crypto/algapi.h> 23 #include <linux/init.h> 24 #include <linux/module.h> 25 #include <linux/mm.h> 26 #include <asm/byteorder.h> 27 #include <linux/types.h> 28 29 #define KHAZAD_KEY_SIZE 16 30 #define KHAZAD_BLOCK_SIZE 8 31 #define KHAZAD_ROUNDS 8 32 33 struct khazad_ctx { 34 u64 E[KHAZAD_ROUNDS + 1]; 35 u64 D[KHAZAD_ROUNDS + 1]; 36 }; 37 38 static const u64 T0[256] = { 39 0xbad3d268bbb96a01ULL, 0x54fc4d19e59a6 40 0x749ccdb925871b51ULL, 0x53f55102f7a25 41 0xd26b6fbdd6deb504ULL, 0x4dd72964b3528 42 0xace98a26cf09e063ULL, 0x8d8a0e83091c9 43 0x7090ddad3da7374dULL, 0x52f65507f1aa5 44 0x4cd42d61b55a8ef9ULL, 0xea238f6546032 45 0x97a466f155cc68c2ULL, 0xd16e63b2dcc6a 46 0x51f35908fbb241aaULL, 0x5bed712ac7e20 47 0xde7f5f81febec120ULL, 0x48d83d75ad7aa 48 0x99b65ec771bc0ae8ULL, 0xdb704b90e096e 49 0xb7c4e65195d11522ULL, 0xfc19d72b32b3a 50 0x9ebf42dc63843bfdULL, 0x91ae7eef41fc5 51 0xe23baf4d76437894ULL, 0xbbd0d66dbdb16 52 0x6eb2a5cb7957e517ULL, 0xa5f2ae0bf941b 53 0x6bbdb1da677fc20cULL, 0x95a26efb59dc7 54 0xf308eb1810cbc3e3ULL, 0xb1cefe4f81e12 55 0xcc4917db922e675eULL, 0xc45137f3a26e3 56 0x143c504478a09c6cULL, 0xc3582be8b0560 57 0xda734f95e69eed3cULL, 0x5de76934d3d23 58 0xdc79578bf2aed72eULL, 0x7d87e99413cf4 59 0x7f81e19e1fdf5e60ULL, 0x5aee752fc1ea0 60 0x5ce46d31d5da3e89ULL, 0xf704fb0c08ebe 61 0xff1cdb2438abb7c7ULL, 0xed2a937e543b1 62 0x9dba4ed3699c26f4ULL, 0x6fb1a1ce7f5fe 63 0x192b647d56c8e34fULL, 0xa0fdba1ae7699 64 0x89861e97113cba98ULL, 0x0f113c3322786 65 0xafec8629c511fd6aULL, 0xfb10cb30208b9 66 0x153f54417ea8976bULL, 0x0d1734392e687 67 0x0103040506080b07ULL, 0x64ac8de94507a 68 0x769ac5b329970d5fULL, 0x798bf9800bef6 69 0x3d47f4c98ef5b2b3ULL, 0x163a584e74b08 70 0x3759dcebb2a5fc85ULL, 0x6db7a9c4734ff 71 0xb9d6de67b1a17708ULL, 0x7395d1a237bf2 72 0x355fd4e1beb5ea8bULL, 0x55ff491ce3926 73 0x7b8df18a07ff727cULL, 0x8c890a860f149 74 0x88851a921734b19fULL, 0xf607ff090ee3e 75 0x3e42f8c684edafbaULL, 0x5ee2653bd9ca2 76 0x46ca0543890ac0cfULL, 0x0c14303c28607 77 0x68b8bdd56d67df05ULL, 0x61a399f85b2f8 78 0xc15e23e2bc46187dULL, 0x57f94116ef827 79 0xd976439aec86f035ULL, 0x58e87d25cdfa1 80 0x66aa85e34917bd2fULL, 0xd7647bacc8f69 81 0xc84507cf8a0e4b42ULL, 0x3c44f0cc88fdb 82 0x96a762f453c463c5ULL, 0xa7f4a601f551a 83 0xec29977b52331abeULL, 0xb8d5da62b7a97 84 0xaeef822cc319f66dULL, 0x69bbb9d06b6fd 85 0xabe0963ddd31d176ULL, 0xa9e69e37d121c 86 0x0a1e28223c504e36ULL, 0x47c901468f02c 87 0xb5c2ee5b99c1032cULL, 0x226688aacc0d6 88 0xee2f9f715e230cb0ULL, 0xbedfc27ca3994 89 0x819e3ebf217ce2a0ULL, 0x1236485a6c90a 90 0x1b2d6c775ad8f541ULL, 0x0e12383624706 91 0xf502f30604fbf9f1ULL, 0x45cf094c8312d 92 0xce4f1fd19e3e7150ULL, 0x49db3970ab72a 93 0xf916c33a2c9b8dd5ULL, 0xe637bf596e635 94 0x2878a088f05d25d8ULL, 0x17395c4b72b88 95 0x1a2e68725cd0fe46ULL, 0x8b80169d1d2ca 96 0x8a8312981b24a791ULL, 0x091b242d36485 97 0x879426a1354cd8b2ULL, 0x4ed2256bb94a9 98 0x2e72b896e46d1fcaULL, 0xe431b75362734 99 0xeb208b60400b2babULL, 0x90ad7aea47f45 100 0x1e22786644f0d25aULL, 0x85922eab395cc 101 0x0000000000000000ULL, 0x256f94b1de355 102 0xf10ee3121cdbd5edULL, 0x94a16afe5fd47 103 0xe734bb5c686b5f8fULL, 0x759fc9bc238f1 104 0x345cd0e4b8bde18cULL, 0x3153c4f5a695c 105 0xd06d67b7dacea30aULL, 0x869722a43344d 106 0xadea8e23c901eb64ULL, 0xfd1ad32e34bba 107 0x3050c0f0a09dcd90ULL, 0x3b4decd79ac58 108 0xf815c73f2a9386d2ULL, 0xc6573ff9ae7e2 109 0x060a181e14303a12ULL, 0x050f14111e282 110 0x113344556688bb77ULL, 0x7799c1b62f9f0 111 0x7a8ef58f01f7797bULL, 0x7888fd850de76 112 0x1c24706c48e0c454ULL, 0x394be4dd96d59 113 0x1828607850c0e848ULL, 0x56fa4513e98a7 114 0xb0cdfa4a87e92437ULL, 0x246c90b4d83d5 115 0xb2cbf2408bf93239ULL, 0x92ab72e04be44 116 0xc05d27e7ba4e137aULL, 0x44cc0d49851ad 117 0x103040506080b070ULL, 0xb4c1ea5e9fc90 118 0x43c511529722e7d4ULL, 0x93a876e54dec4 119 0x4ade357fa16ab4ebULL, 0xbddace73a9815 120 0x2d77b499ee7502c3ULL, 0xbcd9ca76af895 121 0x6abeb5df6177c90bULL, 0x40c01d5d9d3af 122 0xa2fbb210eb798249ULL, 0x809d3aba2774e 123 0x1f217c6342f8d95dULL, 0xca430fc5861e5 124 0x42c61557912aecd3ULL 125 }; 126 127 static const u64 T1[256] = { 128 0xd3ba68d2b9bb016aULL, 0xfc54194d9ae5b 129 0x9c74b9cd8725511bULL, 0xf5530251a2f7a 130 0x6bd2bd6fded604b5ULL, 0xd74d642952b3f 131 0xe9ac268a09cf63e0ULL, 0x8a8d830e1c098 132 0x9070addda73d4d37ULL, 0xf6520755aaf1a 133 0xd44c612d5ab5f98eULL, 0x23ea658f0346a 134 0xa497f166cc55c268ULL, 0x6ed1b263c6dc0 135 0xf3510859b2fbaa41ULL, 0xed5b2a71e2c79 136 0x7fde815fbefe20c1ULL, 0xd848753d7aade 137 0xb699c75ebc71e80aULL, 0x70db904b96e03 138 0xc4b751e6d1952215ULL, 0x19fc2bd7b332c 139 0xbf9edc428463fd3bULL, 0xae91ef7efc41d 140 0x3be24daf43769478ULL, 0xd0bb6dd6b1bd0 141 0xb26ecba5577917e5ULL, 0xf2a50bae41f95 142 0xbd6bdab17f670cc2ULL, 0xa295fb6edc59c 143 0x08f318ebcb10e3c3ULL, 0xceb14ffee1813 144 0x49ccdb172e925e67ULL, 0x51c4f3376ea26 145 0x3c144450a0786c9cULL, 0x58c3e82b56b07 146 0x73da954f9ee63cedULL, 0xe75d3469d2d38 147 0x79dc8b57aef22ed7ULL, 0x877d94e9cf136 148 0x817f9ee1df1f605eULL, 0xee5a2f75eac19 149 0xe45c316ddad5893eULL, 0x04f70cfbeb08f 150 0x1cff24dbab38c7b7ULL, 0x2aed7e933b54b 151 0xba9dd34e9c69f426ULL, 0xb16fcea15f7f1 152 0x2b197d64c8564fe3ULL, 0xfda01aba69e74 153 0x8689971e3c1198baULL, 0x110f333c78222 154 0xecaf298611c56afdULL, 0x10fb30cb8b20d 155 0x3f154154a87e6b97ULL, 0x170d3934682e2 156 0x030105040806070bULL, 0xac64e98d07452 157 0x9a76b3c597295f0dULL, 0x8b7980f9ef0b7 158 0x473dc9f4f58eb3b2ULL, 0x3a164e58b0746 159 0x5937ebdca5b285fcULL, 0xb76dc4a94f731 160 0xd6b967dea1b10877ULL, 0x9573a2d1bf374 161 0x5f35e1d4b5be8beaULL, 0xff551c4992e3b 162 0x8d7b8af1ff077c72ULL, 0x898c860a140f8 163 0x8588921a34179fb1ULL, 0x07f609ffe30ef 164 0x423ec6f8ed84baafULL, 0xe25e3b65cad98 165 0xca4643050a89cfc0ULL, 0x140c3c3060282 166 0xb868d5bd676d05dfULL, 0xa361f8992f5b3 167 0x5ec1e22346bc7d18ULL, 0xf957164182efb 168 0x76d99a4386ec35f0ULL, 0xe858257dfacd9 169 0xaa66e38517492fbdULL, 0x64d7ac7bf6c81 170 0x45c8cf070e8a424bULL, 0x443cccf0fd88b 171 0xa796f462c453c563ULL, 0xf4a701a651f55 172 0x29ec7b973352be1aULL, 0xd5b862daa9b70 173 0xefae2c8219c36df6ULL, 0xbb69d0b96f6b0 174 0xe0ab3d9631dd76d1ULL, 0xe6a9379e21d17 175 0x1e0a2228503c364eULL, 0xc9474601028fc 176 0xc2b55beec1992c03ULL, 0x6622aa880dcce 177 0x2fee719f235eb00cULL, 0xdfbe7cc299a31 178 0x9e81bf3e7c21a0e2ULL, 0x36125a48906c7 179 0x2d1b776cd85a41f5ULL, 0x120e363870242 180 0x02f506f3fb04f1f9ULL, 0xcf454c091283c 181 0x4fced11f3e9e5071ULL, 0xdb49703972abe 182 0x16f93ac39b2cd58dULL, 0x37e659bf636e8 183 0x782888a05df0d825ULL, 0x39174b5cb8726 184 0x2e1a7268d05c46feULL, 0x808b9d162c1d9 185 0x838a9812241b91a7ULL, 0x1b092d2448363 186 0x9487a1264c35b2d8ULL, 0xd24e6b254ab9f 187 0x722e96b86de4ca1fULL, 0x31e453b773628 188 0x20eb608b0b40ab2bULL, 0xad90ea7af447d 189 0x221e6678f0445ad2ULL, 0x9285ab2e5c39b 190 0x0000000000000000ULL, 0x6f25b19435def 191 0x0ef112e3db1cedd5ULL, 0xa194fe6ad45fc 192 0x34e75cbb6b688f5fULL, 0x9f75bcc98f235 193 0x5c34e4d0bdb88ce1ULL, 0x5331f5c495a69 194 0x6dd0b767ceda0aa3ULL, 0x9786a4224433b 195 0xeaad238e01c964ebULL, 0x1afd2ed3bb34c 196 0x5030f0c09da090cdULL, 0x4d3bd7ecc59aa 197 0x15f83fc7932ad286ULL, 0x57c6f93f7eae6 198 0x0a061e183014123aULL, 0x0f051114281e1 199 0x33115544886677bbULL, 0x9977b6c19f2f5 200 0x8e7a8ff5f7017b79ULL, 0x887885fde70d7 201 0x241c6c70e04854c4ULL, 0x4b39dde4d596a 202 0x28187860c05048e8ULL, 0xfa5613458ae9b 203 0xcdb04afae9873724ULL, 0x6c24b4903dd8f 204 0xcbb240f2f98b3932ULL, 0xab92e072e44bd 205 0x5dc0e7274eba7a13ULL, 0xcc44490d1a85c 206 0x30105040806070b0ULL, 0xc1b45eeac99f2 207 0xc54352112297d4e7ULL, 0xa893e576ec4dd 208 0xde4a7f356aa1ebb4ULL, 0xdabd73ce81a91 209 0x772d99b475eec302ULL, 0xd9bc76ca89af1 210 0xbe6adfb577610bc9ULL, 0xc0405d1d3a9dd 211 0xfba210b279eb4982ULL, 0x9d80ba3a7427a 212 0x211f637cf8425dd9ULL, 0x43cac50f1e864 213 0xc64257152a91d3ecULL 214 }; 215 216 static const u64 T2[256] = { 217 0xd268bad36a01bbb9ULL, 0x4d1954fc66b1e 218 0xcdb9749c1b512587ULL, 0x510253f557a4f 219 0x6fbdd26bb504d6deULL, 0x29644dd785feb 220 0x8a26ace9e063cf09ULL, 0x0e838d8a96840 221 0xddad7090374d3da7ULL, 0x550752f65ca3f 222 0x2d614cd48ef9b55aULL, 0x8f65ea2320ac4 223 0x66f197a468c255ccULL, 0x63b2d16ea80dd 224 0x590851f341aafbb2ULL, 0x712a5bed0f9cc 225 0x5f81de7fc120febeULL, 0x3d7548d8a2e5a 226 0x5ec799b60ae871bcULL, 0x4b90db70e63be 227 0xe651b7c4152295d1ULL, 0xd72bfc19aace3 228 0x42dc9ebf3bfd6384ULL, 0x7eef91ae52d04 229 0xaf4de23b78947643ULL, 0xd66dbbd06106b 230 0xa5cb6eb2e5177957ULL, 0xae0ba5f2b35cf 231 0xb1da6bbdc20c677fULL, 0x6efb95a27ecc5 232 0xeb18f308c3e310cbULL, 0xfe4fb1ce2f308 233 0x17dbcc49675e922eULL, 0x37f3c4513f66a 234 0x5044143c9c6c78a0ULL, 0x2be8c3580e73b 235 0x4f95da73ed3ce69eULL, 0x69345de7358ed 236 0x578bdc79d72ef2aeULL, 0xe9947d87486e1 237 0xe19e7f815e601fdfULL, 0x752f5aee049bc 238 0x6d315ce43e89d5daULL, 0xfb0cf704efff0 239 0xdb24ff1cb7c738abULL, 0x937eed2a11b95 240 0x4ed39dba26f4699cULL, 0xa1ce6fb1ee107 241 0x647d192be34f56c8ULL, 0xba1aa0fd9447e 242 0x1e978986ba98113cULL, 0x3c330f11692d2 243 0x8629afecfd6ac511ULL, 0xcb30fb109bdb2 244 0x5441153f976b7ea8ULL, 0x34390d177f232 245 0x040501030b070608ULL, 0x8de964acab214 246 0xc5b3769a0d5f2997ULL, 0xf980798b64720 247 0xf4c93d47b2b38ef5ULL, 0x584e163a8a627 248 0xdceb3759fc85b2a5ULL, 0xa9c46db7f81e7 249 0xde67b9d67708b1a1ULL, 0xd1a273952a443 250 0xd4e1355fea8bbeb5ULL, 0x491c55ff6db6e 251 0xf18a7b8d727c07ffULL, 0x0a868c899d830 252 0x1a928885b19f1734ULL, 0xff09f607e4f80 253 0xf8c63e42afba84edULL, 0x653b5ee22887d 254 0x054346cac0cf890aULL, 0x303c0c1474242 255 0xbdd568b8df056d67ULL, 0x99f861a38c3a5 256 0x23e2c15e187dbc46ULL, 0x411657f97bb8e 257 0x439ad976f035ec86ULL, 0x7d2558e81295c 258 0x85e366aabd2f4917ULL, 0x7bacd764921fc 259 0x07cfc8454b428a0eULL, 0xf0cc3c44b9b48 260 0x62f496a763c553c4ULL, 0xa601a7f4a552f 261 0x977bec291abe5233ULL, 0xda62b8d57c0fb 262 0x822caeeff66dc319ULL, 0xb9d069bbd4026 263 0x963dabe0d176dd31ULL, 0x9e37a9e6c778d 264 0x28220a1e4e363c50ULL, 0x014647c9cbc88 265 0xee5bb5c2032c99c1ULL, 0x88aa22666beec 266 0x9f71ee2f0cb05e23ULL, 0xc27cbedf461da 267 0x3ebf819ee2a0217cULL, 0x485a1236a67e6 268 0x6c771b2df5415ad8ULL, 0x38360e12622a2 269 0xf306f502f9f104fbULL, 0x094c45cfddc68 270 0x1fd1ce4f71509e3eULL, 0x397049dba9e2a 271 0xc33af9168dd52c9bULL, 0xbf59e63754886 272 0xa088287825d8f05dULL, 0x5c4b173981657 273 0x68721a2efe465cd0ULL, 0x169d8b80ac961 274 0x12988a83a7911b24ULL, 0x242d091b533f3 275 0x26a18794d8b2354cULL, 0x256b4ed298f7b 276 0xb8962e721fcae46dULL, 0xb753e43142866 277 0x8b60eb202bab400bULL, 0x7aea90ad59d74 278 0x78661e22d25a44f0ULL, 0x2eab8592cebc3 279 0x0000000000000000ULL, 0x94b1256f5afbd 280 0xe312f10ed5ed1cdbULL, 0x6afe94a175cb5 281 0xbb5ce7345f8f686bULL, 0xc9bc759f10562 282 0xd0e4345ce18cb8bdULL, 0xc4f53153c697a 283 0x67b7d06da30adaceULL, 0x22a48697d3b53 284 0x8e23adeaeb64c901ULL, 0xd32efd1aa1c93 285 0xc0f03050cd90a09dULL, 0xecd73b4d88a19 286 0xc73ff81586d22a93ULL, 0x3ff9c6572968a 287 0x181e060a3a121430ULL, 0x1411050f271b1 288 0x44551133bb776688ULL, 0xc1b6779906582 289 0xf58f7a8e797b01f7ULL, 0xfd8578886f750 290 0x706c1c24c45448e0ULL, 0xe4dd394b9eaf9 291 0x60781828e84850c0ULL, 0x451356fa70bfe 292 0xfa4ab0cd243787e9ULL, 0x90b4246c51fcd 293 0xf240b2cb32398bf9ULL, 0x72e092ab4fd94 294 0x27e7c05d137aba4eULL, 0x0d4944ccd6c18 295 0x40501030b0706080ULL, 0xea5eb4c1082b9 296 0x115243c5e7d49722ULL, 0x76e593a844de4 297 0x357f4adeb4eba16aULL, 0xce73bdda5b14a 298 0xb4992d7702c3ee75ULL, 0xca76bcd95013a 299 0xb5df6abec90b6177ULL, 0x1d5d40c0fadd9 300 0xb210a2fb8249eb79ULL, 0x3aba809de9a72 301 0x7c631f21d95d42f8ULL, 0x0fc5ca435d4c8 302 0x155742c6ecd3912aULL 303 }; 304 305 static const u64 T3[256] = { 306 0x68d2d3ba016ab9bbULL, 0x194dfc54b1669 307 0xb9cd9c74511b8725ULL, 0x0251f553a457a 308 0xbd6f6bd204b5ded6ULL, 0x6429d74dfe855 309 0x268ae9ac63e009cfULL, 0x830e8a8d84961 310 0xaddd90704d37a73dULL, 0x0755f652a35ca 311 0x612dd44cf98e5ab5ULL, 0x658f23eaac200 312 0xf166a497c268cc55ULL, 0xb2636ed10da8c 313 0x0859f351aa41b2fbULL, 0x2a71ed5b9c0fe 314 0x815f7fde20c1befeULL, 0x753dd848e5a27 315 0xc75eb699e80abc71ULL, 0x904b70db3be69 316 0x51e6c4b72215d195ULL, 0x2bd719fcceaab 317 0xdc42bf9efd3b8463ULL, 0xef7eae91d052f 318 0x4daf3be294784376ULL, 0x6dd6d0bb0661b 319 0xcba5b26e17e55779ULL, 0x0baef2a55cb34 320 0xdab1bd6b0cc27f67ULL, 0xfb6ea295cc7ed 321 0x18eb08f3e3c3cb10ULL, 0x4ffeceb1302fe 322 0xdb1749cc5e672e92ULL, 0xf33751c4663f6 323 0x44503c146c9ca078ULL, 0xe82b58c3730e5 324 0x954f73da3ced9ee6ULL, 0x3469e75d8e35d 325 0x8b5779dc2ed7aef2ULL, 0x94e9877d6e48c 326 0x9ee1817f605edf1fULL, 0x2f75ee5a9b04e 327 0x316de45c893edad5ULL, 0x0cfb04f7ffefe 328 0x24db1cffc7b7ab38ULL, 0x7e932aedb9113 329 0xd34eba9df4269c69ULL, 0xcea1b16f10ee5 330 0x7d642b194fe3c856ULL, 0x1abafda047946 331 0x971e868998ba3c11ULL, 0x333c110f2d697 332 0x2986ecaf6afd11c5ULL, 0x30cb10fbdb9b8 333 0x41543f156b97a87eULL, 0x3934170d237f6 334 0x05040301070b0806ULL, 0xe98dac6421ab0 335 0xb3c59a765f0d9729ULL, 0x80f98b797264e 336 0xc9f4473db3b2f58eULL, 0x4e583a16628ab 337 0xebdc593785fca5b2ULL, 0xc4a9b76d1ef84 338 0x67ded6b90877a1b1ULL, 0xa2d19573442ab 339 0xe1d45f358beab5beULL, 0x1c49ff55b66d9 340 0x8af18d7b7c72ff07ULL, 0x860a898c839d1 341 0x921a85889fb13417ULL, 0x09ff07f6f8e4e 342 0xc6f8423ebaafed84ULL, 0x3b65e25e8728c 343 0x4305ca46cfc00a89ULL, 0x3c30140c24746 344 0xd5bdb86805df676dULL, 0xf899a3613a8c2 345 0xe2235ec17d1846bcULL, 0x1641f957b87b8 346 0x9a4376d935f086ecULL, 0x257de8589512f 347 0xe385aa662fbd1749ULL, 0xac7b64d71f92f 348 0xcf0745c8424b0e8aULL, 0xccf0443cb4b9f 349 0xf462a796c563c453ULL, 0x01a6f4a752a55 350 0x7b9729ecbe1a3352ULL, 0x62dad5b80f7ca 351 0x2c82efae6df619c3ULL, 0xd0b9bb6902d46 352 0x3d96e0ab76d131ddULL, 0x379ee6a978c72 353 0x22281e0a364e503cULL, 0x4601c947c8cb0 354 0x5beec2b52c03c199ULL, 0xaa886622ee6b0 355 0x719f2feeb00c235eULL, 0x7cc2dfbe1d469 356 0xbf3e9e81a0e27c21ULL, 0x5a4836127ea69 357 0x776c2d1b41f5d85aULL, 0x3638120e2a627 358 0x06f302f5f1f9fb04ULL, 0x4c09cf45c6dd1 359 0xd11f4fce50713e9eULL, 0x7039db49e2a97 360 0x3ac316f9d58d9b2cULL, 0x59bf37e688546 361 0x88a07828d8255df0ULL, 0x4b5c39176581b 362 0x72682e1a46fed05cULL, 0x9d16808b96ac2 363 0x9812838a91a7241bULL, 0x2d241b093f534 364 0xa1269487b2d84c35ULL, 0x6b25d24ef7984 365 0x96b8722eca1f6de4ULL, 0x53b731e486427 366 0x608b20ebab2b0b40ULL, 0xea7aad90d759f 367 0x6678221e5ad2f044ULL, 0xab2e9285bcce5 368 0x0000000000000000ULL, 0xb1946f25fb5a3 369 0x12e30ef1edd5db1cULL, 0xfe6aa194cb75d 370 0x5cbb34e78f5f6b68ULL, 0xbcc99f7556108 371 0xe4d05c348ce1bdb8ULL, 0xf5c4533197c69 372 0xb7676dd00aa3cedaULL, 0xa4229786b5d34 373 0x238eeaad64eb01c9ULL, 0x2ed31afdc9a1b 374 0xf0c0503090cd9da0ULL, 0xd7ec4d3ba188c 375 0x3fc715f8d286932aULL, 0xf93f57c668297 376 0x1e180a06123a3014ULL, 0x11140f051b272 377 0x5544331177bb8866ULL, 0xb6c1997758069 378 0x8ff58e7a7b79f701ULL, 0x85fd8878756fe 379 0x6c70241c54c4e048ULL, 0xdde44b39af9ed 380 0x7860281848e8c050ULL, 0x1345fa56bf708 381 0x4afacdb03724e987ULL, 0xb4906c24fc513 382 0x40f2cbb23932f98bULL, 0xe072ab92d94fe 383 0xe7275dc07a134ebaULL, 0x490dcc44c1d61 384 0x5040301070b08060ULL, 0x5eeac1b42b08c 385 0x5211c543d4e72297ULL, 0xe576a893de44e 386 0x7f35de4aebb46aa1ULL, 0x73cedabd145b8 387 0x99b4772dc30275eeULL, 0x76cad9bc13508 388 0xdfb5be6a0bc97761ULL, 0x5d1dc040ddfa3 389 0x10b2fba2498279ebULL, 0xba3a9d80a7e97 390 0x637c211f5dd9f842ULL, 0xc50f43ca4c5d1 391 0x5715c642d3ec2a91ULL 392 }; 393 394 static const u64 T4[256] = { 395 0xbbb96a01bad3d268ULL, 0xe59a66b154fc4 396 0x25871b51749ccdb9ULL, 0xf7a257a453f55 397 0xd6deb504d26b6fbdULL, 0xb35285fe4dd72 398 0xcf09e063ace98a26ULL, 0x091c96848d8a0 399 0x3da7374d7090ddadULL, 0xf1aa5ca352f65 400 0xb55a8ef94cd42d61ULL, 0x460320acea238 401 0x55cc68c297a466f1ULL, 0xdcc6a80dd16e6 402 0xfbb241aa51f35908ULL, 0xc7e20f9c5bed7 403 0xfebec120de7f5f81ULL, 0xad7aa2e548d83 404 0x71bc0ae899b65ec7ULL, 0xe096e63bdb704 405 0x95d11522b7c4e651ULL, 0x32b3aacefc19d 406 0x63843bfd9ebf42dcULL, 0x41fc52d091ae7 407 0x76437894e23baf4dULL, 0xbdb16106bbd0d 408 0x7957e5176eb2a5cbULL, 0xf941b35ca5f2a 409 0x677fc20c6bbdb1daULL, 0x59dc7ecc95a26 410 0x10cbc3e3f308eb18ULL, 0x81e12f30b1cef 411 0x922e675ecc4917dbULL, 0xa26e3f66c4513 412 0x78a09c6c143c5044ULL, 0xb0560e73c3582 413 0xe69eed3cda734f95ULL, 0xd3d2358e5de76 414 0xf2aed72edc79578bULL, 0x13cf486e7d87e 415 0x1fdf5e607f81e19eULL, 0xc1ea049b5aee7 416 0xd5da3e895ce46d31ULL, 0x08ebeffff704f 417 0x38abb7c7ff1cdb24ULL, 0x543b11b9ed2a9 418 0x699c26f49dba4ed3ULL, 0x7f5fee106fb1a 419 0x56c8e34f192b647dULL, 0xe7699447a0fdb 420 0x113cba9889861e97ULL, 0x2278692d0f113 421 0xc511fd6aafec8629ULL, 0x208b9bdbfb10c 422 0x7ea8976b153f5441ULL, 0x2e687f230d173 423 0x06080b0701030405ULL, 0x4507ab2164ac8 424 0x29970d5f769ac5b3ULL, 0x0bef6472798bf 425 0x8ef5b2b33d47f4c9ULL, 0x74b08a62163a5 426 0xb2a5fc853759dcebULL, 0x734ff81e6db7a 427 0xb1a17708b9d6de67ULL, 0x37bf2a447395d 428 0xbeb5ea8b355fd4e1ULL, 0xe3926db655ff4 429 0x07ff727c7b8df18aULL, 0x0f149d838c890 430 0x1734b19f88851a92ULL, 0x0ee3e4f8f607f 431 0x84edafba3e42f8c6ULL, 0xd9ca28875ee26 432 0x890ac0cf46ca0543ULL, 0x286074240c143 433 0x6d67df0568b8bdd5ULL, 0x5b2f8c3a61a39 434 0xbc46187dc15e23e2ULL, 0xef827bb857f94 435 0xec86f035d976439aULL, 0xcdfa129558e87 436 0x4917bd2f66aa85e3ULL, 0xc8f6921fd7647 437 0x8a0e4b42c84507cfULL, 0x88fdb9b43c44f 438 0x53c463c596a762f4ULL, 0xf551a552a7f4a 439 0x52331abeec29977bULL, 0xb7a97c0fb8d5d 440 0xc319f66daeef822cULL, 0x6b6fd40269bbb 441 0xdd31d176abe0963dULL, 0xd121c778a9e69 442 0x3c504e360a1e2822ULL, 0x8f02cbc847c90 443 0x99c1032cb5c2ee5bULL, 0xcc0d6bee22668 444 0x5e230cb0ee2f9f71ULL, 0xa399461dbedfc 445 0x217ce2a0819e3ebfULL, 0x6c90a67e12364 446 0x5ad8f5411b2d6c77ULL, 0x2470622a0e123 447 0x04fbf9f1f502f306ULL, 0x8312ddc645cf0 448 0x9e3e7150ce4f1fd1ULL, 0xab72a9e249db3 449 0x2c9b8dd5f916c33aULL, 0x6e635488e637b 450 0xf05d25d82878a088ULL, 0x72b8816517395 451 0x5cd0fe461a2e6872ULL, 0x1d2cac968b801 452 0x1b24a7918a831298ULL, 0x3648533f091b2 453 0x354cd8b2879426a1ULL, 0xb94a98f74ed22 454 0xe46d1fca2e72b896ULL, 0x62734286e431b 455 0x400b2babeb208b60ULL, 0x47f459d790ad7 456 0x44f0d25a1e227866ULL, 0x395ccebc85922 457 0x0000000000000000ULL, 0xde355afb256f9 458 0x1cdbd5edf10ee312ULL, 0x5fd475cb94a16 459 0x686b5f8fe734bb5cULL, 0x238f1056759fc 460 0xb8bde18c345cd0e4ULL, 0xa695c6973153c 461 0xdacea30ad06d67b7ULL, 0x3344d3b586972 462 0xc901eb64adea8e23ULL, 0x34bba1c9fd1ad 463 0xa09dcd903050c0f0ULL, 0x9ac588a13b4de 464 0x2a9386d2f815c73fULL, 0xae7e2968c6573 465 0x14303a12060a181eULL, 0x1e28271b050f1 466 0x6688bb7711334455ULL, 0x2f9f06587799c 467 0x01f7797b7a8ef58fULL, 0x0de76f757888f 468 0x48e0c4541c24706cULL, 0x96d59eaf394be 469 0x50c0e84818286078ULL, 0xe98a70bf56fa4 470 0x87e92437b0cdfa4aULL, 0xd83d51fc246c9 471 0x8bf93239b2cbf240ULL, 0x4be44fd992ab7 472 0xba4e137ac05d27e7ULL, 0x851ad6c144cc0 473 0x6080b07010304050ULL, 0x9fc9082bb4c1e 474 0x9722e7d443c51152ULL, 0x4dec44de93a87 475 0xa16ab4eb4ade357fULL, 0xa9815b14bddac 476 0xee7502c32d77b499ULL, 0xaf895013bcd9c 477 0x6177c90b6abeb5dfULL, 0x9d3afadd40c01 478 0xeb798249a2fbb210ULL, 0x2774e9a7809d3 479 0x42f8d95d1f217c63ULL, 0x861e5d4cca430 480 0x912aecd342c61557ULL 481 }; 482 483 static const u64 T5[256] = { 484 0xb9bb016ad3ba68d2ULL, 0x9ae5b166fc541 485 0x8725511b9c74b9cdULL, 0xa2f7a457f5530 486 0xded604b56bd2bd6fULL, 0x52b3fe85d74d6 487 0x09cf63e0e9ac268aULL, 0x1c0984968a8d8 488 0xa73d4d379070adddULL, 0xaaf1a35cf6520 489 0x5ab5f98ed44c612dULL, 0x0346ac2023ea6 490 0xcc55c268a497f166ULL, 0xc6dc0da86ed1b 491 0xb2fbaa41f3510859ULL, 0xe2c79c0fed5b2 492 0xbefe20c17fde815fULL, 0x7aade5a2d8487 493 0xbc71e80ab699c75eULL, 0x96e03be670db9 494 0xd1952215c4b751e6ULL, 0xb332ceaa19fc2 495 0x8463fd3bbf9edc42ULL, 0xfc41d052ae91e 496 0x437694783be24dafULL, 0xb1bd0661d0bb6 497 0x577917e5b26ecba5ULL, 0x41f95cb3f2a50 498 0x7f670cc2bd6bdab1ULL, 0xdc59cc7ea295f 499 0xcb10e3c308f318ebULL, 0xe181302fceb14 500 0x2e925e6749ccdb17ULL, 0x6ea2663f51c4f 501 0xa0786c9c3c144450ULL, 0x56b0730e58c3e 502 0x9ee63ced73da954fULL, 0xd2d38e35e75d3 503 0xaef22ed779dc8b57ULL, 0xcf136e48877d9 504 0xdf1f605e817f9ee1ULL, 0xeac19b04ee5a2 505 0xdad5893ee45c316dULL, 0xeb08ffef04f70 506 0xab38c7b71cff24dbULL, 0x3b54b9112aed7 507 0x9c69f426ba9dd34eULL, 0x5f7f10eeb16fc 508 0xc8564fe32b197d64ULL, 0x69e74794fda01 509 0x3c1198ba8689971eULL, 0x78222d69110f3 510 0x11c56afdecaf2986ULL, 0x8b20db9b10fb3 511 0xa87e6b973f154154ULL, 0x682e237f170d3 512 0x0806070b03010504ULL, 0x074521abac64e 513 0x97295f0d9a76b3c5ULL, 0xef0b72648b798 514 0xf58eb3b2473dc9f4ULL, 0xb074628a3a164 515 0xa5b285fc5937ebdcULL, 0x4f731ef8b76dc 516 0xa1b10877d6b967deULL, 0xbf37442a9573a 517 0xb5be8bea5f35e1d4ULL, 0x92e3b66dff551 518 0xff077c728d7b8af1ULL, 0x140f839d898c8 519 0x34179fb18588921aULL, 0xe30ef8e407f60 520 0xed84baaf423ec6f8ULL, 0xcad98728e25e3 521 0x0a89cfc0ca464305ULL, 0x60282474140c3 522 0x676d05dfb868d5bdULL, 0x2f5b3a8ca361f 523 0x46bc7d185ec1e223ULL, 0x82efb87bf9571 524 0x86ec35f076d99a43ULL, 0xfacd9512e8582 525 0x17492fbdaa66e385ULL, 0xf6c81f9264d7a 526 0x0e8a424b45c8cf07ULL, 0xfd88b4b9443cc 527 0xc453c563a796f462ULL, 0x51f552a5f4a70 528 0x3352be1a29ec7b97ULL, 0xa9b70f7cd5b86 529 0x19c36df6efae2c82ULL, 0x6f6b02d4bb69d 530 0x31dd76d1e0ab3d96ULL, 0x21d178c7e6a93 531 0x503c364e1e0a2228ULL, 0x028fc8cbc9474 532 0xc1992c03c2b55beeULL, 0x0dccee6b6622a 533 0x235eb00c2fee719fULL, 0x99a31d46dfbe7 534 0x7c21a0e29e81bf3eULL, 0x906c7ea636125 535 0xd85a41f52d1b776cULL, 0x70242a62120e3 536 0xfb04f1f902f506f3ULL, 0x1283c6ddcf454 537 0x3e9e50714fced11fULL, 0x72abe2a9db497 538 0x9b2cd58d16f93ac3ULL, 0x636e885437e65 539 0x5df0d825782888a0ULL, 0xb872658139174 540 0xd05c46fe2e1a7268ULL, 0x2c1d96ac808b9 541 0x241b91a7838a9812ULL, 0x48363f531b092 542 0x4c35b2d89487a126ULL, 0x4ab9f798d24e6 543 0x6de4ca1f722e96b8ULL, 0x7362864231e45 544 0x0b40ab2b20eb608bULL, 0xf447d759ad90e 545 0xf0445ad2221e6678ULL, 0x5c39bcce9285a 546 0x0000000000000000ULL, 0x35defb5a6f25b 547 0xdb1cedd50ef112e3ULL, 0xd45fcb75a194f 548 0x6b688f5f34e75cbbULL, 0x8f2356109f75b 549 0xbdb88ce15c34e4d0ULL, 0x95a697c65331f 550 0xceda0aa36dd0b767ULL, 0x4433b5d39786a 551 0x01c964ebeaad238eULL, 0xbb34c9a11afd2 552 0x9da090cd5030f0c0ULL, 0xc59aa1884d3bd 553 0x932ad28615f83fc7ULL, 0x7eae682957c6f 554 0x3014123a0a061e18ULL, 0x281e1b270f051 555 0x886677bb33115544ULL, 0x9f2f58069977b 556 0xf7017b798e7a8ff5ULL, 0xe70d756f88788 557 0xe04854c4241c6c70ULL, 0xd596af9e4b39d 558 0xc05048e828187860ULL, 0x8ae9bf70fa561 559 0xe9873724cdb04afaULL, 0x3dd8fc516c24b 560 0xf98b3932cbb240f2ULL, 0xe44bd94fab92e 561 0x4eba7a135dc0e727ULL, 0x1a85c1d6cc444 562 0x806070b030105040ULL, 0xc99f2b08c1b45 563 0x2297d4e7c5435211ULL, 0xec4dde44a893e 564 0x6aa1ebb4de4a7f35ULL, 0x81a9145bdabd7 565 0x75eec302772d99b4ULL, 0x89af1350d9bc7 566 0x77610bc9be6adfb5ULL, 0x3a9dddfac0405 567 0x79eb4982fba210b2ULL, 0x7427a7e99d80b 568 0xf8425dd9211f637cULL, 0x1e864c5d43cac 569 0x2a91d3ecc6425715ULL 570 }; 571 572 static const u64 T6[256] = { 573 0x6a01bbb9d268bad3ULL, 0x66b1e59a4d195 574 0x1b512587cdb9749cULL, 0x57a4f7a251025 575 0xb504d6de6fbdd26bULL, 0x85feb35229644 576 0xe063cf098a26ace9ULL, 0x9684091c0e838 577 0x374d3da7ddad7090ULL, 0x5ca3f1aa55075 578 0x8ef9b55a2d614cd4ULL, 0x20ac46038f65e 579 0x68c255cc66f197a4ULL, 0xa80ddcc663b2d 580 0x41aafbb2590851f3ULL, 0x0f9cc7e2712a5 581 0xc120febe5f81de7fULL, 0xa2e5ad7a3d754 582 0x0ae871bc5ec799b6ULL, 0xe63be0964b90d 583 0x152295d1e651b7c4ULL, 0xaace32b3d72bf 584 0x3bfd638442dc9ebfULL, 0x52d041fc7eef9 585 0x78947643af4de23bULL, 0x6106bdb1d66db 586 0xe5177957a5cb6eb2ULL, 0xb35cf941ae0ba 587 0xc20c677fb1da6bbdULL, 0x7ecc59dc6efb9 588 0xc3e310cbeb18f308ULL, 0x2f3081e1fe4fb 589 0x675e922e17dbcc49ULL, 0x3f66a26e37f3c 590 0x9c6c78a05044143cULL, 0x0e73b0562be8c 591 0xed3ce69e4f95da73ULL, 0x358ed3d269345 592 0xd72ef2ae578bdc79ULL, 0x486e13cfe9947 593 0x5e601fdfe19e7f81ULL, 0x049bc1ea752f5 594 0x3e89d5da6d315ce4ULL, 0xefff08ebfb0cf 595 0xb7c738abdb24ff1cULL, 0x11b9543b937ee 596 0x26f4699c4ed39dbaULL, 0xee107f5fa1ce6 597 0xe34f56c8647d192bULL, 0x9447e769ba1aa 598 0xba98113c1e978986ULL, 0x692d22783c330 599 0xfd6ac5118629afecULL, 0x9bdb208bcb30f 600 0x976b7ea85441153fULL, 0x7f232e6834390 601 0x0b07060804050103ULL, 0xab2145078de96 602 0x0d5f2997c5b3769aULL, 0x64720beff9807 603 0xb2b38ef5f4c93d47ULL, 0x8a6274b0584e1 604 0xfc85b2a5dceb3759ULL, 0xf81e734fa9c46 605 0x7708b1a1de67b9d6ULL, 0x2a4437bfd1a27 606 0xea8bbeb5d4e1355fULL, 0x6db6e392491c5 607 0x727c07fff18a7b8dULL, 0x9d830f140a868 608 0xb19f17341a928885ULL, 0xe4f80ee3ff09f 609 0xafba84edf8c63e42ULL, 0x2887d9ca653b5 610 0xc0cf890a054346caULL, 0x74242860303c0 611 0xdf056d67bdd568b8ULL, 0x8c3a5b2f99f86 612 0x187dbc4623e2c15eULL, 0x7bb8ef8241165 613 0xf035ec86439ad976ULL, 0x1295cdfa7d255 614 0xbd2f491785e366aaULL, 0x921fc8f67bacd 615 0x4b428a0e07cfc845ULL, 0xb9b488fdf0cc3 616 0x63c553c462f496a7ULL, 0xa552f551a601a 617 0x1abe5233977bec29ULL, 0x7c0fb7a9da62b 618 0xf66dc319822caeefULL, 0xd4026b6fb9d06 619 0xd176dd31963dabe0ULL, 0xc778d1219e37a 620 0x4e363c5028220a1eULL, 0xcbc88f0201464 621 0x032c99c1ee5bb5c2ULL, 0x6beecc0d88aa2 622 0x0cb05e239f71ee2fULL, 0x461da399c27cb 623 0xe2a0217c3ebf819eULL, 0xa67e6c90485a1 624 0xf5415ad86c771b2dULL, 0x622a247038360 625 0xf9f104fbf306f502ULL, 0xddc68312094c4 626 0x71509e3e1fd1ce4fULL, 0xa9e2ab7239704 627 0x8dd52c9bc33af916ULL, 0x54886e63bf59e 628 0x25d8f05da0882878ULL, 0x816572b85c4b1 629 0xfe465cd068721a2eULL, 0xac961d2c169d8 630 0xa7911b2412988a83ULL, 0x533f3648242d0 631 0xd8b2354c26a18794ULL, 0x98f7b94a256b4 632 0x1fcae46db8962e72ULL, 0x42866273b753e 633 0x2bab400b8b60eb20ULL, 0x59d747f47aea9 634 0xd25a44f078661e22ULL, 0xcebc395c2eab8 635 0x0000000000000000ULL, 0x5afbde3594b12 636 0xd5ed1cdbe312f10eULL, 0x75cb5fd46afe9 637 0x5f8f686bbb5ce734ULL, 0x1056238fc9bc7 638 0xe18cb8bdd0e4345cULL, 0xc697a695c4f53 639 0xa30adace67b7d06dULL, 0xd3b5334422a48 640 0xeb64c9018e23adeaULL, 0xa1c934bbd32ef 641 0xcd90a09dc0f03050ULL, 0x88a19ac5ecd73 642 0x86d22a93c73ff815ULL, 0x2968ae7e3ff9c 643 0x3a121430181e060aULL, 0x271b1e2814110 644 0xbb77668844551133ULL, 0x06582f9fc1b67 645 0x797b01f7f58f7a8eULL, 0x6f750de7fd857 646 0xc45448e0706c1c24ULL, 0x9eaf96d5e4dd3 647 0xe84850c060781828ULL, 0x70bfe98a45135 648 0x243787e9fa4ab0cdULL, 0x51fcd83d90b42 649 0x32398bf9f240b2cbULL, 0x4fd94be472e09 650 0x137aba4e27e7c05dULL, 0xd6c1851a0d494 651 0xb070608040501030ULL, 0x082b9fc9ea5eb 652 0xe7d49722115243c5ULL, 0x44de4dec76e59 653 0xb4eba16a357f4adeULL, 0x5b14a981ce73b 654 0x02c3ee75b4992d77ULL, 0x5013af89ca76b 655 0xc90b6177b5df6abeULL, 0xfadd9d3a1d5d4 656 0x8249eb79b210a2fbULL, 0xe9a727743aba8 657 0xd95d42f87c631f21ULL, 0x5d4c861e0fc5c 658 0xecd3912a155742c6ULL 659 }; 660 661 static const u64 T7[256] = { 662 0x016ab9bb68d2d3baULL, 0xb1669ae5194df 663 0x511b8725b9cd9c74ULL, 0xa457a2f70251f 664 0x04b5ded6bd6f6bd2ULL, 0xfe8552b36429d 665 0x63e009cf268ae9acULL, 0x84961c09830e8 666 0x4d37a73daddd9070ULL, 0xa35caaf10755f 667 0xf98e5ab5612dd44cULL, 0xac200346658f2 668 0xc268cc55f166a497ULL, 0x0da8c6dcb2636 669 0xaa41b2fb0859f351ULL, 0x9c0fe2c72a71e 670 0x20c1befe815f7fdeULL, 0xe5a27aad753dd 671 0xe80abc71c75eb699ULL, 0x3be696e0904b7 672 0x2215d19551e6c4b7ULL, 0xceaab3322bd71 673 0xfd3b8463dc42bf9eULL, 0xd052fc41ef7ea 674 0x947843764daf3be2ULL, 0x0661b1bd6dd6d 675 0x17e55779cba5b26eULL, 0x5cb341f90baef 676 0x0cc27f67dab1bd6bULL, 0xcc7edc59fb6ea 677 0xe3c3cb1018eb08f3ULL, 0x302fe1814ffec 678 0x5e672e92db1749ccULL, 0x663f6ea2f3375 679 0x6c9ca07844503c14ULL, 0x730e56b0e82b5 680 0x3ced9ee6954f73daULL, 0x8e35d2d33469e 681 0x2ed7aef28b5779dcULL, 0x6e48cf1394e98 682 0x605edf1f9ee1817fULL, 0x9b04eac12f75e 683 0x893edad5316de45cULL, 0xffefeb080cfb0 684 0xc7b7ab3824db1cffULL, 0xb9113b547e932 685 0xf4269c69d34eba9dULL, 0x10ee5f7fcea1b 686 0x4fe3c8567d642b19ULL, 0x479469e71abaf 687 0x98ba3c11971e8689ULL, 0x2d697822333c1 688 0x6afd11c52986ecafULL, 0xdb9b8b2030cb1 689 0x6b97a87e41543f15ULL, 0x237f682e39341 690 0x070b080605040301ULL, 0x21ab0745e98da 691 0x5f0d9729b3c59a76ULL, 0x7264ef0b80f98 692 0xb3b2f58ec9f4473dULL, 0x628ab0744e583 693 0x85fca5b2ebdc5937ULL, 0x1ef84f73c4a9b 694 0x0877a1b167ded6b9ULL, 0x442abf37a2d19 695 0x8beab5bee1d45f35ULL, 0xb66d92e31c49f 696 0x7c72ff078af18d7bULL, 0x839d140f860a8 697 0x9fb13417921a8588ULL, 0xf8e4e30e09ff0 698 0xbaafed84c6f8423eULL, 0x8728cad93b65e 699 0xcfc00a894305ca46ULL, 0x247460283c301 700 0x05df676dd5bdb868ULL, 0x3a8c2f5bf899a 701 0x7d1846bce2235ec1ULL, 0xb87b82ef1641f 702 0x35f086ec9a4376d9ULL, 0x9512facd257de 703 0x2fbd1749e385aa66ULL, 0x1f92f6c8ac7b6 704 0x424b0e8acf0745c8ULL, 0xb4b9fd88ccf04 705 0xc563c453f462a796ULL, 0x52a551f501a6f 706 0xbe1a33527b9729ecULL, 0x0f7ca9b762dad 707 0x6df619c32c82efaeULL, 0x02d46f6bd0b9b 708 0x76d131dd3d96e0abULL, 0x78c721d1379ee 709 0x364e503c22281e0aULL, 0xc8cb028f4601c 710 0x2c03c1995beec2b5ULL, 0xee6b0dccaa886 711 0xb00c235e719f2feeULL, 0x1d4699a37cc2d 712 0xa0e27c21bf3e9e81ULL, 0x7ea6906c5a483 713 0x41f5d85a776c2d1bULL, 0x2a62702436381 714 0xf1f9fb0406f302f5ULL, 0xc6dd12834c09c 715 0x50713e9ed11f4fceULL, 0xe2a972ab7039d 716 0xd58d9b2c3ac316f9ULL, 0x8854636e59bf3 717 0xd8255df088a07828ULL, 0x6581b8724b5c3 718 0x46fed05c72682e1aULL, 0x96ac2c1d9d168 719 0x91a7241b9812838aULL, 0x3f5348362d241 720 0xb2d84c35a1269487ULL, 0xf7984ab96b25d 721 0xca1f6de496b8722eULL, 0x8642736253b73 722 0xab2b0b40608b20ebULL, 0xd759f447ea7aa 723 0x5ad2f0446678221eULL, 0xbcce5c39ab2e9 724 0x0000000000000000ULL, 0xfb5a35deb1946 725 0xedd5db1c12e30ef1ULL, 0xcb75d45ffe6aa 726 0x8f5f6b685cbb34e7ULL, 0x56108f23bcc99 727 0x8ce1bdb8e4d05c34ULL, 0x97c695a6f5c45 728 0x0aa3cedab7676dd0ULL, 0xb5d34433a4229 729 0x64eb01c9238eeaadULL, 0xc9a1bb342ed31 730 0x90cd9da0f0c05030ULL, 0xa188c59ad7ec4 731 0xd286932a3fc715f8ULL, 0x68297eaef93f5 732 0x123a30141e180a06ULL, 0x1b27281e11140 733 0x77bb886655443311ULL, 0x58069f2fb6c19 734 0x7b79f7018ff58e7aULL, 0x756fe70d85fd8 735 0x54c4e0486c70241cULL, 0xaf9ed596dde44 736 0x48e8c05078602818ULL, 0xbf708ae91345f 737 0x3724e9874afacdb0ULL, 0xfc513dd8b4906 738 0x3932f98b40f2cbb2ULL, 0xd94fe44be072a 739 0x7a134ebae7275dc0ULL, 0xc1d61a85490dc 740 0x70b0806050403010ULL, 0x2b08c99f5eeac 741 0xd4e722975211c543ULL, 0xde44ec4de576a 742 0xebb46aa17f35de4aULL, 0x145b81a973ced 743 0xc30275ee99b4772dULL, 0x135089af76cad 744 0x0bc97761dfb5be6aULL, 0xddfa3a9d5d1dc 745 0x498279eb10b2fba2ULL, 0xa7e97427ba3a9 746 0x5dd9f842637c211fULL, 0x4c5d1e86c50f4 747 0xd3ec2a915715c642ULL 748 }; 749 750 static const u64 c[KHAZAD_ROUNDS + 1] = { 751 0xba542f7453d3d24dULL, 0x50ac8dbf70529 752 0xde48a899db32b7fcULL, 0xe39e919be2bb4 753 0xccc41d14c363da5dULL, 0x5fdc7dcd7f5a6 754 }; 755 756 static int khazad_setkey(struct crypto_tfm *tf 757 unsigned int key_len) 758 { 759 struct khazad_ctx *ctx = crypto_tfm_ct 760 const __be32 *key = (const __be32 *)in 761 int r; 762 const u64 *S = T7; 763 u64 K2, K1; 764 765 /* key is supposed to be 32-bit aligne 766 K2 = ((u64)be32_to_cpu(key[0]) << 32) 767 K1 = ((u64)be32_to_cpu(key[2]) << 32) 768 769 /* setup the encrypt key */ 770 for (r = 0; r <= KHAZAD_ROUNDS; r++) { 771 ctx->E[r] = T0[(int)(K1 >> 56) 772 T1[(int)(K1 >> 48) 773 T2[(int)(K1 >> 40) 774 T3[(int)(K1 >> 32) 775 T4[(int)(K1 >> 24) 776 T5[(int)(K1 >> 16) 777 T6[(int)(K1 >> 8) 778 T7[(int)(K1 ) 779 c[r] ^ K2; 780 K2 = K1; 781 K1 = ctx->E[r]; 782 } 783 /* Setup the decrypt key */ 784 ctx->D[0] = ctx->E[KHAZAD_ROUNDS]; 785 for (r = 1; r < KHAZAD_ROUNDS; r++) { 786 K1 = ctx->E[KHAZAD_ROUNDS - r] 787 ctx->D[r] = T0[(int)S[(int)(K1 788 T1[(int)S[(int)(K1 789 T2[(int)S[(int)(K1 790 T3[(int)S[(int)(K1 791 T4[(int)S[(int)(K1 792 T5[(int)S[(int)(K1 793 T6[(int)S[(int)(K1 794 T7[(int)S[(int)(K1 795 } 796 ctx->D[KHAZAD_ROUNDS] = ctx->E[0]; 797 798 return 0; 799 800 } 801 802 static void khazad_crypt(const u64 roundKey[KH 803 u8 *ciphertext, const u8 *plai 804 { 805 const __be64 *src = (const __be64 *)pl 806 __be64 *dst = (__be64 *)ciphertext; 807 int r; 808 u64 state; 809 810 state = be64_to_cpu(*src) ^ roundKey[0 811 812 for (r = 1; r < KHAZAD_ROUNDS; r++) { 813 state = T0[(int)(state >> 56) 814 T1[(int)(state >> 48) 815 T2[(int)(state >> 40) 816 T3[(int)(state >> 32) 817 T4[(int)(state >> 24) 818 T5[(int)(state >> 16) 819 T6[(int)(state >> 8) 820 T7[(int)(state ) 821 roundKey[r]; 822 } 823 824 state = (T0[(int)(state >> 56) ] 825 (T1[(int)(state >> 48) & 0xff] 826 (T2[(int)(state >> 40) & 0xff] 827 (T3[(int)(state >> 32) & 0xff] 828 (T4[(int)(state >> 24) & 0xff] 829 (T5[(int)(state >> 16) & 0xff] 830 (T6[(int)(state >> 8) & 0xff] 831 (T7[(int)(state ) & 0xff] 832 roundKey[KHAZAD_ROUNDS]; 833 834 *dst = cpu_to_be64(state); 835 } 836 837 static void khazad_encrypt(struct crypto_tfm * 838 { 839 struct khazad_ctx *ctx = crypto_tfm_ct 840 khazad_crypt(ctx->E, dst, src); 841 } 842 843 static void khazad_decrypt(struct crypto_tfm * 844 { 845 struct khazad_ctx *ctx = crypto_tfm_ct 846 khazad_crypt(ctx->D, dst, src); 847 } 848 849 static struct crypto_alg khazad_alg = { 850 .cra_name = "khaza 851 .cra_driver_name = "khaza 852 .cra_flags = CRYPTO 853 .cra_blocksize = KHAZAD 854 .cra_ctxsize = sizeof 855 .cra_alignmask = 7, 856 .cra_module = THIS_M 857 .cra_u = { .cip 858 .cia_min_keysize = KHAZAD 859 .cia_max_keysize = KHAZAD 860 .cia_setkey = khazad 861 .cia_encrypt = khazad 862 .cia_decrypt = khazad 863 }; 864 865 static int __init khazad_mod_init(void) 866 { 867 int ret = 0; 868 869 ret = crypto_register_alg(&khazad_alg) 870 return ret; 871 } 872 873 static void __exit khazad_mod_fini(void) 874 { 875 crypto_unregister_alg(&khazad_alg); 876 } 877 878 879 subsys_initcall(khazad_mod_init); 880 module_exit(khazad_mod_fini); 881 882 MODULE_LICENSE("GPL"); 883 MODULE_DESCRIPTION("Khazad Cryptographic Algor 884 MODULE_ALIAS_CRYPTO("khazad"); 885
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.