1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-03-14 22:46:04 +00:00

Merge pull request #3 from hashcat/master

Merge to bring fork up to date
This commit is contained in:
Chick3nman 2019-05-10 06:32:09 -05:00 committed by GitHub
commit 5373440a5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1140 changed files with 98879 additions and 21704 deletions

1
.gitignore vendored
View File

@ -19,4 +19,5 @@ lib/*.a
modules/*.dll modules/*.dll
modules/*.so modules/*.so
obj/*.o obj/*.o
obj/*.a
include/CL include/CL

View File

@ -1,37 +1,49 @@
hashcat build documentation hashcat build documentation
= =
# Revision:
### Revision ###
* 1.4 * 1.4
# Author: see docs/credits.txt ### Author ###
# Building hashcat for Linux, macOS and Windows (using Cygwin or MSYS2) See docs/credits.txt
### Building hashcat for Linux and macOS ###
Get a copy of the **hashcat** repository Get a copy of the **hashcat** repository
```sh ```
$ git clone https://github.com/hashcat/hashcat.git $ git clone https://github.com/hashcat/hashcat.git
``` ```
Run "make" Run "make"
```sh ```
$ make $ make
``` ```
# Install hashcat for Linux ### Install hashcat for Linux ###
The install target is linux FHS compatible and can be used like this: The install target is linux FHS compatible and can be used like this:
```sh ```
$ make install $ make install
``` ```
If you install it, cached kernels, session files, restore- and pot-files etc. will go to $HOME/.hashcat/ If you install it, cached kernels, session files, restore- and pot-files etc. will go to $HOME/.hashcat/
# Building hashcat for Windows from Linux ### Building hashcat for Windows (using Cygwin) ###
```sh Refer to [BUILD_CYGWIN.md](BUILD_CYGWIN.md)
### Building hashcat for Windows (using MSYS2) ###
Refer to [BUILD_MSYS2.md](BUILD_MSYS2.md)
### Building hashcat for Windows from Linux ###
```
$ make win $ make win
``` ```

46
BUILD_CYGWIN.md Normal file
View File

@ -0,0 +1,46 @@
# Compiling hashcat with Cygwin.
Tested on a Windows 7 SP1 x64 machine.
### Installation ###
Go to https://www.cygwin.com , get the setup-x86_64 file and follow the instructions on the website.
Make sure to install additional dependencies necessary for hashcat compilation by selecting the following packages during cygwin installation
```
libiconv-devel
gcc-core
make
git
```
### Building ###
Once all that is done, open the cygwin bash (cygwin\cygwin.bat) and type the following command to copy the latest master revision of hashcat repository into cygwin\home\username\hashcat
```
$ git clone https://github.com/hashcat/hashcat.git
```
Switch to the newly created folder by running
```
$ cd hashcat
```
Now type "make" to start compiling hashcat
```
$ make
```
The process may take a while, please be patient. Once it's finished, run hashcat by typing "./hashcat.exe"
```
$ ./hashcat.exe
```
### Notes ###
While hashcat will run fine from cygwin bash, running it from a windows shell will require cygwin1.dll and cygiconv-2.dll to be in the same folder with hashcat.exe (the files can be found in cygwin\bin folder).

46
BUILD_MSYS2.md Normal file
View File

@ -0,0 +1,46 @@
# Compiling hashcat with msys2.
Tested on a Windows 7 SP1 x64 machine.
### Installation ###
Go to https://www.msys2.org/ and follow the instructions on the main page (steps 1 to 7).
Install additional dependencies required to compile hashcat by running the following commands
```
$ pacman -S git
$ pacman -S make
$ pacman -S gcc
$ pacman -S libiconv-devel
```
### Building ###
Once all that is done, type the following command to copy the latest master revision of hashcat repository into msys64\home\username\hashcat
```
$ git clone https://github.com/hashcat/hashcat.git
```
Switch to the newly created folder by running
```
$ cd hashcat
```
Now type "make" to start compiling hashcat
```
$ make
```
The process may take a while, please be patient. Once it's finished, run hashcat by typing "./hashcat.exe"
```
$ ./hashcat.exe
```
### Notes ###
While hashcat will run fine from msys shell, running it from a windows shell will require msys-iconv-2.dll and msys-2.0.dll to be in the same folder with hashcat.exe (the files can be found in msys64\usr\bin).

View File

@ -11,7 +11,7 @@
#include "inc_rp.cl" #include "inc_rp.cl"
#endif #endif
KERNEL_FQ void amp (GLOBAL_AS pw_t * restrict pws, GLOBAL_AS pw_t * restrict pws_amp, CONSTANT_AS const kernel_rule_t * restrict rules_buf, GLOBAL_AS const pw_t * restrict combs_buf, GLOBAL_AS const bf_t * restrict bfs_buf, const u32 combs_mode, const u64 gid_max) KERNEL_FQ void amp (GLOBAL_AS pw_t *pws, GLOBAL_AS pw_t *pws_amp, CONSTANT_AS const kernel_rule_t *rules_buf, GLOBAL_AS const pw_t *combs_buf, GLOBAL_AS const bf_t *bfs_buf, const u32 combs_mode, const u64 gid_max)
{ {
const u64 gid = get_global_id (0); const u64 gid = get_global_id (0);

View File

@ -9,7 +9,7 @@
#include "inc_common.cl" #include "inc_common.cl"
#endif #endif
KERNEL_FQ void amp (GLOBAL_AS pw_t * restrict pws, GLOBAL_AS pw_t * restrict pws_amp, GLOBAL_AS const kernel_rule_t * restrict rules_buf, GLOBAL_AS const pw_t * restrict combs_buf, GLOBAL_AS const bf_t * restrict bfs_buf, const u32 combs_mode, const u64 gid_max) KERNEL_FQ void amp (GLOBAL_AS pw_t *pws, GLOBAL_AS pw_t *pws_amp, GLOBAL_AS const kernel_rule_t *rules_buf, GLOBAL_AS const pw_t *combs_buf, GLOBAL_AS const bf_t *bfs_buf, const u32 combs_mode, const u64 gid_max)
{ {
const u64 gid = get_global_id (0); const u64 gid = get_global_id (0);

View File

@ -8,7 +8,7 @@
#include "inc_types.h" #include "inc_types.h"
#endif #endif
KERNEL_FQ void amp (GLOBAL_AS pw_t * restrict pws, GLOBAL_AS pw_t * restrict pws_amp, GLOBAL_AS const kernel_rule_t * restrict rules_buf, GLOBAL_AS const pw_t * restrict combs_buf, CONSTANT_AS const bf_t * restrict bfs_buf, const u32 combs_mode, const u64 gid_max) KERNEL_FQ void amp (GLOBAL_AS pw_t *pws, GLOBAL_AS pw_t *pws_amp, GLOBAL_AS const kernel_rule_t *rules_buf, GLOBAL_AS const pw_t *combs_buf, CONSTANT_AS bf_t *bfs_buf, const u32 combs_mode, const u64 gid_max)
{ {
const u64 gid = get_global_id (0); const u64 gid = get_global_id (0);

File diff suppressed because it is too large Load Diff

View File

@ -6,704 +6,24 @@
#ifndef _INC_CIPHER_AES_H #ifndef _INC_CIPHER_AES_H
#define _INC_CIPHER_AES_H #define _INC_CIPHER_AES_H
CONSTANT_AS u32a te0[256] = DECLSPEC void aes128_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3);
{ DECLSPEC void aes128_InvertKey (u32 *ks, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, DECLSPEC void aes128_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3);
0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, DECLSPEC void aes128_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d,
0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a,
0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87,
0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b,
0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea,
0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b,
0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a,
0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f,
0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108,
0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f,
0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e,
0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5,
0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d,
0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f,
0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e,
0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb,
0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce,
0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497,
0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c,
0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed,
0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b,
0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a,
0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16,
0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594,
0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81,
0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3,
0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a,
0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504,
0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163,
0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d,
0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f,
0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739,
0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47,
0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395,
0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f,
0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883,
0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c,
0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76,
0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e,
0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4,
0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6,
0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b,
0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7,
0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0,
0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25,
0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818,
0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72,
0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651,
0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21,
0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85,
0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa,
0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12,
0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0,
0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9,
0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133,
0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7,
0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920,
0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a,
0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17,
0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8,
0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11,
0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a,
};
CONSTANT_AS u32a te1[256] =
{
0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b,
0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5,
0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b,
0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676,
0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d,
0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0,
0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf,
0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0,
0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626,
0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc,
0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1,
0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515,
0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3,
0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a,
0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2,
0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575,
0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a,
0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0,
0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3,
0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484,
0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded,
0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b,
0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939,
0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf,
0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb,
0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585,
0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f,
0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8,
0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f,
0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5,
0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121,
0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2,
0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec,
0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717,
0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d,
0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373,
0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc,
0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888,
0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414,
0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb,
0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a,
0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c,
0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262,
0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979,
0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d,
0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9,
0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea,
0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808,
0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e,
0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6,
0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f,
0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a,
0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666,
0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e,
0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9,
0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e,
0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111,
0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494,
0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9,
0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf,
0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d,
0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868,
0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f,
0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616,
};
CONSTANT_AS u32a te2[256] =
{
0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b,
0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5,
0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b,
0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76,
0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d,
0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0,
0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af,
0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0,
0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26,
0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc,
0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1,
0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15,
0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3,
0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a,
0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2,
0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75,
0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a,
0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0,
0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3,
0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384,
0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed,
0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b,
0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239,
0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf,
0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb,
0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185,
0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f,
0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8,
0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f,
0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5,
0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221,
0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2,
0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec,
0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17,
0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d,
0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673,
0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc,
0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88,
0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814,
0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb,
0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a,
0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c,
0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462,
0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279,
0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d,
0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9,
0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea,
0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008,
0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e,
0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6,
0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f,
0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a,
0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66,
0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e,
0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9,
0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e,
0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211,
0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394,
0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9,
0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df,
0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d,
0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068,
0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f,
0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16,
};
CONSTANT_AS u32a te3[256] =
{
0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6,
0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491,
0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56,
0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec,
0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa,
0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb,
0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45,
0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b,
0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c,
0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83,
0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9,
0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a,
0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d,
0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f,
0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf,
0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea,
0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34,
0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b,
0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d,
0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713,
0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1,
0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6,
0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72,
0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85,
0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed,
0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411,
0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe,
0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b,
0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05,
0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1,
0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342,
0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf,
0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3,
0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e,
0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a,
0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6,
0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3,
0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b,
0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28,
0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad,
0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14,
0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8,
0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4,
0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2,
0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da,
0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049,
0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf,
0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810,
0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c,
0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197,
0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e,
0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f,
0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc,
0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c,
0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069,
0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927,
0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322,
0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733,
0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9,
0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5,
0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a,
0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0,
0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e,
0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c,
};
CONSTANT_AS u32a te4[256] =
{
0x63636363, 0x7c7c7c7c, 0x77777777, 0x7b7b7b7b,
0xf2f2f2f2, 0x6b6b6b6b, 0x6f6f6f6f, 0xc5c5c5c5,
0x30303030, 0x01010101, 0x67676767, 0x2b2b2b2b,
0xfefefefe, 0xd7d7d7d7, 0xabababab, 0x76767676,
0xcacacaca, 0x82828282, 0xc9c9c9c9, 0x7d7d7d7d,
0xfafafafa, 0x59595959, 0x47474747, 0xf0f0f0f0,
0xadadadad, 0xd4d4d4d4, 0xa2a2a2a2, 0xafafafaf,
0x9c9c9c9c, 0xa4a4a4a4, 0x72727272, 0xc0c0c0c0,
0xb7b7b7b7, 0xfdfdfdfd, 0x93939393, 0x26262626,
0x36363636, 0x3f3f3f3f, 0xf7f7f7f7, 0xcccccccc,
0x34343434, 0xa5a5a5a5, 0xe5e5e5e5, 0xf1f1f1f1,
0x71717171, 0xd8d8d8d8, 0x31313131, 0x15151515,
0x04040404, 0xc7c7c7c7, 0x23232323, 0xc3c3c3c3,
0x18181818, 0x96969696, 0x05050505, 0x9a9a9a9a,
0x07070707, 0x12121212, 0x80808080, 0xe2e2e2e2,
0xebebebeb, 0x27272727, 0xb2b2b2b2, 0x75757575,
0x09090909, 0x83838383, 0x2c2c2c2c, 0x1a1a1a1a,
0x1b1b1b1b, 0x6e6e6e6e, 0x5a5a5a5a, 0xa0a0a0a0,
0x52525252, 0x3b3b3b3b, 0xd6d6d6d6, 0xb3b3b3b3,
0x29292929, 0xe3e3e3e3, 0x2f2f2f2f, 0x84848484,
0x53535353, 0xd1d1d1d1, 0x00000000, 0xedededed,
0x20202020, 0xfcfcfcfc, 0xb1b1b1b1, 0x5b5b5b5b,
0x6a6a6a6a, 0xcbcbcbcb, 0xbebebebe, 0x39393939,
0x4a4a4a4a, 0x4c4c4c4c, 0x58585858, 0xcfcfcfcf,
0xd0d0d0d0, 0xefefefef, 0xaaaaaaaa, 0xfbfbfbfb,
0x43434343, 0x4d4d4d4d, 0x33333333, 0x85858585,
0x45454545, 0xf9f9f9f9, 0x02020202, 0x7f7f7f7f,
0x50505050, 0x3c3c3c3c, 0x9f9f9f9f, 0xa8a8a8a8,
0x51515151, 0xa3a3a3a3, 0x40404040, 0x8f8f8f8f,
0x92929292, 0x9d9d9d9d, 0x38383838, 0xf5f5f5f5,
0xbcbcbcbc, 0xb6b6b6b6, 0xdadadada, 0x21212121,
0x10101010, 0xffffffff, 0xf3f3f3f3, 0xd2d2d2d2,
0xcdcdcdcd, 0x0c0c0c0c, 0x13131313, 0xecececec,
0x5f5f5f5f, 0x97979797, 0x44444444, 0x17171717,
0xc4c4c4c4, 0xa7a7a7a7, 0x7e7e7e7e, 0x3d3d3d3d,
0x64646464, 0x5d5d5d5d, 0x19191919, 0x73737373,
0x60606060, 0x81818181, 0x4f4f4f4f, 0xdcdcdcdc,
0x22222222, 0x2a2a2a2a, 0x90909090, 0x88888888,
0x46464646, 0xeeeeeeee, 0xb8b8b8b8, 0x14141414,
0xdededede, 0x5e5e5e5e, 0x0b0b0b0b, 0xdbdbdbdb,
0xe0e0e0e0, 0x32323232, 0x3a3a3a3a, 0x0a0a0a0a,
0x49494949, 0x06060606, 0x24242424, 0x5c5c5c5c,
0xc2c2c2c2, 0xd3d3d3d3, 0xacacacac, 0x62626262,
0x91919191, 0x95959595, 0xe4e4e4e4, 0x79797979,
0xe7e7e7e7, 0xc8c8c8c8, 0x37373737, 0x6d6d6d6d,
0x8d8d8d8d, 0xd5d5d5d5, 0x4e4e4e4e, 0xa9a9a9a9,
0x6c6c6c6c, 0x56565656, 0xf4f4f4f4, 0xeaeaeaea,
0x65656565, 0x7a7a7a7a, 0xaeaeaeae, 0x08080808,
0xbabababa, 0x78787878, 0x25252525, 0x2e2e2e2e,
0x1c1c1c1c, 0xa6a6a6a6, 0xb4b4b4b4, 0xc6c6c6c6,
0xe8e8e8e8, 0xdddddddd, 0x74747474, 0x1f1f1f1f,
0x4b4b4b4b, 0xbdbdbdbd, 0x8b8b8b8b, 0x8a8a8a8a,
0x70707070, 0x3e3e3e3e, 0xb5b5b5b5, 0x66666666,
0x48484848, 0x03030303, 0xf6f6f6f6, 0x0e0e0e0e,
0x61616161, 0x35353535, 0x57575757, 0xb9b9b9b9,
0x86868686, 0xc1c1c1c1, 0x1d1d1d1d, 0x9e9e9e9e,
0xe1e1e1e1, 0xf8f8f8f8, 0x98989898, 0x11111111,
0x69696969, 0xd9d9d9d9, 0x8e8e8e8e, 0x94949494,
0x9b9b9b9b, 0x1e1e1e1e, 0x87878787, 0xe9e9e9e9,
0xcececece, 0x55555555, 0x28282828, 0xdfdfdfdf,
0x8c8c8c8c, 0xa1a1a1a1, 0x89898989, 0x0d0d0d0d,
0xbfbfbfbf, 0xe6e6e6e6, 0x42424242, 0x68686868,
0x41414141, 0x99999999, 0x2d2d2d2d, 0x0f0f0f0f,
0xb0b0b0b0, 0x54545454, 0xbbbbbbbb, 0x16161616,
};
CONSTANT_AS u32a td0[256] =
{
0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96,
0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393,
0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25,
0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f,
0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1,
0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6,
0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da,
0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844,
0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd,
0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4,
0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45,
0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94,
0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7,
0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a,
0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5,
0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c,
0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1,
0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a,
0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75,
0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051,
0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46,
0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff,
0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77,
0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb,
0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000,
0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e,
0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927,
0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a,
0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e,
0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16,
0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d,
0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8,
0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd,
0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34,
0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163,
0xd731dcca, 0x42638510, 0x13972240, 0x84c61120,
0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d,
0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0,
0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422,
0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef,
0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36,
0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4,
0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662,
0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5,
0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3,
0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b,
0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8,
0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6,
0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6,
0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0,
0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815,
0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f,
0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df,
0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f,
0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e,
0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713,
0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89,
0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c,
0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf,
0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86,
0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f,
0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541,
0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190,
0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742,
};
CONSTANT_AS u32a td1[256] =
{
0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e,
0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303,
0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c,
0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3,
0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0,
0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9,
0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259,
0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8,
0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971,
0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a,
0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f,
0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b,
0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8,
0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab,
0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708,
0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682,
0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2,
0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe,
0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb,
0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10,
0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd,
0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015,
0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e,
0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee,
0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000,
0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72,
0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39,
0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e,
0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91,
0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a,
0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17,
0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9,
0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60,
0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e,
0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1,
0xcad731dc, 0x10426385, 0x40139722, 0x2084c611,
0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1,
0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3,
0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964,
0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390,
0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b,
0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf,
0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46,
0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af,
0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512,
0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb,
0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a,
0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8,
0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c,
0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266,
0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8,
0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6,
0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604,
0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551,
0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41,
0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647,
0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c,
0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1,
0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737,
0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db,
0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340,
0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95,
0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1,
0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857,
};
CONSTANT_AS u32a td2[256] =
{
0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27,
0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3,
0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502,
0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562,
0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe,
0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3,
0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552,
0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9,
0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9,
0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce,
0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253,
0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908,
0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b,
0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655,
0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337,
0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16,
0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69,
0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6,
0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6,
0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e,
0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6,
0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050,
0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9,
0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8,
0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000,
0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a,
0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d,
0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436,
0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b,
0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12,
0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b,
0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e,
0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f,
0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb,
0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4,
0xdccad731, 0x85104263, 0x22401397, 0x112084c6,
0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729,
0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1,
0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9,
0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233,
0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4,
0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad,
0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e,
0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3,
0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25,
0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b,
0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f,
0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15,
0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0,
0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2,
0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7,
0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791,
0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496,
0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665,
0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b,
0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6,
0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13,
0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47,
0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7,
0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844,
0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3,
0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d,
0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456,
0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8,
};
CONSTANT_AS u32a td3[256] =
{
0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a,
0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b,
0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5,
0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5,
0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d,
0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b,
0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95,
0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e,
0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27,
0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d,
0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562,
0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9,
0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752,
0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66,
0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3,
0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced,
0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e,
0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4,
0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4,
0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd,
0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d,
0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60,
0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767,
0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79,
0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000,
0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c,
0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736,
0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24,
0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b,
0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c,
0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12,
0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814,
0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3,
0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b,
0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8,
0x31dccad7, 0x63851042, 0x97224013, 0xc6112084,
0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7,
0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077,
0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247,
0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22,
0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698,
0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f,
0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254,
0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582,
0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf,
0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb,
0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883,
0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef,
0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629,
0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035,
0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533,
0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17,
0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4,
0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46,
0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb,
0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d,
0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb,
0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a,
0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73,
0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678,
0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2,
0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff,
0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064,
0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0,
};
CONSTANT_AS u32a td4[256] =
{
0x52525252, 0x09090909, 0x6a6a6a6a, 0xd5d5d5d5,
0x30303030, 0x36363636, 0xa5a5a5a5, 0x38383838,
0xbfbfbfbf, 0x40404040, 0xa3a3a3a3, 0x9e9e9e9e,
0x81818181, 0xf3f3f3f3, 0xd7d7d7d7, 0xfbfbfbfb,
0x7c7c7c7c, 0xe3e3e3e3, 0x39393939, 0x82828282,
0x9b9b9b9b, 0x2f2f2f2f, 0xffffffff, 0x87878787,
0x34343434, 0x8e8e8e8e, 0x43434343, 0x44444444,
0xc4c4c4c4, 0xdededede, 0xe9e9e9e9, 0xcbcbcbcb,
0x54545454, 0x7b7b7b7b, 0x94949494, 0x32323232,
0xa6a6a6a6, 0xc2c2c2c2, 0x23232323, 0x3d3d3d3d,
0xeeeeeeee, 0x4c4c4c4c, 0x95959595, 0x0b0b0b0b,
0x42424242, 0xfafafafa, 0xc3c3c3c3, 0x4e4e4e4e,
0x08080808, 0x2e2e2e2e, 0xa1a1a1a1, 0x66666666,
0x28282828, 0xd9d9d9d9, 0x24242424, 0xb2b2b2b2,
0x76767676, 0x5b5b5b5b, 0xa2a2a2a2, 0x49494949,
0x6d6d6d6d, 0x8b8b8b8b, 0xd1d1d1d1, 0x25252525,
0x72727272, 0xf8f8f8f8, 0xf6f6f6f6, 0x64646464,
0x86868686, 0x68686868, 0x98989898, 0x16161616,
0xd4d4d4d4, 0xa4a4a4a4, 0x5c5c5c5c, 0xcccccccc,
0x5d5d5d5d, 0x65656565, 0xb6b6b6b6, 0x92929292,
0x6c6c6c6c, 0x70707070, 0x48484848, 0x50505050,
0xfdfdfdfd, 0xedededed, 0xb9b9b9b9, 0xdadadada,
0x5e5e5e5e, 0x15151515, 0x46464646, 0x57575757,
0xa7a7a7a7, 0x8d8d8d8d, 0x9d9d9d9d, 0x84848484,
0x90909090, 0xd8d8d8d8, 0xabababab, 0x00000000,
0x8c8c8c8c, 0xbcbcbcbc, 0xd3d3d3d3, 0x0a0a0a0a,
0xf7f7f7f7, 0xe4e4e4e4, 0x58585858, 0x05050505,
0xb8b8b8b8, 0xb3b3b3b3, 0x45454545, 0x06060606,
0xd0d0d0d0, 0x2c2c2c2c, 0x1e1e1e1e, 0x8f8f8f8f,
0xcacacaca, 0x3f3f3f3f, 0x0f0f0f0f, 0x02020202,
0xc1c1c1c1, 0xafafafaf, 0xbdbdbdbd, 0x03030303,
0x01010101, 0x13131313, 0x8a8a8a8a, 0x6b6b6b6b,
0x3a3a3a3a, 0x91919191, 0x11111111, 0x41414141,
0x4f4f4f4f, 0x67676767, 0xdcdcdcdc, 0xeaeaeaea,
0x97979797, 0xf2f2f2f2, 0xcfcfcfcf, 0xcececece,
0xf0f0f0f0, 0xb4b4b4b4, 0xe6e6e6e6, 0x73737373,
0x96969696, 0xacacacac, 0x74747474, 0x22222222,
0xe7e7e7e7, 0xadadadad, 0x35353535, 0x85858585,
0xe2e2e2e2, 0xf9f9f9f9, 0x37373737, 0xe8e8e8e8,
0x1c1c1c1c, 0x75757575, 0xdfdfdfdf, 0x6e6e6e6e,
0x47474747, 0xf1f1f1f1, 0x1a1a1a1a, 0x71717171,
0x1d1d1d1d, 0x29292929, 0xc5c5c5c5, 0x89898989,
0x6f6f6f6f, 0xb7b7b7b7, 0x62626262, 0x0e0e0e0e,
0xaaaaaaaa, 0x18181818, 0xbebebebe, 0x1b1b1b1b,
0xfcfcfcfc, 0x56565656, 0x3e3e3e3e, 0x4b4b4b4b,
0xc6c6c6c6, 0xd2d2d2d2, 0x79797979, 0x20202020,
0x9a9a9a9a, 0xdbdbdbdb, 0xc0c0c0c0, 0xfefefefe,
0x78787878, 0xcdcdcdcd, 0x5a5a5a5a, 0xf4f4f4f4,
0x1f1f1f1f, 0xdddddddd, 0xa8a8a8a8, 0x33333333,
0x88888888, 0x07070707, 0xc7c7c7c7, 0x31313131,
0xb1b1b1b1, 0x12121212, 0x10101010, 0x59595959,
0x27272727, 0x80808080, 0xecececec, 0x5f5f5f5f,
0x60606060, 0x51515151, 0x7f7f7f7f, 0xa9a9a9a9,
0x19191919, 0xb5b5b5b5, 0x4a4a4a4a, 0x0d0d0d0d,
0x2d2d2d2d, 0xe5e5e5e5, 0x7a7a7a7a, 0x9f9f9f9f,
0x93939393, 0xc9c9c9c9, 0x9c9c9c9c, 0xefefefef,
0xa0a0a0a0, 0xe0e0e0e0, 0x3b3b3b3b, 0x4d4d4d4d,
0xaeaeaeae, 0x2a2a2a2a, 0xf5f5f5f5, 0xb0b0b0b0,
0xc8c8c8c8, 0xebebebeb, 0xbbbbbbbb, 0x3c3c3c3c,
0x83838383, 0x53535353, 0x99999999, 0x61616161,
0x17171717, 0x2b2b2b2b, 0x04040404, 0x7e7e7e7e,
0xbabababa, 0x77777777, 0xd6d6d6d6, 0x26262626,
0xe1e1e1e1, 0x69696969, 0x14141414, 0x63636363,
0x55555555, 0x21212121, 0x0c0c0c0c, 0x7d7d7d7d,
};
DECLSPEC void aes128_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4);
DECLSPEC void aes128_InvertKey (u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
DECLSPEC void aes128_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4);
DECLSPEC void aes128_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
DECLSPEC void aes128_encrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4); DECLSPEC void aes128_encrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4);
DECLSPEC void aes128_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); DECLSPEC void aes128_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
DECLSPEC void aes256_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4); DECLSPEC void aes256_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3);
DECLSPEC void aes256_InvertKey (u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); DECLSPEC void aes256_InvertKey (u32 *ks, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
DECLSPEC void aes256_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4); DECLSPEC void aes256_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3);
DECLSPEC void aes256_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); DECLSPEC void aes256_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
DECLSPEC void aes256_encrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4); DECLSPEC void aes256_encrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4);
DECLSPEC void aes256_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); DECLSPEC void aes256_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
DECLSPEC void AES128_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4); DECLSPEC void AES128_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3);
DECLSPEC void AES128_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); DECLSPEC void AES128_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
DECLSPEC void AES128_encrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4); DECLSPEC void AES128_encrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4);
DECLSPEC void AES128_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); DECLSPEC void AES128_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
DECLSPEC void AES256_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4); DECLSPEC void AES256_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3);
DECLSPEC void AES256_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); DECLSPEC void AES256_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
DECLSPEC void AES256_encrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4); DECLSPEC void AES256_encrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4);
DECLSPEC void AES256_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); DECLSPEC void AES256_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);

View File

@ -20,6 +20,42 @@
#include "inc_common.h" #include "inc_common.h"
#include "inc_cipher_camellia.h" #include "inc_cipher_camellia.h"
CONSTANT_AS u32a c_sbox[256] =
{
0x70, 0x82, 0x2c, 0xec, 0xb3, 0x27, 0xc0, 0xe5,
0xe4, 0x85, 0x57, 0x35, 0xea, 0x0c, 0xae, 0x41,
0x23, 0xef, 0x6b, 0x93, 0x45, 0x19, 0xa5, 0x21,
0xed, 0x0e, 0x4f, 0x4e, 0x1d, 0x65, 0x92, 0xbd,
0x86, 0xb8, 0xaf, 0x8f, 0x7c, 0xeb, 0x1f, 0xce,
0x3e, 0x30, 0xdc, 0x5f, 0x5e, 0xc5, 0x0b, 0x1a,
0xa6, 0xe1, 0x39, 0xca, 0xd5, 0x47, 0x5d, 0x3d,
0xd9, 0x01, 0x5a, 0xd6, 0x51, 0x56, 0x6c, 0x4d,
0x8b, 0x0d, 0x9a, 0x66, 0xfb, 0xcc, 0xb0, 0x2d,
0x74, 0x12, 0x2b, 0x20, 0xf0, 0xb1, 0x84, 0x99,
0xdf, 0x4c, 0xcb, 0xc2, 0x34, 0x7e, 0x76, 0x05,
0x6d, 0xb7, 0xa9, 0x31, 0xd1, 0x17, 0x04, 0xd7,
0x14, 0x58, 0x3a, 0x61, 0xde, 0x1b, 0x11, 0x1c,
0x32, 0x0f, 0x9c, 0x16, 0x53, 0x18, 0xf2, 0x22,
0xfe, 0x44, 0xcf, 0xb2, 0xc3, 0xb5, 0x7a, 0x91,
0x24, 0x08, 0xe8, 0xa8, 0x60, 0xfc, 0x69, 0x50,
0xaa, 0xd0, 0xa0, 0x7d, 0xa1, 0x89, 0x62, 0x97,
0x54, 0x5b, 0x1e, 0x95, 0xe0, 0xff, 0x64, 0xd2,
0x10, 0xc4, 0x00, 0x48, 0xa3, 0xf7, 0x75, 0xdb,
0x8a, 0x03, 0xe6, 0xda, 0x09, 0x3f, 0xdd, 0x94,
0x87, 0x5c, 0x83, 0x02, 0xcd, 0x4a, 0x90, 0x33,
0x73, 0x67, 0xf6, 0xf3, 0x9d, 0x7f, 0xbf, 0xe2,
0x52, 0x9b, 0xd8, 0x26, 0xc8, 0x37, 0xc6, 0x3b,
0x81, 0x96, 0x6f, 0x4b, 0x13, 0xbe, 0x63, 0x2e,
0xe9, 0x79, 0xa7, 0x8c, 0x9f, 0x6e, 0xbc, 0x8e,
0x29, 0xf5, 0xf9, 0xb6, 0x2f, 0xfd, 0xb4, 0x59,
0x78, 0x98, 0x06, 0x6a, 0xe7, 0x46, 0x71, 0xba,
0xd4, 0x25, 0xab, 0x42, 0x88, 0xa2, 0x8d, 0xfa,
0x72, 0x07, 0xb9, 0x55, 0xf8, 0xee, 0xac, 0x0a,
0x36, 0x49, 0x2a, 0x68, 0x3c, 0x38, 0xf1, 0xa4,
0x40, 0x28, 0xd3, 0x7b, 0xbb, 0xc9, 0x43, 0xc1,
0x15, 0xe3, 0xad, 0xf4, 0x77, 0xc7, 0x80, 0x9e
};
#define c_sbox1(n) c_sbox[(n)] #define c_sbox1(n) c_sbox[(n)]
#define c_sbox2(n) (((c_sbox[(n)] >> 7) ^ (c_sbox[(n)] << 1)) & 0xff) #define c_sbox2(n) (((c_sbox[(n)] >> 7) ^ (c_sbox[(n)] << 1)) & 0xff)
#define c_sbox3(n) (((c_sbox[(n)] >> 1) ^ (c_sbox[(n)] << 7)) & 0xff) #define c_sbox3(n) (((c_sbox[(n)] >> 1) ^ (c_sbox[(n)] << 7)) & 0xff)
@ -27,35 +63,71 @@
#define cam_rotate(a,b,n) hc_swap32_S ((u[(a)] << (n)) ^ (u[(b)] >> (32 - (n)))) #define cam_rotate(a,b,n) hc_swap32_S ((u[(a)] << (n)) ^ (u[(b)] >> (32 - (n))))
#define extract_byte(x,n) (((x) >> (8 * (n))) & 0xff)
DECLSPEC void cam_feistel (const u32 *x, const u32 *k, u32 *y) DECLSPEC void cam_feistel (const u32 *x, const u32 *k, u32 *y)
{ {
u32 b[8]; const u32 xk0 = x[0] ^ k[0];
const u32 xk1 = x[1] ^ k[1];
b[0] = c_sbox1 (extract_byte (x[0], 0) ^ extract_byte (k[0], 0)); const u32 b0 = c_sbox1 (unpack_v8a_from_v32_S (xk0));
b[1] = c_sbox2 (extract_byte (x[0], 1) ^ extract_byte (k[0], 1)); const u32 b1 = c_sbox2 (unpack_v8b_from_v32_S (xk0));
b[2] = c_sbox3 (extract_byte (x[0], 2) ^ extract_byte (k[0], 2)); const u32 b2 = c_sbox3 (unpack_v8c_from_v32_S (xk0));
b[3] = c_sbox4 (extract_byte (x[0], 3) ^ extract_byte (k[0], 3)); const u32 b3 = c_sbox4 (unpack_v8d_from_v32_S (xk0));
b[4] = c_sbox2 (extract_byte (x[1], 0) ^ extract_byte (k[1], 0)); const u32 b4 = c_sbox2 (unpack_v8a_from_v32_S (xk1));
b[5] = c_sbox3 (extract_byte (x[1], 1) ^ extract_byte (k[1], 1)); const u32 b5 = c_sbox3 (unpack_v8b_from_v32_S (xk1));
b[6] = c_sbox4 (extract_byte (x[1], 2) ^ extract_byte (k[1], 2)); const u32 b6 = c_sbox4 (unpack_v8c_from_v32_S (xk1));
b[7] = c_sbox1 (extract_byte (x[1], 3) ^ extract_byte (k[1], 3)); const u32 b7 = c_sbox1 (unpack_v8d_from_v32_S (xk1));
u32 tmp[2]; /*
const u32 t0a = b0 ^ b2 ^ b3 ^ b5 ^ b6 ^ b7;
const u32 t0b = b0 ^ b1 ^ b3 ^ b4 ^ b6 ^ b7;
const u32 t0c = b0 ^ b1 ^ b2 ^ b4 ^ b5 ^ b7;
const u32 t0d = b1 ^ b2 ^ b3 ^ b4 ^ b5 ^ b6 ;
tmp[0] = (b[0] ^ b[2] ^ b[3] ^ b[5] ^ b[6] ^ b[7]) << 0 const u32 t1a = b0 ^ b1 ^ b5 ^ b6 ^ b7;
| (b[0] ^ b[1] ^ b[3] ^ b[4] ^ b[6] ^ b[7]) << 8 const u32 t1b = b1 ^ b2 ^ b4 ^ b6 ^ b7;
| (b[0] ^ b[1] ^ b[2] ^ b[4] ^ b[5] ^ b[7]) << 16 const u32 t1c = b2 ^ b3 ^ b4 ^ b5 ^ b7;
| (b[1] ^ b[2] ^ b[3] ^ b[4] ^ b[5] ^ b[6]) << 24; const u32 t1d = b0 ^ b3 ^ b4 ^ b5 ^ b6 ;
*/
tmp[1] = (b[0] ^ b[1] ^ b[5] ^ b[6] ^ b[7]) << 0 const u32 b14 = b1 ^ b4;
| (b[1] ^ b[2] ^ b[4] ^ b[6] ^ b[7]) << 8 const u32 b25 = b2 ^ b5;
| (b[2] ^ b[3] ^ b[4] ^ b[5] ^ b[7]) << 16 const u32 b36 = b3 ^ b6;
| (b[0] ^ b[3] ^ b[4] ^ b[5] ^ b[6]) << 24; const u32 b07 = b0 ^ b7;
y[0] ^= tmp[0]; const u32 b01234567 = b14 ^ b25 ^ b36 ^ b07;
y[1] ^= tmp[1];
const u32 t0a = b01234567 ^ b14;
const u32 t0b = b01234567 ^ b25;
const u32 t0c = b01234567 ^ b36;
const u32 t0d = b01234567 ^ b07;
/*
const u32 t1a = b01234567 ^ b2 ^ b3 ^ b4;
const u32 t1b = b01234567 ^ b0 ^ b3 ^ b5;
const u32 t1c = b01234567 ^ b0 ^ b1 ^ b6;
const u32 t1d = b01234567 ^ b1 ^ b2 ^ b7;
*/
const u32 b0_234567 = b01234567 ^ b1;
const u32 b012_4567 = b01234567 ^ b3;
const u32 t1a = b012_4567 ^ b2 ^ b4;
const u32 t1b = b012_4567 ^ b0 ^ b5;
const u32 t1c = b0_234567 ^ b0 ^ b6;
const u32 t1d = b0_234567 ^ b2 ^ b7;
const u32 t0 = (t0a << 0)
| (t0b << 8)
| (t0c << 16)
| (t0d << 24);
const u32 t1 = (t1a << 0)
| (t1b << 8)
| (t1c << 16)
| (t1d << 24);
y[0] ^= t0;
y[1] ^= t1;
} }
DECLSPEC void cam_fl (u32 *x, const u32 *kl, const u32 *kr) DECLSPEC void cam_fl (u32 *x, const u32 *kl, const u32 *kr)
@ -339,5 +411,3 @@ DECLSPEC void camellia256_decrypt (const u32 *ks, const u32 *in, u32 *out)
#undef c_sbox4 #undef c_sbox4
#undef cam_rotate #undef cam_rotate
#undef extract_byte

View File

@ -6,42 +6,6 @@
#ifndef _INC_CIPHER_CAMELLIA_H #ifndef _INC_CIPHER_CAMELLIA_H
#define _INC_CIPHER_CAMELLIA_H #define _INC_CIPHER_CAMELLIA_H
CONSTANT_AS const u32a c_sbox[256] =
{
0x70, 0x82, 0x2c, 0xec, 0xb3, 0x27, 0xc0, 0xe5,
0xe4, 0x85, 0x57, 0x35, 0xea, 0x0c, 0xae, 0x41,
0x23, 0xef, 0x6b, 0x93, 0x45, 0x19, 0xa5, 0x21,
0xed, 0x0e, 0x4f, 0x4e, 0x1d, 0x65, 0x92, 0xbd,
0x86, 0xb8, 0xaf, 0x8f, 0x7c, 0xeb, 0x1f, 0xce,
0x3e, 0x30, 0xdc, 0x5f, 0x5e, 0xc5, 0x0b, 0x1a,
0xa6, 0xe1, 0x39, 0xca, 0xd5, 0x47, 0x5d, 0x3d,
0xd9, 0x01, 0x5a, 0xd6, 0x51, 0x56, 0x6c, 0x4d,
0x8b, 0x0d, 0x9a, 0x66, 0xfb, 0xcc, 0xb0, 0x2d,
0x74, 0x12, 0x2b, 0x20, 0xf0, 0xb1, 0x84, 0x99,
0xdf, 0x4c, 0xcb, 0xc2, 0x34, 0x7e, 0x76, 0x05,
0x6d, 0xb7, 0xa9, 0x31, 0xd1, 0x17, 0x04, 0xd7,
0x14, 0x58, 0x3a, 0x61, 0xde, 0x1b, 0x11, 0x1c,
0x32, 0x0f, 0x9c, 0x16, 0x53, 0x18, 0xf2, 0x22,
0xfe, 0x44, 0xcf, 0xb2, 0xc3, 0xb5, 0x7a, 0x91,
0x24, 0x08, 0xe8, 0xa8, 0x60, 0xfc, 0x69, 0x50,
0xaa, 0xd0, 0xa0, 0x7d, 0xa1, 0x89, 0x62, 0x97,
0x54, 0x5b, 0x1e, 0x95, 0xe0, 0xff, 0x64, 0xd2,
0x10, 0xc4, 0x00, 0x48, 0xa3, 0xf7, 0x75, 0xdb,
0x8a, 0x03, 0xe6, 0xda, 0x09, 0x3f, 0xdd, 0x94,
0x87, 0x5c, 0x83, 0x02, 0xcd, 0x4a, 0x90, 0x33,
0x73, 0x67, 0xf6, 0xf3, 0x9d, 0x7f, 0xbf, 0xe2,
0x52, 0x9b, 0xd8, 0x26, 0xc8, 0x37, 0xc6, 0x3b,
0x81, 0x96, 0x6f, 0x4b, 0x13, 0xbe, 0x63, 0x2e,
0xe9, 0x79, 0xa7, 0x8c, 0x9f, 0x6e, 0xbc, 0x8e,
0x29, 0xf5, 0xf9, 0xb6, 0x2f, 0xfd, 0xb4, 0x59,
0x78, 0x98, 0x06, 0x6a, 0xe7, 0x46, 0x71, 0xba,
0xd4, 0x25, 0xab, 0x42, 0x88, 0xa2, 0x8d, 0xfa,
0x72, 0x07, 0xb9, 0x55, 0xf8, 0xee, 0xac, 0x0a,
0x36, 0x49, 0x2a, 0x68, 0x3c, 0x38, 0xf1, 0xa4,
0x40, 0x28, 0xd3, 0x7b, 0xbb, 0xc9, 0x43, 0xc1,
0x15, 0xe3, 0xad, 0xf4, 0x77, 0xc7, 0x80, 0x9e
};
DECLSPEC void cam_feistel (const u32 *x, const u32 *k, u32 *y); DECLSPEC void cam_feistel (const u32 *x, const u32 *k, u32 *y);
DECLSPEC void cam_fl (u32 *x, const u32 *kl, const u32 *kr); DECLSPEC void cam_fl (u32 *x, const u32 *kl, const u32 *kr);
DECLSPEC void camellia256_set_key (u32 *ks, const u32 *ukey); DECLSPEC void camellia256_set_key (u32 *ks, const u32 *ukey);

View File

@ -8,62 +8,479 @@
#include "inc_common.h" #include "inc_common.h"
#include "inc_cipher_des.h" #include "inc_cipher_des.h"
#define PERM_OP(a,b,n,m) \ CONSTANT_AS u32a c_SPtrans[8][64] =
{ \
u32x t; \
t = a >> n; \
t = t ^ b; \
t = t & m; \
b = b ^ t; \
t = t << n; \
a = a ^ t; \
}
#define HPERM_OP(a,n,m) \
{ \
u32x t; \
t = a << (16 + n); \
t = t ^ a; \
t = t & m; \
a = a ^ t; \
t = t >> (16 + n); \
a = a ^ t; \
}
#define DES_IP(l,r) \
{ \
PERM_OP (r, l, 4, 0x0f0f0f0f); \
PERM_OP (l, r, 16, 0x0000ffff); \
PERM_OP (r, l, 2, 0x33333333); \
PERM_OP (l, r, 8, 0x00ff00ff); \
PERM_OP (r, l, 1, 0x55555555); \
}
#define DES_FP(l,r) \
{ \
PERM_OP (l, r, 1, 0x55555555); \
PERM_OP (r, l, 8, 0x00ff00ff); \
PERM_OP (l, r, 2, 0x33333333); \
PERM_OP (r, l, 16, 0x0000ffff); \
PERM_OP (l, r, 4, 0x0f0f0f0f); \
}
#if VECT_SIZE == 1
#define DES_BOX(i,n,S) (S)[(n)][(i)]
#elif VECT_SIZE == 2
#define DES_BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1])
#elif VECT_SIZE == 4
#define DES_BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3])
#elif VECT_SIZE == 8
#define DES_BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7])
#elif VECT_SIZE == 16
#define DES_BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf])
#endif
DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
{ {
u32x r = data[0]; {
u32x l = data[1]; /* nibble 0 */
0x02080800, 0x00080000, 0x02000002, 0x02080802,
0x02000000, 0x00080802, 0x00080002, 0x02000002,
0x00080802, 0x02080800, 0x02080000, 0x00000802,
0x02000802, 0x02000000, 0x00000000, 0x00080002,
0x00080000, 0x00000002, 0x02000800, 0x00080800,
0x02080802, 0x02080000, 0x00000802, 0x02000800,
0x00000002, 0x00000800, 0x00080800, 0x02080002,
0x00000800, 0x02000802, 0x02080002, 0x00000000,
0x00000000, 0x02080802, 0x02000800, 0x00080002,
0x02080800, 0x00080000, 0x00000802, 0x02000800,
0x02080002, 0x00000800, 0x00080800, 0x02000002,
0x00080802, 0x00000002, 0x02000002, 0x02080000,
0x02080802, 0x00080800, 0x02080000, 0x02000802,
0x02000000, 0x00000802, 0x00080002, 0x00000000,
0x00080000, 0x02000000, 0x02000802, 0x02080800,
0x00000002, 0x02080002, 0x00000800, 0x00080802,
},
{
/* nibble 1 */
0x40108010, 0x00000000, 0x00108000, 0x40100000,
0x40000010, 0x00008010, 0x40008000, 0x00108000,
0x00008000, 0x40100010, 0x00000010, 0x40008000,
0x00100010, 0x40108000, 0x40100000, 0x00000010,
0x00100000, 0x40008010, 0x40100010, 0x00008000,
0x00108010, 0x40000000, 0x00000000, 0x00100010,
0x40008010, 0x00108010, 0x40108000, 0x40000010,
0x40000000, 0x00100000, 0x00008010, 0x40108010,
0x00100010, 0x40108000, 0x40008000, 0x00108010,
0x40108010, 0x00100010, 0x40000010, 0x00000000,
0x40000000, 0x00008010, 0x00100000, 0x40100010,
0x00008000, 0x40000000, 0x00108010, 0x40008010,
0x40108000, 0x00008000, 0x00000000, 0x40000010,
0x00000010, 0x40108010, 0x00108000, 0x40100000,
0x40100010, 0x00100000, 0x00008010, 0x40008000,
0x40008010, 0x00000010, 0x40100000, 0x00108000,
},
{
/* nibble 2 */
0x04000001, 0x04040100, 0x00000100, 0x04000101,
0x00040001, 0x04000000, 0x04000101, 0x00040100,
0x04000100, 0x00040000, 0x04040000, 0x00000001,
0x04040101, 0x00000101, 0x00000001, 0x04040001,
0x00000000, 0x00040001, 0x04040100, 0x00000100,
0x00000101, 0x04040101, 0x00040000, 0x04000001,
0x04040001, 0x04000100, 0x00040101, 0x04040000,
0x00040100, 0x00000000, 0x04000000, 0x00040101,
0x04040100, 0x00000100, 0x00000001, 0x00040000,
0x00000101, 0x00040001, 0x04040000, 0x04000101,
0x00000000, 0x04040100, 0x00040100, 0x04040001,
0x00040001, 0x04000000, 0x04040101, 0x00000001,
0x00040101, 0x04000001, 0x04000000, 0x04040101,
0x00040000, 0x04000100, 0x04000101, 0x00040100,
0x04000100, 0x00000000, 0x04040001, 0x00000101,
0x04000001, 0x00040101, 0x00000100, 0x04040000,
},
{
/* nibble 3 */
0x00401008, 0x10001000, 0x00000008, 0x10401008,
0x00000000, 0x10400000, 0x10001008, 0x00400008,
0x10401000, 0x10000008, 0x10000000, 0x00001008,
0x10000008, 0x00401008, 0x00400000, 0x10000000,
0x10400008, 0x00401000, 0x00001000, 0x00000008,
0x00401000, 0x10001008, 0x10400000, 0x00001000,
0x00001008, 0x00000000, 0x00400008, 0x10401000,
0x10001000, 0x10400008, 0x10401008, 0x00400000,
0x10400008, 0x00001008, 0x00400000, 0x10000008,
0x00401000, 0x10001000, 0x00000008, 0x10400000,
0x10001008, 0x00000000, 0x00001000, 0x00400008,
0x00000000, 0x10400008, 0x10401000, 0x00001000,
0x10000000, 0x10401008, 0x00401008, 0x00400000,
0x10401008, 0x00000008, 0x10001000, 0x00401008,
0x00400008, 0x00401000, 0x10400000, 0x10001008,
0x00001008, 0x10000000, 0x10000008, 0x10401000,
},
{
/* nibble 4 */
0x08000000, 0x00010000, 0x00000400, 0x08010420,
0x08010020, 0x08000400, 0x00010420, 0x08010000,
0x00010000, 0x00000020, 0x08000020, 0x00010400,
0x08000420, 0x08010020, 0x08010400, 0x00000000,
0x00010400, 0x08000000, 0x00010020, 0x00000420,
0x08000400, 0x00010420, 0x00000000, 0x08000020,
0x00000020, 0x08000420, 0x08010420, 0x00010020,
0x08010000, 0x00000400, 0x00000420, 0x08010400,
0x08010400, 0x08000420, 0x00010020, 0x08010000,
0x00010000, 0x00000020, 0x08000020, 0x08000400,
0x08000000, 0x00010400, 0x08010420, 0x00000000,
0x00010420, 0x08000000, 0x00000400, 0x00010020,
0x08000420, 0x00000400, 0x00000000, 0x08010420,
0x08010020, 0x08010400, 0x00000420, 0x00010000,
0x00010400, 0x08010020, 0x08000400, 0x00000420,
0x00000020, 0x00010420, 0x08010000, 0x08000020,
},
{
/* nibble 5 */
0x80000040, 0x00200040, 0x00000000, 0x80202000,
0x00200040, 0x00002000, 0x80002040, 0x00200000,
0x00002040, 0x80202040, 0x00202000, 0x80000000,
0x80002000, 0x80000040, 0x80200000, 0x00202040,
0x00200000, 0x80002040, 0x80200040, 0x00000000,
0x00002000, 0x00000040, 0x80202000, 0x80200040,
0x80202040, 0x80200000, 0x80000000, 0x00002040,
0x00000040, 0x00202000, 0x00202040, 0x80002000,
0x00002040, 0x80000000, 0x80002000, 0x00202040,
0x80202000, 0x00200040, 0x00000000, 0x80002000,
0x80000000, 0x00002000, 0x80200040, 0x00200000,
0x00200040, 0x80202040, 0x00202000, 0x00000040,
0x80202040, 0x00202000, 0x00200000, 0x80002040,
0x80000040, 0x80200000, 0x00202040, 0x00000000,
0x00002000, 0x80000040, 0x80002040, 0x80202000,
0x80200000, 0x00002040, 0x00000040, 0x80200040,
},
{
/* nibble 6 */
0x00004000, 0x00000200, 0x01000200, 0x01000004,
0x01004204, 0x00004004, 0x00004200, 0x00000000,
0x01000000, 0x01000204, 0x00000204, 0x01004000,
0x00000004, 0x01004200, 0x01004000, 0x00000204,
0x01000204, 0x00004000, 0x00004004, 0x01004204,
0x00000000, 0x01000200, 0x01000004, 0x00004200,
0x01004004, 0x00004204, 0x01004200, 0x00000004,
0x00004204, 0x01004004, 0x00000200, 0x01000000,
0x00004204, 0x01004000, 0x01004004, 0x00000204,
0x00004000, 0x00000200, 0x01000000, 0x01004004,
0x01000204, 0x00004204, 0x00004200, 0x00000000,
0x00000200, 0x01000004, 0x00000004, 0x01000200,
0x00000000, 0x01000204, 0x01000200, 0x00004200,
0x00000204, 0x00004000, 0x01004204, 0x01000000,
0x01004200, 0x00000004, 0x00004004, 0x01004204,
0x01000004, 0x01004200, 0x01004000, 0x00004004,
},
{
/* nibble 7 */
0x20800080, 0x20820000, 0x00020080, 0x00000000,
0x20020000, 0x00800080, 0x20800000, 0x20820080,
0x00000080, 0x20000000, 0x00820000, 0x00020080,
0x00820080, 0x20020080, 0x20000080, 0x20800000,
0x00020000, 0x00820080, 0x00800080, 0x20020000,
0x20820080, 0x20000080, 0x00000000, 0x00820000,
0x20000000, 0x00800000, 0x20020080, 0x20800080,
0x00800000, 0x00020000, 0x20820000, 0x00000080,
0x00800000, 0x00020000, 0x20000080, 0x20820080,
0x00020080, 0x20000000, 0x00000000, 0x00820000,
0x20800080, 0x20020080, 0x20020000, 0x00800080,
0x20820000, 0x00000080, 0x00800080, 0x20020000,
0x20820080, 0x00800000, 0x20800000, 0x20000080,
0x00820000, 0x00020080, 0x20020080, 0x20800000,
0x00000080, 0x20820000, 0x00820080, 0x00000000,
0x20000000, 0x20800080, 0x00020000, 0x00820080,
},
};
CONSTANT_AS u32a c_skb[8][64] =
{
{
0x00000000, 0x00000010, 0x20000000, 0x20000010,
0x00010000, 0x00010010, 0x20010000, 0x20010010,
0x00000800, 0x00000810, 0x20000800, 0x20000810,
0x00010800, 0x00010810, 0x20010800, 0x20010810,
0x00000020, 0x00000030, 0x20000020, 0x20000030,
0x00010020, 0x00010030, 0x20010020, 0x20010030,
0x00000820, 0x00000830, 0x20000820, 0x20000830,
0x00010820, 0x00010830, 0x20010820, 0x20010830,
0x00080000, 0x00080010, 0x20080000, 0x20080010,
0x00090000, 0x00090010, 0x20090000, 0x20090010,
0x00080800, 0x00080810, 0x20080800, 0x20080810,
0x00090800, 0x00090810, 0x20090800, 0x20090810,
0x00080020, 0x00080030, 0x20080020, 0x20080030,
0x00090020, 0x00090030, 0x20090020, 0x20090030,
0x00080820, 0x00080830, 0x20080820, 0x20080830,
0x00090820, 0x00090830, 0x20090820, 0x20090830,
},
{
0x00000000, 0x02000000, 0x00002000, 0x02002000,
0x00200000, 0x02200000, 0x00202000, 0x02202000,
0x00000004, 0x02000004, 0x00002004, 0x02002004,
0x00200004, 0x02200004, 0x00202004, 0x02202004,
0x00000400, 0x02000400, 0x00002400, 0x02002400,
0x00200400, 0x02200400, 0x00202400, 0x02202400,
0x00000404, 0x02000404, 0x00002404, 0x02002404,
0x00200404, 0x02200404, 0x00202404, 0x02202404,
0x10000000, 0x12000000, 0x10002000, 0x12002000,
0x10200000, 0x12200000, 0x10202000, 0x12202000,
0x10000004, 0x12000004, 0x10002004, 0x12002004,
0x10200004, 0x12200004, 0x10202004, 0x12202004,
0x10000400, 0x12000400, 0x10002400, 0x12002400,
0x10200400, 0x12200400, 0x10202400, 0x12202400,
0x10000404, 0x12000404, 0x10002404, 0x12002404,
0x10200404, 0x12200404, 0x10202404, 0x12202404,
},
{
0x00000000, 0x00000001, 0x00040000, 0x00040001,
0x01000000, 0x01000001, 0x01040000, 0x01040001,
0x00000002, 0x00000003, 0x00040002, 0x00040003,
0x01000002, 0x01000003, 0x01040002, 0x01040003,
0x00000200, 0x00000201, 0x00040200, 0x00040201,
0x01000200, 0x01000201, 0x01040200, 0x01040201,
0x00000202, 0x00000203, 0x00040202, 0x00040203,
0x01000202, 0x01000203, 0x01040202, 0x01040203,
0x08000000, 0x08000001, 0x08040000, 0x08040001,
0x09000000, 0x09000001, 0x09040000, 0x09040001,
0x08000002, 0x08000003, 0x08040002, 0x08040003,
0x09000002, 0x09000003, 0x09040002, 0x09040003,
0x08000200, 0x08000201, 0x08040200, 0x08040201,
0x09000200, 0x09000201, 0x09040200, 0x09040201,
0x08000202, 0x08000203, 0x08040202, 0x08040203,
0x09000202, 0x09000203, 0x09040202, 0x09040203,
},
{
0x00000000, 0x00100000, 0x00000100, 0x00100100,
0x00000008, 0x00100008, 0x00000108, 0x00100108,
0x00001000, 0x00101000, 0x00001100, 0x00101100,
0x00001008, 0x00101008, 0x00001108, 0x00101108,
0x04000000, 0x04100000, 0x04000100, 0x04100100,
0x04000008, 0x04100008, 0x04000108, 0x04100108,
0x04001000, 0x04101000, 0x04001100, 0x04101100,
0x04001008, 0x04101008, 0x04001108, 0x04101108,
0x00020000, 0x00120000, 0x00020100, 0x00120100,
0x00020008, 0x00120008, 0x00020108, 0x00120108,
0x00021000, 0x00121000, 0x00021100, 0x00121100,
0x00021008, 0x00121008, 0x00021108, 0x00121108,
0x04020000, 0x04120000, 0x04020100, 0x04120100,
0x04020008, 0x04120008, 0x04020108, 0x04120108,
0x04021000, 0x04121000, 0x04021100, 0x04121100,
0x04021008, 0x04121008, 0x04021108, 0x04121108,
},
{
0x00000000, 0x10000000, 0x00010000, 0x10010000,
0x00000004, 0x10000004, 0x00010004, 0x10010004,
0x20000000, 0x30000000, 0x20010000, 0x30010000,
0x20000004, 0x30000004, 0x20010004, 0x30010004,
0x00100000, 0x10100000, 0x00110000, 0x10110000,
0x00100004, 0x10100004, 0x00110004, 0x10110004,
0x20100000, 0x30100000, 0x20110000, 0x30110000,
0x20100004, 0x30100004, 0x20110004, 0x30110004,
0x00001000, 0x10001000, 0x00011000, 0x10011000,
0x00001004, 0x10001004, 0x00011004, 0x10011004,
0x20001000, 0x30001000, 0x20011000, 0x30011000,
0x20001004, 0x30001004, 0x20011004, 0x30011004,
0x00101000, 0x10101000, 0x00111000, 0x10111000,
0x00101004, 0x10101004, 0x00111004, 0x10111004,
0x20101000, 0x30101000, 0x20111000, 0x30111000,
0x20101004, 0x30101004, 0x20111004, 0x30111004,
},
{
0x00000000, 0x08000000, 0x00000008, 0x08000008,
0x00000400, 0x08000400, 0x00000408, 0x08000408,
0x00020000, 0x08020000, 0x00020008, 0x08020008,
0x00020400, 0x08020400, 0x00020408, 0x08020408,
0x00000001, 0x08000001, 0x00000009, 0x08000009,
0x00000401, 0x08000401, 0x00000409, 0x08000409,
0x00020001, 0x08020001, 0x00020009, 0x08020009,
0x00020401, 0x08020401, 0x00020409, 0x08020409,
0x02000000, 0x0A000000, 0x02000008, 0x0A000008,
0x02000400, 0x0A000400, 0x02000408, 0x0A000408,
0x02020000, 0x0A020000, 0x02020008, 0x0A020008,
0x02020400, 0x0A020400, 0x02020408, 0x0A020408,
0x02000001, 0x0A000001, 0x02000009, 0x0A000009,
0x02000401, 0x0A000401, 0x02000409, 0x0A000409,
0x02020001, 0x0A020001, 0x02020009, 0x0A020009,
0x02020401, 0x0A020401, 0x02020409, 0x0A020409,
},
{
0x00000000, 0x00000100, 0x00080000, 0x00080100,
0x01000000, 0x01000100, 0x01080000, 0x01080100,
0x00000010, 0x00000110, 0x00080010, 0x00080110,
0x01000010, 0x01000110, 0x01080010, 0x01080110,
0x00200000, 0x00200100, 0x00280000, 0x00280100,
0x01200000, 0x01200100, 0x01280000, 0x01280100,
0x00200010, 0x00200110, 0x00280010, 0x00280110,
0x01200010, 0x01200110, 0x01280010, 0x01280110,
0x00000200, 0x00000300, 0x00080200, 0x00080300,
0x01000200, 0x01000300, 0x01080200, 0x01080300,
0x00000210, 0x00000310, 0x00080210, 0x00080310,
0x01000210, 0x01000310, 0x01080210, 0x01080310,
0x00200200, 0x00200300, 0x00280200, 0x00280300,
0x01200200, 0x01200300, 0x01280200, 0x01280300,
0x00200210, 0x00200310, 0x00280210, 0x00280310,
0x01200210, 0x01200310, 0x01280210, 0x01280310,
},
{
0x00000000, 0x04000000, 0x00040000, 0x04040000,
0x00000002, 0x04000002, 0x00040002, 0x04040002,
0x00002000, 0x04002000, 0x00042000, 0x04042000,
0x00002002, 0x04002002, 0x00042002, 0x04042002,
0x00000020, 0x04000020, 0x00040020, 0x04040020,
0x00000022, 0x04000022, 0x00040022, 0x04040022,
0x00002020, 0x04002020, 0x00042020, 0x04042020,
0x00002022, 0x04002022, 0x00042022, 0x04042022,
0x00000800, 0x04000800, 0x00040800, 0x04040800,
0x00000802, 0x04000802, 0x00040802, 0x04040802,
0x00002800, 0x04002800, 0x00042800, 0x04042800,
0x00002802, 0x04002802, 0x00042802, 0x04042802,
0x00000820, 0x04000820, 0x00040820, 0x04040820,
0x00000822, 0x04000822, 0x00040822, 0x04040822,
0x00002820, 0x04002820, 0x00042820, 0x04042820,
0x00002822, 0x04002822, 0x00042822, 0x04042822
}
};
DECLSPEC void _des_crypt_encrypt (u32 *out, const u32 *in, const u32 *Kc, const u32 *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
{
u32 r = in[0];
u32 l = in[1];
DES_IP_S (r, l);
r = hc_rotl32_S (r, 3u);
l = hc_rotl32_S (l, 3u);
for (u32 i = 0; i < 16; i += 2)
{
u32 u;
u32 t;
u = Kc[i + 0] ^ r;
t = Kd[i + 0] ^ hc_rotl32_S (r, 28u);
l ^= DES_BOX_S (((u >> 2) & 0x3f), 0, s_SPtrans)
| DES_BOX_S (((u >> 10) & 0x3f), 2, s_SPtrans)
| DES_BOX_S (((u >> 18) & 0x3f), 4, s_SPtrans)
| DES_BOX_S (((u >> 26) & 0x3f), 6, s_SPtrans)
| DES_BOX_S (((t >> 2) & 0x3f), 1, s_SPtrans)
| DES_BOX_S (((t >> 10) & 0x3f), 3, s_SPtrans)
| DES_BOX_S (((t >> 18) & 0x3f), 5, s_SPtrans)
| DES_BOX_S (((t >> 26) & 0x3f), 7, s_SPtrans);
u = Kc[i + 1] ^ l;
t = Kd[i + 1] ^ hc_rotl32_S (l, 28u);
r ^= DES_BOX_S (((u >> 2) & 0x3f), 0, s_SPtrans)
| DES_BOX_S (((u >> 10) & 0x3f), 2, s_SPtrans)
| DES_BOX_S (((u >> 18) & 0x3f), 4, s_SPtrans)
| DES_BOX_S (((u >> 26) & 0x3f), 6, s_SPtrans)
| DES_BOX_S (((t >> 2) & 0x3f), 1, s_SPtrans)
| DES_BOX_S (((t >> 10) & 0x3f), 3, s_SPtrans)
| DES_BOX_S (((t >> 18) & 0x3f), 5, s_SPtrans)
| DES_BOX_S (((t >> 26) & 0x3f), 7, s_SPtrans);
}
l = hc_rotl32_S (l, 29u);
r = hc_rotl32_S (r, 29u);
DES_FP_S (r, l);
out[0] = l;
out[1] = r;
}
DECLSPEC void _des_crypt_decrypt (u32 *out, const u32 *in, const u32 *Kc, const u32 *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
{
u32 r = in[0];
u32 l = in[1];
DES_IP_S (r, l);
r = hc_rotl32_S (r, 3u);
l = hc_rotl32_S (l, 3u);
for (u32 i = 16; i > 0; i -= 2)
{
u32 u;
u32 t;
u = Kc[i - 1] ^ r;
t = Kd[i - 1] ^ hc_rotl32_S (r, 28u);
l ^= DES_BOX_S (((u >> 2) & 0x3f), 0, s_SPtrans)
| DES_BOX_S (((u >> 10) & 0x3f), 2, s_SPtrans)
| DES_BOX_S (((u >> 18) & 0x3f), 4, s_SPtrans)
| DES_BOX_S (((u >> 26) & 0x3f), 6, s_SPtrans)
| DES_BOX_S (((t >> 2) & 0x3f), 1, s_SPtrans)
| DES_BOX_S (((t >> 10) & 0x3f), 3, s_SPtrans)
| DES_BOX_S (((t >> 18) & 0x3f), 5, s_SPtrans)
| DES_BOX_S (((t >> 26) & 0x3f), 7, s_SPtrans);
u = Kc[i - 2] ^ l;
t = Kd[i - 2] ^ hc_rotl32_S (l, 28u);
r ^= DES_BOX_S (((u >> 2) & 0x3f), 0, s_SPtrans)
| DES_BOX_S (((u >> 10) & 0x3f), 2, s_SPtrans)
| DES_BOX_S (((u >> 18) & 0x3f), 4, s_SPtrans)
| DES_BOX_S (((u >> 26) & 0x3f), 6, s_SPtrans)
| DES_BOX_S (((t >> 2) & 0x3f), 1, s_SPtrans)
| DES_BOX_S (((t >> 10) & 0x3f), 3, s_SPtrans)
| DES_BOX_S (((t >> 18) & 0x3f), 5, s_SPtrans)
| DES_BOX_S (((t >> 26) & 0x3f), 7, s_SPtrans);
}
l = hc_rotl32_S (l, 29u);
r = hc_rotl32_S (r, 29u);
DES_FP_S (r, l);
out[0] = l;
out[1] = r;
}
DECLSPEC void _des_crypt_keysetup (u32 c, u32 d, u32 *Kc, u32 *Kd, SHM_TYPE u32 (*s_skb)[64])
{
PERM_OP_S (d, c, 4, 0x0f0f0f0f);
HPERM_OP_S (c, 2, 0xcccc0000);
HPERM_OP_S (d, 2, 0xcccc0000);
PERM_OP_S (d, c, 1, 0x55555555);
PERM_OP_S (c, d, 8, 0x00ff00ff);
PERM_OP_S (d, c, 1, 0x55555555);
d = ((d & 0x000000ff) << 16)
| ((d & 0x0000ff00) << 0)
| ((d & 0x00ff0000) >> 16)
| ((c & 0xf0000000) >> 4);
c = c & 0x0fffffff;
for (u32 i = 0; i < 16; i++)
{
if ((i < 2) || (i == 8) || (i == 15))
{
c = ((c >> 1) | (c << 27));
d = ((d >> 1) | (d << 27));
}
else
{
c = ((c >> 2) | (c << 26));
d = ((d >> 2) | (d << 26));
}
c = c & 0x0fffffff;
d = d & 0x0fffffff;
const u32 c00 = (c >> 0) & 0x0000003f;
const u32 c06 = (c >> 6) & 0x00383003;
const u32 c07 = (c >> 7) & 0x0000003c;
const u32 c13 = (c >> 13) & 0x0000060f;
const u32 c20 = (c >> 20) & 0x00000001;
u32 s = DES_BOX_S (((c00 >> 0) & 0xff), 0, s_skb)
| DES_BOX_S (((c06 >> 0) & 0xff)
|((c07 >> 0) & 0xff), 1, s_skb)
| DES_BOX_S (((c13 >> 0) & 0xff)
|((c06 >> 8) & 0xff), 2, s_skb)
| DES_BOX_S (((c20 >> 0) & 0xff)
|((c13 >> 8) & 0xff)
|((c06 >> 16) & 0xff), 3, s_skb);
const u32 d00 = (d >> 0) & 0x00003c3f;
const u32 d07 = (d >> 7) & 0x00003f03;
const u32 d21 = (d >> 21) & 0x0000000f;
const u32 d22 = (d >> 22) & 0x00000030;
u32 t = DES_BOX_S (((d00 >> 0) & 0xff), 4, s_skb)
| DES_BOX_S (((d07 >> 0) & 0xff)
|((d00 >> 8) & 0xff), 5, s_skb)
| DES_BOX_S (((d07 >> 8) & 0xff), 6, s_skb)
| DES_BOX_S (((d21 >> 0) & 0xff)
|((d22 >> 0) & 0xff), 7, s_skb);
Kc[i] = ((t << 16) | (s & 0x0000ffff));
Kd[i] = ((s >> 16) | (t & 0xffff0000));
Kc[i] = hc_rotl32_S (Kc[i], 2u);
Kd[i] = hc_rotl32_S (Kd[i], 2u);
}
}
DECLSPEC void _des_crypt_encrypt_vect (u32x *out, const u32x *in, const u32x *Kc, const u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
{
u32x r = in[0];
u32x l = in[1];
DES_IP (r, l); DES_IP (r, l);
@ -105,14 +522,14 @@ DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_
DES_FP (r, l); DES_FP (r, l);
iv[0] = l; out[0] = l;
iv[1] = r; out[1] = r;
} }
DECLSPEC void _des_crypt_decrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]) DECLSPEC void _des_crypt_decrypt_vect (u32x *out, const u32x *in, const u32x *Kc, const u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
{ {
u32x r = data[0]; u32x r = in[0];
u32x l = data[1]; u32x l = in[1];
DES_IP (r, l); DES_IP (r, l);
@ -154,11 +571,11 @@ DECLSPEC void _des_crypt_decrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_
DES_FP (r, l); DES_FP (r, l);
iv[0] = l; out[0] = l;
iv[1] = r; out[1] = r;
} }
DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64]) DECLSPEC void _des_crypt_keysetup_vect (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64])
{ {
PERM_OP (d, c, 4, 0x0f0f0f0f); PERM_OP (d, c, 4, 0x0f0f0f0f);
HPERM_OP (c, 2, 0xcccc0000); HPERM_OP (c, 2, 0xcccc0000);
@ -224,10 +641,3 @@ DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE
Kd[i] = hc_rotl32 (Kd[i], 2u); Kd[i] = hc_rotl32 (Kd[i], 2u);
} }
} }
#undef PERM_OP
#undef HPERM_OP
#undef DES_IP
#undef DES_FP
#undef DES_BOX

View File

@ -6,312 +6,107 @@
#ifndef _INC_CIPHER_DES_H #ifndef _INC_CIPHER_DES_H
#define _INC_CIPHER_DES_H #define _INC_CIPHER_DES_H
CONSTANT_AS u32a c_SPtrans[8][64] = // these really should be turned into real function
{ #define PERM_OP(a,b,n,m) \
{ { \
/* nibble 0 */ u32x t; \
0x02080800, 0x00080000, 0x02000002, 0x02080802, t = a >> n; \
0x02000000, 0x00080802, 0x00080002, 0x02000002, t = t ^ b; \
0x00080802, 0x02080800, 0x02080000, 0x00000802, t = t & m; \
0x02000802, 0x02000000, 0x00000000, 0x00080002, b = b ^ t; \
0x00080000, 0x00000002, 0x02000800, 0x00080800, t = t << n; \
0x02080802, 0x02080000, 0x00000802, 0x02000800, a = a ^ t; \
0x00000002, 0x00000800, 0x00080800, 0x02080002, }
0x00000800, 0x02000802, 0x02080002, 0x00000000,
0x00000000, 0x02080802, 0x02000800, 0x00080002,
0x02080800, 0x00080000, 0x00000802, 0x02000800,
0x02080002, 0x00000800, 0x00080800, 0x02000002,
0x00080802, 0x00000002, 0x02000002, 0x02080000,
0x02080802, 0x00080800, 0x02080000, 0x02000802,
0x02000000, 0x00000802, 0x00080002, 0x00000000,
0x00080000, 0x02000000, 0x02000802, 0x02080800,
0x00000002, 0x02080002, 0x00000800, 0x00080802,
},
{
/* nibble 1 */
0x40108010, 0x00000000, 0x00108000, 0x40100000,
0x40000010, 0x00008010, 0x40008000, 0x00108000,
0x00008000, 0x40100010, 0x00000010, 0x40008000,
0x00100010, 0x40108000, 0x40100000, 0x00000010,
0x00100000, 0x40008010, 0x40100010, 0x00008000,
0x00108010, 0x40000000, 0x00000000, 0x00100010,
0x40008010, 0x00108010, 0x40108000, 0x40000010,
0x40000000, 0x00100000, 0x00008010, 0x40108010,
0x00100010, 0x40108000, 0x40008000, 0x00108010,
0x40108010, 0x00100010, 0x40000010, 0x00000000,
0x40000000, 0x00008010, 0x00100000, 0x40100010,
0x00008000, 0x40000000, 0x00108010, 0x40008010,
0x40108000, 0x00008000, 0x00000000, 0x40000010,
0x00000010, 0x40108010, 0x00108000, 0x40100000,
0x40100010, 0x00100000, 0x00008010, 0x40008000,
0x40008010, 0x00000010, 0x40100000, 0x00108000,
},
{
/* nibble 2 */
0x04000001, 0x04040100, 0x00000100, 0x04000101,
0x00040001, 0x04000000, 0x04000101, 0x00040100,
0x04000100, 0x00040000, 0x04040000, 0x00000001,
0x04040101, 0x00000101, 0x00000001, 0x04040001,
0x00000000, 0x00040001, 0x04040100, 0x00000100,
0x00000101, 0x04040101, 0x00040000, 0x04000001,
0x04040001, 0x04000100, 0x00040101, 0x04040000,
0x00040100, 0x00000000, 0x04000000, 0x00040101,
0x04040100, 0x00000100, 0x00000001, 0x00040000,
0x00000101, 0x00040001, 0x04040000, 0x04000101,
0x00000000, 0x04040100, 0x00040100, 0x04040001,
0x00040001, 0x04000000, 0x04040101, 0x00000001,
0x00040101, 0x04000001, 0x04000000, 0x04040101,
0x00040000, 0x04000100, 0x04000101, 0x00040100,
0x04000100, 0x00000000, 0x04040001, 0x00000101,
0x04000001, 0x00040101, 0x00000100, 0x04040000,
},
{
/* nibble 3 */
0x00401008, 0x10001000, 0x00000008, 0x10401008,
0x00000000, 0x10400000, 0x10001008, 0x00400008,
0x10401000, 0x10000008, 0x10000000, 0x00001008,
0x10000008, 0x00401008, 0x00400000, 0x10000000,
0x10400008, 0x00401000, 0x00001000, 0x00000008,
0x00401000, 0x10001008, 0x10400000, 0x00001000,
0x00001008, 0x00000000, 0x00400008, 0x10401000,
0x10001000, 0x10400008, 0x10401008, 0x00400000,
0x10400008, 0x00001008, 0x00400000, 0x10000008,
0x00401000, 0x10001000, 0x00000008, 0x10400000,
0x10001008, 0x00000000, 0x00001000, 0x00400008,
0x00000000, 0x10400008, 0x10401000, 0x00001000,
0x10000000, 0x10401008, 0x00401008, 0x00400000,
0x10401008, 0x00000008, 0x10001000, 0x00401008,
0x00400008, 0x00401000, 0x10400000, 0x10001008,
0x00001008, 0x10000000, 0x10000008, 0x10401000,
},
{
/* nibble 4 */
0x08000000, 0x00010000, 0x00000400, 0x08010420,
0x08010020, 0x08000400, 0x00010420, 0x08010000,
0x00010000, 0x00000020, 0x08000020, 0x00010400,
0x08000420, 0x08010020, 0x08010400, 0x00000000,
0x00010400, 0x08000000, 0x00010020, 0x00000420,
0x08000400, 0x00010420, 0x00000000, 0x08000020,
0x00000020, 0x08000420, 0x08010420, 0x00010020,
0x08010000, 0x00000400, 0x00000420, 0x08010400,
0x08010400, 0x08000420, 0x00010020, 0x08010000,
0x00010000, 0x00000020, 0x08000020, 0x08000400,
0x08000000, 0x00010400, 0x08010420, 0x00000000,
0x00010420, 0x08000000, 0x00000400, 0x00010020,
0x08000420, 0x00000400, 0x00000000, 0x08010420,
0x08010020, 0x08010400, 0x00000420, 0x00010000,
0x00010400, 0x08010020, 0x08000400, 0x00000420,
0x00000020, 0x00010420, 0x08010000, 0x08000020,
},
{
/* nibble 5 */
0x80000040, 0x00200040, 0x00000000, 0x80202000,
0x00200040, 0x00002000, 0x80002040, 0x00200000,
0x00002040, 0x80202040, 0x00202000, 0x80000000,
0x80002000, 0x80000040, 0x80200000, 0x00202040,
0x00200000, 0x80002040, 0x80200040, 0x00000000,
0x00002000, 0x00000040, 0x80202000, 0x80200040,
0x80202040, 0x80200000, 0x80000000, 0x00002040,
0x00000040, 0x00202000, 0x00202040, 0x80002000,
0x00002040, 0x80000000, 0x80002000, 0x00202040,
0x80202000, 0x00200040, 0x00000000, 0x80002000,
0x80000000, 0x00002000, 0x80200040, 0x00200000,
0x00200040, 0x80202040, 0x00202000, 0x00000040,
0x80202040, 0x00202000, 0x00200000, 0x80002040,
0x80000040, 0x80200000, 0x00202040, 0x00000000,
0x00002000, 0x80000040, 0x80002040, 0x80202000,
0x80200000, 0x00002040, 0x00000040, 0x80200040,
},
{
/* nibble 6 */
0x00004000, 0x00000200, 0x01000200, 0x01000004,
0x01004204, 0x00004004, 0x00004200, 0x00000000,
0x01000000, 0x01000204, 0x00000204, 0x01004000,
0x00000004, 0x01004200, 0x01004000, 0x00000204,
0x01000204, 0x00004000, 0x00004004, 0x01004204,
0x00000000, 0x01000200, 0x01000004, 0x00004200,
0x01004004, 0x00004204, 0x01004200, 0x00000004,
0x00004204, 0x01004004, 0x00000200, 0x01000000,
0x00004204, 0x01004000, 0x01004004, 0x00000204,
0x00004000, 0x00000200, 0x01000000, 0x01004004,
0x01000204, 0x00004204, 0x00004200, 0x00000000,
0x00000200, 0x01000004, 0x00000004, 0x01000200,
0x00000000, 0x01000204, 0x01000200, 0x00004200,
0x00000204, 0x00004000, 0x01004204, 0x01000000,
0x01004200, 0x00000004, 0x00004004, 0x01004204,
0x01000004, 0x01004200, 0x01004000, 0x00004004,
},
{
/* nibble 7 */
0x20800080, 0x20820000, 0x00020080, 0x00000000,
0x20020000, 0x00800080, 0x20800000, 0x20820080,
0x00000080, 0x20000000, 0x00820000, 0x00020080,
0x00820080, 0x20020080, 0x20000080, 0x20800000,
0x00020000, 0x00820080, 0x00800080, 0x20020000,
0x20820080, 0x20000080, 0x00000000, 0x00820000,
0x20000000, 0x00800000, 0x20020080, 0x20800080,
0x00800000, 0x00020000, 0x20820000, 0x00000080,
0x00800000, 0x00020000, 0x20000080, 0x20820080,
0x00020080, 0x20000000, 0x00000000, 0x00820000,
0x20800080, 0x20020080, 0x20020000, 0x00800080,
0x20820000, 0x00000080, 0x00800080, 0x20020000,
0x20820080, 0x00800000, 0x20800000, 0x20000080,
0x00820000, 0x00020080, 0x20020080, 0x20800000,
0x00000080, 0x20820000, 0x00820080, 0x00000000,
0x20000000, 0x20800080, 0x00020000, 0x00820080,
},
};
CONSTANT_AS u32a c_skb[8][64] = #define HPERM_OP(a,n,m) \
{ { \
{ u32x t; \
0x00000000, 0x00000010, 0x20000000, 0x20000010, t = a << (16 + n); \
0x00010000, 0x00010010, 0x20010000, 0x20010010, t = t ^ a; \
0x00000800, 0x00000810, 0x20000800, 0x20000810, t = t & m; \
0x00010800, 0x00010810, 0x20010800, 0x20010810, a = a ^ t; \
0x00000020, 0x00000030, 0x20000020, 0x20000030, t = t >> (16 + n); \
0x00010020, 0x00010030, 0x20010020, 0x20010030, a = a ^ t; \
0x00000820, 0x00000830, 0x20000820, 0x20000830, }
0x00010820, 0x00010830, 0x20010820, 0x20010830,
0x00080000, 0x00080010, 0x20080000, 0x20080010,
0x00090000, 0x00090010, 0x20090000, 0x20090010,
0x00080800, 0x00080810, 0x20080800, 0x20080810,
0x00090800, 0x00090810, 0x20090800, 0x20090810,
0x00080020, 0x00080030, 0x20080020, 0x20080030,
0x00090020, 0x00090030, 0x20090020, 0x20090030,
0x00080820, 0x00080830, 0x20080820, 0x20080830,
0x00090820, 0x00090830, 0x20090820, 0x20090830,
},
{
0x00000000, 0x02000000, 0x00002000, 0x02002000,
0x00200000, 0x02200000, 0x00202000, 0x02202000,
0x00000004, 0x02000004, 0x00002004, 0x02002004,
0x00200004, 0x02200004, 0x00202004, 0x02202004,
0x00000400, 0x02000400, 0x00002400, 0x02002400,
0x00200400, 0x02200400, 0x00202400, 0x02202400,
0x00000404, 0x02000404, 0x00002404, 0x02002404,
0x00200404, 0x02200404, 0x00202404, 0x02202404,
0x10000000, 0x12000000, 0x10002000, 0x12002000,
0x10200000, 0x12200000, 0x10202000, 0x12202000,
0x10000004, 0x12000004, 0x10002004, 0x12002004,
0x10200004, 0x12200004, 0x10202004, 0x12202004,
0x10000400, 0x12000400, 0x10002400, 0x12002400,
0x10200400, 0x12200400, 0x10202400, 0x12202400,
0x10000404, 0x12000404, 0x10002404, 0x12002404,
0x10200404, 0x12200404, 0x10202404, 0x12202404,
},
{
0x00000000, 0x00000001, 0x00040000, 0x00040001,
0x01000000, 0x01000001, 0x01040000, 0x01040001,
0x00000002, 0x00000003, 0x00040002, 0x00040003,
0x01000002, 0x01000003, 0x01040002, 0x01040003,
0x00000200, 0x00000201, 0x00040200, 0x00040201,
0x01000200, 0x01000201, 0x01040200, 0x01040201,
0x00000202, 0x00000203, 0x00040202, 0x00040203,
0x01000202, 0x01000203, 0x01040202, 0x01040203,
0x08000000, 0x08000001, 0x08040000, 0x08040001,
0x09000000, 0x09000001, 0x09040000, 0x09040001,
0x08000002, 0x08000003, 0x08040002, 0x08040003,
0x09000002, 0x09000003, 0x09040002, 0x09040003,
0x08000200, 0x08000201, 0x08040200, 0x08040201,
0x09000200, 0x09000201, 0x09040200, 0x09040201,
0x08000202, 0x08000203, 0x08040202, 0x08040203,
0x09000202, 0x09000203, 0x09040202, 0x09040203,
},
{
0x00000000, 0x00100000, 0x00000100, 0x00100100,
0x00000008, 0x00100008, 0x00000108, 0x00100108,
0x00001000, 0x00101000, 0x00001100, 0x00101100,
0x00001008, 0x00101008, 0x00001108, 0x00101108,
0x04000000, 0x04100000, 0x04000100, 0x04100100,
0x04000008, 0x04100008, 0x04000108, 0x04100108,
0x04001000, 0x04101000, 0x04001100, 0x04101100,
0x04001008, 0x04101008, 0x04001108, 0x04101108,
0x00020000, 0x00120000, 0x00020100, 0x00120100,
0x00020008, 0x00120008, 0x00020108, 0x00120108,
0x00021000, 0x00121000, 0x00021100, 0x00121100,
0x00021008, 0x00121008, 0x00021108, 0x00121108,
0x04020000, 0x04120000, 0x04020100, 0x04120100,
0x04020008, 0x04120008, 0x04020108, 0x04120108,
0x04021000, 0x04121000, 0x04021100, 0x04121100,
0x04021008, 0x04121008, 0x04021108, 0x04121108,
},
{
0x00000000, 0x10000000, 0x00010000, 0x10010000,
0x00000004, 0x10000004, 0x00010004, 0x10010004,
0x20000000, 0x30000000, 0x20010000, 0x30010000,
0x20000004, 0x30000004, 0x20010004, 0x30010004,
0x00100000, 0x10100000, 0x00110000, 0x10110000,
0x00100004, 0x10100004, 0x00110004, 0x10110004,
0x20100000, 0x30100000, 0x20110000, 0x30110000,
0x20100004, 0x30100004, 0x20110004, 0x30110004,
0x00001000, 0x10001000, 0x00011000, 0x10011000,
0x00001004, 0x10001004, 0x00011004, 0x10011004,
0x20001000, 0x30001000, 0x20011000, 0x30011000,
0x20001004, 0x30001004, 0x20011004, 0x30011004,
0x00101000, 0x10101000, 0x00111000, 0x10111000,
0x00101004, 0x10101004, 0x00111004, 0x10111004,
0x20101000, 0x30101000, 0x20111000, 0x30111000,
0x20101004, 0x30101004, 0x20111004, 0x30111004,
},
{
0x00000000, 0x08000000, 0x00000008, 0x08000008,
0x00000400, 0x08000400, 0x00000408, 0x08000408,
0x00020000, 0x08020000, 0x00020008, 0x08020008,
0x00020400, 0x08020400, 0x00020408, 0x08020408,
0x00000001, 0x08000001, 0x00000009, 0x08000009,
0x00000401, 0x08000401, 0x00000409, 0x08000409,
0x00020001, 0x08020001, 0x00020009, 0x08020009,
0x00020401, 0x08020401, 0x00020409, 0x08020409,
0x02000000, 0x0A000000, 0x02000008, 0x0A000008,
0x02000400, 0x0A000400, 0x02000408, 0x0A000408,
0x02020000, 0x0A020000, 0x02020008, 0x0A020008,
0x02020400, 0x0A020400, 0x02020408, 0x0A020408,
0x02000001, 0x0A000001, 0x02000009, 0x0A000009,
0x02000401, 0x0A000401, 0x02000409, 0x0A000409,
0x02020001, 0x0A020001, 0x02020009, 0x0A020009,
0x02020401, 0x0A020401, 0x02020409, 0x0A020409,
},
{
0x00000000, 0x00000100, 0x00080000, 0x00080100,
0x01000000, 0x01000100, 0x01080000, 0x01080100,
0x00000010, 0x00000110, 0x00080010, 0x00080110,
0x01000010, 0x01000110, 0x01080010, 0x01080110,
0x00200000, 0x00200100, 0x00280000, 0x00280100,
0x01200000, 0x01200100, 0x01280000, 0x01280100,
0x00200010, 0x00200110, 0x00280010, 0x00280110,
0x01200010, 0x01200110, 0x01280010, 0x01280110,
0x00000200, 0x00000300, 0x00080200, 0x00080300,
0x01000200, 0x01000300, 0x01080200, 0x01080300,
0x00000210, 0x00000310, 0x00080210, 0x00080310,
0x01000210, 0x01000310, 0x01080210, 0x01080310,
0x00200200, 0x00200300, 0x00280200, 0x00280300,
0x01200200, 0x01200300, 0x01280200, 0x01280300,
0x00200210, 0x00200310, 0x00280210, 0x00280310,
0x01200210, 0x01200310, 0x01280210, 0x01280310,
},
{
0x00000000, 0x04000000, 0x00040000, 0x04040000,
0x00000002, 0x04000002, 0x00040002, 0x04040002,
0x00002000, 0x04002000, 0x00042000, 0x04042000,
0x00002002, 0x04002002, 0x00042002, 0x04042002,
0x00000020, 0x04000020, 0x00040020, 0x04040020,
0x00000022, 0x04000022, 0x00040022, 0x04040022,
0x00002020, 0x04002020, 0x00042020, 0x04042020,
0x00002022, 0x04002022, 0x00042022, 0x04042022,
0x00000800, 0x04000800, 0x00040800, 0x04040800,
0x00000802, 0x04000802, 0x00040802, 0x04040802,
0x00002800, 0x04002800, 0x00042800, 0x04042800,
0x00002802, 0x04002802, 0x00042802, 0x04042802,
0x00000820, 0x04000820, 0x00040820, 0x04040820,
0x00000822, 0x04000822, 0x00040822, 0x04040822,
0x00002820, 0x04002820, 0x00042820, 0x04042820,
0x00002822, 0x04002822, 0x00042822, 0x04042822
}
};
DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]); #define DES_IP(l,r) \
DECLSPEC void _des_crypt_decrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]); { \
DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64]); PERM_OP (r, l, 4, 0x0f0f0f0f); \
PERM_OP (l, r, 16, 0x0000ffff); \
PERM_OP (r, l, 2, 0x33333333); \
PERM_OP (l, r, 8, 0x00ff00ff); \
PERM_OP (r, l, 1, 0x55555555); \
}
#define DES_FP(l,r) \
{ \
PERM_OP (l, r, 1, 0x55555555); \
PERM_OP (r, l, 8, 0x00ff00ff); \
PERM_OP (l, r, 2, 0x33333333); \
PERM_OP (r, l, 16, 0x0000ffff); \
PERM_OP (l, r, 4, 0x0f0f0f0f); \
}
#define PERM_OP_S(a,b,n,m) \
{ \
u32 t; \
t = a >> n; \
t = t ^ b; \
t = t & m; \
b = b ^ t; \
t = t << n; \
a = a ^ t; \
}
#define HPERM_OP_S(a,n,m) \
{ \
u32 t; \
t = a << (16 + n); \
t = t ^ a; \
t = t & m; \
a = a ^ t; \
t = t >> (16 + n); \
a = a ^ t; \
}
#define DES_IP_S(l,r) \
{ \
PERM_OP_S (r, l, 4, 0x0f0f0f0f); \
PERM_OP_S (l, r, 16, 0x0000ffff); \
PERM_OP_S (r, l, 2, 0x33333333); \
PERM_OP_S (l, r, 8, 0x00ff00ff); \
PERM_OP_S (r, l, 1, 0x55555555); \
}
#define DES_FP_S(l,r) \
{ \
PERM_OP_S (l, r, 1, 0x55555555); \
PERM_OP_S (r, l, 8, 0x00ff00ff); \
PERM_OP_S (l, r, 2, 0x33333333); \
PERM_OP_S (r, l, 16, 0x0000ffff); \
PERM_OP_S (l, r, 4, 0x0f0f0f0f); \
}
#define DES_BOX_S(i,n,S) (S)[(n)][(i)]
#if VECT_SIZE == 1
#define DES_BOX(i,n,S) (S)[(n)][(i)]
#elif VECT_SIZE == 2
#define DES_BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1])
#elif VECT_SIZE == 4
#define DES_BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3])
#elif VECT_SIZE == 8
#define DES_BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7])
#elif VECT_SIZE == 16
#define DES_BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf])
#endif
DECLSPEC void _des_crypt_encrypt (u32 *out, const u32 *in, const u32 *Kc, const u32 *Kd, SHM_TYPE u32 (*s_SPtrans)[64]);
DECLSPEC void _des_crypt_decrypt (u32 *out, const u32 *in, const u32 *Kc, const u32 *Kd, SHM_TYPE u32 (*s_SPtrans)[64]);
DECLSPEC void _des_crypt_keysetup (u32 c, u32 d, u32 *Kc, u32 *Kd, SHM_TYPE u32 (*s_skb)[64]);
DECLSPEC void _des_crypt_encrypt_vect (u32x *out, const u32x *in, const u32x *Kc, const u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]);
DECLSPEC void _des_crypt_decrypt_vect (u32x *out, const u32x *in, const u32x *Kc, const u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]);
DECLSPEC void _des_crypt_keysetup_vect (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64]);
#endif // _INC_CIPHER_DES_H #endif // _INC_CIPHER_DES_H

View File

@ -17,6 +17,78 @@
#include "inc_common.h" #include "inc_common.h"
#include "inc_cipher_kuznyechik.h" #include "inc_cipher_kuznyechik.h"
CONSTANT_AS u32a k_sbox[256] =
{
0xfc, 0xee, 0xdd, 0x11, 0xcf, 0x6e, 0x31, 0x16,
0xfb, 0xc4, 0xfa, 0xda, 0x23, 0xc5, 0x04, 0x4d,
0xe9, 0x77, 0xf0, 0xdb, 0x93, 0x2e, 0x99, 0xba,
0x17, 0x36, 0xf1, 0xbb, 0x14, 0xcd, 0x5f, 0xc1,
0xf9, 0x18, 0x65, 0x5a, 0xe2, 0x5c, 0xef, 0x21,
0x81, 0x1c, 0x3c, 0x42, 0x8b, 0x01, 0x8e, 0x4f,
0x05, 0x84, 0x02, 0xae, 0xe3, 0x6a, 0x8f, 0xa0,
0x06, 0x0b, 0xed, 0x98, 0x7f, 0xd4, 0xd3, 0x1f,
0xeb, 0x34, 0x2c, 0x51, 0xea, 0xc8, 0x48, 0xab,
0xf2, 0x2a, 0x68, 0xa2, 0xfd, 0x3a, 0xce, 0xcc,
0xb5, 0x70, 0x0e, 0x56, 0x08, 0x0c, 0x76, 0x12,
0xbf, 0x72, 0x13, 0x47, 0x9c, 0xb7, 0x5d, 0x87,
0x15, 0xa1, 0x96, 0x29, 0x10, 0x7b, 0x9a, 0xc7,
0xf3, 0x91, 0x78, 0x6f, 0x9d, 0x9e, 0xb2, 0xb1,
0x32, 0x75, 0x19, 0x3d, 0xff, 0x35, 0x8a, 0x7e,
0x6d, 0x54, 0xc6, 0x80, 0xc3, 0xbd, 0x0d, 0x57,
0xdf, 0xf5, 0x24, 0xa9, 0x3e, 0xa8, 0x43, 0xc9,
0xd7, 0x79, 0xd6, 0xf6, 0x7c, 0x22, 0xb9, 0x03,
0xe0, 0x0f, 0xec, 0xde, 0x7a, 0x94, 0xb0, 0xbc,
0xdc, 0xe8, 0x28, 0x50, 0x4e, 0x33, 0x0a, 0x4a,
0xa7, 0x97, 0x60, 0x73, 0x1e, 0x00, 0x62, 0x44,
0x1a, 0xb8, 0x38, 0x82, 0x64, 0x9f, 0x26, 0x41,
0xad, 0x45, 0x46, 0x92, 0x27, 0x5e, 0x55, 0x2f,
0x8c, 0xa3, 0xa5, 0x7d, 0x69, 0xd5, 0x95, 0x3b,
0x07, 0x58, 0xb3, 0x40, 0x86, 0xac, 0x1d, 0xf7,
0x30, 0x37, 0x6b, 0xe4, 0x88, 0xd9, 0xe7, 0x89,
0xe1, 0x1b, 0x83, 0x49, 0x4c, 0x3f, 0xf8, 0xfe,
0x8d, 0x53, 0xaa, 0x90, 0xca, 0xd8, 0x85, 0x61,
0x20, 0x71, 0x67, 0xa4, 0x2d, 0x2b, 0x09, 0x5b,
0xcb, 0x9b, 0x25, 0xd0, 0xbe, 0xe5, 0x6c, 0x52,
0x59, 0xa6, 0x74, 0xd2, 0xe6, 0xf4, 0xb4, 0xc0,
0xd1, 0x66, 0xaf, 0xc2, 0x39, 0x4b, 0x63, 0xb6
};
CONSTANT_AS u32a k_sbox_inv[256] =
{
0xa5, 0x2d, 0x32, 0x8f, 0x0e, 0x30, 0x38, 0xc0,
0x54, 0xe6, 0x9e, 0x39, 0x55, 0x7e, 0x52, 0x91,
0x64, 0x03, 0x57, 0x5a, 0x1c, 0x60, 0x07, 0x18,
0x21, 0x72, 0xa8, 0xd1, 0x29, 0xc6, 0xa4, 0x3f,
0xe0, 0x27, 0x8d, 0x0c, 0x82, 0xea, 0xae, 0xb4,
0x9a, 0x63, 0x49, 0xe5, 0x42, 0xe4, 0x15, 0xb7,
0xc8, 0x06, 0x70, 0x9d, 0x41, 0x75, 0x19, 0xc9,
0xaa, 0xfc, 0x4d, 0xbf, 0x2a, 0x73, 0x84, 0xd5,
0xc3, 0xaf, 0x2b, 0x86, 0xa7, 0xb1, 0xb2, 0x5b,
0x46, 0xd3, 0x9f, 0xfd, 0xd4, 0x0f, 0x9c, 0x2f,
0x9b, 0x43, 0xef, 0xd9, 0x79, 0xb6, 0x53, 0x7f,
0xc1, 0xf0, 0x23, 0xe7, 0x25, 0x5e, 0xb5, 0x1e,
0xa2, 0xdf, 0xa6, 0xfe, 0xac, 0x22, 0xf9, 0xe2,
0x4a, 0xbc, 0x35, 0xca, 0xee, 0x78, 0x05, 0x6b,
0x51, 0xe1, 0x59, 0xa3, 0xf2, 0x71, 0x56, 0x11,
0x6a, 0x89, 0x94, 0x65, 0x8c, 0xbb, 0x77, 0x3c,
0x7b, 0x28, 0xab, 0xd2, 0x31, 0xde, 0xc4, 0x5f,
0xcc, 0xcf, 0x76, 0x2c, 0xb8, 0xd8, 0x2e, 0x36,
0xdb, 0x69, 0xb3, 0x14, 0x95, 0xbe, 0x62, 0xa1,
0x3b, 0x16, 0x66, 0xe9, 0x5c, 0x6c, 0x6d, 0xad,
0x37, 0x61, 0x4b, 0xb9, 0xe3, 0xba, 0xf1, 0xa0,
0x85, 0x83, 0xda, 0x47, 0xc5, 0xb0, 0x33, 0xfa,
0x96, 0x6f, 0x6e, 0xc2, 0xf6, 0x50, 0xff, 0x5d,
0xa9, 0x8e, 0x17, 0x1b, 0x97, 0x7d, 0xec, 0x58,
0xf7, 0x1f, 0xfb, 0x7c, 0x09, 0x0d, 0x7a, 0x67,
0x45, 0x87, 0xdc, 0xe8, 0x4f, 0x1d, 0x4e, 0x04,
0xeb, 0xf8, 0xf3, 0x3e, 0x3d, 0xbd, 0x8a, 0x88,
0xdd, 0xcd, 0x0b, 0x13, 0x98, 0x02, 0x93, 0x80,
0x90, 0xd0, 0x24, 0x34, 0xcb, 0xed, 0xf4, 0xce,
0x99, 0x10, 0x44, 0x40, 0x92, 0x3a, 0x01, 0x26,
0x12, 0x1a, 0x48, 0x68, 0xf5, 0x81, 0x8b, 0xc7,
0xd6, 0x20, 0x0a, 0x08, 0x00, 0x4c, 0xd7, 0x74
};
#define extract_byte(x,n) (((x) >> (8 * (n))) & 0xff) #define extract_byte(x,n) (((x) >> (8 * (n))) & 0xff)
#define k_lookup(w,sbox) \ #define k_lookup(w,sbox) \

View File

@ -6,78 +6,6 @@
#ifndef _INC_CIPHER_KUZNYECHIK_H #ifndef _INC_CIPHER_KUZNYECHIK_H
#define _INC_CIPHER_KUZNYECHIK_H #define _INC_CIPHER_KUZNYECHIK_H
CONSTANT_AS const u32a k_sbox[256] =
{
0xfc, 0xee, 0xdd, 0x11, 0xcf, 0x6e, 0x31, 0x16,
0xfb, 0xc4, 0xfa, 0xda, 0x23, 0xc5, 0x04, 0x4d,
0xe9, 0x77, 0xf0, 0xdb, 0x93, 0x2e, 0x99, 0xba,
0x17, 0x36, 0xf1, 0xbb, 0x14, 0xcd, 0x5f, 0xc1,
0xf9, 0x18, 0x65, 0x5a, 0xe2, 0x5c, 0xef, 0x21,
0x81, 0x1c, 0x3c, 0x42, 0x8b, 0x01, 0x8e, 0x4f,
0x05, 0x84, 0x02, 0xae, 0xe3, 0x6a, 0x8f, 0xa0,
0x06, 0x0b, 0xed, 0x98, 0x7f, 0xd4, 0xd3, 0x1f,
0xeb, 0x34, 0x2c, 0x51, 0xea, 0xc8, 0x48, 0xab,
0xf2, 0x2a, 0x68, 0xa2, 0xfd, 0x3a, 0xce, 0xcc,
0xb5, 0x70, 0x0e, 0x56, 0x08, 0x0c, 0x76, 0x12,
0xbf, 0x72, 0x13, 0x47, 0x9c, 0xb7, 0x5d, 0x87,
0x15, 0xa1, 0x96, 0x29, 0x10, 0x7b, 0x9a, 0xc7,
0xf3, 0x91, 0x78, 0x6f, 0x9d, 0x9e, 0xb2, 0xb1,
0x32, 0x75, 0x19, 0x3d, 0xff, 0x35, 0x8a, 0x7e,
0x6d, 0x54, 0xc6, 0x80, 0xc3, 0xbd, 0x0d, 0x57,
0xdf, 0xf5, 0x24, 0xa9, 0x3e, 0xa8, 0x43, 0xc9,
0xd7, 0x79, 0xd6, 0xf6, 0x7c, 0x22, 0xb9, 0x03,
0xe0, 0x0f, 0xec, 0xde, 0x7a, 0x94, 0xb0, 0xbc,
0xdc, 0xe8, 0x28, 0x50, 0x4e, 0x33, 0x0a, 0x4a,
0xa7, 0x97, 0x60, 0x73, 0x1e, 0x00, 0x62, 0x44,
0x1a, 0xb8, 0x38, 0x82, 0x64, 0x9f, 0x26, 0x41,
0xad, 0x45, 0x46, 0x92, 0x27, 0x5e, 0x55, 0x2f,
0x8c, 0xa3, 0xa5, 0x7d, 0x69, 0xd5, 0x95, 0x3b,
0x07, 0x58, 0xb3, 0x40, 0x86, 0xac, 0x1d, 0xf7,
0x30, 0x37, 0x6b, 0xe4, 0x88, 0xd9, 0xe7, 0x89,
0xe1, 0x1b, 0x83, 0x49, 0x4c, 0x3f, 0xf8, 0xfe,
0x8d, 0x53, 0xaa, 0x90, 0xca, 0xd8, 0x85, 0x61,
0x20, 0x71, 0x67, 0xa4, 0x2d, 0x2b, 0x09, 0x5b,
0xcb, 0x9b, 0x25, 0xd0, 0xbe, 0xe5, 0x6c, 0x52,
0x59, 0xa6, 0x74, 0xd2, 0xe6, 0xf4, 0xb4, 0xc0,
0xd1, 0x66, 0xaf, 0xc2, 0x39, 0x4b, 0x63, 0xb6
};
CONSTANT_AS const u32a k_sbox_inv[256] =
{
0xa5, 0x2d, 0x32, 0x8f, 0x0e, 0x30, 0x38, 0xc0,
0x54, 0xe6, 0x9e, 0x39, 0x55, 0x7e, 0x52, 0x91,
0x64, 0x03, 0x57, 0x5a, 0x1c, 0x60, 0x07, 0x18,
0x21, 0x72, 0xa8, 0xd1, 0x29, 0xc6, 0xa4, 0x3f,
0xe0, 0x27, 0x8d, 0x0c, 0x82, 0xea, 0xae, 0xb4,
0x9a, 0x63, 0x49, 0xe5, 0x42, 0xe4, 0x15, 0xb7,
0xc8, 0x06, 0x70, 0x9d, 0x41, 0x75, 0x19, 0xc9,
0xaa, 0xfc, 0x4d, 0xbf, 0x2a, 0x73, 0x84, 0xd5,
0xc3, 0xaf, 0x2b, 0x86, 0xa7, 0xb1, 0xb2, 0x5b,
0x46, 0xd3, 0x9f, 0xfd, 0xd4, 0x0f, 0x9c, 0x2f,
0x9b, 0x43, 0xef, 0xd9, 0x79, 0xb6, 0x53, 0x7f,
0xc1, 0xf0, 0x23, 0xe7, 0x25, 0x5e, 0xb5, 0x1e,
0xa2, 0xdf, 0xa6, 0xfe, 0xac, 0x22, 0xf9, 0xe2,
0x4a, 0xbc, 0x35, 0xca, 0xee, 0x78, 0x05, 0x6b,
0x51, 0xe1, 0x59, 0xa3, 0xf2, 0x71, 0x56, 0x11,
0x6a, 0x89, 0x94, 0x65, 0x8c, 0xbb, 0x77, 0x3c,
0x7b, 0x28, 0xab, 0xd2, 0x31, 0xde, 0xc4, 0x5f,
0xcc, 0xcf, 0x76, 0x2c, 0xb8, 0xd8, 0x2e, 0x36,
0xdb, 0x69, 0xb3, 0x14, 0x95, 0xbe, 0x62, 0xa1,
0x3b, 0x16, 0x66, 0xe9, 0x5c, 0x6c, 0x6d, 0xad,
0x37, 0x61, 0x4b, 0xb9, 0xe3, 0xba, 0xf1, 0xa0,
0x85, 0x83, 0xda, 0x47, 0xc5, 0xb0, 0x33, 0xfa,
0x96, 0x6f, 0x6e, 0xc2, 0xf6, 0x50, 0xff, 0x5d,
0xa9, 0x8e, 0x17, 0x1b, 0x97, 0x7d, 0xec, 0x58,
0xf7, 0x1f, 0xfb, 0x7c, 0x09, 0x0d, 0x7a, 0x67,
0x45, 0x87, 0xdc, 0xe8, 0x4f, 0x1d, 0x4e, 0x04,
0xeb, 0xf8, 0xf3, 0x3e, 0x3d, 0xbd, 0x8a, 0x88,
0xdd, 0xcd, 0x0b, 0x13, 0x98, 0x02, 0x93, 0x80,
0x90, 0xd0, 0x24, 0x34, 0xcb, 0xed, 0xf4, 0xce,
0x99, 0x10, 0x44, 0x40, 0x92, 0x3a, 0x01, 0x26,
0x12, 0x1a, 0x48, 0x68, 0xf5, 0x81, 0x8b, 0xc7,
0xd6, 0x20, 0x0a, 0x08, 0x00, 0x4c, 0xd7, 0x74
};
DECLSPEC void kuznyechik_linear (u32 *w); DECLSPEC void kuznyechik_linear (u32 *w);
DECLSPEC void kuznyechik_linear_inv (u32 *w); DECLSPEC void kuznyechik_linear_inv (u32 *w);
DECLSPEC void kuznyechik_set_key (u32 *ks, const u32 *ukey); DECLSPEC void kuznyechik_set_key (u32 *ks, const u32 *ukey);

View File

@ -24,64 +24,293 @@
#include "inc_common.h" #include "inc_common.h"
#include "inc_cipher_twofish.h" #include "inc_cipher_twofish.h"
#define extract_byte(x,n) (((x) >> (8 * (n))) & 0xff) CONSTANT_AS u32a q_tab[2][256] =
{
{
0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76, 0x9A, 0x92, 0x80, 0x78,
0xE4, 0xDD, 0xD1, 0x38, 0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C,
0x43, 0x75, 0x37, 0x26, 0xFA, 0x13, 0x94, 0x48, 0xF2, 0xD0, 0x8B, 0x30,
0x84, 0x54, 0xDF, 0x23, 0x19, 0x5B, 0x3D, 0x59, 0xF3, 0xAE, 0xA2, 0x82,
0x63, 0x01, 0x83, 0x2E, 0xD9, 0x51, 0x9B, 0x7C, 0xA6, 0xEB, 0xA5, 0xBE,
0x16, 0x0C, 0xE3, 0x61, 0xC0, 0x8C, 0x3A, 0xF5, 0x73, 0x2C, 0x25, 0x0B,
0xBB, 0x4E, 0x89, 0x6B, 0x53, 0x6A, 0xB4, 0xF1, 0xE1, 0xE6, 0xBD, 0x45,
0xE2, 0xF4, 0xB6, 0x66, 0xCC, 0x95, 0x03, 0x56, 0xD4, 0x1C, 0x1E, 0xD7,
0xFB, 0xC3, 0x8E, 0xB5, 0xE9, 0xCF, 0xBF, 0xBA, 0xEA, 0x77, 0x39, 0xAF,
0x33, 0xC9, 0x62, 0x71, 0x81, 0x79, 0x09, 0xAD, 0x24, 0xCD, 0xF9, 0xD8,
0xE5, 0xC5, 0xB9, 0x4D, 0x44, 0x08, 0x86, 0xE7, 0xA1, 0x1D, 0xAA, 0xED,
0x06, 0x70, 0xB2, 0xD2, 0x41, 0x7B, 0xA0, 0x11, 0x31, 0xC2, 0x27, 0x90,
0x20, 0xF6, 0x60, 0xFF, 0x96, 0x5C, 0xB1, 0xAB, 0x9E, 0x9C, 0x52, 0x1B,
0x5F, 0x93, 0x0A, 0xEF, 0x91, 0x85, 0x49, 0xEE, 0x2D, 0x4F, 0x8F, 0x3B,
0x47, 0x87, 0x6D, 0x46, 0xD6, 0x3E, 0x69, 0x64, 0x2A, 0xCE, 0xCB, 0x2F,
0xFC, 0x97, 0x05, 0x7A, 0xAC, 0x7F, 0xD5, 0x1A, 0x4B, 0x0E, 0xA7, 0x5A,
0x28, 0x14, 0x3F, 0x29, 0x88, 0x3C, 0x4C, 0x02, 0xB8, 0xDA, 0xB0, 0x17,
0x55, 0x1F, 0x8A, 0x7D, 0x57, 0xC7, 0x8D, 0x74, 0xB7, 0xC4, 0x9F, 0x72,
0x7E, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, 0x6E, 0x50, 0xDE, 0x68,
0x65, 0xBC, 0xDB, 0xF8, 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4,
0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, 0x6F, 0x9D, 0x36, 0x42,
0x4A, 0x5E, 0xC1, 0xE0
},
{
0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8, 0x4A, 0xD3, 0xE6, 0x6B,
0x45, 0x7D, 0xE8, 0x4B, 0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1,
0x30, 0x0F, 0xF8, 0x1B, 0x87, 0xFA, 0x06, 0x3F, 0x5E, 0xBA, 0xAE, 0x5B,
0x8A, 0x00, 0xBC, 0x9D, 0x6D, 0xC1, 0xB1, 0x0E, 0x80, 0x5D, 0xD2, 0xD5,
0xA0, 0x84, 0x07, 0x14, 0xB5, 0x90, 0x2C, 0xA3, 0xB2, 0x73, 0x4C, 0x54,
0x92, 0x74, 0x36, 0x51, 0x38, 0xB0, 0xBD, 0x5A, 0xFC, 0x60, 0x62, 0x96,
0x6C, 0x42, 0xF7, 0x10, 0x7C, 0x28, 0x27, 0x8C, 0x13, 0x95, 0x9C, 0xC7,
0x24, 0x46, 0x3B, 0x70, 0xCA, 0xE3, 0x85, 0xCB, 0x11, 0xD0, 0x93, 0xB8,
0xA6, 0x83, 0x20, 0xFF, 0x9F, 0x77, 0xC3, 0xCC, 0x03, 0x6F, 0x08, 0xBF,
0x40, 0xE7, 0x2B, 0xE2, 0x79, 0x0C, 0xAA, 0x82, 0x41, 0x3A, 0xEA, 0xB9,
0xE4, 0x9A, 0xA4, 0x97, 0x7E, 0xDA, 0x7A, 0x17, 0x66, 0x94, 0xA1, 0x1D,
0x3D, 0xF0, 0xDE, 0xB3, 0x0B, 0x72, 0xA7, 0x1C, 0xEF, 0xD1, 0x53, 0x3E,
0x8F, 0x33, 0x26, 0x5F, 0xEC, 0x76, 0x2A, 0x49, 0x81, 0x88, 0xEE, 0x21,
0xC4, 0x1A, 0xEB, 0xD9, 0xC5, 0x39, 0x99, 0xCD, 0xAD, 0x31, 0x8B, 0x01,
0x18, 0x23, 0xDD, 0x1F, 0x4E, 0x2D, 0xF9, 0x48, 0x4F, 0xF2, 0x65, 0x8E,
0x78, 0x5C, 0x58, 0x19, 0x8D, 0xE5, 0x98, 0x57, 0x67, 0x7F, 0x05, 0x64,
0xAF, 0x63, 0xB6, 0xFE, 0xF5, 0xB7, 0x3C, 0xA5, 0xCE, 0xE9, 0x68, 0x44,
0xE0, 0x4D, 0x43, 0x69, 0x29, 0x2E, 0xAC, 0x15, 0x59, 0xA8, 0x0A, 0x9E,
0x6E, 0x47, 0xDF, 0x34, 0x35, 0x6A, 0xCF, 0xDC, 0x22, 0xC9, 0xC0, 0x9B,
0x89, 0xD4, 0xED, 0xAB, 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9,
0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, 0x16, 0x25, 0x86, 0x56,
0x55, 0x09, 0xBE, 0x91
}
};
#define g1_fun128(x) \ CONSTANT_AS u32a m_tab[4][256] =
(mds (0, q20 (extract_byte (x, 3), sk)) ^ \ {
mds (1, q21 (extract_byte (x, 0), sk)) ^ \ { 0xBCBC3275, 0xECEC21F3, 0x202043C6, 0xB3B3C9F4, 0xDADA03DB, 0x02028B7B,
mds (2, q22 (extract_byte (x, 1), sk)) ^ \ 0xE2E22BFB, 0x9E9EFAC8, 0xC9C9EC4A, 0xD4D409D3, 0x18186BE6, 0x1E1E9F6B,
mds (3, q23 (extract_byte (x, 2), sk))) 0x98980E45, 0xB2B2387D, 0xA6A6D2E8, 0x2626B74B, 0x3C3C57D6, 0x93938A32,
0x8282EED8, 0x525298FD, 0x7B7BD437, 0xBBBB3771, 0x5B5B97F1, 0x474783E1,
0x24243C30, 0x5151E20F, 0xBABAC6F8, 0x4A4AF31B, 0xBFBF4887, 0x0D0D70FA,
0xB0B0B306, 0x7575DE3F, 0xD2D2FD5E, 0x7D7D20BA, 0x666631AE, 0x3A3AA35B,
0x59591C8A, 0x00000000, 0xCDCD93BC, 0x1A1AE09D, 0xAEAE2C6D, 0x7F7FABC1,
0x2B2BC7B1, 0xBEBEB90E, 0xE0E0A080, 0x8A8A105D, 0x3B3B52D2, 0x6464BAD5,
0xD8D888A0, 0xE7E7A584, 0x5F5FE807, 0x1B1B1114, 0x2C2CC2B5, 0xFCFCB490,
0x3131272C, 0x808065A3, 0x73732AB2, 0x0C0C8173, 0x79795F4C, 0x6B6B4154,
0x4B4B0292, 0x53536974, 0x94948F36, 0x83831F51, 0x2A2A3638, 0xC4C49CB0,
0x2222C8BD, 0xD5D5F85A, 0xBDBDC3FC, 0x48487860, 0xFFFFCE62, 0x4C4C0796,
0x4141776C, 0xC7C7E642, 0xEBEB24F7, 0x1C1C1410, 0x5D5D637C, 0x36362228,
0x6767C027, 0xE9E9AF8C, 0x4444F913, 0x1414EA95, 0xF5F5BB9C, 0xCFCF18C7,
0x3F3F2D24, 0xC0C0E346, 0x7272DB3B, 0x54546C70, 0x29294CCA, 0xF0F035E3,
0x0808FE85, 0xC6C617CB, 0xF3F34F11, 0x8C8CE4D0, 0xA4A45993, 0xCACA96B8,
0x68683BA6, 0xB8B84D83, 0x38382820, 0xE5E52EFF, 0xADAD569F, 0x0B0B8477,
0xC8C81DC3, 0x9999FFCC, 0x5858ED03, 0x19199A6F, 0x0E0E0A08, 0x95957EBF,
0x70705040, 0xF7F730E7, 0x6E6ECF2B, 0x1F1F6EE2, 0xB5B53D79, 0x09090F0C,
0x616134AA, 0x57571682, 0x9F9F0B41, 0x9D9D803A, 0x111164EA, 0x2525CDB9,
0xAFAFDDE4, 0x4545089A, 0xDFDF8DA4, 0xA3A35C97, 0xEAEAD57E, 0x353558DA,
0xEDEDD07A, 0x4343FC17, 0xF8F8CB66, 0xFBFBB194, 0x3737D3A1, 0xFAFA401D,
0xC2C2683D, 0xB4B4CCF0, 0x32325DDE, 0x9C9C71B3, 0x5656E70B, 0xE3E3DA72,
0x878760A7, 0x15151B1C, 0xF9F93AEF, 0x6363BFD1, 0x3434A953, 0x9A9A853E,
0xB1B1428F, 0x7C7CD133, 0x88889B26, 0x3D3DA65F, 0xA1A1D7EC, 0xE4E4DF76,
0x8181942A, 0x91910149, 0x0F0FFB81, 0xEEEEAA88, 0x161661EE, 0xD7D77321,
0x9797F5C4, 0xA5A5A81A, 0xFEFE3FEB, 0x6D6DB5D9, 0x7878AEC5, 0xC5C56D39,
0x1D1DE599, 0x7676A4CD, 0x3E3EDCAD, 0xCBCB6731, 0xB6B6478B, 0xEFEF5B01,
0x12121E18, 0x6060C523, 0x6A6AB0DD, 0x4D4DF61F, 0xCECEE94E, 0xDEDE7C2D,
0x55559DF9, 0x7E7E5A48, 0x2121B24F, 0x03037AF2, 0xA0A02665, 0x5E5E198E,
0x5A5A6678, 0x65654B5C, 0x62624E58, 0xFDFD4519, 0x0606F48D, 0x404086E5,
0xF2F2BE98, 0x3333AC57, 0x17179067, 0x05058E7F, 0xE8E85E05, 0x4F4F7D64,
0x89896AAF, 0x10109563, 0x74742FB6, 0x0A0A75FE, 0x5C5C92F5, 0x9B9B74B7,
0x2D2D333C, 0x3030D6A5, 0x2E2E49CE, 0x494989E9, 0x46467268, 0x77775544,
0xA8A8D8E0, 0x9696044D, 0x2828BD43, 0xA9A92969, 0xD9D97929, 0x8686912E,
0xD1D187AC, 0xF4F44A15, 0x8D8D1559, 0xD6D682A8, 0xB9B9BC0A, 0x42420D9E,
0xF6F6C16E, 0x2F2FB847, 0xDDDD06DF, 0x23233934, 0xCCCC6235, 0xF1F1C46A,
0xC1C112CF, 0x8585EBDC, 0x8F8F9E22, 0x7171A1C9, 0x9090F0C0, 0xAAAA539B,
0x0101F189, 0x8B8BE1D4, 0x4E4E8CED, 0x8E8E6FAB, 0xABABA212, 0x6F6F3EA2,
0xE6E6540D, 0xDBDBF252, 0x92927BBB, 0xB7B7B602, 0x6969CA2F, 0x3939D9A9,
0xD3D30CD7, 0xA7A72361, 0xA2A2AD1E, 0xC3C399B4, 0x6C6C4450, 0x07070504,
0x04047FF6, 0x272746C2, 0xACACA716, 0xD0D07625, 0x50501386, 0xDCDCF756,
0x84841A55, 0xE1E15109, 0x7A7A25BE, 0x1313EF91 },
#define g0_fun128(x) \ { 0xA9D93939, 0x67901717, 0xB3719C9C, 0xE8D2A6A6, 0x04050707, 0xFD985252,
(mds (0, q20 (extract_byte (x, 0), sk)) ^ \ 0xA3658080, 0x76DFE4E4, 0x9A084545, 0x92024B4B, 0x80A0E0E0, 0x78665A5A,
mds (1, q21 (extract_byte (x, 1), sk)) ^ \ 0xE4DDAFAF, 0xDDB06A6A, 0xD1BF6363, 0x38362A2A, 0x0D54E6E6, 0xC6432020,
mds (2, q22 (extract_byte (x, 2), sk)) ^ \ 0x3562CCCC, 0x98BEF2F2, 0x181E1212, 0xF724EBEB, 0xECD7A1A1, 0x6C774141,
mds (3, q23 (extract_byte (x, 3), sk))) 0x43BD2828, 0x7532BCBC, 0x37D47B7B, 0x269B8888, 0xFA700D0D, 0x13F94444,
0x94B1FBFB, 0x485A7E7E, 0xF27A0303, 0xD0E48C8C, 0x8B47B6B6, 0x303C2424,
0x84A5E7E7, 0x54416B6B, 0xDF06DDDD, 0x23C56060, 0x1945FDFD, 0x5BA33A3A,
0x3D68C2C2, 0x59158D8D, 0xF321ECEC, 0xAE316666, 0xA23E6F6F, 0x82165757,
0x63951010, 0x015BEFEF, 0x834DB8B8, 0x2E918686, 0xD9B56D6D, 0x511F8383,
0x9B53AAAA, 0x7C635D5D, 0xA63B6868, 0xEB3FFEFE, 0xA5D63030, 0xBE257A7A,
0x16A7ACAC, 0x0C0F0909, 0xE335F0F0, 0x6123A7A7, 0xC0F09090, 0x8CAFE9E9,
0x3A809D9D, 0xF5925C5C, 0x73810C0C, 0x2C273131, 0x2576D0D0, 0x0BE75656,
0xBB7B9292, 0x4EE9CECE, 0x89F10101, 0x6B9F1E1E, 0x53A93434, 0x6AC4F1F1,
0xB499C3C3, 0xF1975B5B, 0xE1834747, 0xE66B1818, 0xBDC82222, 0x450E9898,
0xE26E1F1F, 0xF4C9B3B3, 0xB62F7474, 0x66CBF8F8, 0xCCFF9999, 0x95EA1414,
0x03ED5858, 0x56F7DCDC, 0xD4E18B8B, 0x1C1B1515, 0x1EADA2A2, 0xD70CD3D3,
0xFB2BE2E2, 0xC31DC8C8, 0x8E195E5E, 0xB5C22C2C, 0xE9894949, 0xCF12C1C1,
0xBF7E9595, 0xBA207D7D, 0xEA641111, 0x77840B0B, 0x396DC5C5, 0xAF6A8989,
0x33D17C7C, 0xC9A17171, 0x62CEFFFF, 0x7137BBBB, 0x81FB0F0F, 0x793DB5B5,
0x0951E1E1, 0xADDC3E3E, 0x242D3F3F, 0xCDA47676, 0xF99D5555, 0xD8EE8282,
0xE5864040, 0xC5AE7878, 0xB9CD2525, 0x4D049696, 0x44557777, 0x080A0E0E,
0x86135050, 0xE730F7F7, 0xA1D33737, 0x1D40FAFA, 0xAA346161, 0xED8C4E4E,
0x06B3B0B0, 0x706C5454, 0xB22A7373, 0xD2523B3B, 0x410B9F9F, 0x7B8B0202,
0xA088D8D8, 0x114FF3F3, 0x3167CBCB, 0xC2462727, 0x27C06767, 0x90B4FCFC,
0x20283838, 0xF67F0404, 0x60784848, 0xFF2EE5E5, 0x96074C4C, 0x5C4B6565,
0xB1C72B2B, 0xAB6F8E8E, 0x9E0D4242, 0x9CBBF5F5, 0x52F2DBDB, 0x1BF34A4A,
0x5FA63D3D, 0x9359A4A4, 0x0ABCB9B9, 0xEF3AF9F9, 0x91EF1313, 0x85FE0808,
0x49019191, 0xEE611616, 0x2D7CDEDE, 0x4FB22121, 0x8F42B1B1, 0x3BDB7272,
0x47B82F2F, 0x8748BFBF, 0x6D2CAEAE, 0x46E3C0C0, 0xD6573C3C, 0x3E859A9A,
0x6929A9A9, 0x647D4F4F, 0x2A948181, 0xCE492E2E, 0xCB17C6C6, 0x2FCA6969,
0xFCC3BDBD, 0x975CA3A3, 0x055EE8E8, 0x7AD0EDED, 0xAC87D1D1, 0x7F8E0505,
0xD5BA6464, 0x1AA8A5A5, 0x4BB72626, 0x0EB9BEBE, 0xA7608787, 0x5AF8D5D5,
0x28223636, 0x14111B1B, 0x3FDE7575, 0x2979D9D9, 0x88AAEEEE, 0x3C332D2D,
0x4C5F7979, 0x02B6B7B7, 0xB896CACA, 0xDA583535, 0xB09CC4C4, 0x17FC4343,
0x551A8484, 0x1FF64D4D, 0x8A1C5959, 0x7D38B2B2, 0x57AC3333, 0xC718CFCF,
0x8DF40606, 0x74695353, 0xB7749B9B, 0xC4F59797, 0x9F56ADAD, 0x72DAE3E3,
0x7ED5EAEA, 0x154AF4F4, 0x229E8F8F, 0x12A2ABAB, 0x584E6262, 0x07E85F5F,
0x99E51D1D, 0x34392323, 0x6EC1F6F6, 0x50446C6C, 0xDE5D3232, 0x68724646,
0x6526A0A0, 0xBC93CDCD, 0xDB03DADA, 0xF8C6BABA, 0xC8FA9E9E, 0xA882D6D6,
0x2BCF6E6E, 0x40507070, 0xDCEB8585, 0xFE750A0A, 0x328A9393, 0xA48DDFDF,
0xCA4C2929, 0x10141C1C, 0x2173D7D7, 0xF0CCB4B4, 0xD309D4D4, 0x5D108A8A,
0x0FE25151, 0x00000000, 0x6F9A1919, 0x9DE01A1A, 0x368F9494, 0x42E6C7C7,
0x4AECC9C9, 0x5EFDD2D2, 0xC1AB7F7F, 0xE0D8A8A8 },
#define f_rnd128(i) \ { 0xBC75BC32, 0xECF3EC21, 0x20C62043, 0xB3F4B3C9, 0xDADBDA03, 0x027B028B,
{ \ 0xE2FBE22B, 0x9EC89EFA, 0xC94AC9EC, 0xD4D3D409, 0x18E6186B, 0x1E6B1E9F,
u32 t0 = g0_fun128 (data[0]); \ 0x9845980E, 0xB27DB238, 0xA6E8A6D2, 0x264B26B7, 0x3CD63C57, 0x9332938A,
u32 t1 = g1_fun128 (data[1]); \ 0x82D882EE, 0x52FD5298, 0x7B377BD4, 0xBB71BB37, 0x5BF15B97, 0x47E14783,
0x2430243C, 0x510F51E2, 0xBAF8BAC6, 0x4A1B4AF3, 0xBF87BF48, 0x0DFA0D70,
0xB006B0B3, 0x753F75DE, 0xD25ED2FD, 0x7DBA7D20, 0x66AE6631, 0x3A5B3AA3,
0x598A591C, 0x00000000, 0xCDBCCD93, 0x1A9D1AE0, 0xAE6DAE2C, 0x7FC17FAB,
0x2BB12BC7, 0xBE0EBEB9, 0xE080E0A0, 0x8A5D8A10, 0x3BD23B52, 0x64D564BA,
0xD8A0D888, 0xE784E7A5, 0x5F075FE8, 0x1B141B11, 0x2CB52CC2, 0xFC90FCB4,
0x312C3127, 0x80A38065, 0x73B2732A, 0x0C730C81, 0x794C795F, 0x6B546B41,
0x4B924B02, 0x53745369, 0x9436948F, 0x8351831F, 0x2A382A36, 0xC4B0C49C,
0x22BD22C8, 0xD55AD5F8, 0xBDFCBDC3, 0x48604878, 0xFF62FFCE, 0x4C964C07,
0x416C4177, 0xC742C7E6, 0xEBF7EB24, 0x1C101C14, 0x5D7C5D63, 0x36283622,
0x672767C0, 0xE98CE9AF, 0x441344F9, 0x149514EA, 0xF59CF5BB, 0xCFC7CF18,
0x3F243F2D, 0xC046C0E3, 0x723B72DB, 0x5470546C, 0x29CA294C, 0xF0E3F035,
0x088508FE, 0xC6CBC617, 0xF311F34F, 0x8CD08CE4, 0xA493A459, 0xCAB8CA96,
0x68A6683B, 0xB883B84D, 0x38203828, 0xE5FFE52E, 0xAD9FAD56, 0x0B770B84,
0xC8C3C81D, 0x99CC99FF, 0x580358ED, 0x196F199A, 0x0E080E0A, 0x95BF957E,
0x70407050, 0xF7E7F730, 0x6E2B6ECF, 0x1FE21F6E, 0xB579B53D, 0x090C090F,
0x61AA6134, 0x57825716, 0x9F419F0B, 0x9D3A9D80, 0x11EA1164, 0x25B925CD,
0xAFE4AFDD, 0x459A4508, 0xDFA4DF8D, 0xA397A35C, 0xEA7EEAD5, 0x35DA3558,
0xED7AEDD0, 0x431743FC, 0xF866F8CB, 0xFB94FBB1, 0x37A137D3, 0xFA1DFA40,
0xC23DC268, 0xB4F0B4CC, 0x32DE325D, 0x9CB39C71, 0x560B56E7, 0xE372E3DA,
0x87A78760, 0x151C151B, 0xF9EFF93A, 0x63D163BF, 0x345334A9, 0x9A3E9A85,
0xB18FB142, 0x7C337CD1, 0x8826889B, 0x3D5F3DA6, 0xA1ECA1D7, 0xE476E4DF,
0x812A8194, 0x91499101, 0x0F810FFB, 0xEE88EEAA, 0x16EE1661, 0xD721D773,
0x97C497F5, 0xA51AA5A8, 0xFEEBFE3F, 0x6DD96DB5, 0x78C578AE, 0xC539C56D,
0x1D991DE5, 0x76CD76A4, 0x3EAD3EDC, 0xCB31CB67, 0xB68BB647, 0xEF01EF5B,
0x1218121E, 0x602360C5, 0x6ADD6AB0, 0x4D1F4DF6, 0xCE4ECEE9, 0xDE2DDE7C,
0x55F9559D, 0x7E487E5A, 0x214F21B2, 0x03F2037A, 0xA065A026, 0x5E8E5E19,
0x5A785A66, 0x655C654B, 0x6258624E, 0xFD19FD45, 0x068D06F4, 0x40E54086,
0xF298F2BE, 0x335733AC, 0x17671790, 0x057F058E, 0xE805E85E, 0x4F644F7D,
0x89AF896A, 0x10631095, 0x74B6742F, 0x0AFE0A75, 0x5CF55C92, 0x9BB79B74,
0x2D3C2D33, 0x30A530D6, 0x2ECE2E49, 0x49E94989, 0x46684672, 0x77447755,
0xA8E0A8D8, 0x964D9604, 0x284328BD, 0xA969A929, 0xD929D979, 0x862E8691,
0xD1ACD187, 0xF415F44A, 0x8D598D15, 0xD6A8D682, 0xB90AB9BC, 0x429E420D,
0xF66EF6C1, 0x2F472FB8, 0xDDDFDD06, 0x23342339, 0xCC35CC62, 0xF16AF1C4,
0xC1CFC112, 0x85DC85EB, 0x8F228F9E, 0x71C971A1, 0x90C090F0, 0xAA9BAA53,
0x018901F1, 0x8BD48BE1, 0x4EED4E8C, 0x8EAB8E6F, 0xAB12ABA2, 0x6FA26F3E,
0xE60DE654, 0xDB52DBF2, 0x92BB927B, 0xB702B7B6, 0x692F69CA, 0x39A939D9,
0xD3D7D30C, 0xA761A723, 0xA21EA2AD, 0xC3B4C399, 0x6C506C44, 0x07040705,
0x04F6047F, 0x27C22746, 0xAC16ACA7, 0xD025D076, 0x50865013, 0xDC56DCF7,
0x8455841A, 0xE109E151, 0x7ABE7A25, 0x139113EF },
{ 0xD939A9D9, 0x90176790, 0x719CB371, 0xD2A6E8D2, 0x05070405, 0x9852FD98,
0x6580A365, 0xDFE476DF, 0x08459A08, 0x024B9202, 0xA0E080A0, 0x665A7866,
0xDDAFE4DD, 0xB06ADDB0, 0xBF63D1BF, 0x362A3836, 0x54E60D54, 0x4320C643,
0x62CC3562, 0xBEF298BE, 0x1E12181E, 0x24EBF724, 0xD7A1ECD7, 0x77416C77,
0xBD2843BD, 0x32BC7532, 0xD47B37D4, 0x9B88269B, 0x700DFA70, 0xF94413F9,
0xB1FB94B1, 0x5A7E485A, 0x7A03F27A, 0xE48CD0E4, 0x47B68B47, 0x3C24303C,
0xA5E784A5, 0x416B5441, 0x06DDDF06, 0xC56023C5, 0x45FD1945, 0xA33A5BA3,
0x68C23D68, 0x158D5915, 0x21ECF321, 0x3166AE31, 0x3E6FA23E, 0x16578216,
0x95106395, 0x5BEF015B, 0x4DB8834D, 0x91862E91, 0xB56DD9B5, 0x1F83511F,
0x53AA9B53, 0x635D7C63, 0x3B68A63B, 0x3FFEEB3F, 0xD630A5D6, 0x257ABE25,
0xA7AC16A7, 0x0F090C0F, 0x35F0E335, 0x23A76123, 0xF090C0F0, 0xAFE98CAF,
0x809D3A80, 0x925CF592, 0x810C7381, 0x27312C27, 0x76D02576, 0xE7560BE7,
0x7B92BB7B, 0xE9CE4EE9, 0xF10189F1, 0x9F1E6B9F, 0xA93453A9, 0xC4F16AC4,
0x99C3B499, 0x975BF197, 0x8347E183, 0x6B18E66B, 0xC822BDC8, 0x0E98450E,
0x6E1FE26E, 0xC9B3F4C9, 0x2F74B62F, 0xCBF866CB, 0xFF99CCFF, 0xEA1495EA,
0xED5803ED, 0xF7DC56F7, 0xE18BD4E1, 0x1B151C1B, 0xADA21EAD, 0x0CD3D70C,
0x2BE2FB2B, 0x1DC8C31D, 0x195E8E19, 0xC22CB5C2, 0x8949E989, 0x12C1CF12,
0x7E95BF7E, 0x207DBA20, 0x6411EA64, 0x840B7784, 0x6DC5396D, 0x6A89AF6A,
0xD17C33D1, 0xA171C9A1, 0xCEFF62CE, 0x37BB7137, 0xFB0F81FB, 0x3DB5793D,
0x51E10951, 0xDC3EADDC, 0x2D3F242D, 0xA476CDA4, 0x9D55F99D, 0xEE82D8EE,
0x8640E586, 0xAE78C5AE, 0xCD25B9CD, 0x04964D04, 0x55774455, 0x0A0E080A,
0x13508613, 0x30F7E730, 0xD337A1D3, 0x40FA1D40, 0x3461AA34, 0x8C4EED8C,
0xB3B006B3, 0x6C54706C, 0x2A73B22A, 0x523BD252, 0x0B9F410B, 0x8B027B8B,
0x88D8A088, 0x4FF3114F, 0x67CB3167, 0x4627C246, 0xC06727C0, 0xB4FC90B4,
0x28382028, 0x7F04F67F, 0x78486078, 0x2EE5FF2E, 0x074C9607, 0x4B655C4B,
0xC72BB1C7, 0x6F8EAB6F, 0x0D429E0D, 0xBBF59CBB, 0xF2DB52F2, 0xF34A1BF3,
0xA63D5FA6, 0x59A49359, 0xBCB90ABC, 0x3AF9EF3A, 0xEF1391EF, 0xFE0885FE,
0x01914901, 0x6116EE61, 0x7CDE2D7C, 0xB2214FB2, 0x42B18F42, 0xDB723BDB,
0xB82F47B8, 0x48BF8748, 0x2CAE6D2C, 0xE3C046E3, 0x573CD657, 0x859A3E85,
0x29A96929, 0x7D4F647D, 0x94812A94, 0x492ECE49, 0x17C6CB17, 0xCA692FCA,
0xC3BDFCC3, 0x5CA3975C, 0x5EE8055E, 0xD0ED7AD0, 0x87D1AC87, 0x8E057F8E,
0xBA64D5BA, 0xA8A51AA8, 0xB7264BB7, 0xB9BE0EB9, 0x6087A760, 0xF8D55AF8,
0x22362822, 0x111B1411, 0xDE753FDE, 0x79D92979, 0xAAEE88AA, 0x332D3C33,
0x5F794C5F, 0xB6B702B6, 0x96CAB896, 0x5835DA58, 0x9CC4B09C, 0xFC4317FC,
0x1A84551A, 0xF64D1FF6, 0x1C598A1C, 0x38B27D38, 0xAC3357AC, 0x18CFC718,
0xF4068DF4, 0x69537469, 0x749BB774, 0xF597C4F5, 0x56AD9F56, 0xDAE372DA,
0xD5EA7ED5, 0x4AF4154A, 0x9E8F229E, 0xA2AB12A2, 0x4E62584E, 0xE85F07E8,
0xE51D99E5, 0x39233439, 0xC1F66EC1, 0x446C5044, 0x5D32DE5D, 0x72466872,
0x26A06526, 0x93CDBC93, 0x03DADB03, 0xC6BAF8C6, 0xFA9EC8FA, 0x82D6A882,
0xCF6E2BCF, 0x50704050, 0xEB85DCEB, 0x750AFE75, 0x8A93328A, 0x8DDFA48D,
0x4C29CA4C, 0x141C1014, 0x73D72173, 0xCCB4F0CC, 0x09D4D309, 0x108A5D10,
0xE2510FE2, 0x00000000, 0x9A196F9A, 0xE01A9DE0, 0x8F94368F, 0xE6C742E6,
0xECC94AEC, 0xFDD25EFD, 0xAB7FC1AB, 0xD8A8E0D8 }
};
#define g1_fun128(x) \
(mds (0, q20 (unpack_v8d_from_v32_S (x), sk)) ^ \
mds (1, q21 (unpack_v8a_from_v32_S (x), sk)) ^ \
mds (2, q22 (unpack_v8b_from_v32_S (x), sk)) ^ \
mds (3, q23 (unpack_v8c_from_v32_S (x), sk)))
#define g0_fun128(x) \
(mds (0, q20 (unpack_v8a_from_v32_S (x), sk)) ^ \
mds (1, q21 (unpack_v8b_from_v32_S (x), sk)) ^ \
mds (2, q22 (unpack_v8c_from_v32_S (x), sk)) ^ \
mds (3, q23 (unpack_v8d_from_v32_S (x), sk)))
#define f_rnd128(i) \
{ \
const u32 t0 = g0_fun128 (data[0]); \
const u32 t1 = g1_fun128 (data[1]); \
data[2] = hc_rotr32_S (data[2] ^ (t0 + t1 + lk[4 * (i) + 8]), 1); \ data[2] = hc_rotr32_S (data[2] ^ (t0 + t1 + lk[4 * (i) + 8]), 1); \
data[3] = hc_rotl32_S (data[3], 1) ^ (t0 + 2 * t1 + lk[4 * (i) + 9]); \ data[3] = hc_rotl32_S (data[3], 1) ^ (t0 + 2 * t1 + lk[4 * (i) + 9]); \
u32 t2 = g0_fun128 (data[2]); \ const u32 t2 = g0_fun128 (data[2]); \
u32 t3 = g1_fun128 (data[3]); \ const u32 t3 = g1_fun128 (data[3]); \
data[0] = hc_rotr32_S (data[0] ^ (t2 + t3 + lk[4 * (i) + 10]), 1); \ data[0] = hc_rotr32_S (data[0] ^ (t2 + t3 + lk[4 * (i) + 10]), 1); \
data[1] = hc_rotl32_S (data[1], 1) ^ (t2 + 2 * t3 + lk[4 * (i) + 11]); \ data[1] = hc_rotl32_S (data[1], 1) ^ (t2 + 2 * t3 + lk[4 * (i) + 11]); \
} }
#define i_rnd128(i) \ #define i_rnd128(i) \
{ \ { \
u32 t0 = g0_fun128 (data[0]); \ const u32 t0 = g0_fun128 (data[0]); \
u32 t1 = g1_fun128 (data[1]); \ const u32 t1 = g1_fun128 (data[1]); \
data[2] = hc_rotl32_S (data[2], 1) ^ (t0 + t1 + lk[4 * (i) + 10]); \ data[2] = hc_rotl32_S (data[2], 1) ^ (t0 + t1 + lk[4 * (i) + 10]); \
data[3] = hc_rotr32_S (data[3] ^ (t0 + 2 * t1 + lk[4 * (i) + 11]), 1); \ data[3] = hc_rotr32_S (data[3] ^ (t0 + 2 * t1 + lk[4 * (i) + 11]), 1); \
u32 t2 = g0_fun128 (data[2]); \ const u32 t2 = g0_fun128 (data[2]); \
u32 t3 = g1_fun128 (data[3]); \ const u32 t3 = g1_fun128 (data[3]); \
data[0] = hc_rotl32_S (data[0], 1) ^ (t2 + t3 + lk[4 * (i) + 8]); \ data[0] = hc_rotl32_S (data[0], 1) ^ (t2 + t3 + lk[4 * (i) + 8]); \
data[1] = hc_rotr32_S (data[1] ^ (t2 + 2 * t3 + lk[4 * (i) + 9]), 1); \ data[1] = hc_rotr32_S (data[1] ^ (t2 + 2 * t3 + lk[4 * (i) + 9]), 1); \
} }
#define f_rnd256(i) \ #define f_rnd256(i) \
{ \ { \
u32 t0 = g0_fun256 (data[0]); \ const u32 t0 = g0_fun256 (data[0]); \
u32 t1 = g1_fun256 (data[1]); \ const u32 t1 = g1_fun256 (data[1]); \
data[2] = hc_rotr32_S (data[2] ^ (t0 + t1 + lk[4 * (i) + 8]), 1); \ data[2] = hc_rotr32_S (data[2] ^ (t0 + t1 + lk[4 * (i) + 8]), 1); \
data[3] = hc_rotl32_S (data[3], 1) ^ (t0 + 2 * t1 + lk[4 * (i) + 9]); \ data[3] = hc_rotl32_S (data[3], 1) ^ (t0 + 2 * t1 + lk[4 * (i) + 9]); \
u32 t2 = g0_fun256 (data[2]); \ const u32 t2 = g0_fun256 (data[2]); \
u32 t3 = g1_fun256 (data[3]); \ const u32 t3 = g1_fun256 (data[3]); \
data[0] = hc_rotr32_S (data[0] ^ (t2 + t3 + lk[4 * (i) + 10]), 1); \ data[0] = hc_rotr32_S (data[0] ^ (t2 + t3 + lk[4 * (i) + 10]), 1); \
data[1] = hc_rotl32_S (data[1], 1) ^ (t2 + 2 * t3 + lk[4 * (i) + 11]); \ data[1] = hc_rotl32_S (data[1], 1) ^ (t2 + 2 * t3 + lk[4 * (i) + 11]); \
} }
#define i_rnd256(i) \ #define i_rnd256(i) \
{ \ { \
u32 t0 = g0_fun256 (data[0]); \ const u32 t0 = g0_fun256 (data[0]); \
u32 t1 = g1_fun256 (data[1]); \ const u32 t1 = g1_fun256 (data[1]); \
data[2] = hc_rotl32_S (data[2], 1) ^ (t0 + t1 + lk[4 * (i) + 10]); \ data[2] = hc_rotl32_S (data[2], 1) ^ (t0 + t1 + lk[4 * (i) + 10]); \
data[3] = hc_rotr32_S (data[3] ^ (t0 + 2 * t1 + lk[4 * (i) + 11]), 1); \ data[3] = hc_rotr32_S (data[3] ^ (t0 + 2 * t1 + lk[4 * (i) + 11]), 1); \
u32 t2 = g0_fun256 (data[2]); \ const u32 t2 = g0_fun256 (data[2]); \
u32 t3 = g1_fun256 (data[3]); \ const u32 t3 = g1_fun256 (data[3]); \
data[0] = hc_rotl32_S (data[0], 1) ^ (t2 + t3 + lk[4 * (i) + 8]); \ data[0] = hc_rotl32_S (data[0], 1) ^ (t2 + t3 + lk[4 * (i) + 8]); \
data[1] = hc_rotr32_S (data[1] ^ (t2 + 2 * t3 + lk[4 * (i) + 9]), 1); \ data[1] = hc_rotr32_S (data[1] ^ (t2 + 2 * t3 + lk[4 * (i) + 9]), 1); \
} }
@ -90,15 +319,15 @@
#define mds(n,x) m_tab[n][x] #define mds(n,x) m_tab[n][x]
#define q20(x,k) q (0, q (0, x) ^ extract_byte (k[1], 0)) ^ extract_byte (k[0], 0) #define q20(x,k) q (0, q (0, x) ^ unpack_v8a_from_v32_S (k[1])) ^ unpack_v8a_from_v32_S (k[0])
#define q21(x,k) q (0, q (1, x) ^ extract_byte (k[1], 1)) ^ extract_byte (k[0], 1) #define q21(x,k) q (0, q (1, x) ^ unpack_v8b_from_v32_S (k[1])) ^ unpack_v8b_from_v32_S (k[0])
#define q22(x,k) q (1, q (0, x) ^ extract_byte (k[1], 2)) ^ extract_byte (k[0], 2) #define q22(x,k) q (1, q (0, x) ^ unpack_v8c_from_v32_S (k[1])) ^ unpack_v8c_from_v32_S (k[0])
#define q23(x,k) q (1, q (1, x) ^ extract_byte (k[1], 3)) ^ extract_byte (k[0], 3) #define q23(x,k) q (1, q (1, x) ^ unpack_v8d_from_v32_S (k[1])) ^ unpack_v8d_from_v32_S (k[0])
#define q40(x,k) q (0, q (0, q (1, q (1, x) ^ extract_byte (k[3], 0)) ^ extract_byte (k[2], 0)) ^ extract_byte (k[1], 0)) ^ extract_byte (k[0], 0) #define q40(x,k) q (0, q (0, q (1, q (1, x) ^ unpack_v8a_from_v32_S (k[3])) ^ unpack_v8a_from_v32_S (k[2])) ^ unpack_v8a_from_v32_S (k[1])) ^ unpack_v8a_from_v32_S (k[0])
#define q41(x,k) q (0, q (1, q (1, q (0, x) ^ extract_byte (k[3], 1)) ^ extract_byte (k[2], 1)) ^ extract_byte (k[1], 1)) ^ extract_byte (k[0], 1) #define q41(x,k) q (0, q (1, q (1, q (0, x) ^ unpack_v8b_from_v32_S (k[3])) ^ unpack_v8b_from_v32_S (k[2])) ^ unpack_v8b_from_v32_S (k[1])) ^ unpack_v8b_from_v32_S (k[0])
#define q42(x,k) q (1, q (0, q (0, q (0, x) ^ extract_byte (k[3], 2)) ^ extract_byte (k[2], 2)) ^ extract_byte (k[1], 2)) ^ extract_byte (k[0], 2) #define q42(x,k) q (1, q (0, q (0, q (0, x) ^ unpack_v8c_from_v32_S (k[3])) ^ unpack_v8c_from_v32_S (k[2])) ^ unpack_v8c_from_v32_S (k[1])) ^ unpack_v8c_from_v32_S (k[0])
#define q43(x,k) q (1, q (1, q (0, q (1, x) ^ extract_byte (k[3], 3)) ^ extract_byte (k[2], 3)) ^ extract_byte (k[1], 3)) ^ extract_byte (k[0], 3) #define q43(x,k) q (1, q (1, q (0, q (1, x) ^ unpack_v8d_from_v32_S (k[3])) ^ unpack_v8d_from_v32_S (k[2])) ^ unpack_v8d_from_v32_S (k[1])) ^ unpack_v8d_from_v32_S (k[0])
DECLSPEC u32 mds_rem (u32 p0, u32 p1) DECLSPEC u32 mds_rem (u32 p0, u32 p1)
{ {
@ -106,7 +335,7 @@ DECLSPEC u32 mds_rem (u32 p0, u32 p1)
#define MDS_REM_ROUND() \ #define MDS_REM_ROUND() \
{ \ { \
u32 t = p1 >> 24; \ const u32 t = p1 >> 24; \
p1 = (p1 << 8) | (p0 >> 24); \ p1 = (p1 << 8) | (p0 >> 24); \
p0 <<= 8; \ p0 <<= 8; \
u32 u = (t << 1); \ u32 u = (t << 1); \
@ -131,19 +360,19 @@ DECLSPEC u32 mds_rem (u32 p0, u32 p1)
return p1; return p1;
} }
DECLSPEC u32 h_fun128 (u32 *sk, u32 *lk, const u32 x, const u32 *key) DECLSPEC u32 h_fun128 (const u32 x, const u32 *key)
{ {
u32 b0, b1, b2, b3; u32 b0, b1, b2, b3;
b0 = extract_byte (x, 0); b0 = unpack_v8a_from_v32_S (x);
b1 = extract_byte (x, 1); b1 = unpack_v8b_from_v32_S (x);
b2 = extract_byte (x, 2); b2 = unpack_v8c_from_v32_S (x);
b3 = extract_byte (x, 3); b3 = unpack_v8d_from_v32_S (x);
b0 = q (0, (q (0, b0) ^ extract_byte (key[1], 0))) ^ extract_byte (key[0], 0); b0 = q (0, (q (0, b0) ^ unpack_v8a_from_v32_S (key[1]))) ^ unpack_v8a_from_v32_S (key[0]);
b1 = q (0, (q (1, b1) ^ extract_byte (key[1], 1))) ^ extract_byte (key[0], 1); b1 = q (0, (q (1, b1) ^ unpack_v8b_from_v32_S (key[1]))) ^ unpack_v8b_from_v32_S (key[0]);
b2 = q (1, (q (0, b2) ^ extract_byte (key[1], 2))) ^ extract_byte (key[0], 2); b2 = q (1, (q (0, b2) ^ unpack_v8c_from_v32_S (key[1]))) ^ unpack_v8c_from_v32_S (key[0]);
b3 = q (1, (q (1, b3) ^ extract_byte (key[1], 3))) ^ extract_byte (key[0], 3); b3 = q (1, (q (1, b3) ^ unpack_v8d_from_v32_S (key[1]))) ^ unpack_v8d_from_v32_S (key[0]);
return mds (0, b0) ^ mds (1, b1) ^ mds (2, b2) ^ mds (3, b3); return mds (0, b0) ^ mds (1, b1) ^ mds (2, b2) ^ mds (3, b3);
} }
@ -168,8 +397,8 @@ DECLSPEC void twofish128_set_key (u32 *sk, u32 *lk, const u32 *ukey)
u32 a = 0x01010101 * i; u32 a = 0x01010101 * i;
u32 b = 0x01010101 + a; u32 b = 0x01010101 + a;
a = h_fun128 (sk, lk, a, me_key); a = h_fun128 (a, me_key);
b = h_fun128 (sk, lk, b, mo_key); b = h_fun128 (b, mo_key);
b = hc_rotl32_S (b, 8); b = hc_rotl32_S (b, 8);
@ -228,41 +457,41 @@ DECLSPEC void twofish128_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u
// 256 bit key // 256 bit key
#define g1_fun256(x) \ #define g1_fun256(x) \
(mds (0, q40 (extract_byte (x, 3), sk)) ^ \ (mds (0, q40 (unpack_v8d_from_v32_S (x), sk)) ^ \
mds (1, q41 (extract_byte (x, 0), sk)) ^ \ mds (1, q41 (unpack_v8a_from_v32_S (x), sk)) ^ \
mds (2, q42 (extract_byte (x, 1), sk)) ^ \ mds (2, q42 (unpack_v8b_from_v32_S (x), sk)) ^ \
mds (3, q43 (extract_byte (x, 2), sk))) mds (3, q43 (unpack_v8c_from_v32_S (x), sk)))
#define g0_fun256(x) \ #define g0_fun256(x) \
(mds (0, q40 (extract_byte (x, 0), sk)) ^ \ (mds (0, q40 (unpack_v8a_from_v32_S (x), sk)) ^ \
mds (1, q41 (extract_byte (x, 1), sk)) ^ \ mds (1, q41 (unpack_v8b_from_v32_S (x), sk)) ^ \
mds (2, q42 (extract_byte (x, 2), sk)) ^ \ mds (2, q42 (unpack_v8c_from_v32_S (x), sk)) ^ \
mds (3, q43 (extract_byte (x, 3), sk))) mds (3, q43 (unpack_v8d_from_v32_S (x), sk)))
DECLSPEC u32 h_fun256 (u32 *sk, u32 *lk, const u32 x, const u32 *key) DECLSPEC u32 h_fun256 (const u32 x, const u32 *key)
{ {
u32 b0, b1, b2, b3; u32 b0, b1, b2, b3;
b0 = extract_byte (x, 0); b0 = unpack_v8a_from_v32_S (x);
b1 = extract_byte (x, 1); b1 = unpack_v8b_from_v32_S (x);
b2 = extract_byte (x, 2); b2 = unpack_v8c_from_v32_S (x);
b3 = extract_byte (x, 3); b3 = unpack_v8d_from_v32_S (x);
b0 = q (1, b0) ^ extract_byte (key[3], 0); b0 = q (1, b0) ^ unpack_v8a_from_v32_S (key[3]);
b1 = q (0, b1) ^ extract_byte (key[3], 1); b1 = q (0, b1) ^ unpack_v8b_from_v32_S (key[3]);
b2 = q (0, b2) ^ extract_byte (key[3], 2); b2 = q (0, b2) ^ unpack_v8c_from_v32_S (key[3]);
b3 = q (1, b3) ^ extract_byte (key[3], 3); b3 = q (1, b3) ^ unpack_v8d_from_v32_S (key[3]);
b0 = q (1, b0) ^ extract_byte (key[2], 0); b0 = q (1, b0) ^ unpack_v8a_from_v32_S (key[2]);
b1 = q (1, b1) ^ extract_byte (key[2], 1); b1 = q (1, b1) ^ unpack_v8b_from_v32_S (key[2]);
b2 = q (0, b2) ^ extract_byte (key[2], 2); b2 = q (0, b2) ^ unpack_v8c_from_v32_S (key[2]);
b3 = q (0, b3) ^ extract_byte (key[2], 3); b3 = q (0, b3) ^ unpack_v8d_from_v32_S (key[2]);
b0 = q (0, (q (0, b0) ^ extract_byte (key[1], 0))) ^ extract_byte (key[0], 0); b0 = q (0, (q (0, b0) ^ unpack_v8a_from_v32_S (key[1]))) ^ unpack_v8a_from_v32_S (key[0]);
b1 = q (0, (q (1, b1) ^ extract_byte (key[1], 1))) ^ extract_byte (key[0], 1); b1 = q (0, (q (1, b1) ^ unpack_v8b_from_v32_S (key[1]))) ^ unpack_v8b_from_v32_S (key[0]);
b2 = q (1, (q (0, b2) ^ extract_byte (key[1], 2))) ^ extract_byte (key[0], 2); b2 = q (1, (q (0, b2) ^ unpack_v8c_from_v32_S (key[1]))) ^ unpack_v8c_from_v32_S (key[0]);
b3 = q (1, (q (1, b3) ^ extract_byte (key[1], 3))) ^ extract_byte (key[0], 3); b3 = q (1, (q (1, b3) ^ unpack_v8d_from_v32_S (key[1]))) ^ unpack_v8d_from_v32_S (key[0]);
return mds (0, b0) ^ mds (1, b1) ^ mds (2, b2) ^ mds (3, b3); return mds (0, b0) ^ mds (1, b1) ^ mds (2, b2) ^ mds (3, b3);
} }
@ -293,8 +522,8 @@ DECLSPEC void twofish256_set_key (u32 *sk, u32 *lk, const u32 *ukey)
u32 a = 0x01010101 * i; u32 a = 0x01010101 * i;
u32 b = 0x01010101 + a; u32 b = 0x01010101 + a;
a = h_fun256 (sk, lk, a, me_key); a = h_fun256 (a, me_key);
b = h_fun256 (sk, lk, b, mo_key); b = h_fun256 (b, mo_key);
b = hc_rotl32_S (b, 8); b = hc_rotl32_S (b, 8);
@ -351,22 +580,22 @@ DECLSPEC void twofish256_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u
out[3] = data[1] ^ lk[3]; out[3] = data[1] ^ lk[3];
} }
#define g1_fun128 #undef g1_fun128
#define g0_fun128 #undef g0_fun128
#define f_rnd128 #undef f_rnd128
#define i_rnd128 #undef i_rnd128
#define f_rnd256 #undef f_rnd256
#define i_rnd256 #undef i_rnd256
#define q #undef q
#define mds #undef mds
#define q20 #undef q20
#define q21 #undef q21
#define q22 #undef q22
#define q23 #undef q23
#define q40 #undef q40
#define q41 #undef q41
#define q42 #undef q42
#define q43 #undef q43

View File

@ -6,243 +6,12 @@
#ifndef _INC_CIPHER_TWOFISH_H #ifndef _INC_CIPHER_TWOFISH_H
#define _INC_CIPHER_TWOFISH_H #define _INC_CIPHER_TWOFISH_H
CONSTANT_AS u32a q_tab[2][256] =
{
{
0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76, 0x9A, 0x92, 0x80, 0x78,
0xE4, 0xDD, 0xD1, 0x38, 0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C,
0x43, 0x75, 0x37, 0x26, 0xFA, 0x13, 0x94, 0x48, 0xF2, 0xD0, 0x8B, 0x30,
0x84, 0x54, 0xDF, 0x23, 0x19, 0x5B, 0x3D, 0x59, 0xF3, 0xAE, 0xA2, 0x82,
0x63, 0x01, 0x83, 0x2E, 0xD9, 0x51, 0x9B, 0x7C, 0xA6, 0xEB, 0xA5, 0xBE,
0x16, 0x0C, 0xE3, 0x61, 0xC0, 0x8C, 0x3A, 0xF5, 0x73, 0x2C, 0x25, 0x0B,
0xBB, 0x4E, 0x89, 0x6B, 0x53, 0x6A, 0xB4, 0xF1, 0xE1, 0xE6, 0xBD, 0x45,
0xE2, 0xF4, 0xB6, 0x66, 0xCC, 0x95, 0x03, 0x56, 0xD4, 0x1C, 0x1E, 0xD7,
0xFB, 0xC3, 0x8E, 0xB5, 0xE9, 0xCF, 0xBF, 0xBA, 0xEA, 0x77, 0x39, 0xAF,
0x33, 0xC9, 0x62, 0x71, 0x81, 0x79, 0x09, 0xAD, 0x24, 0xCD, 0xF9, 0xD8,
0xE5, 0xC5, 0xB9, 0x4D, 0x44, 0x08, 0x86, 0xE7, 0xA1, 0x1D, 0xAA, 0xED,
0x06, 0x70, 0xB2, 0xD2, 0x41, 0x7B, 0xA0, 0x11, 0x31, 0xC2, 0x27, 0x90,
0x20, 0xF6, 0x60, 0xFF, 0x96, 0x5C, 0xB1, 0xAB, 0x9E, 0x9C, 0x52, 0x1B,
0x5F, 0x93, 0x0A, 0xEF, 0x91, 0x85, 0x49, 0xEE, 0x2D, 0x4F, 0x8F, 0x3B,
0x47, 0x87, 0x6D, 0x46, 0xD6, 0x3E, 0x69, 0x64, 0x2A, 0xCE, 0xCB, 0x2F,
0xFC, 0x97, 0x05, 0x7A, 0xAC, 0x7F, 0xD5, 0x1A, 0x4B, 0x0E, 0xA7, 0x5A,
0x28, 0x14, 0x3F, 0x29, 0x88, 0x3C, 0x4C, 0x02, 0xB8, 0xDA, 0xB0, 0x17,
0x55, 0x1F, 0x8A, 0x7D, 0x57, 0xC7, 0x8D, 0x74, 0xB7, 0xC4, 0x9F, 0x72,
0x7E, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, 0x6E, 0x50, 0xDE, 0x68,
0x65, 0xBC, 0xDB, 0xF8, 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4,
0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, 0x6F, 0x9D, 0x36, 0x42,
0x4A, 0x5E, 0xC1, 0xE0
},
{
0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8, 0x4A, 0xD3, 0xE6, 0x6B,
0x45, 0x7D, 0xE8, 0x4B, 0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1,
0x30, 0x0F, 0xF8, 0x1B, 0x87, 0xFA, 0x06, 0x3F, 0x5E, 0xBA, 0xAE, 0x5B,
0x8A, 0x00, 0xBC, 0x9D, 0x6D, 0xC1, 0xB1, 0x0E, 0x80, 0x5D, 0xD2, 0xD5,
0xA0, 0x84, 0x07, 0x14, 0xB5, 0x90, 0x2C, 0xA3, 0xB2, 0x73, 0x4C, 0x54,
0x92, 0x74, 0x36, 0x51, 0x38, 0xB0, 0xBD, 0x5A, 0xFC, 0x60, 0x62, 0x96,
0x6C, 0x42, 0xF7, 0x10, 0x7C, 0x28, 0x27, 0x8C, 0x13, 0x95, 0x9C, 0xC7,
0x24, 0x46, 0x3B, 0x70, 0xCA, 0xE3, 0x85, 0xCB, 0x11, 0xD0, 0x93, 0xB8,
0xA6, 0x83, 0x20, 0xFF, 0x9F, 0x77, 0xC3, 0xCC, 0x03, 0x6F, 0x08, 0xBF,
0x40, 0xE7, 0x2B, 0xE2, 0x79, 0x0C, 0xAA, 0x82, 0x41, 0x3A, 0xEA, 0xB9,
0xE4, 0x9A, 0xA4, 0x97, 0x7E, 0xDA, 0x7A, 0x17, 0x66, 0x94, 0xA1, 0x1D,
0x3D, 0xF0, 0xDE, 0xB3, 0x0B, 0x72, 0xA7, 0x1C, 0xEF, 0xD1, 0x53, 0x3E,
0x8F, 0x33, 0x26, 0x5F, 0xEC, 0x76, 0x2A, 0x49, 0x81, 0x88, 0xEE, 0x21,
0xC4, 0x1A, 0xEB, 0xD9, 0xC5, 0x39, 0x99, 0xCD, 0xAD, 0x31, 0x8B, 0x01,
0x18, 0x23, 0xDD, 0x1F, 0x4E, 0x2D, 0xF9, 0x48, 0x4F, 0xF2, 0x65, 0x8E,
0x78, 0x5C, 0x58, 0x19, 0x8D, 0xE5, 0x98, 0x57, 0x67, 0x7F, 0x05, 0x64,
0xAF, 0x63, 0xB6, 0xFE, 0xF5, 0xB7, 0x3C, 0xA5, 0xCE, 0xE9, 0x68, 0x44,
0xE0, 0x4D, 0x43, 0x69, 0x29, 0x2E, 0xAC, 0x15, 0x59, 0xA8, 0x0A, 0x9E,
0x6E, 0x47, 0xDF, 0x34, 0x35, 0x6A, 0xCF, 0xDC, 0x22, 0xC9, 0xC0, 0x9B,
0x89, 0xD4, 0xED, 0xAB, 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9,
0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, 0x16, 0x25, 0x86, 0x56,
0x55, 0x09, 0xBE, 0x91
}
};
CONSTANT_AS u32a m_tab[4][256] =
{
{ 0xBCBC3275, 0xECEC21F3, 0x202043C6, 0xB3B3C9F4, 0xDADA03DB, 0x02028B7B,
0xE2E22BFB, 0x9E9EFAC8, 0xC9C9EC4A, 0xD4D409D3, 0x18186BE6, 0x1E1E9F6B,
0x98980E45, 0xB2B2387D, 0xA6A6D2E8, 0x2626B74B, 0x3C3C57D6, 0x93938A32,
0x8282EED8, 0x525298FD, 0x7B7BD437, 0xBBBB3771, 0x5B5B97F1, 0x474783E1,
0x24243C30, 0x5151E20F, 0xBABAC6F8, 0x4A4AF31B, 0xBFBF4887, 0x0D0D70FA,
0xB0B0B306, 0x7575DE3F, 0xD2D2FD5E, 0x7D7D20BA, 0x666631AE, 0x3A3AA35B,
0x59591C8A, 0x00000000, 0xCDCD93BC, 0x1A1AE09D, 0xAEAE2C6D, 0x7F7FABC1,
0x2B2BC7B1, 0xBEBEB90E, 0xE0E0A080, 0x8A8A105D, 0x3B3B52D2, 0x6464BAD5,
0xD8D888A0, 0xE7E7A584, 0x5F5FE807, 0x1B1B1114, 0x2C2CC2B5, 0xFCFCB490,
0x3131272C, 0x808065A3, 0x73732AB2, 0x0C0C8173, 0x79795F4C, 0x6B6B4154,
0x4B4B0292, 0x53536974, 0x94948F36, 0x83831F51, 0x2A2A3638, 0xC4C49CB0,
0x2222C8BD, 0xD5D5F85A, 0xBDBDC3FC, 0x48487860, 0xFFFFCE62, 0x4C4C0796,
0x4141776C, 0xC7C7E642, 0xEBEB24F7, 0x1C1C1410, 0x5D5D637C, 0x36362228,
0x6767C027, 0xE9E9AF8C, 0x4444F913, 0x1414EA95, 0xF5F5BB9C, 0xCFCF18C7,
0x3F3F2D24, 0xC0C0E346, 0x7272DB3B, 0x54546C70, 0x29294CCA, 0xF0F035E3,
0x0808FE85, 0xC6C617CB, 0xF3F34F11, 0x8C8CE4D0, 0xA4A45993, 0xCACA96B8,
0x68683BA6, 0xB8B84D83, 0x38382820, 0xE5E52EFF, 0xADAD569F, 0x0B0B8477,
0xC8C81DC3, 0x9999FFCC, 0x5858ED03, 0x19199A6F, 0x0E0E0A08, 0x95957EBF,
0x70705040, 0xF7F730E7, 0x6E6ECF2B, 0x1F1F6EE2, 0xB5B53D79, 0x09090F0C,
0x616134AA, 0x57571682, 0x9F9F0B41, 0x9D9D803A, 0x111164EA, 0x2525CDB9,
0xAFAFDDE4, 0x4545089A, 0xDFDF8DA4, 0xA3A35C97, 0xEAEAD57E, 0x353558DA,
0xEDEDD07A, 0x4343FC17, 0xF8F8CB66, 0xFBFBB194, 0x3737D3A1, 0xFAFA401D,
0xC2C2683D, 0xB4B4CCF0, 0x32325DDE, 0x9C9C71B3, 0x5656E70B, 0xE3E3DA72,
0x878760A7, 0x15151B1C, 0xF9F93AEF, 0x6363BFD1, 0x3434A953, 0x9A9A853E,
0xB1B1428F, 0x7C7CD133, 0x88889B26, 0x3D3DA65F, 0xA1A1D7EC, 0xE4E4DF76,
0x8181942A, 0x91910149, 0x0F0FFB81, 0xEEEEAA88, 0x161661EE, 0xD7D77321,
0x9797F5C4, 0xA5A5A81A, 0xFEFE3FEB, 0x6D6DB5D9, 0x7878AEC5, 0xC5C56D39,
0x1D1DE599, 0x7676A4CD, 0x3E3EDCAD, 0xCBCB6731, 0xB6B6478B, 0xEFEF5B01,
0x12121E18, 0x6060C523, 0x6A6AB0DD, 0x4D4DF61F, 0xCECEE94E, 0xDEDE7C2D,
0x55559DF9, 0x7E7E5A48, 0x2121B24F, 0x03037AF2, 0xA0A02665, 0x5E5E198E,
0x5A5A6678, 0x65654B5C, 0x62624E58, 0xFDFD4519, 0x0606F48D, 0x404086E5,
0xF2F2BE98, 0x3333AC57, 0x17179067, 0x05058E7F, 0xE8E85E05, 0x4F4F7D64,
0x89896AAF, 0x10109563, 0x74742FB6, 0x0A0A75FE, 0x5C5C92F5, 0x9B9B74B7,
0x2D2D333C, 0x3030D6A5, 0x2E2E49CE, 0x494989E9, 0x46467268, 0x77775544,
0xA8A8D8E0, 0x9696044D, 0x2828BD43, 0xA9A92969, 0xD9D97929, 0x8686912E,
0xD1D187AC, 0xF4F44A15, 0x8D8D1559, 0xD6D682A8, 0xB9B9BC0A, 0x42420D9E,
0xF6F6C16E, 0x2F2FB847, 0xDDDD06DF, 0x23233934, 0xCCCC6235, 0xF1F1C46A,
0xC1C112CF, 0x8585EBDC, 0x8F8F9E22, 0x7171A1C9, 0x9090F0C0, 0xAAAA539B,
0x0101F189, 0x8B8BE1D4, 0x4E4E8CED, 0x8E8E6FAB, 0xABABA212, 0x6F6F3EA2,
0xE6E6540D, 0xDBDBF252, 0x92927BBB, 0xB7B7B602, 0x6969CA2F, 0x3939D9A9,
0xD3D30CD7, 0xA7A72361, 0xA2A2AD1E, 0xC3C399B4, 0x6C6C4450, 0x07070504,
0x04047FF6, 0x272746C2, 0xACACA716, 0xD0D07625, 0x50501386, 0xDCDCF756,
0x84841A55, 0xE1E15109, 0x7A7A25BE, 0x1313EF91 },
{ 0xA9D93939, 0x67901717, 0xB3719C9C, 0xE8D2A6A6, 0x04050707, 0xFD985252,
0xA3658080, 0x76DFE4E4, 0x9A084545, 0x92024B4B, 0x80A0E0E0, 0x78665A5A,
0xE4DDAFAF, 0xDDB06A6A, 0xD1BF6363, 0x38362A2A, 0x0D54E6E6, 0xC6432020,
0x3562CCCC, 0x98BEF2F2, 0x181E1212, 0xF724EBEB, 0xECD7A1A1, 0x6C774141,
0x43BD2828, 0x7532BCBC, 0x37D47B7B, 0x269B8888, 0xFA700D0D, 0x13F94444,
0x94B1FBFB, 0x485A7E7E, 0xF27A0303, 0xD0E48C8C, 0x8B47B6B6, 0x303C2424,
0x84A5E7E7, 0x54416B6B, 0xDF06DDDD, 0x23C56060, 0x1945FDFD, 0x5BA33A3A,
0x3D68C2C2, 0x59158D8D, 0xF321ECEC, 0xAE316666, 0xA23E6F6F, 0x82165757,
0x63951010, 0x015BEFEF, 0x834DB8B8, 0x2E918686, 0xD9B56D6D, 0x511F8383,
0x9B53AAAA, 0x7C635D5D, 0xA63B6868, 0xEB3FFEFE, 0xA5D63030, 0xBE257A7A,
0x16A7ACAC, 0x0C0F0909, 0xE335F0F0, 0x6123A7A7, 0xC0F09090, 0x8CAFE9E9,
0x3A809D9D, 0xF5925C5C, 0x73810C0C, 0x2C273131, 0x2576D0D0, 0x0BE75656,
0xBB7B9292, 0x4EE9CECE, 0x89F10101, 0x6B9F1E1E, 0x53A93434, 0x6AC4F1F1,
0xB499C3C3, 0xF1975B5B, 0xE1834747, 0xE66B1818, 0xBDC82222, 0x450E9898,
0xE26E1F1F, 0xF4C9B3B3, 0xB62F7474, 0x66CBF8F8, 0xCCFF9999, 0x95EA1414,
0x03ED5858, 0x56F7DCDC, 0xD4E18B8B, 0x1C1B1515, 0x1EADA2A2, 0xD70CD3D3,
0xFB2BE2E2, 0xC31DC8C8, 0x8E195E5E, 0xB5C22C2C, 0xE9894949, 0xCF12C1C1,
0xBF7E9595, 0xBA207D7D, 0xEA641111, 0x77840B0B, 0x396DC5C5, 0xAF6A8989,
0x33D17C7C, 0xC9A17171, 0x62CEFFFF, 0x7137BBBB, 0x81FB0F0F, 0x793DB5B5,
0x0951E1E1, 0xADDC3E3E, 0x242D3F3F, 0xCDA47676, 0xF99D5555, 0xD8EE8282,
0xE5864040, 0xC5AE7878, 0xB9CD2525, 0x4D049696, 0x44557777, 0x080A0E0E,
0x86135050, 0xE730F7F7, 0xA1D33737, 0x1D40FAFA, 0xAA346161, 0xED8C4E4E,
0x06B3B0B0, 0x706C5454, 0xB22A7373, 0xD2523B3B, 0x410B9F9F, 0x7B8B0202,
0xA088D8D8, 0x114FF3F3, 0x3167CBCB, 0xC2462727, 0x27C06767, 0x90B4FCFC,
0x20283838, 0xF67F0404, 0x60784848, 0xFF2EE5E5, 0x96074C4C, 0x5C4B6565,
0xB1C72B2B, 0xAB6F8E8E, 0x9E0D4242, 0x9CBBF5F5, 0x52F2DBDB, 0x1BF34A4A,
0x5FA63D3D, 0x9359A4A4, 0x0ABCB9B9, 0xEF3AF9F9, 0x91EF1313, 0x85FE0808,
0x49019191, 0xEE611616, 0x2D7CDEDE, 0x4FB22121, 0x8F42B1B1, 0x3BDB7272,
0x47B82F2F, 0x8748BFBF, 0x6D2CAEAE, 0x46E3C0C0, 0xD6573C3C, 0x3E859A9A,
0x6929A9A9, 0x647D4F4F, 0x2A948181, 0xCE492E2E, 0xCB17C6C6, 0x2FCA6969,
0xFCC3BDBD, 0x975CA3A3, 0x055EE8E8, 0x7AD0EDED, 0xAC87D1D1, 0x7F8E0505,
0xD5BA6464, 0x1AA8A5A5, 0x4BB72626, 0x0EB9BEBE, 0xA7608787, 0x5AF8D5D5,
0x28223636, 0x14111B1B, 0x3FDE7575, 0x2979D9D9, 0x88AAEEEE, 0x3C332D2D,
0x4C5F7979, 0x02B6B7B7, 0xB896CACA, 0xDA583535, 0xB09CC4C4, 0x17FC4343,
0x551A8484, 0x1FF64D4D, 0x8A1C5959, 0x7D38B2B2, 0x57AC3333, 0xC718CFCF,
0x8DF40606, 0x74695353, 0xB7749B9B, 0xC4F59797, 0x9F56ADAD, 0x72DAE3E3,
0x7ED5EAEA, 0x154AF4F4, 0x229E8F8F, 0x12A2ABAB, 0x584E6262, 0x07E85F5F,
0x99E51D1D, 0x34392323, 0x6EC1F6F6, 0x50446C6C, 0xDE5D3232, 0x68724646,
0x6526A0A0, 0xBC93CDCD, 0xDB03DADA, 0xF8C6BABA, 0xC8FA9E9E, 0xA882D6D6,
0x2BCF6E6E, 0x40507070, 0xDCEB8585, 0xFE750A0A, 0x328A9393, 0xA48DDFDF,
0xCA4C2929, 0x10141C1C, 0x2173D7D7, 0xF0CCB4B4, 0xD309D4D4, 0x5D108A8A,
0x0FE25151, 0x00000000, 0x6F9A1919, 0x9DE01A1A, 0x368F9494, 0x42E6C7C7,
0x4AECC9C9, 0x5EFDD2D2, 0xC1AB7F7F, 0xE0D8A8A8 },
{ 0xBC75BC32, 0xECF3EC21, 0x20C62043, 0xB3F4B3C9, 0xDADBDA03, 0x027B028B,
0xE2FBE22B, 0x9EC89EFA, 0xC94AC9EC, 0xD4D3D409, 0x18E6186B, 0x1E6B1E9F,
0x9845980E, 0xB27DB238, 0xA6E8A6D2, 0x264B26B7, 0x3CD63C57, 0x9332938A,
0x82D882EE, 0x52FD5298, 0x7B377BD4, 0xBB71BB37, 0x5BF15B97, 0x47E14783,
0x2430243C, 0x510F51E2, 0xBAF8BAC6, 0x4A1B4AF3, 0xBF87BF48, 0x0DFA0D70,
0xB006B0B3, 0x753F75DE, 0xD25ED2FD, 0x7DBA7D20, 0x66AE6631, 0x3A5B3AA3,
0x598A591C, 0x00000000, 0xCDBCCD93, 0x1A9D1AE0, 0xAE6DAE2C, 0x7FC17FAB,
0x2BB12BC7, 0xBE0EBEB9, 0xE080E0A0, 0x8A5D8A10, 0x3BD23B52, 0x64D564BA,
0xD8A0D888, 0xE784E7A5, 0x5F075FE8, 0x1B141B11, 0x2CB52CC2, 0xFC90FCB4,
0x312C3127, 0x80A38065, 0x73B2732A, 0x0C730C81, 0x794C795F, 0x6B546B41,
0x4B924B02, 0x53745369, 0x9436948F, 0x8351831F, 0x2A382A36, 0xC4B0C49C,
0x22BD22C8, 0xD55AD5F8, 0xBDFCBDC3, 0x48604878, 0xFF62FFCE, 0x4C964C07,
0x416C4177, 0xC742C7E6, 0xEBF7EB24, 0x1C101C14, 0x5D7C5D63, 0x36283622,
0x672767C0, 0xE98CE9AF, 0x441344F9, 0x149514EA, 0xF59CF5BB, 0xCFC7CF18,
0x3F243F2D, 0xC046C0E3, 0x723B72DB, 0x5470546C, 0x29CA294C, 0xF0E3F035,
0x088508FE, 0xC6CBC617, 0xF311F34F, 0x8CD08CE4, 0xA493A459, 0xCAB8CA96,
0x68A6683B, 0xB883B84D, 0x38203828, 0xE5FFE52E, 0xAD9FAD56, 0x0B770B84,
0xC8C3C81D, 0x99CC99FF, 0x580358ED, 0x196F199A, 0x0E080E0A, 0x95BF957E,
0x70407050, 0xF7E7F730, 0x6E2B6ECF, 0x1FE21F6E, 0xB579B53D, 0x090C090F,
0x61AA6134, 0x57825716, 0x9F419F0B, 0x9D3A9D80, 0x11EA1164, 0x25B925CD,
0xAFE4AFDD, 0x459A4508, 0xDFA4DF8D, 0xA397A35C, 0xEA7EEAD5, 0x35DA3558,
0xED7AEDD0, 0x431743FC, 0xF866F8CB, 0xFB94FBB1, 0x37A137D3, 0xFA1DFA40,
0xC23DC268, 0xB4F0B4CC, 0x32DE325D, 0x9CB39C71, 0x560B56E7, 0xE372E3DA,
0x87A78760, 0x151C151B, 0xF9EFF93A, 0x63D163BF, 0x345334A9, 0x9A3E9A85,
0xB18FB142, 0x7C337CD1, 0x8826889B, 0x3D5F3DA6, 0xA1ECA1D7, 0xE476E4DF,
0x812A8194, 0x91499101, 0x0F810FFB, 0xEE88EEAA, 0x16EE1661, 0xD721D773,
0x97C497F5, 0xA51AA5A8, 0xFEEBFE3F, 0x6DD96DB5, 0x78C578AE, 0xC539C56D,
0x1D991DE5, 0x76CD76A4, 0x3EAD3EDC, 0xCB31CB67, 0xB68BB647, 0xEF01EF5B,
0x1218121E, 0x602360C5, 0x6ADD6AB0, 0x4D1F4DF6, 0xCE4ECEE9, 0xDE2DDE7C,
0x55F9559D, 0x7E487E5A, 0x214F21B2, 0x03F2037A, 0xA065A026, 0x5E8E5E19,
0x5A785A66, 0x655C654B, 0x6258624E, 0xFD19FD45, 0x068D06F4, 0x40E54086,
0xF298F2BE, 0x335733AC, 0x17671790, 0x057F058E, 0xE805E85E, 0x4F644F7D,
0x89AF896A, 0x10631095, 0x74B6742F, 0x0AFE0A75, 0x5CF55C92, 0x9BB79B74,
0x2D3C2D33, 0x30A530D6, 0x2ECE2E49, 0x49E94989, 0x46684672, 0x77447755,
0xA8E0A8D8, 0x964D9604, 0x284328BD, 0xA969A929, 0xD929D979, 0x862E8691,
0xD1ACD187, 0xF415F44A, 0x8D598D15, 0xD6A8D682, 0xB90AB9BC, 0x429E420D,
0xF66EF6C1, 0x2F472FB8, 0xDDDFDD06, 0x23342339, 0xCC35CC62, 0xF16AF1C4,
0xC1CFC112, 0x85DC85EB, 0x8F228F9E, 0x71C971A1, 0x90C090F0, 0xAA9BAA53,
0x018901F1, 0x8BD48BE1, 0x4EED4E8C, 0x8EAB8E6F, 0xAB12ABA2, 0x6FA26F3E,
0xE60DE654, 0xDB52DBF2, 0x92BB927B, 0xB702B7B6, 0x692F69CA, 0x39A939D9,
0xD3D7D30C, 0xA761A723, 0xA21EA2AD, 0xC3B4C399, 0x6C506C44, 0x07040705,
0x04F6047F, 0x27C22746, 0xAC16ACA7, 0xD025D076, 0x50865013, 0xDC56DCF7,
0x8455841A, 0xE109E151, 0x7ABE7A25, 0x139113EF },
{ 0xD939A9D9, 0x90176790, 0x719CB371, 0xD2A6E8D2, 0x05070405, 0x9852FD98,
0x6580A365, 0xDFE476DF, 0x08459A08, 0x024B9202, 0xA0E080A0, 0x665A7866,
0xDDAFE4DD, 0xB06ADDB0, 0xBF63D1BF, 0x362A3836, 0x54E60D54, 0x4320C643,
0x62CC3562, 0xBEF298BE, 0x1E12181E, 0x24EBF724, 0xD7A1ECD7, 0x77416C77,
0xBD2843BD, 0x32BC7532, 0xD47B37D4, 0x9B88269B, 0x700DFA70, 0xF94413F9,
0xB1FB94B1, 0x5A7E485A, 0x7A03F27A, 0xE48CD0E4, 0x47B68B47, 0x3C24303C,
0xA5E784A5, 0x416B5441, 0x06DDDF06, 0xC56023C5, 0x45FD1945, 0xA33A5BA3,
0x68C23D68, 0x158D5915, 0x21ECF321, 0x3166AE31, 0x3E6FA23E, 0x16578216,
0x95106395, 0x5BEF015B, 0x4DB8834D, 0x91862E91, 0xB56DD9B5, 0x1F83511F,
0x53AA9B53, 0x635D7C63, 0x3B68A63B, 0x3FFEEB3F, 0xD630A5D6, 0x257ABE25,
0xA7AC16A7, 0x0F090C0F, 0x35F0E335, 0x23A76123, 0xF090C0F0, 0xAFE98CAF,
0x809D3A80, 0x925CF592, 0x810C7381, 0x27312C27, 0x76D02576, 0xE7560BE7,
0x7B92BB7B, 0xE9CE4EE9, 0xF10189F1, 0x9F1E6B9F, 0xA93453A9, 0xC4F16AC4,
0x99C3B499, 0x975BF197, 0x8347E183, 0x6B18E66B, 0xC822BDC8, 0x0E98450E,
0x6E1FE26E, 0xC9B3F4C9, 0x2F74B62F, 0xCBF866CB, 0xFF99CCFF, 0xEA1495EA,
0xED5803ED, 0xF7DC56F7, 0xE18BD4E1, 0x1B151C1B, 0xADA21EAD, 0x0CD3D70C,
0x2BE2FB2B, 0x1DC8C31D, 0x195E8E19, 0xC22CB5C2, 0x8949E989, 0x12C1CF12,
0x7E95BF7E, 0x207DBA20, 0x6411EA64, 0x840B7784, 0x6DC5396D, 0x6A89AF6A,
0xD17C33D1, 0xA171C9A1, 0xCEFF62CE, 0x37BB7137, 0xFB0F81FB, 0x3DB5793D,
0x51E10951, 0xDC3EADDC, 0x2D3F242D, 0xA476CDA4, 0x9D55F99D, 0xEE82D8EE,
0x8640E586, 0xAE78C5AE, 0xCD25B9CD, 0x04964D04, 0x55774455, 0x0A0E080A,
0x13508613, 0x30F7E730, 0xD337A1D3, 0x40FA1D40, 0x3461AA34, 0x8C4EED8C,
0xB3B006B3, 0x6C54706C, 0x2A73B22A, 0x523BD252, 0x0B9F410B, 0x8B027B8B,
0x88D8A088, 0x4FF3114F, 0x67CB3167, 0x4627C246, 0xC06727C0, 0xB4FC90B4,
0x28382028, 0x7F04F67F, 0x78486078, 0x2EE5FF2E, 0x074C9607, 0x4B655C4B,
0xC72BB1C7, 0x6F8EAB6F, 0x0D429E0D, 0xBBF59CBB, 0xF2DB52F2, 0xF34A1BF3,
0xA63D5FA6, 0x59A49359, 0xBCB90ABC, 0x3AF9EF3A, 0xEF1391EF, 0xFE0885FE,
0x01914901, 0x6116EE61, 0x7CDE2D7C, 0xB2214FB2, 0x42B18F42, 0xDB723BDB,
0xB82F47B8, 0x48BF8748, 0x2CAE6D2C, 0xE3C046E3, 0x573CD657, 0x859A3E85,
0x29A96929, 0x7D4F647D, 0x94812A94, 0x492ECE49, 0x17C6CB17, 0xCA692FCA,
0xC3BDFCC3, 0x5CA3975C, 0x5EE8055E, 0xD0ED7AD0, 0x87D1AC87, 0x8E057F8E,
0xBA64D5BA, 0xA8A51AA8, 0xB7264BB7, 0xB9BE0EB9, 0x6087A760, 0xF8D55AF8,
0x22362822, 0x111B1411, 0xDE753FDE, 0x79D92979, 0xAAEE88AA, 0x332D3C33,
0x5F794C5F, 0xB6B702B6, 0x96CAB896, 0x5835DA58, 0x9CC4B09C, 0xFC4317FC,
0x1A84551A, 0xF64D1FF6, 0x1C598A1C, 0x38B27D38, 0xAC3357AC, 0x18CFC718,
0xF4068DF4, 0x69537469, 0x749BB774, 0xF597C4F5, 0x56AD9F56, 0xDAE372DA,
0xD5EA7ED5, 0x4AF4154A, 0x9E8F229E, 0xA2AB12A2, 0x4E62584E, 0xE85F07E8,
0xE51D99E5, 0x39233439, 0xC1F66EC1, 0x446C5044, 0x5D32DE5D, 0x72466872,
0x26A06526, 0x93CDBC93, 0x03DADB03, 0xC6BAF8C6, 0xFA9EC8FA, 0x82D6A882,
0xCF6E2BCF, 0x50704050, 0xEB85DCEB, 0x750AFE75, 0x8A93328A, 0x8DDFA48D,
0x4C29CA4C, 0x141C1014, 0x73D72173, 0xCCB4F0CC, 0x09D4D309, 0x108A5D10,
0xE2510FE2, 0x00000000, 0x9A196F9A, 0xE01A9DE0, 0x8F94368F, 0xE6C742E6,
0xECC94AEC, 0xFDD25EFD, 0xAB7FC1AB, 0xD8A8E0D8 }
};
DECLSPEC u32 mds_rem (u32 p0, u32 p1); DECLSPEC u32 mds_rem (u32 p0, u32 p1);
DECLSPEC u32 h_fun128 (u32 *sk, u32 *lk, const u32 x, const u32 *key); DECLSPEC u32 h_fun128 (const u32 x, const u32 *key);
DECLSPEC void twofish128_set_key (u32 *sk, u32 *lk, const u32 *ukey); DECLSPEC void twofish128_set_key (u32 *sk, u32 *lk, const u32 *ukey);
DECLSPEC void twofish128_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out); DECLSPEC void twofish128_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);
DECLSPEC void twofish128_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out); DECLSPEC void twofish128_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);
DECLSPEC u32 h_fun256 (u32 *sk, u32 *lk, const u32 x, const u32 *key); DECLSPEC u32 h_fun256 (const u32 x, const u32 *key);
DECLSPEC void twofish256_set_key (u32 *sk, u32 *lk, const u32 *ukey); DECLSPEC void twofish256_set_key (u32 *sk, u32 *lk, const u32 *ukey);
DECLSPEC void twofish256_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out); DECLSPEC void twofish256_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);
DECLSPEC void twofish256_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out); DECLSPEC void twofish256_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);

File diff suppressed because it is too large Load Diff

View File

@ -26,42 +26,42 @@
* - P19: Type of the esalt_bufs structure with additional data, or void. * - P19: Type of the esalt_bufs structure with additional data, or void.
*/ */
#define KERN_ATTR(p2,p4,p5,p6,p19) \ #define KERN_ATTR(p2,p4,p5,p6,p19) \
GLOBAL_AS pw_t * restrict pws, \ MAYBE_UNUSED GLOBAL_AS pw_t *pws, \
p2 const kernel_rule_t * restrict rules_buf, \ MAYBE_UNUSED p2 const kernel_rule_t *rules_buf, \
GLOBAL_AS const pw_t * restrict combs_buf, \ MAYBE_UNUSED GLOBAL_AS const pw_t *combs_buf, \
p4, \ MAYBE_UNUSED p4, \
GLOBAL_AS p5 * restrict tmps, \ MAYBE_UNUSED GLOBAL_AS p5 *tmps, \
GLOBAL_AS p6 * restrict hooks, \ MAYBE_UNUSED GLOBAL_AS p6 *hooks, \
GLOBAL_AS const u32 * restrict bitmaps_buf_s1_a, \ MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_a, \
GLOBAL_AS const u32 * restrict bitmaps_buf_s1_b, \ MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_b, \
GLOBAL_AS const u32 * restrict bitmaps_buf_s1_c, \ MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_c, \
GLOBAL_AS const u32 * restrict bitmaps_buf_s1_d, \ MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_d, \
GLOBAL_AS const u32 * restrict bitmaps_buf_s2_a, \ MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_a, \
GLOBAL_AS const u32 * restrict bitmaps_buf_s2_b, \ MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_b, \
GLOBAL_AS const u32 * restrict bitmaps_buf_s2_c, \ MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_c, \
GLOBAL_AS const u32 * restrict bitmaps_buf_s2_d, \ MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_d, \
GLOBAL_AS plain_t * restrict plains_buf, \ MAYBE_UNUSED GLOBAL_AS plain_t *plains_buf, \
GLOBAL_AS const digest_t * restrict digests_buf, \ MAYBE_UNUSED GLOBAL_AS const digest_t *digests_buf, \
GLOBAL_AS u32 * restrict hashes_shown, \ MAYBE_UNUSED GLOBAL_AS u32 *hashes_shown, \
GLOBAL_AS const salt_t * restrict salt_bufs, \ MAYBE_UNUSED GLOBAL_AS const salt_t *salt_bufs, \
GLOBAL_AS const p19 * restrict esalt_bufs, \ MAYBE_UNUSED GLOBAL_AS const p19 *esalt_bufs, \
GLOBAL_AS u32 * restrict d_return_buf, \ MAYBE_UNUSED GLOBAL_AS u32 *d_return_buf, \
GLOBAL_AS void * restrict d_extra0_buf, \ MAYBE_UNUSED GLOBAL_AS void *d_extra0_buf, \
GLOBAL_AS void * restrict d_extra1_buf, \ MAYBE_UNUSED GLOBAL_AS void *d_extra1_buf, \
GLOBAL_AS void * restrict d_extra2_buf, \ MAYBE_UNUSED GLOBAL_AS void *d_extra2_buf, \
GLOBAL_AS void * restrict d_extra3_buf, \ MAYBE_UNUSED GLOBAL_AS void *d_extra3_buf, \
const u32 bitmap_mask, \ MAYBE_UNUSED const u32 bitmap_mask, \
const u32 bitmap_shift1, \ MAYBE_UNUSED const u32 bitmap_shift1, \
const u32 bitmap_shift2, \ MAYBE_UNUSED const u32 bitmap_shift2, \
const u32 salt_pos, \ MAYBE_UNUSED const u32 salt_pos, \
const u32 loop_pos, \ MAYBE_UNUSED const u32 loop_pos, \
const u32 loop_cnt, \ MAYBE_UNUSED const u32 loop_cnt, \
const u32 il_cnt, \ MAYBE_UNUSED const u32 il_cnt, \
const u32 digests_cnt, \ MAYBE_UNUSED const u32 digests_cnt, \
const u32 digests_offset, \ MAYBE_UNUSED const u32 digests_offset, \
const u32 combs_mode, \ MAYBE_UNUSED const u32 combs_mode, \
const u64 gid_max MAYBE_UNUSED const u64 gid_max
/* /*
* Shortcut macros for usage in the actual kernels * Shortcut macros for usage in the actual kernels
@ -71,16 +71,16 @@
* do not use rules or tmps, etc. * do not use rules or tmps, etc.
*/ */
#define KERN_ATTR_BASIC() KERN_ATTR (GLOBAL_AS, GLOBAL_AS const bf_t * restrict bfs_buf, void, void, void) #define KERN_ATTR_BASIC() KERN_ATTR (GLOBAL_AS, GLOBAL_AS const bf_t *bfs_buf, void, void, void)
#define KERN_ATTR_BITSLICE() KERN_ATTR (GLOBAL_AS, CONSTANT_AS const bs_word_t * restrict words_buf_r, void, void, void) #define KERN_ATTR_BITSLICE() KERN_ATTR (GLOBAL_AS, CONSTANT_AS const bs_word_t *words_buf_r, void, void, void)
#define KERN_ATTR_ESALT(e) KERN_ATTR (GLOBAL_AS, GLOBAL_AS const bf_t * restrict bfs_buf, void, void, e) #define KERN_ATTR_ESALT(e) KERN_ATTR (GLOBAL_AS, GLOBAL_AS const bf_t *bfs_buf, void, void, e)
#define KERN_ATTR_RULES() KERN_ATTR (CONSTANT_AS, GLOBAL_AS const bf_t * restrict bfs_buf, void, void, void) #define KERN_ATTR_RULES() KERN_ATTR (CONSTANT_AS, GLOBAL_AS const bf_t *bfs_buf, void, void, void)
#define KERN_ATTR_RULES_ESALT(e) KERN_ATTR (CONSTANT_AS, GLOBAL_AS const bf_t * restrict bfs_buf, void, void, e) #define KERN_ATTR_RULES_ESALT(e) KERN_ATTR (CONSTANT_AS, GLOBAL_AS const bf_t *bfs_buf, void, void, e)
#define KERN_ATTR_TMPS(t) KERN_ATTR (GLOBAL_AS, GLOBAL_AS const bf_t * restrict bfs_buf, t, void, void) #define KERN_ATTR_TMPS(t) KERN_ATTR (GLOBAL_AS, GLOBAL_AS const bf_t *bfs_buf, t, void, void)
#define KERN_ATTR_TMPS_ESALT(t,e) KERN_ATTR (GLOBAL_AS, GLOBAL_AS const bf_t * restrict bfs_buf, t, void, e) #define KERN_ATTR_TMPS_ESALT(t,e) KERN_ATTR (GLOBAL_AS, GLOBAL_AS const bf_t *bfs_buf, t, void, e)
#define KERN_ATTR_TMPS_HOOKS(t,h) KERN_ATTR (GLOBAL_AS, GLOBAL_AS const bf_t * restrict bfs_buf, t, h, void) #define KERN_ATTR_TMPS_HOOKS(t,h) KERN_ATTR (GLOBAL_AS, GLOBAL_AS const bf_t *bfs_buf, t, h, void)
#define KERN_ATTR_VECTOR() KERN_ATTR (GLOBAL_AS, CONSTANT_AS const u32x * restrict words_buf_r, void, void, void) #define KERN_ATTR_VECTOR() KERN_ATTR (GLOBAL_AS, CONSTANT_AS const u32x *words_buf_r, void, void, void)
#define KERN_ATTR_VECTOR_ESALT(e) KERN_ATTR (GLOBAL_AS, CONSTANT_AS const u32x * restrict words_buf_r, void, void, e) #define KERN_ATTR_VECTOR_ESALT(e) KERN_ATTR (GLOBAL_AS, CONSTANT_AS const u32x *words_buf_r, void, void, e)
// union based packing // union based packing
@ -118,20 +118,12 @@ DECLSPEC u64 hl32_to_64_S (const u32 a, const u32 b);
// bit operations // bit operations
DECLSPEC u32x hc_rotl32 (const u32x a, const int n); DECLSPEC u32x hc_rotl32 (const u32x a, const int n);
DECLSPEC u32x hc_rotl32 (const u32x a, const int n);
DECLSPEC u32x hc_rotr32 (const u32x a, const int n);
DECLSPEC u32x hc_rotr32 (const u32x a, const int n); DECLSPEC u32x hc_rotr32 (const u32x a, const int n);
DECLSPEC u32 hc_rotl32_S (const u32 a, const int n); DECLSPEC u32 hc_rotl32_S (const u32 a, const int n);
DECLSPEC u32 hc_rotl32_S (const u32 a, const int n);
DECLSPEC u32 hc_rotr32_S (const u32 a, const int n);
DECLSPEC u32 hc_rotr32_S (const u32 a, const int n); DECLSPEC u32 hc_rotr32_S (const u32 a, const int n);
DECLSPEC u64x hc_rotl64 (const u64x a, const int n); DECLSPEC u64x hc_rotl64 (const u64x a, const int n);
DECLSPEC u64x hc_rotl64 (const u64x a, const int n);
DECLSPEC u64x hc_rotr64 (const u64x a, const int n);
DECLSPEC u64x hc_rotr64 (const u64x a, const int n); DECLSPEC u64x hc_rotr64 (const u64x a, const int n);
DECLSPEC u64 hc_rotl64_S (const u64 a, const int n); DECLSPEC u64 hc_rotl64_S (const u64 a, const int n);
DECLSPEC u64 hc_rotl64_S (const u64 a, const int n);
DECLSPEC u64 hc_rotr64_S (const u64 a, const int n);
DECLSPEC u64 hc_rotr64_S (const u64 a, const int n); DECLSPEC u64 hc_rotr64_S (const u64 a, const int n);
DECLSPEC u32x hc_swap32 (const u32x v); DECLSPEC u32x hc_swap32 (const u32x v);
@ -158,8 +150,12 @@ DECLSPEC u32 hc_lop_0x96_S (const u32 a, const u32 b, const u32 c);
// legacy common code // legacy common code
DECLSPEC int ffz (const u32 v); DECLSPEC int ffz (const u32 v);
#ifdef KERNEL_STATIC
DECLSPEC int hash_comp (const u32 *d1, GLOBAL_AS const u32 *d2); DECLSPEC int hash_comp (const u32 *d1, GLOBAL_AS const u32 *d2);
DECLSPEC int find_hash (const u32 *digest, const u32 digests_cnt, GLOBAL_AS const digest_t *digests_buf); DECLSPEC int find_hash (const u32 *digest, const u32 digests_cnt, GLOBAL_AS const digest_t *digests_buf);
#endif
DECLSPEC u32 check_bitmap (GLOBAL_AS const u32 *bitmap, const u32 bitmap_mask, const u32 bitmap_shift, const u32 digest); DECLSPEC u32 check_bitmap (GLOBAL_AS const u32 *bitmap, const u32 bitmap_mask, const u32 bitmap_shift, const u32 digest);
DECLSPEC u32 check (const u32 *digest, GLOBAL_AS const u32 *bitmap_s1_a, GLOBAL_AS const u32 *bitmap_s1_b, GLOBAL_AS const u32 *bitmap_s1_c, GLOBAL_AS const u32 *bitmap_s1_d, GLOBAL_AS const u32 *bitmap_s2_a, GLOBAL_AS const u32 *bitmap_s2_b, GLOBAL_AS const u32 *bitmap_s2_c, GLOBAL_AS const u32 *bitmap_s2_d, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2); DECLSPEC u32 check (const u32 *digest, GLOBAL_AS const u32 *bitmap_s1_a, GLOBAL_AS const u32 *bitmap_s1_b, GLOBAL_AS const u32 *bitmap_s1_c, GLOBAL_AS const u32 *bitmap_s1_d, GLOBAL_AS const u32 *bitmap_s2_a, GLOBAL_AS const u32 *bitmap_s2_b, GLOBAL_AS const u32 *bitmap_s2_c, GLOBAL_AS const u32 *bitmap_s2_d, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2);
DECLSPEC void mark_hash (GLOBAL_AS plain_t *plains_buf, GLOBAL_AS u32 *d_result, const u32 salt_pos, const u32 digests_cnt, const u32 digest_pos, const u32 hash_pos, const u64 gid, const u32 il_pos, const u32 extra1, const u32 extra2); DECLSPEC void mark_hash (GLOBAL_AS plain_t *plains_buf, GLOBAL_AS u32 *d_result, const u32 salt_pos, const u32 digests_cnt, const u32 digest_pos, const u32 hash_pos, const u64 gid, const u32 il_pos, const u32 extra1, const u32 extra2);

View File

@ -0,0 +1,366 @@
DECLSPEC void dcrp_xts_mul2 (u32 *in, u32 *out)
{
const u32 c = in[3] >> 31;
out[3] = (in[3] << 1) | (in[2] >> 31);
out[2] = (in[2] << 1) | (in[1] >> 31);
out[1] = (in[1] << 1) | (in[0] >> 31);
out[0] = (in[0] << 1);
out[0] ^= c * 0x87;
}
DECLSPEC void dcrp_aes256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
{
out[0] = in[0];
out[1] = in[1];
out[2] = in[2];
out[3] = in[3];
aes256_set_encrypt_key (ks, ukey2, s_te0, s_te1, s_te2, s_te3);
aes256_encrypt (ks, S, T, s_te0, s_te1, s_te2, s_te3, s_te4);
// skip four blocks (the starting position + 64 raw salt bytes that were replaced after encryption):
dcrp_xts_mul2 (T, T);
dcrp_xts_mul2 (T, T);
dcrp_xts_mul2 (T, T);
dcrp_xts_mul2 (T, T);
out[0] ^= T[0];
out[1] ^= T[1];
out[2] ^= T[2];
out[3] ^= T[3];
aes256_set_decrypt_key (ks, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_decrypt (ks, out, out, s_td0, s_td1, s_td2, s_td3, s_td4);
out[0] ^= T[0];
out[1] ^= T[1];
out[2] ^= T[2];
out[3] ^= T[3];
}
DECLSPEC void dcrp_serpent256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks)
{
out[0] = in[0];
out[1] = in[1];
out[2] = in[2];
out[3] = in[3];
serpent256_set_key (ks, ukey2);
serpent256_encrypt (ks, S, T);
// skip four blocks (the starting position + 64 raw salt bytes that were replaced after encryption):
dcrp_xts_mul2 (T, T);
dcrp_xts_mul2 (T, T);
dcrp_xts_mul2 (T, T);
dcrp_xts_mul2 (T, T);
out[0] ^= T[0];
out[1] ^= T[1];
out[2] ^= T[2];
out[3] ^= T[3];
serpent256_set_key (ks, ukey1);
serpent256_decrypt (ks, out, out);
out[0] ^= T[0];
out[1] ^= T[1];
out[2] ^= T[2];
out[3] ^= T[3];
}
DECLSPEC void dcrp_twofish256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *sk, u32 *lk)
{
out[0] = in[0];
out[1] = in[1];
out[2] = in[2];
out[3] = in[3];
twofish256_set_key (sk, lk, ukey2);
twofish256_encrypt (sk, lk, S, T);
// skip four blocks (the starting position + 64 raw salt bytes that were replaced after encryption):
dcrp_xts_mul2 (T, T);
dcrp_xts_mul2 (T, T);
dcrp_xts_mul2 (T, T);
dcrp_xts_mul2 (T, T);
out[0] ^= T[0];
out[1] ^= T[1];
out[2] ^= T[2];
out[3] ^= T[3];
twofish256_set_key (sk, lk, ukey1);
twofish256_decrypt (sk, lk, out, out);
out[0] ^= T[0];
out[1] ^= T[1];
out[2] ^= T[2];
out[3] ^= T[3];
}
// 512 bit
DECLSPEC int dcrp_verify_header_aes (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
{
u32 ks_aes[60];
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID
u32 T_aes[4] = { 0 };
u32 data[4];
data[0] = data_buf[0];
data[1] = data_buf[1];
data[2] = data_buf[2];
data[3] = data_buf[3];
u32 tmp[4];
dcrp_aes256_decrypt_xts (ukey1, ukey2, data, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002) && (tmp[2] != 0x00080002)) return 0; // header version 0x0002 and flags either 0x04, 0x05 or 0x08
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 / 0x00000008 => must be 0x0000
return 1;
}
DECLSPEC int dcrp_verify_header_serpent (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2)
{
u32 ks_serpent[140];
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
u32 T_serpent[4] = { 0 };
u32 data[4];
data[0] = data_buf[0];
data[1] = data_buf[1];
data[2] = data_buf[2];
data[3] = data_buf[3];
u32 tmp[4];
dcrp_serpent256_decrypt_xts (ukey1, ukey2, data, tmp, S, T_serpent, ks_serpent);
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002) && (tmp[2] != 0x00080002)) return 0; // header version 0x0002 and flags either 0x04, 0x05 or 0x08
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 / 0x00000008 => must be 0x0000
return 1;
}
DECLSPEC int dcrp_verify_header_twofish (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2)
{
u32 sk_twofish[4];
u32 lk_twofish[40];
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
u32 T_twofish[4] = { 0 };
u32 data[4];
data[0] = data_buf[0];
data[1] = data_buf[1];
data[2] = data_buf[2];
data[3] = data_buf[3];
u32 tmp[4];
dcrp_twofish256_decrypt_xts (ukey1, ukey2, data, tmp, S, T_twofish, sk_twofish, lk_twofish);
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002) && (tmp[2] != 0x00080002)) return 0; // header version 0x0002 and flags either 0x04, 0x05 or 0x08
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 / 0x00000008 => must be 0x0000
return 1;
}
// 1024 bit
DECLSPEC int dcrp_verify_header_aes_twofish (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
{
u32 ks_aes[60];
u32 sk_twofish[4];
u32 lk_twofish[40];
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
u32 T_aes[4] = { 0 };
u32 T_twofish[4] = { 0 };
u32 data[4];
data[0] = data_buf[0];
data[1] = data_buf[1];
data[2] = data_buf[2];
data[3] = data_buf[3];
u32 tmp[4];
dcrp_aes256_decrypt_xts (ukey2, ukey4, data, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
dcrp_twofish256_decrypt_xts (ukey1, ukey3, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish);
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002) && (tmp[2] != 0x00080002)) return 0; // header version 0x0002 and flags either 0x04, 0x05 or 0x08
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 / 0x00000008 => must be 0x0000
return 1;
}
DECLSPEC int dcrp_verify_header_serpent_aes (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
{
u32 ks_serpent[140];
u32 ks_aes[60];
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
u32 T_serpent[4] = { 0 };
u32 T_aes[4] = { 0 };
u32 data[4];
data[0] = data_buf[0];
data[1] = data_buf[1];
data[2] = data_buf[2];
data[3] = data_buf[3];
u32 tmp[4];
dcrp_serpent256_decrypt_xts (ukey2, ukey4, data, tmp, S, T_serpent, ks_serpent);
dcrp_aes256_decrypt_xts (ukey1, ukey3, tmp, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002) && (tmp[2] != 0x00080002)) return 0; // header version 0x0002 and flags either 0x04, 0x05 or 0x08
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 / 0x00000008 => must be 0x0000
return 1;
}
DECLSPEC int dcrp_verify_header_twofish_serpent (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4)
{
u32 sk_twofish[4];
u32 lk_twofish[40];
u32 ks_serpent[140];
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
u32 T_twofish[4] = { 0 };
u32 T_serpent[4] = { 0 };
u32 data[4];
data[0] = data_buf[0];
data[1] = data_buf[1];
data[2] = data_buf[2];
data[3] = data_buf[3];
u32 tmp[4];
dcrp_twofish256_decrypt_xts (ukey2, ukey4, data, tmp, S, T_twofish, sk_twofish, lk_twofish);
dcrp_serpent256_decrypt_xts (ukey1, ukey3, tmp, tmp, S, T_serpent, ks_serpent);
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002) && (tmp[2] != 0x00080002)) return 0; // header version 0x0002 and flags either 0x04, 0x05 or 0x08
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 / 0x00000008 => must be 0x0000
return 1;
}
// 1536 bit
DECLSPEC int dcrp_verify_header_aes_twofish_serpent (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
{
u32 ks_aes[60];
u32 sk_twofish[4];
u32 lk_twofish[40];
u32 ks_serpent[140];
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
u32 T_aes[4] = { 0 };
u32 T_twofish[4] = { 0 };
u32 T_serpent[4] = { 0 };
u32 data[4];
data[0] = data_buf[0];
data[1] = data_buf[1];
data[2] = data_buf[2];
data[3] = data_buf[3];
u32 tmp[4];
dcrp_aes256_decrypt_xts (ukey3, ukey6, data, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
dcrp_twofish256_decrypt_xts (ukey2, ukey5, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish);
dcrp_serpent256_decrypt_xts (ukey1, ukey4, tmp, tmp, S, T_serpent, ks_serpent);
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002) && (tmp[2] != 0x00080002)) return 0; // header version 0x0002 and flags either 0x04, 0x05 or 0x08
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 / 0x00000008 => must be 0x0000
return 1;
}
DECLSPEC int dcrp_verify_header_serpent_twofish_aes (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
{
u32 ks_serpent[140];
u32 sk_twofish[4];
u32 lk_twofish[40];
u32 ks_aes[60];
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
u32 T_serpent[4] = { 0 };
u32 T_twofish[4] = { 0 };
u32 T_aes[4] = { 0 };
u32 data[4];
data[0] = data_buf[0];
data[1] = data_buf[1];
data[2] = data_buf[2];
data[3] = data_buf[3];
u32 tmp[4];
dcrp_serpent256_decrypt_xts (ukey3, ukey6, data, tmp, S, T_serpent, ks_serpent);
dcrp_twofish256_decrypt_xts (ukey2, ukey5, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish);
dcrp_aes256_decrypt_xts (ukey1, ukey4, tmp, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002) && (tmp[2] != 0x00080002)) return 0; // header version 0x0002 and flags either 0x04, 0x05 or 0x08
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 / 0x00000008 => must be 0x0000
return 1;
}

View File

@ -0,0 +1,22 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef _INC_DISKCRYPTOR_XTS_H
#define _INC_DISKCRYPTOR_XTS_H
DECLSPEC void dcrp_xts_mul2 (u32 *in, u32 *out);
DECLSPEC void dcrp_aes256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
DECLSPEC void dcrp_serpent256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks);
DECLSPEC void dcrp_twofish256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *sk, u32 *lk);
DECLSPEC int dcrp_verify_header_aes (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
DECLSPEC int dcrp_verify_header_serpent (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2);
DECLSPEC int dcrp_verify_header_twofish (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2);
DECLSPEC int dcrp_verify_header_aes_twofish (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
DECLSPEC int dcrp_verify_header_serpent_aes (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
DECLSPEC int dcrp_verify_header_twofish_serpent (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4);
DECLSPEC int dcrp_verify_header_aes_twofish_serpent (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
DECLSPEC int dcrp_verify_header_serpent_twofish_aes (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
#endif // _INC_DISKCRYPTOR_XTS_H

View File

@ -106,75 +106,119 @@ DECLSPEC void md4_init (md4_ctx_t *ctx)
DECLSPEC void md4_update_64 (md4_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void md4_update_64 (md4_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
ctx->len += len; ctx->len += len;
if ((pos + len) < 64) if (pos == 0)
{ {
switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0]; if (len == 64)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; md4_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
} }
else else
{ {
u32 c0[4] = { 0 }; if ((pos + len) < 64)
u32 c1[4] = { 0 }; {
u32 c2[4] = { 0 }; switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos);
u32 c3[4] = { 0 };
switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
md4_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0]; md4_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
} }
} }
@ -434,7 +478,7 @@ DECLSPEC void md4_update_utf16le_swap (md4_ctx_t *ctx, const u32 *w, const int l
md4_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md4_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md4_update_global (md4_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md4_update_global (md4_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -486,7 +530,7 @@ DECLSPEC void md4_update_global (md4_ctx_t *ctx, const GLOBAL_AS u32 *w, const i
md4_update_64 (ctx, w0, w1, w2, w3, len - pos1); md4_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md4_update_global_swap (md4_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md4_update_global_swap (md4_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -572,7 +616,7 @@ DECLSPEC void md4_update_global_swap (md4_ctx_t *ctx, const GLOBAL_AS u32 *w, co
md4_update_64 (ctx, w0, w1, w2, w3, len - pos1); md4_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md4_update_global_utf16le (md4_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md4_update_global_utf16le (md4_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -614,7 +658,7 @@ DECLSPEC void md4_update_global_utf16le (md4_ctx_t *ctx, const GLOBAL_AS u32 *w,
md4_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md4_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -692,7 +736,7 @@ DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, const GLOBAL_AS u3
DECLSPEC void md4_final (md4_ctx_t *ctx) DECLSPEC void md4_final (md4_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos); append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);
@ -754,7 +798,9 @@ DECLSPEC void md4_hmac_init_64 (md4_hmac_ctx_t *ctx, const u32 *w0, const u32 *w
md4_init (&ctx->ipad); md4_init (&ctx->ipad);
md4_update_64 (&ctx->ipad, t0, t1, t2, t3, 64); md4_transform (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad // opad
@ -777,7 +823,9 @@ DECLSPEC void md4_hmac_init_64 (md4_hmac_ctx_t *ctx, const u32 *w0, const u32 *w
md4_init (&ctx->opad); md4_init (&ctx->opad);
md4_update_64 (&ctx->opad, t0, t1, t2, t3, 64); md4_transform (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
} }
DECLSPEC void md4_hmac_init (md4_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md4_hmac_init (md4_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1033,22 +1081,22 @@ DECLSPEC void md4_hmac_update_utf16le_swap (md4_hmac_ctx_t *ctx, const u32 *w, c
md4_update_utf16le_swap (&ctx->ipad, w, len); md4_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_update_global (md4_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md4_hmac_update_global (md4_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
md4_update_global (&ctx->ipad, w, len); md4_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_update_global_swap (md4_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md4_hmac_update_global_swap (md4_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
md4_update_global_swap (&ctx->ipad, w, len); md4_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_update_global_utf16le (md4_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md4_hmac_update_global_utf16le (md4_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
md4_update_global_utf16le (&ctx->ipad, w, len); md4_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_update_global_utf16le_swap (md4_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md4_hmac_update_global_utf16le_swap (md4_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
md4_update_global_utf16le_swap (&ctx->ipad, w, len); md4_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
@ -1057,29 +1105,24 @@ DECLSPEC void md4_hmac_final (md4_hmac_ctx_t *ctx)
{ {
md4_final (&ctx->ipad); md4_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 16;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md4_update_64 (&ctx->opad, t0, t1, t2, t3, 16);
md4_final (&ctx->opad); md4_final (&ctx->opad);
} }
@ -1206,75 +1249,119 @@ DECLSPEC void md4_init_vector_from_scalar (md4_ctx_vector_t *ctx, md4_ctx_t *ctx
DECLSPEC void md4_update_vector_64 (md4_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void md4_update_vector_64 (md4_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
ctx->len += len; ctx->len += len;
if ((pos + len) < 64) if (pos == 0)
{ {
switch_buffer_by_offset_le (w0, w1, w2, w3, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0]; if (len == 64)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; md4_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
} }
else else
{ {
u32x c0[4] = { 0 }; if ((pos + len) < 64)
u32x c1[4] = { 0 }; {
u32x c2[4] = { 0 }; switch_buffer_by_offset_le (w0, w1, w2, w3, pos);
u32x c3[4] = { 0 };
switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
md4_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0]; md4_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
} }
} }
@ -1536,7 +1623,7 @@ DECLSPEC void md4_update_vector_utf16le_swap (md4_ctx_vector_t *ctx, const u32x
DECLSPEC void md4_final_vector (md4_ctx_vector_t *ctx) DECLSPEC void md4_final_vector (md4_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);
@ -1598,7 +1685,9 @@ DECLSPEC void md4_hmac_init_vector_64 (md4_hmac_ctx_vector_t *ctx, const u32x *w
md4_init_vector (&ctx->ipad); md4_init_vector (&ctx->ipad);
md4_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64); md4_transform_vector (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad // opad
@ -1621,7 +1710,9 @@ DECLSPEC void md4_hmac_init_vector_64 (md4_hmac_ctx_vector_t *ctx, const u32x *w
md4_init_vector (&ctx->opad); md4_init_vector (&ctx->opad);
md4_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); md4_transform_vector (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
} }
DECLSPEC void md4_hmac_init_vector (md4_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md4_hmac_init_vector (md4_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -1695,29 +1786,24 @@ DECLSPEC void md4_hmac_final_vector (md4_hmac_ctx_vector_t *ctx)
{ {
md4_final_vector (&ctx->ipad); md4_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 16;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md4_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 16);
md4_final_vector (&ctx->opad); md4_final_vector (&ctx->opad);
} }

View File

@ -101,10 +101,10 @@ DECLSPEC void md4_update (md4_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_update_swap (md4_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md4_update_swap (md4_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_update_utf16le (md4_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md4_update_utf16le (md4_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_update_utf16le_swap (md4_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md4_update_utf16le_swap (md4_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_update_global (md4_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md4_update_global (md4_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md4_update_global_swap (md4_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md4_update_global_swap (md4_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md4_update_global_utf16le (md4_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md4_update_global_utf16le (md4_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md4_final (md4_ctx_t *ctx); DECLSPEC void md4_final (md4_ctx_t *ctx);
DECLSPEC void md4_hmac_init_64 (md4_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3); DECLSPEC void md4_hmac_init_64 (md4_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void md4_hmac_init (md4_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md4_hmac_init (md4_hmac_ctx_t *ctx, const u32 *w, const int len);
@ -116,10 +116,10 @@ DECLSPEC void md4_hmac_update (md4_hmac_ctx_t *ctx, const u32 *w, const int len)
DECLSPEC void md4_hmac_update_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md4_hmac_update_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_hmac_update_utf16le (md4_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md4_hmac_update_utf16le (md4_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_hmac_update_utf16le_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md4_hmac_update_utf16le_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_hmac_update_global (md4_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md4_hmac_update_global (md4_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md4_hmac_update_global_swap (md4_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md4_hmac_update_global_swap (md4_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md4_hmac_update_global_utf16le (md4_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md4_hmac_update_global_utf16le (md4_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md4_hmac_update_global_utf16le_swap (md4_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md4_hmac_update_global_utf16le_swap (md4_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md4_hmac_final (md4_hmac_ctx_t *ctx); DECLSPEC void md4_hmac_final (md4_hmac_ctx_t *ctx);
DECLSPEC void md4_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest); DECLSPEC void md4_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest);
DECLSPEC void md4_init_vector (md4_ctx_vector_t *ctx); DECLSPEC void md4_init_vector (md4_ctx_vector_t *ctx);

View File

@ -142,75 +142,119 @@ DECLSPEC void md5_init (md5_ctx_t *ctx)
DECLSPEC void md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
ctx->len += len; ctx->len += len;
if ((pos + len) < 64) if (pos == 0)
{ {
switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0]; if (len == 64)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; md5_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
} }
else else
{ {
u32 c0[4] = { 0 }; if ((pos + len) < 64)
u32 c1[4] = { 0 }; {
u32 c2[4] = { 0 }; switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos);
u32 c3[4] = { 0 };
switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
md5_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0]; md5_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
} }
} }
@ -470,7 +514,7 @@ DECLSPEC void md5_update_utf16le_swap (md5_ctx_t *ctx, const u32 *w, const int l
md5_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md5_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md5_update_global (md5_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md5_update_global (md5_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -522,7 +566,7 @@ DECLSPEC void md5_update_global (md5_ctx_t *ctx, const GLOBAL_AS u32 *w, const i
md5_update_64 (ctx, w0, w1, w2, w3, len - pos1); md5_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md5_update_global_swap (md5_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md5_update_global_swap (md5_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -608,7 +652,7 @@ DECLSPEC void md5_update_global_swap (md5_ctx_t *ctx, const GLOBAL_AS u32 *w, co
md5_update_64 (ctx, w0, w1, w2, w3, len - pos1); md5_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md5_update_global_utf16le (md5_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md5_update_global_utf16le (md5_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -650,7 +694,7 @@ DECLSPEC void md5_update_global_utf16le (md5_ctx_t *ctx, const GLOBAL_AS u32 *w,
md5_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md5_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -728,7 +772,7 @@ DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, const GLOBAL_AS u3
DECLSPEC void md5_final (md5_ctx_t *ctx) DECLSPEC void md5_final (md5_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos); append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);
@ -790,7 +834,9 @@ DECLSPEC void md5_hmac_init_64 (md5_hmac_ctx_t *ctx, const u32 *w0, const u32 *w
md5_init (&ctx->ipad); md5_init (&ctx->ipad);
md5_update_64 (&ctx->ipad, t0, t1, t2, t3, 64); md5_transform (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad // opad
@ -813,7 +859,9 @@ DECLSPEC void md5_hmac_init_64 (md5_hmac_ctx_t *ctx, const u32 *w0, const u32 *w
md5_init (&ctx->opad); md5_init (&ctx->opad);
md5_update_64 (&ctx->opad, t0, t1, t2, t3, 64); md5_transform (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
} }
DECLSPEC void md5_hmac_init (md5_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md5_hmac_init (md5_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1069,22 +1117,22 @@ DECLSPEC void md5_hmac_update_utf16le_swap (md5_hmac_ctx_t *ctx, const u32 *w, c
md5_update_utf16le_swap (&ctx->ipad, w, len); md5_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_update_global (md5_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md5_hmac_update_global (md5_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
md5_update_global (&ctx->ipad, w, len); md5_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_update_global_swap (md5_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md5_hmac_update_global_swap (md5_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
md5_update_global_swap (&ctx->ipad, w, len); md5_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_update_global_utf16le (md5_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md5_hmac_update_global_utf16le (md5_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
md5_update_global_utf16le (&ctx->ipad, w, len); md5_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_update_global_utf16le_swap (md5_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void md5_hmac_update_global_utf16le_swap (md5_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
md5_update_global_utf16le_swap (&ctx->ipad, w, len); md5_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
@ -1093,29 +1141,24 @@ DECLSPEC void md5_hmac_final (md5_hmac_ctx_t *ctx)
{ {
md5_final (&ctx->ipad); md5_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 16;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md5_update_64 (&ctx->opad, t0, t1, t2, t3, 16);
md5_final (&ctx->opad); md5_final (&ctx->opad);
} }
@ -1278,75 +1321,119 @@ DECLSPEC void md5_init_vector_from_scalar (md5_ctx_vector_t *ctx, md5_ctx_t *ctx
DECLSPEC void md5_update_vector_64 (md5_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void md5_update_vector_64 (md5_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
ctx->len += len; ctx->len += len;
if ((pos + len) < 64) if (pos == 0)
{ {
switch_buffer_by_offset_le (w0, w1, w2, w3, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0]; if (len == 64)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; md5_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
} }
else else
{ {
u32x c0[4] = { 0 }; if ((pos + len) < 64)
u32x c1[4] = { 0 }; {
u32x c2[4] = { 0 }; switch_buffer_by_offset_le (w0, w1, w2, w3, pos);
u32x c3[4] = { 0 };
switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
md5_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0]; md5_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
} }
} }
@ -1608,7 +1695,7 @@ DECLSPEC void md5_update_vector_utf16le_swap (md5_ctx_vector_t *ctx, const u32x
DECLSPEC void md5_final_vector (md5_ctx_vector_t *ctx) DECLSPEC void md5_final_vector (md5_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);
@ -1670,7 +1757,9 @@ DECLSPEC void md5_hmac_init_vector_64 (md5_hmac_ctx_vector_t *ctx, const u32x *w
md5_init_vector (&ctx->ipad); md5_init_vector (&ctx->ipad);
md5_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64); md5_transform_vector (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad // opad
@ -1693,7 +1782,9 @@ DECLSPEC void md5_hmac_init_vector_64 (md5_hmac_ctx_vector_t *ctx, const u32x *w
md5_init_vector (&ctx->opad); md5_init_vector (&ctx->opad);
md5_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); md5_transform_vector (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
} }
DECLSPEC void md5_hmac_init_vector (md5_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md5_hmac_init_vector (md5_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -1767,29 +1858,24 @@ DECLSPEC void md5_hmac_final_vector (md5_hmac_ctx_vector_t *ctx)
{ {
md5_final_vector (&ctx->ipad); md5_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 16;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md5_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 16);
md5_final_vector (&ctx->opad); md5_final_vector (&ctx->opad);
} }

View File

@ -114,10 +114,10 @@ DECLSPEC void md5_update (md5_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_update_swap (md5_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md5_update_swap (md5_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_update_utf16le (md5_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md5_update_utf16le (md5_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_update_utf16le_swap (md5_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md5_update_utf16le_swap (md5_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_update_global (md5_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md5_update_global (md5_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md5_update_global_swap (md5_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md5_update_global_swap (md5_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md5_update_global_utf16le (md5_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md5_update_global_utf16le (md5_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md5_final (md5_ctx_t *ctx); DECLSPEC void md5_final (md5_ctx_t *ctx);
DECLSPEC void md5_hmac_init_64 (md5_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3); DECLSPEC void md5_hmac_init_64 (md5_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void md5_hmac_init (md5_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md5_hmac_init (md5_hmac_ctx_t *ctx, const u32 *w, const int len);
@ -129,10 +129,10 @@ DECLSPEC void md5_hmac_update (md5_hmac_ctx_t *ctx, const u32 *w, const int len)
DECLSPEC void md5_hmac_update_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md5_hmac_update_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_hmac_update_utf16le (md5_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md5_hmac_update_utf16le (md5_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_hmac_update_utf16le_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void md5_hmac_update_utf16le_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_hmac_update_global (md5_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md5_hmac_update_global (md5_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md5_hmac_update_global_swap (md5_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md5_hmac_update_global_swap (md5_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md5_hmac_update_global_utf16le (md5_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md5_hmac_update_global_utf16le (md5_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md5_hmac_update_global_utf16le_swap (md5_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void md5_hmac_update_global_utf16le_swap (md5_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void md5_hmac_final (md5_hmac_ctx_t *ctx); DECLSPEC void md5_hmac_final (md5_hmac_ctx_t *ctx);
DECLSPEC void md5_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest); DECLSPEC void md5_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest);
DECLSPEC void md5_init_vector (md5_ctx_vector_t *ctx); DECLSPEC void md5_init_vector (md5_ctx_vector_t *ctx);

View File

@ -240,75 +240,119 @@ DECLSPEC void ripemd160_init (ripemd160_ctx_t *ctx)
DECLSPEC void ripemd160_update_64 (ripemd160_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void ripemd160_update_64 (ripemd160_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
ctx->len += len; ctx->len += len;
if ((pos + len) < 64) if (pos == 0)
{ {
switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0]; if (len == 64)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; ripemd160_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
} }
else else
{ {
u32 c0[4] = { 0 }; if ((pos + len) < 64)
u32 c1[4] = { 0 }; {
u32 c2[4] = { 0 }; switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos);
u32 c3[4] = { 0 };
switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ripemd160_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0]; ripemd160_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
} }
} }
@ -568,7 +612,7 @@ DECLSPEC void ripemd160_update_utf16le_swap (ripemd160_ctx_t *ctx, const u32 *w,
ripemd160_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); ripemd160_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void ripemd160_update_global (ripemd160_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void ripemd160_update_global (ripemd160_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -620,7 +664,7 @@ DECLSPEC void ripemd160_update_global (ripemd160_ctx_t *ctx, const GLOBAL_AS u32
ripemd160_update_64 (ctx, w0, w1, w2, w3, len - pos1); ripemd160_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void ripemd160_update_global_swap (ripemd160_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void ripemd160_update_global_swap (ripemd160_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -706,7 +750,7 @@ DECLSPEC void ripemd160_update_global_swap (ripemd160_ctx_t *ctx, const GLOBAL_A
ripemd160_update_64 (ctx, w0, w1, w2, w3, len - pos1); ripemd160_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void ripemd160_update_global_utf16le (ripemd160_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void ripemd160_update_global_utf16le (ripemd160_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -748,7 +792,7 @@ DECLSPEC void ripemd160_update_global_utf16le (ripemd160_ctx_t *ctx, const GLOBA
ripemd160_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); ripemd160_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -826,7 +870,7 @@ DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, const
DECLSPEC void ripemd160_final (ripemd160_ctx_t *ctx) DECLSPEC void ripemd160_final (ripemd160_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos); append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);
@ -888,7 +932,9 @@ DECLSPEC void ripemd160_hmac_init_64 (ripemd160_hmac_ctx_t *ctx, const u32 *w0,
ripemd160_init (&ctx->ipad); ripemd160_init (&ctx->ipad);
ripemd160_update_64 (&ctx->ipad, t0, t1, t2, t3, 64); ripemd160_transform (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad // opad
@ -911,7 +957,9 @@ DECLSPEC void ripemd160_hmac_init_64 (ripemd160_hmac_ctx_t *ctx, const u32 *w0,
ripemd160_init (&ctx->opad); ripemd160_init (&ctx->opad);
ripemd160_update_64 (&ctx->opad, t0, t1, t2, t3, 64); ripemd160_transform (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
} }
DECLSPEC void ripemd160_hmac_init (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void ripemd160_hmac_init (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1167,22 +1215,22 @@ DECLSPEC void ripemd160_hmac_update_utf16le_swap (ripemd160_hmac_ctx_t *ctx, con
ripemd160_update_utf16le_swap (&ctx->ipad, w, len); ripemd160_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_update_global (ripemd160_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void ripemd160_hmac_update_global (ripemd160_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
ripemd160_update_global (&ctx->ipad, w, len); ripemd160_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_update_global_swap (ripemd160_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void ripemd160_hmac_update_global_swap (ripemd160_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
ripemd160_update_global_swap (&ctx->ipad, w, len); ripemd160_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_update_global_utf16le (ripemd160_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void ripemd160_hmac_update_global_utf16le (ripemd160_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
ripemd160_update_global_utf16le (&ctx->ipad, w, len); ripemd160_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_update_global_utf16le_swap (ripemd160_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void ripemd160_hmac_update_global_utf16le_swap (ripemd160_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
ripemd160_update_global_utf16le_swap (&ctx->ipad, w, len); ripemd160_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
@ -1191,29 +1239,24 @@ DECLSPEC void ripemd160_hmac_final (ripemd160_hmac_ctx_t *ctx)
{ {
ripemd160_final (&ctx->ipad); ripemd160_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 20;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
ripemd160_update_64 (&ctx->opad, t0, t1, t2, t3, 20);
ripemd160_final (&ctx->opad); ripemd160_final (&ctx->opad);
} }
@ -1475,75 +1518,119 @@ DECLSPEC void ripemd160_init_vector_from_scalar (ripemd160_ctx_vector_t *ctx, ri
DECLSPEC void ripemd160_update_vector_64 (ripemd160_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void ripemd160_update_vector_64 (ripemd160_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
ctx->len += len; ctx->len += len;
if ((pos + len) < 64) if (pos == 0)
{ {
switch_buffer_by_offset_le (w0, w1, w2, w3, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0]; if (len == 64)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; ripemd160_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
} }
else else
{ {
u32x c0[4] = { 0 }; if ((pos + len) < 64)
u32x c1[4] = { 0 }; {
u32x c2[4] = { 0 }; switch_buffer_by_offset_le (w0, w1, w2, w3, pos);
u32x c3[4] = { 0 };
switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ripemd160_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0]; ripemd160_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
} }
} }
@ -1805,7 +1892,7 @@ DECLSPEC void ripemd160_update_vector_utf16le_swap (ripemd160_ctx_vector_t *ctx,
DECLSPEC void ripemd160_final_vector (ripemd160_ctx_vector_t *ctx) DECLSPEC void ripemd160_final_vector (ripemd160_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);
@ -1867,7 +1954,9 @@ DECLSPEC void ripemd160_hmac_init_vector_64 (ripemd160_hmac_ctx_vector_t *ctx, c
ripemd160_init_vector (&ctx->ipad); ripemd160_init_vector (&ctx->ipad);
ripemd160_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64); ripemd160_transform_vector (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad // opad
@ -1890,7 +1979,9 @@ DECLSPEC void ripemd160_hmac_init_vector_64 (ripemd160_hmac_ctx_vector_t *ctx, c
ripemd160_init_vector (&ctx->opad); ripemd160_init_vector (&ctx->opad);
ripemd160_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); ripemd160_transform_vector (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
} }
DECLSPEC void ripemd160_hmac_init_vector (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void ripemd160_hmac_init_vector (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -1964,29 +2055,24 @@ DECLSPEC void ripemd160_hmac_final_vector (ripemd160_hmac_ctx_vector_t *ctx)
{ {
ripemd160_final_vector (&ctx->ipad); ripemd160_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 20;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
ripemd160_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 20);
ripemd160_final_vector (&ctx->opad); ripemd160_final_vector (&ctx->opad);
} }

View File

@ -125,10 +125,10 @@ DECLSPEC void ripemd160_update (ripemd160_ctx_t *ctx, const u32 *w, const int le
DECLSPEC void ripemd160_update_swap (ripemd160_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void ripemd160_update_swap (ripemd160_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_update_utf16le (ripemd160_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void ripemd160_update_utf16le (ripemd160_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_update_utf16le_swap (ripemd160_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void ripemd160_update_utf16le_swap (ripemd160_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_update_global (ripemd160_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void ripemd160_update_global (ripemd160_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void ripemd160_update_global_swap (ripemd160_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void ripemd160_update_global_swap (ripemd160_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void ripemd160_update_global_utf16le (ripemd160_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void ripemd160_update_global_utf16le (ripemd160_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void ripemd160_final (ripemd160_ctx_t *ctx); DECLSPEC void ripemd160_final (ripemd160_ctx_t *ctx);
DECLSPEC void ripemd160_hmac_init_64 (ripemd160_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3); DECLSPEC void ripemd160_hmac_init_64 (ripemd160_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void ripemd160_hmac_init (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void ripemd160_hmac_init (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len);
@ -140,10 +140,10 @@ DECLSPEC void ripemd160_hmac_update (ripemd160_hmac_ctx_t *ctx, const u32 *w, co
DECLSPEC void ripemd160_hmac_update_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void ripemd160_hmac_update_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_utf16le (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void ripemd160_hmac_update_utf16le (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_utf16le_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void ripemd160_hmac_update_utf16le_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_global (ripemd160_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void ripemd160_hmac_update_global (ripemd160_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_global_swap (ripemd160_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void ripemd160_hmac_update_global_swap (ripemd160_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_global_utf16le (ripemd160_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void ripemd160_hmac_update_global_utf16le (ripemd160_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_global_utf16le_swap (ripemd160_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void ripemd160_hmac_update_global_utf16le_swap (ripemd160_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_final (ripemd160_hmac_ctx_t *ctx); DECLSPEC void ripemd160_hmac_final (ripemd160_hmac_ctx_t *ctx);
DECLSPEC void ripemd160_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest); DECLSPEC void ripemd160_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest);
DECLSPEC void ripemd160_init_vector (ripemd160_ctx_vector_t *ctx); DECLSPEC void ripemd160_init_vector (ripemd160_ctx_vector_t *ctx);

View File

@ -172,75 +172,119 @@ DECLSPEC void sha1_init (sha1_ctx_t *ctx)
DECLSPEC void sha1_update_64 (sha1_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void sha1_update_64 (sha1_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
ctx->len += len; ctx->len += len;
if ((pos + len) < 64) if (pos == 0)
{ {
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0]; if (len == 64)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; sha1_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
} }
else else
{ {
u32 c0[4] = { 0 }; if ((pos + len) < 64)
u32 c1[4] = { 0 }; {
u32 c2[4] = { 0 }; switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
u32 c3[4] = { 0 };
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
sha1_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0]; sha1_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
} }
} }
@ -618,7 +662,7 @@ DECLSPEC void sha1_update_utf16be_swap (sha1_ctx_t *ctx, const u32 *w, const int
sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_global (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha1_update_global (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -670,7 +714,7 @@ DECLSPEC void sha1_update_global (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const
sha1_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha1_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha1_update_global_swap (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha1_update_global_swap (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -756,7 +800,7 @@ DECLSPEC void sha1_update_global_swap (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w,
sha1_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha1_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha1_update_global_utf16le (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha1_update_global_utf16le (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -798,7 +842,7 @@ DECLSPEC void sha1_update_global_utf16le (sha1_ctx_t *ctx, const GLOBAL_AS u32 *
sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_global_utf16le_swap (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha1_update_global_utf16le_swap (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -874,7 +918,7 @@ DECLSPEC void sha1_update_global_utf16le_swap (sha1_ctx_t *ctx, const GLOBAL_AS
sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_global_utf16be (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha1_update_global_utf16be (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -916,7 +960,7 @@ DECLSPEC void sha1_update_global_utf16be (sha1_ctx_t *ctx, const GLOBAL_AS u32 *
sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_global_utf16be_swap (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha1_update_global_utf16be_swap (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -994,7 +1038,7 @@ DECLSPEC void sha1_update_global_utf16be_swap (sha1_ctx_t *ctx, const GLOBAL_AS
DECLSPEC void sha1_final (sha1_ctx_t *ctx) DECLSPEC void sha1_final (sha1_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -1056,7 +1100,9 @@ DECLSPEC void sha1_hmac_init_64 (sha1_hmac_ctx_t *ctx, const u32 *w0, const u32
sha1_init (&ctx->ipad); sha1_init (&ctx->ipad);
sha1_update_64 (&ctx->ipad, t0, t1, t2, t3, 64); sha1_transform (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad // opad
@ -1079,7 +1125,9 @@ DECLSPEC void sha1_hmac_init_64 (sha1_hmac_ctx_t *ctx, const u32 *w0, const u32
sha1_init (&ctx->opad); sha1_init (&ctx->opad);
sha1_update_64 (&ctx->opad, t0, t1, t2, t3, 64); sha1_transform (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
} }
DECLSPEC void sha1_hmac_init (sha1_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_hmac_init (sha1_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1335,22 +1383,22 @@ DECLSPEC void sha1_hmac_update_utf16le_swap (sha1_hmac_ctx_t *ctx, const u32 *w,
sha1_update_utf16le_swap (&ctx->ipad, w, len); sha1_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_update_global (sha1_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha1_hmac_update_global (sha1_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha1_update_global (&ctx->ipad, w, len); sha1_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_update_global_swap (sha1_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha1_hmac_update_global_swap (sha1_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha1_update_global_swap (&ctx->ipad, w, len); sha1_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_update_global_utf16le (sha1_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha1_hmac_update_global_utf16le (sha1_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha1_update_global_utf16le (&ctx->ipad, w, len); sha1_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_update_global_utf16le_swap (sha1_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha1_hmac_update_global_utf16le_swap (sha1_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha1_update_global_utf16le_swap (&ctx->ipad, w, len); sha1_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
@ -1359,29 +1407,24 @@ DECLSPEC void sha1_hmac_final (sha1_hmac_ctx_t *ctx)
{ {
sha1_final (&ctx->ipad); sha1_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 20;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha1_update_64 (&ctx->opad, t0, t1, t2, t3, 20);
sha1_final (&ctx->opad); sha1_final (&ctx->opad);
} }
@ -1575,75 +1618,119 @@ DECLSPEC void sha1_init_vector_from_scalar (sha1_ctx_vector_t *ctx, sha1_ctx_t *
DECLSPEC void sha1_update_vector_64 (sha1_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void sha1_update_vector_64 (sha1_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
ctx->len += len; ctx->len += len;
if ((pos + len) < 64) if (pos == 0)
{ {
switch_buffer_by_offset_be (w0, w1, w2, w3, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0]; if (len == 64)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; sha1_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
} }
else else
{ {
u32x c0[4] = { 0 }; if ((pos + len) < 64)
u32x c1[4] = { 0 }; {
u32x c2[4] = { 0 }; switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
u32x c3[4] = { 0 };
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
sha1_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0]; sha1_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
} }
} }
@ -1989,7 +2076,7 @@ DECLSPEC void sha1_update_vector_utf16beN (sha1_ctx_vector_t *ctx, const u32x *w
DECLSPEC void sha1_final_vector (sha1_ctx_vector_t *ctx) DECLSPEC void sha1_final_vector (sha1_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -2051,7 +2138,9 @@ DECLSPEC void sha1_hmac_init_vector_64 (sha1_hmac_ctx_vector_t *ctx, const u32x
sha1_init_vector (&ctx->ipad); sha1_init_vector (&ctx->ipad);
sha1_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64); sha1_transform_vector (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad // opad
@ -2074,7 +2163,9 @@ DECLSPEC void sha1_hmac_init_vector_64 (sha1_hmac_ctx_vector_t *ctx, const u32x
sha1_init_vector (&ctx->opad); sha1_init_vector (&ctx->opad);
sha1_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); sha1_transform_vector (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
} }
DECLSPEC void sha1_hmac_init_vector (sha1_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha1_hmac_init_vector (sha1_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -2148,29 +2239,24 @@ DECLSPEC void sha1_hmac_final_vector (sha1_hmac_ctx_vector_t *ctx)
{ {
sha1_final_vector (&ctx->ipad); sha1_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 20;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha1_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 20);
sha1_final_vector (&ctx->opad); sha1_final_vector (&ctx->opad);
} }

View File

@ -111,12 +111,12 @@ DECLSPEC void sha1_update_utf16le (sha1_ctx_t *ctx, const u32 *w, const int len)
DECLSPEC void sha1_update_utf16le_swap (sha1_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha1_update_utf16le_swap (sha1_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_update_utf16be (sha1_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha1_update_utf16be (sha1_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_update_utf16be_swap (sha1_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha1_update_utf16be_swap (sha1_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_update_global (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha1_update_global (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha1_update_global_swap (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha1_update_global_swap (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha1_update_global_utf16le (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha1_update_global_utf16le (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha1_update_global_utf16le_swap (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha1_update_global_utf16le_swap (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha1_update_global_utf16be (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha1_update_global_utf16be (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha1_update_global_utf16be_swap (sha1_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha1_update_global_utf16be_swap (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha1_final (sha1_ctx_t *ctx); DECLSPEC void sha1_final (sha1_ctx_t *ctx);
DECLSPEC void sha1_hmac_init_64 (sha1_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3); DECLSPEC void sha1_hmac_init_64 (sha1_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void sha1_hmac_init (sha1_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha1_hmac_init (sha1_hmac_ctx_t *ctx, const u32 *w, const int len);
@ -128,10 +128,10 @@ DECLSPEC void sha1_hmac_update (sha1_hmac_ctx_t *ctx, const u32 *w, const int le
DECLSPEC void sha1_hmac_update_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha1_hmac_update_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_hmac_update_utf16le (sha1_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha1_hmac_update_utf16le (sha1_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_hmac_update_utf16le_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha1_hmac_update_utf16le_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_hmac_update_global (sha1_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha1_hmac_update_global (sha1_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha1_hmac_update_global_swap (sha1_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha1_hmac_update_global_swap (sha1_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha1_hmac_update_global_utf16le (sha1_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha1_hmac_update_global_utf16le (sha1_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha1_hmac_update_global_utf16le_swap (sha1_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha1_hmac_update_global_utf16le_swap (sha1_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha1_hmac_final (sha1_hmac_ctx_t *ctx); DECLSPEC void sha1_hmac_final (sha1_hmac_ctx_t *ctx);
DECLSPEC void sha1_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest); DECLSPEC void sha1_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest);
DECLSPEC void sha1_init_vector (sha1_ctx_vector_t *ctx); DECLSPEC void sha1_init_vector (sha1_ctx_vector_t *ctx);

View File

@ -8,6 +8,26 @@
#include "inc_common.h" #include "inc_common.h"
#include "inc_hash_sha224.h" #include "inc_hash_sha224.h"
CONSTANT_AS u32a k_sha224[64] =
{
SHA224C00, SHA224C01, SHA224C02, SHA224C03,
SHA224C04, SHA224C05, SHA224C06, SHA224C07,
SHA224C08, SHA224C09, SHA224C0a, SHA224C0b,
SHA224C0c, SHA224C0d, SHA224C0e, SHA224C0f,
SHA224C10, SHA224C11, SHA224C12, SHA224C13,
SHA224C14, SHA224C15, SHA224C16, SHA224C17,
SHA224C18, SHA224C19, SHA224C1a, SHA224C1b,
SHA224C1c, SHA224C1d, SHA224C1e, SHA224C1f,
SHA224C20, SHA224C21, SHA224C22, SHA224C23,
SHA224C24, SHA224C25, SHA224C26, SHA224C27,
SHA224C28, SHA224C29, SHA224C2a, SHA224C2b,
SHA224C2c, SHA224C2d, SHA224C2e, SHA224C2f,
SHA224C30, SHA224C31, SHA224C32, SHA224C33,
SHA224C34, SHA224C35, SHA224C36, SHA224C37,
SHA224C38, SHA224C39, SHA224C3a, SHA224C3b,
SHA224C3c, SHA224C3d, SHA224C3e, SHA224C3f,
};
// important notes on this: // important notes on this:
// input buf unused bytes needs to be set to zero // input buf unused bytes needs to be set to zero
// input buf needs to be in algorithm native byte order (md5 = LE, sha1 = BE, etc) // input buf needs to be in algorithm native byte order (md5 = LE, sha1 = BE, etc)
@ -137,75 +157,119 @@ DECLSPEC void sha224_init (sha224_ctx_t *ctx)
DECLSPEC void sha224_update_64 (sha224_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void sha224_update_64 (sha224_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
ctx->len += len; ctx->len += len;
if ((pos + len) < 64) if (pos == 0)
{ {
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0]; if (len == 64)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; sha224_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
} }
else else
{ {
u32 c0[4] = { 0 }; if ((pos + len) < 64)
u32 c1[4] = { 0 }; {
u32 c2[4] = { 0 }; switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
u32 c3[4] = { 0 };
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
sha224_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0]; sha224_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
} }
} }
@ -465,7 +529,7 @@ DECLSPEC void sha224_update_utf16le_swap (sha224_ctx_t *ctx, const u32 *w, const
sha224_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha224_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha224_update_global (sha224_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha224_update_global (sha224_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -517,7 +581,7 @@ DECLSPEC void sha224_update_global (sha224_ctx_t *ctx, const GLOBAL_AS u32 *w, c
sha224_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha224_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha224_update_global_swap (sha224_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha224_update_global_swap (sha224_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -603,7 +667,7 @@ DECLSPEC void sha224_update_global_swap (sha224_ctx_t *ctx, const GLOBAL_AS u32
sha224_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha224_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha224_update_global_utf16le (sha224_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha224_update_global_utf16le (sha224_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -645,7 +709,7 @@ DECLSPEC void sha224_update_global_utf16le (sha224_ctx_t *ctx, const GLOBAL_AS u
sha224_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha224_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -723,7 +787,7 @@ DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, const GLOBAL
DECLSPEC void sha224_final (sha224_ctx_t *ctx) DECLSPEC void sha224_final (sha224_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -785,7 +849,9 @@ DECLSPEC void sha224_hmac_init_64 (sha224_hmac_ctx_t *ctx, const u32 *w0, const
sha224_init (&ctx->ipad); sha224_init (&ctx->ipad);
sha224_update_64 (&ctx->ipad, t0, t1, t2, t3, 64); sha224_transform (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad // opad
@ -808,7 +874,9 @@ DECLSPEC void sha224_hmac_init_64 (sha224_hmac_ctx_t *ctx, const u32 *w0, const
sha224_init (&ctx->opad); sha224_init (&ctx->opad);
sha224_update_64 (&ctx->opad, t0, t1, t2, t3, 64); sha224_transform (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
} }
DECLSPEC void sha224_hmac_init (sha224_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha224_hmac_init (sha224_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1064,22 +1132,22 @@ DECLSPEC void sha224_hmac_update_utf16le_swap (sha224_hmac_ctx_t *ctx, const u32
sha224_update_utf16le_swap (&ctx->ipad, w, len); sha224_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_update_global (sha224_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha224_hmac_update_global (sha224_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha224_update_global (&ctx->ipad, w, len); sha224_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_update_global_swap (sha224_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha224_hmac_update_global_swap (sha224_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha224_update_global_swap (&ctx->ipad, w, len); sha224_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_update_global_utf16le (sha224_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha224_hmac_update_global_utf16le (sha224_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha224_update_global_utf16le (&ctx->ipad, w, len); sha224_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_update_global_utf16le_swap (sha224_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha224_hmac_update_global_utf16le_swap (sha224_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha224_update_global_utf16le_swap (&ctx->ipad, w, len); sha224_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
@ -1088,29 +1156,24 @@ DECLSPEC void sha224_hmac_final (sha224_hmac_ctx_t *ctx)
{ {
sha224_final (&ctx->ipad); sha224_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = ctx->ipad.h[5];
ctx->opad.w1[2] = ctx->ipad.h[6];
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 28;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = ctx->ipad.h[5];
t1[2] = ctx->ipad.h[6];
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha224_update_64 (&ctx->opad, t0, t1, t2, t3, 28);
sha224_final (&ctx->opad); sha224_final (&ctx->opad);
} }
@ -1272,75 +1335,119 @@ DECLSPEC void sha224_init_vector_from_scalar (sha224_ctx_vector_t *ctx, sha224_c
DECLSPEC void sha224_update_vector_64 (sha224_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void sha224_update_vector_64 (sha224_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
ctx->len += len; ctx->len += len;
if ((pos + len) < 64) if (pos == 0)
{ {
switch_buffer_by_offset_be (w0, w1, w2, w3, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0]; if (len == 64)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; sha224_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
} }
else else
{ {
u32x c0[4] = { 0 }; if ((pos + len) < 64)
u32x c1[4] = { 0 }; {
u32x c2[4] = { 0 }; switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
u32x c3[4] = { 0 };
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
sha224_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0]; sha224_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
} }
} }
@ -1644,7 +1751,7 @@ DECLSPEC void sha224_update_vector_utf16beN (sha224_ctx_vector_t *ctx, const u32
DECLSPEC void sha224_final_vector (sha224_ctx_vector_t *ctx) DECLSPEC void sha224_final_vector (sha224_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -1706,7 +1813,9 @@ DECLSPEC void sha224_hmac_init_vector_64 (sha224_hmac_ctx_vector_t *ctx, const u
sha224_init_vector (&ctx->ipad); sha224_init_vector (&ctx->ipad);
sha224_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64); sha224_transform_vector (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad // opad
@ -1729,7 +1838,9 @@ DECLSPEC void sha224_hmac_init_vector_64 (sha224_hmac_ctx_vector_t *ctx, const u
sha224_init_vector (&ctx->opad); sha224_init_vector (&ctx->opad);
sha224_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); sha224_transform_vector (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
} }
DECLSPEC void sha224_hmac_init_vector (sha224_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha224_hmac_init_vector (sha224_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -1803,29 +1914,24 @@ DECLSPEC void sha224_hmac_final_vector (sha224_hmac_ctx_vector_t *ctx)
{ {
sha224_final_vector (&ctx->ipad); sha224_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = ctx->ipad.h[5];
ctx->opad.w1[2] = ctx->ipad.h[6];
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 28;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = ctx->ipad.h[5];
t1[2] = ctx->ipad.h[6];
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha224_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 28);
sha224_final_vector (&ctx->opad); sha224_final_vector (&ctx->opad);
} }

View File

@ -59,26 +59,6 @@
#define SHA224_EXPAND(x,y,z,w) (SHA224_S1 (x) + y + SHA224_S0 (z) + w) #define SHA224_EXPAND(x,y,z,w) (SHA224_S1 (x) + y + SHA224_S0 (z) + w)
CONSTANT_AS u32a k_sha224[64] =
{
SHA224C00, SHA224C01, SHA224C02, SHA224C03,
SHA224C04, SHA224C05, SHA224C06, SHA224C07,
SHA224C08, SHA224C09, SHA224C0a, SHA224C0b,
SHA224C0c, SHA224C0d, SHA224C0e, SHA224C0f,
SHA224C10, SHA224C11, SHA224C12, SHA224C13,
SHA224C14, SHA224C15, SHA224C16, SHA224C17,
SHA224C18, SHA224C19, SHA224C1a, SHA224C1b,
SHA224C1c, SHA224C1d, SHA224C1e, SHA224C1f,
SHA224C20, SHA224C21, SHA224C22, SHA224C23,
SHA224C24, SHA224C25, SHA224C26, SHA224C27,
SHA224C28, SHA224C29, SHA224C2a, SHA224C2b,
SHA224C2c, SHA224C2d, SHA224C2e, SHA224C2f,
SHA224C30, SHA224C31, SHA224C32, SHA224C33,
SHA224C34, SHA224C35, SHA224C36, SHA224C37,
SHA224C38, SHA224C39, SHA224C3a, SHA224C3b,
SHA224C3c, SHA224C3d, SHA224C3e, SHA224C3f,
};
typedef struct sha224_ctx typedef struct sha224_ctx
{ {
u32 h[8]; u32 h[8];
@ -126,10 +106,10 @@ DECLSPEC void sha224_update (sha224_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_update_swap (sha224_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha224_update_swap (sha224_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_update_utf16le (sha224_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha224_update_utf16le (sha224_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_update_utf16le_swap (sha224_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha224_update_utf16le_swap (sha224_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_update_global (sha224_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha224_update_global (sha224_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha224_update_global_swap (sha224_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha224_update_global_swap (sha224_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha224_update_global_utf16le (sha224_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha224_update_global_utf16le (sha224_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha224_final (sha224_ctx_t *ctx); DECLSPEC void sha224_final (sha224_ctx_t *ctx);
DECLSPEC void sha224_hmac_init_64 (sha224_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3); DECLSPEC void sha224_hmac_init_64 (sha224_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void sha224_hmac_init (sha224_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha224_hmac_init (sha224_hmac_ctx_t *ctx, const u32 *w, const int len);
@ -141,10 +121,10 @@ DECLSPEC void sha224_hmac_update (sha224_hmac_ctx_t *ctx, const u32 *w, const in
DECLSPEC void sha224_hmac_update_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha224_hmac_update_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_hmac_update_utf16le (sha224_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha224_hmac_update_utf16le (sha224_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_hmac_update_utf16le_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha224_hmac_update_utf16le_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_hmac_update_global (sha224_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha224_hmac_update_global (sha224_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha224_hmac_update_global_swap (sha224_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha224_hmac_update_global_swap (sha224_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha224_hmac_update_global_utf16le (sha224_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha224_hmac_update_global_utf16le (sha224_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha224_hmac_update_global_utf16le_swap (sha224_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha224_hmac_update_global_utf16le_swap (sha224_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha224_hmac_final (sha224_hmac_ctx_t *ctx); DECLSPEC void sha224_hmac_final (sha224_hmac_ctx_t *ctx);
DECLSPEC void sha224_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest); DECLSPEC void sha224_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest);
DECLSPEC void sha224_init_vector (sha224_ctx_vector_t *ctx); DECLSPEC void sha224_init_vector (sha224_ctx_vector_t *ctx);

View File

@ -8,6 +8,26 @@
#include "inc_common.h" #include "inc_common.h"
#include "inc_hash_sha256.h" #include "inc_hash_sha256.h"
CONSTANT_AS u32a k_sha256[64] =
{
SHA256C00, SHA256C01, SHA256C02, SHA256C03,
SHA256C04, SHA256C05, SHA256C06, SHA256C07,
SHA256C08, SHA256C09, SHA256C0a, SHA256C0b,
SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f,
SHA256C10, SHA256C11, SHA256C12, SHA256C13,
SHA256C14, SHA256C15, SHA256C16, SHA256C17,
SHA256C18, SHA256C19, SHA256C1a, SHA256C1b,
SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f,
SHA256C20, SHA256C21, SHA256C22, SHA256C23,
SHA256C24, SHA256C25, SHA256C26, SHA256C27,
SHA256C28, SHA256C29, SHA256C2a, SHA256C2b,
SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f,
SHA256C30, SHA256C31, SHA256C32, SHA256C33,
SHA256C34, SHA256C35, SHA256C36, SHA256C37,
SHA256C38, SHA256C39, SHA256C3a, SHA256C3b,
SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f,
};
// important notes on this: // important notes on this:
// input buf unused bytes needs to be set to zero // input buf unused bytes needs to be set to zero
// input buf needs to be in algorithm native byte order (md5 = LE, sha256 = BE, etc) // input buf needs to be in algorithm native byte order (md5 = LE, sha256 = BE, etc)
@ -137,75 +157,119 @@ DECLSPEC void sha256_init (sha256_ctx_t *ctx)
DECLSPEC void sha256_update_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void sha256_update_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
ctx->len += len; ctx->len += len;
if ((pos + len) < 64) if (pos == 0)
{ {
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0]; if (len == 64)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; sha256_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
} }
else else
{ {
u32 c0[4] = { 0 }; if ((pos + len) < 64)
u32 c1[4] = { 0 }; {
u32 c2[4] = { 0 }; switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
u32 c3[4] = { 0 };
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
sha256_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0]; sha256_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
} }
} }
@ -465,7 +529,7 @@ DECLSPEC void sha256_update_utf16le_swap (sha256_ctx_t *ctx, const u32 *w, const
sha256_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha256_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha256_update_global (sha256_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha256_update_global (sha256_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -517,7 +581,7 @@ DECLSPEC void sha256_update_global (sha256_ctx_t *ctx, const GLOBAL_AS u32 *w, c
sha256_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha256_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha256_update_global_swap (sha256_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha256_update_global_swap (sha256_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -603,7 +667,7 @@ DECLSPEC void sha256_update_global_swap (sha256_ctx_t *ctx, const GLOBAL_AS u32
sha256_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha256_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha256_update_global_utf16le (sha256_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha256_update_global_utf16le (sha256_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -645,7 +709,7 @@ DECLSPEC void sha256_update_global_utf16le (sha256_ctx_t *ctx, const GLOBAL_AS u
sha256_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha256_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -723,7 +787,7 @@ DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, const GLOBAL
DECLSPEC void sha256_final (sha256_ctx_t *ctx) DECLSPEC void sha256_final (sha256_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -785,7 +849,9 @@ DECLSPEC void sha256_hmac_init_64 (sha256_hmac_ctx_t *ctx, const u32 *w0, const
sha256_init (&ctx->ipad); sha256_init (&ctx->ipad);
sha256_update_64 (&ctx->ipad, t0, t1, t2, t3, 64); sha256_transform (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad // opad
@ -808,7 +874,9 @@ DECLSPEC void sha256_hmac_init_64 (sha256_hmac_ctx_t *ctx, const u32 *w0, const
sha256_init (&ctx->opad); sha256_init (&ctx->opad);
sha256_update_64 (&ctx->opad, t0, t1, t2, t3, 64); sha256_transform (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
} }
DECLSPEC void sha256_hmac_init (sha256_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha256_hmac_init (sha256_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1064,22 +1132,22 @@ DECLSPEC void sha256_hmac_update_utf16le_swap (sha256_hmac_ctx_t *ctx, const u32
sha256_update_utf16le_swap (&ctx->ipad, w, len); sha256_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_update_global (sha256_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha256_hmac_update_global (sha256_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha256_update_global (&ctx->ipad, w, len); sha256_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_update_global_swap (sha256_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha256_hmac_update_global_swap (sha256_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha256_update_global_swap (&ctx->ipad, w, len); sha256_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_update_global_utf16le (sha256_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha256_hmac_update_global_utf16le (sha256_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha256_update_global_utf16le (&ctx->ipad, w, len); sha256_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_update_global_utf16le_swap (sha256_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha256_hmac_update_global_utf16le_swap (sha256_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha256_update_global_utf16le_swap (&ctx->ipad, w, len); sha256_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
@ -1088,29 +1156,24 @@ DECLSPEC void sha256_hmac_final (sha256_hmac_ctx_t *ctx)
{ {
sha256_final (&ctx->ipad); sha256_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = ctx->ipad.h[5];
ctx->opad.w1[2] = ctx->ipad.h[6];
ctx->opad.w1[3] = ctx->ipad.h[7];
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 32;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = ctx->ipad.h[5];
t1[2] = ctx->ipad.h[6];
t1[3] = ctx->ipad.h[7];
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha256_update_64 (&ctx->opad, t0, t1, t2, t3, 32);
sha256_final (&ctx->opad); sha256_final (&ctx->opad);
} }
@ -1272,75 +1335,119 @@ DECLSPEC void sha256_init_vector_from_scalar (sha256_ctx_vector_t *ctx, sha256_c
DECLSPEC void sha256_update_vector_64 (sha256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void sha256_update_vector_64 (sha256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
ctx->len += len; ctx->len += len;
if ((pos + len) < 64) if (pos == 0)
{ {
switch_buffer_by_offset_be (w0, w1, w2, w3, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0]; if (len == 64)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; sha256_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
} }
else else
{ {
u32x c0[4] = { 0 }; if ((pos + len) < 64)
u32x c1[4] = { 0 }; {
u32x c2[4] = { 0 }; switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
u32x c3[4] = { 0 };
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
sha256_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0]; sha256_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
} }
} }
@ -1644,7 +1751,7 @@ DECLSPEC void sha256_update_vector_utf16beN (sha256_ctx_vector_t *ctx, const u32
DECLSPEC void sha256_final_vector (sha256_ctx_vector_t *ctx) DECLSPEC void sha256_final_vector (sha256_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; MAYBE_VOLATILE const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -1706,7 +1813,9 @@ DECLSPEC void sha256_hmac_init_vector_64 (sha256_hmac_ctx_vector_t *ctx, const u
sha256_init_vector (&ctx->ipad); sha256_init_vector (&ctx->ipad);
sha256_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64); sha256_transform_vector (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad // opad
@ -1729,7 +1838,9 @@ DECLSPEC void sha256_hmac_init_vector_64 (sha256_hmac_ctx_vector_t *ctx, const u
sha256_init_vector (&ctx->opad); sha256_init_vector (&ctx->opad);
sha256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); sha256_transform_vector (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
} }
DECLSPEC void sha256_hmac_init_vector (sha256_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha256_hmac_init_vector (sha256_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -1803,29 +1914,24 @@ DECLSPEC void sha256_hmac_final_vector (sha256_hmac_ctx_vector_t *ctx)
{ {
sha256_final_vector (&ctx->ipad); sha256_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = ctx->ipad.h[5];
ctx->opad.w1[2] = ctx->ipad.h[6];
ctx->opad.w1[3] = ctx->ipad.h[7];
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 32;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = ctx->ipad.h[5];
t1[2] = ctx->ipad.h[6];
t1[3] = ctx->ipad.h[7];
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 32);
sha256_final_vector (&ctx->opad); sha256_final_vector (&ctx->opad);
} }

View File

@ -99,26 +99,6 @@ typedef struct sha256_hmac_ctx_vector
} sha256_hmac_ctx_vector_t; } sha256_hmac_ctx_vector_t;
CONSTANT_AS u32a k_sha256[64] =
{
SHA256C00, SHA256C01, SHA256C02, SHA256C03,
SHA256C04, SHA256C05, SHA256C06, SHA256C07,
SHA256C08, SHA256C09, SHA256C0a, SHA256C0b,
SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f,
SHA256C10, SHA256C11, SHA256C12, SHA256C13,
SHA256C14, SHA256C15, SHA256C16, SHA256C17,
SHA256C18, SHA256C19, SHA256C1a, SHA256C1b,
SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f,
SHA256C20, SHA256C21, SHA256C22, SHA256C23,
SHA256C24, SHA256C25, SHA256C26, SHA256C27,
SHA256C28, SHA256C29, SHA256C2a, SHA256C2b,
SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f,
SHA256C30, SHA256C31, SHA256C32, SHA256C33,
SHA256C34, SHA256C35, SHA256C36, SHA256C37,
SHA256C38, SHA256C39, SHA256C3a, SHA256C3b,
SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f,
};
DECLSPEC void sha256_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest); DECLSPEC void sha256_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest);
DECLSPEC void sha256_init (sha256_ctx_t *ctx); DECLSPEC void sha256_init (sha256_ctx_t *ctx);
DECLSPEC void sha256_update_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len); DECLSPEC void sha256_update_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
@ -126,10 +106,10 @@ DECLSPEC void sha256_update (sha256_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_update_swap (sha256_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha256_update_swap (sha256_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_update_utf16le (sha256_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha256_update_utf16le (sha256_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_update_utf16le_swap (sha256_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha256_update_utf16le_swap (sha256_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_update_global (sha256_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha256_update_global (sha256_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha256_update_global_swap (sha256_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha256_update_global_swap (sha256_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha256_update_global_utf16le (sha256_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha256_update_global_utf16le (sha256_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha256_final (sha256_ctx_t *ctx); DECLSPEC void sha256_final (sha256_ctx_t *ctx);
DECLSPEC void sha256_hmac_init_64 (sha256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3); DECLSPEC void sha256_hmac_init_64 (sha256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void sha256_hmac_init (sha256_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha256_hmac_init (sha256_hmac_ctx_t *ctx, const u32 *w, const int len);
@ -141,10 +121,10 @@ DECLSPEC void sha256_hmac_update (sha256_hmac_ctx_t *ctx, const u32 *w, const in
DECLSPEC void sha256_hmac_update_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha256_hmac_update_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_hmac_update_utf16le (sha256_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha256_hmac_update_utf16le (sha256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_hmac_update_utf16le_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha256_hmac_update_utf16le_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_hmac_update_global (sha256_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha256_hmac_update_global (sha256_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha256_hmac_update_global_swap (sha256_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha256_hmac_update_global_swap (sha256_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha256_hmac_update_global_utf16le (sha256_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha256_hmac_update_global_utf16le (sha256_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha256_hmac_update_global_utf16le_swap (sha256_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha256_hmac_update_global_utf16le_swap (sha256_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha256_hmac_final (sha256_hmac_ctx_t *ctx); DECLSPEC void sha256_hmac_final (sha256_hmac_ctx_t *ctx);
DECLSPEC void sha256_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest); DECLSPEC void sha256_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest);
DECLSPEC void sha256_init_vector (sha256_ctx_vector_t *ctx); DECLSPEC void sha256_init_vector (sha256_ctx_vector_t *ctx);

View File

@ -8,6 +8,30 @@
#include "inc_common.h" #include "inc_common.h"
#include "inc_hash_sha384.h" #include "inc_hash_sha384.h"
CONSTANT_AS u64a k_sha384[80] =
{
SHA512C00, SHA512C01, SHA512C02, SHA512C03,
SHA512C04, SHA512C05, SHA512C06, SHA512C07,
SHA512C08, SHA512C09, SHA512C0a, SHA512C0b,
SHA512C0c, SHA512C0d, SHA512C0e, SHA512C0f,
SHA512C10, SHA512C11, SHA512C12, SHA512C13,
SHA512C14, SHA512C15, SHA512C16, SHA512C17,
SHA512C18, SHA512C19, SHA512C1a, SHA512C1b,
SHA512C1c, SHA512C1d, SHA512C1e, SHA512C1f,
SHA512C20, SHA512C21, SHA512C22, SHA512C23,
SHA512C24, SHA512C25, SHA512C26, SHA512C27,
SHA512C28, SHA512C29, SHA512C2a, SHA512C2b,
SHA512C2c, SHA512C2d, SHA512C2e, SHA512C2f,
SHA512C30, SHA512C31, SHA512C32, SHA512C33,
SHA512C34, SHA512C35, SHA512C36, SHA512C37,
SHA512C38, SHA512C39, SHA512C3a, SHA512C3b,
SHA512C3c, SHA512C3d, SHA512C3e, SHA512C3f,
SHA512C40, SHA512C41, SHA512C42, SHA512C43,
SHA512C44, SHA512C45, SHA512C46, SHA512C47,
SHA512C48, SHA512C49, SHA512C4a, SHA512C4b,
SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f,
};
// important notes on this: // important notes on this:
// input buf unused bytes needs to be set to zero // input buf unused bytes needs to be set to zero
// input buf needs to be in algorithm native byte order (md5 = LE, sha1 = BE, etc) // input buf needs to be in algorithm native byte order (md5 = LE, sha1 = BE, etc)
@ -153,127 +177,203 @@ DECLSPEC void sha384_init (sha384_ctx_t *ctx)
DECLSPEC void sha384_update_128 (sha384_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len) DECLSPEC void sha384_update_128 (sha384_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len)
{ {
const int pos = ctx->len & 127; MAYBE_VOLATILE const int pos = ctx->len & 127;
ctx->len += len; ctx->len += len;
if ((pos + len) < 128) if (pos == 0)
{ {
switch_buffer_by_offset_8x4_be_S (w0, w1, w2, w3, w4, w5, w6, w7, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w4[0] = w4[0];
ctx->w4[1] = w4[1];
ctx->w4[2] = w4[2];
ctx->w4[3] = w4[3];
ctx->w5[0] = w5[0];
ctx->w5[1] = w5[1];
ctx->w5[2] = w5[2];
ctx->w5[3] = w5[3];
ctx->w6[0] = w6[0];
ctx->w6[1] = w6[1];
ctx->w6[2] = w6[2];
ctx->w6[3] = w6[3];
ctx->w7[0] = w7[0];
ctx->w7[1] = w7[1];
ctx->w7[2] = w7[2];
ctx->w7[3] = w7[3];
ctx->w0[0] |= w0[0]; if (len == 128)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; sha384_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w4[0] |= w4[0]; ctx->w3[0] = 0;
ctx->w4[1] |= w4[1]; ctx->w3[1] = 0;
ctx->w4[2] |= w4[2]; ctx->w3[2] = 0;
ctx->w4[3] |= w4[3]; ctx->w3[3] = 0;
ctx->w5[0] |= w5[0]; ctx->w4[0] = 0;
ctx->w5[1] |= w5[1]; ctx->w4[1] = 0;
ctx->w5[2] |= w5[2]; ctx->w4[2] = 0;
ctx->w5[3] |= w5[3]; ctx->w4[3] = 0;
ctx->w6[0] |= w6[0]; ctx->w5[0] = 0;
ctx->w6[1] |= w6[1]; ctx->w5[1] = 0;
ctx->w6[2] |= w6[2]; ctx->w5[2] = 0;
ctx->w6[3] |= w6[3]; ctx->w5[3] = 0;
ctx->w7[0] |= w7[0]; ctx->w6[0] = 0;
ctx->w7[1] |= w7[1]; ctx->w6[1] = 0;
ctx->w7[2] |= w7[2]; ctx->w6[2] = 0;
ctx->w7[3] |= w7[3]; ctx->w6[3] = 0;
ctx->w7[0] = 0;
ctx->w7[1] = 0;
ctx->w7[2] = 0;
ctx->w7[3] = 0;
}
} }
else else
{ {
u32 c0[4] = { 0 }; if ((pos + len) < 128)
u32 c1[4] = { 0 }; {
u32 c2[4] = { 0 }; switch_buffer_by_offset_8x4_be_S (w0, w1, w2, w3, w4, w5, w6, w7, pos);
u32 c3[4] = { 0 };
u32 c4[4] = { 0 };
u32 c5[4] = { 0 };
u32 c6[4] = { 0 };
u32 c7[4] = { 0 };
switch_buffer_by_offset_8x4_carry_be_S (w0, w1, w2, w3, w4, w5, w6, w7, c0, c1, c2, c3, c4, c5, c6, c7, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
u32 c4[4] = { 0 };
u32 c5[4] = { 0 };
u32 c6[4] = { 0 };
u32 c7[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_8x4_carry_be_S (w0, w1, w2, w3, w4, w5, w6, w7, c0, c1, c2, c3, c4, c5, c6, c7, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
sha384_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
ctx->w0[0] = c0[0]; sha384_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w4[0] = c4[0]; ctx->w3[2] = c3[2];
ctx->w4[1] = c4[1]; ctx->w3[3] = c3[3];
ctx->w4[2] = c4[2]; ctx->w4[0] = c4[0];
ctx->w4[3] = c4[3]; ctx->w4[1] = c4[1];
ctx->w5[0] = c5[0]; ctx->w4[2] = c4[2];
ctx->w5[1] = c5[1]; ctx->w4[3] = c4[3];
ctx->w5[2] = c5[2]; ctx->w5[0] = c5[0];
ctx->w5[3] = c5[3]; ctx->w5[1] = c5[1];
ctx->w6[0] = c6[0]; ctx->w5[2] = c5[2];
ctx->w6[1] = c6[1]; ctx->w5[3] = c5[3];
ctx->w6[2] = c6[2]; ctx->w6[0] = c6[0];
ctx->w6[3] = c6[3]; ctx->w6[1] = c6[1];
ctx->w7[0] = c7[0]; ctx->w6[2] = c6[2];
ctx->w7[1] = c7[1]; ctx->w6[3] = c6[3];
ctx->w7[2] = c7[2]; ctx->w7[0] = c7[0];
ctx->w7[3] = c7[3]; ctx->w7[1] = c7[1];
ctx->w7[2] = c7[2];
ctx->w7[3] = c7[3];
}
} }
} }
@ -717,7 +817,7 @@ DECLSPEC void sha384_update_utf16le_swap (sha384_ctx_t *ctx, const u32 *w, const
sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha384_update_global (sha384_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha384_update_global (sha384_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -805,7 +905,7 @@ DECLSPEC void sha384_update_global (sha384_ctx_t *ctx, const GLOBAL_AS u32 *w, c
sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha384_update_global_swap (sha384_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha384_update_global_swap (sha384_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -959,7 +1059,7 @@ DECLSPEC void sha384_update_global_swap (sha384_ctx_t *ctx, const GLOBAL_AS u32
sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha384_update_global_utf16le (sha384_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha384_update_global_utf16le (sha384_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -1025,7 +1125,7 @@ DECLSPEC void sha384_update_global_utf16le (sha384_ctx_t *ctx, const GLOBAL_AS u
sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -1159,7 +1259,7 @@ DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, const GLOBAL
DECLSPEC void sha384_final (sha384_ctx_t *ctx) DECLSPEC void sha384_final (sha384_ctx_t *ctx)
{ {
const int pos = ctx->len & 127; MAYBE_VOLATILE const int pos = ctx->len & 127;
append_0x80_8x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3); append_0x80_8x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3);
@ -1257,7 +1357,9 @@ DECLSPEC void sha384_hmac_init_128 (sha384_hmac_ctx_t *ctx, const u32 *w0, const
sha384_init (&ctx->ipad); sha384_init (&ctx->ipad);
sha384_update_128 (&ctx->ipad, t0, t1, t2, t3, t4, t5, t6, t7, 128); sha384_transform (t0, t1, t2, t3, t4, t5, t6, t7, ctx->ipad.h);
ctx->ipad.len = 128;
// opad // opad
@ -1296,7 +1398,9 @@ DECLSPEC void sha384_hmac_init_128 (sha384_hmac_ctx_t *ctx, const u32 *w0, const
sha384_init (&ctx->opad); sha384_init (&ctx->opad);
sha384_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128); sha384_transform (t0, t1, t2, t3, t4, t5, t6, t7, ctx->opad.h);
ctx->opad.len = 128;
} }
DECLSPEC void sha384_hmac_init (sha384_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha384_hmac_init (sha384_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1696,22 +1800,22 @@ DECLSPEC void sha384_hmac_update_utf16le_swap (sha384_hmac_ctx_t *ctx, const u32
sha384_update_utf16le_swap (&ctx->ipad, w, len); sha384_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_update_global (sha384_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha384_hmac_update_global (sha384_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha384_update_global (&ctx->ipad, w, len); sha384_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_update_global_swap (sha384_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha384_hmac_update_global_swap (sha384_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha384_update_global_swap (&ctx->ipad, w, len); sha384_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_update_global_utf16le (sha384_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha384_hmac_update_global_utf16le (sha384_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha384_update_global_utf16le (&ctx->ipad, w, len); sha384_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_update_global_utf16le_swap (sha384_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len) DECLSPEC void sha384_hmac_update_global_utf16le_swap (sha384_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{ {
sha384_update_global_utf16le_swap (&ctx->ipad, w, len); sha384_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
@ -1720,49 +1824,40 @@ DECLSPEC void sha384_hmac_final (sha384_hmac_ctx_t *ctx)
{ {
sha384_final (&ctx->ipad); sha384_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = h32_from_64_S (ctx->ipad.h[0]);
u32 t1[4]; ctx->opad.w0[1] = l32_from_64_S (ctx->ipad.h[0]);
u32 t2[4]; ctx->opad.w0[2] = h32_from_64_S (ctx->ipad.h[1]);
u32 t3[4]; ctx->opad.w0[3] = l32_from_64_S (ctx->ipad.h[1]);
u32 t4[4]; ctx->opad.w1[0] = h32_from_64_S (ctx->ipad.h[2]);
u32 t5[4]; ctx->opad.w1[1] = l32_from_64_S (ctx->ipad.h[2]);
u32 t6[4]; ctx->opad.w1[2] = h32_from_64_S (ctx->ipad.h[3]);
u32 t7[4]; ctx->opad.w1[3] = l32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w2[0] = h32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w2[1] = l32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w2[2] = h32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w2[3] = l32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
ctx->opad.w4[0] = 0;
ctx->opad.w4[1] = 0;
ctx->opad.w4[2] = 0;
ctx->opad.w4[3] = 0;
ctx->opad.w5[0] = 0;
ctx->opad.w5[1] = 0;
ctx->opad.w5[2] = 0;
ctx->opad.w5[3] = 0;
ctx->opad.w6[0] = 0;
ctx->opad.w6[1] = 0;
ctx->opad.w6[2] = 0;
ctx->opad.w6[3] = 0;
ctx->opad.w7[0] = 0;
ctx->opad.w7[1] = 0;
ctx->opad.w7[2] = 0;
ctx->opad.w7[3] = 0;
t0[0] = h32_from_64_S (ctx->ipad.h[0]); ctx->opad.len += 48;
t0[1] = l32_from_64_S (ctx->ipad.h[0]);
t0[2] = h32_from_64_S (ctx->ipad.h[1]);
t0[3] = l32_from_64_S (ctx->ipad.h[1]);
t1[0] = h32_from_64_S (ctx->ipad.h[2]);
t1[1] = l32_from_64_S (ctx->ipad.h[2]);
t1[2] = h32_from_64_S (ctx->ipad.h[3]);
t1[3] = l32_from_64_S (ctx->ipad.h[3]);
t2[0] = h32_from_64_S (ctx->ipad.h[4]);
t2[1] = l32_from_64_S (ctx->ipad.h[4]);
t2[2] = h32_from_64_S (ctx->ipad.h[5]);
t2[3] = l32_from_64_S (ctx->ipad.h[5]);
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
t4[0] = 0;
t4[1] = 0;
t4[2] = 0;
t4[3] = 0;
t5[0] = 0;
t5[1] = 0;
t5[2] = 0;
t5[3] = 0;
t6[0] = 0;
t6[1] = 0;
t6[2] = 0;
t6[3] = 0;
t7[0] = 0;
t7[1] = 0;
t7[2] = 0;
t7[3] = 0;
sha384_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 48);
sha384_final (&ctx->opad); sha384_final (&ctx->opad);
} }
@ -1956,127 +2051,203 @@ DECLSPEC void sha384_init_vector_from_scalar (sha384_ctx_vector_t *ctx, sha384_c
DECLSPEC void sha384_update_vector_128 (sha384_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len) DECLSPEC void sha384_update_vector_128 (sha384_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len)
{ {
const int pos = ctx->len & 127; MAYBE_VOLATILE const int pos = ctx->len & 127;
ctx->len += len; ctx->len += len;
if ((pos + len) < 128) if (pos == 0)
{ {
switch_buffer_by_offset_8x4_be (w0, w1, w2, w3, w4, w5, w6, w7, pos); ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w4[0] = w4[0];
ctx->w4[1] = w4[1];
ctx->w4[2] = w4[2];
ctx->w4[3] = w4[3];
ctx->w5[0] = w5[0];
ctx->w5[1] = w5[1];
ctx->w5[2] = w5[2];
ctx->w5[3] = w5[3];
ctx->w6[0] = w6[0];
ctx->w6[1] = w6[1];
ctx->w6[2] = w6[2];
ctx->w6[3] = w6[3];
ctx->w7[0] = w7[0];
ctx->w7[1] = w7[1];
ctx->w7[2] = w7[2];
ctx->w7[3] = w7[3];
ctx->w0[0] |= w0[0]; if (len == 128)
ctx->w0[1] |= w0[1]; {
ctx->w0[2] |= w0[2]; sha384_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0]; ctx->w0[0] = 0;
ctx->w1[1] |= w1[1]; ctx->w0[1] = 0;
ctx->w1[2] |= w1[2]; ctx->w0[2] = 0;
ctx->w1[3] |= w1[3]; ctx->w0[3] = 0;
ctx->w2[0] |= w2[0]; ctx->w1[0] = 0;
ctx->w2[1] |= w2[1]; ctx->w1[1] = 0;
ctx->w2[2] |= w2[2]; ctx->w1[2] = 0;
ctx->w2[3] |= w2[3]; ctx->w1[3] = 0;
ctx->w3[0] |= w3[0]; ctx->w2[0] = 0;
ctx->w3[1] |= w3[1]; ctx->w2[1] = 0;
ctx->w3[2] |= w3[2]; ctx->w2[2] = 0;
ctx->w3[3] |= w3[3]; ctx->w2[3] = 0;
ctx->w4[0] |= w4[0]; ctx->w3[0] = 0;
ctx->w4[1] |= w4[1]; ctx->w3[1] = 0;
ctx->w4[2] |= w4[2]; ctx->w3[2] = 0;
ctx->w4[3] |= w4[3]; ctx->w3[3] = 0;
ctx->w5[0] |= w5[0]; ctx->w4[0] = 0;
ctx->w5[1] |= w5[1]; ctx->w4[1] = 0;
ctx->w5[2] |= w5[2]; ctx->w4[2] = 0;
ctx->w5[3] |= w5[3]; ctx->w4[3] = 0;
ctx->w6[0] |= w6[0]; ctx->w5[0] = 0;
ctx->w6[1] |= w6[1]; ctx->w5[1] = 0;
ctx->w6[2] |= w6[2]; ctx->w5[2] = 0;
ctx->w6[3] |= w6[3]; ctx->w5[3] = 0;
ctx->w7[0] |= w7[0]; ctx->w6[0] = 0;
ctx->w7[1] |= w7[1]; ctx->w6[1] = 0;
ctx->w7[2] |= w7[2]; ctx->w6[2] = 0;
ctx->w7[3] |= w7[3]; ctx->w6[3] = 0;
ctx->w7[0] = 0;
ctx->w7[1] = 0;
ctx->w7[2] = 0;
ctx->w7[3] = 0;
}
} }
else else
{ {
u32x c0[4] = { 0 }; if ((pos + len) < 128)
u32x c1[4] = { 0 }; {
u32x c2[4] = { 0 }; switch_buffer_by_offset_8x4_be (w0, w1, w2, w3, w4, w5, w6, w7, pos);
u32x c3[4] = { 0 };
u32x c4[4] = { 0 };
u32x c5[4] = { 0 };
u32x c6[4] = { 0 };
u32x c7[4] = { 0 };
switch_buffer_by_offset_8x4_carry_be (w0, w1, w2, w3, w4, w5, w6, w7, c0, c1, c2, c3, c4, c5, c6, c7, pos); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
u32x c4[4] = { 0 };
u32x c5[4] = { 0 };
u32x c6[4] = { 0 };
u32x c7[4] = { 0 };
ctx->w0[0] |= w0[0]; switch_buffer_by_offset_8x4_carry_be (w0, w1, w2, w3, w4, w5, w6, w7, c0, c1, c2, c3, c4, c5, c6, c7, pos);
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
sha384_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h); ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
ctx->w0[0] = c0[0]; sha384_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2]; ctx->w0[0] = c0[0];
ctx->w0[3] = c0[3]; ctx->w0[1] = c0[1];
ctx->w1[0] = c1[0]; ctx->w0[2] = c0[2];
ctx->w1[1] = c1[1]; ctx->w0[3] = c0[3];
ctx->w1[2] = c1[2]; ctx->w1[0] = c1[0];
ctx->w1[3] = c1[3]; ctx->w1[1] = c1[1];
ctx->w2[0] = c2[0]; ctx->w1[2] = c1[2];
ctx->w2[1] = c2[1]; ctx->w1[3] = c1[3];
ctx->w2[2] = c2[2]; ctx->w2[0] = c2[0];
ctx->w2[3] = c2[3]; ctx->w2[1] = c2[1];
ctx->w3[0] = c3[0]; ctx->w2[2] = c2[2];
ctx->w3[1] = c3[1]; ctx->w2[3] = c2[3];
ctx->w3[2] = c3[2]; ctx->w3[0] = c3[0];
ctx->w3[3] = c3[3]; ctx->w3[1] = c3[1];
ctx->w4[0] = c4[0]; ctx->w3[2] = c3[2];
ctx->w4[1] = c4[1]; ctx->w3[3] = c3[3];
ctx->w4[2] = c4[2]; ctx->w4[0] = c4[0];
ctx->w4[3] = c4[3]; ctx->w4[1] = c4[1];
ctx->w5[0] = c5[0]; ctx->w4[2] = c4[2];
ctx->w5[1] = c5[1]; ctx->w4[3] = c4[3];
ctx->w5[2] = c5[2]; ctx->w5[0] = c5[0];
ctx->w5[3] = c5[3]; ctx->w5[1] = c5[1];
ctx->w6[0] = c6[0]; ctx->w5[2] = c5[2];
ctx->w6[1] = c6[1]; ctx->w5[3] = c5[3];
ctx->w6[2] = c6[2]; ctx->w6[0] = c6[0];
ctx->w6[3] = c6[3]; ctx->w6[1] = c6[1];
ctx->w7[0] = c7[0]; ctx->w6[2] = c6[2];
ctx->w7[1] = c7[1]; ctx->w6[3] = c6[3];
ctx->w7[2] = c7[2]; ctx->w7[0] = c7[0];
ctx->w7[3] = c7[3]; ctx->w7[1] = c7[1];
ctx->w7[2] = c7[2];
ctx->w7[3] = c7[3];
}
} }
} }
@ -2588,7 +2759,7 @@ DECLSPEC void sha384_update_vector_utf16beN (sha384_ctx_vector_t *ctx, const u32
DECLSPEC void sha384_final_vector (sha384_ctx_vector_t *ctx) DECLSPEC void sha384_final_vector (sha384_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 127; MAYBE_VOLATILE const int pos = ctx->len & 127;
append_0x80_8x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3); append_0x80_8x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3);
@ -2686,7 +2857,9 @@ DECLSPEC void sha384_hmac_init_vector_128 (sha384_hmac_ctx_vector_t *ctx, const
sha384_init_vector (&ctx->ipad); sha384_init_vector (&ctx->ipad);
sha384_update_vector_128 (&ctx->ipad, t0, t1, t2, t3, t4, t5, t6, t7, 128); sha384_transform_vector (t0, t1, t2, t3, t4, t5, t6, t7, ctx->ipad.h);
ctx->ipad.len = 128;
// opad // opad
@ -2725,7 +2898,9 @@ DECLSPEC void sha384_hmac_init_vector_128 (sha384_hmac_ctx_vector_t *ctx, const
sha384_init_vector (&ctx->opad); sha384_init_vector (&ctx->opad);
sha384_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128); sha384_transform_vector (t0, t1, t2, t3, t4, t5, t6, t7, ctx->opad.h);
ctx->opad.len = 128;
} }
DECLSPEC void sha384_hmac_init_vector (sha384_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha384_hmac_init_vector (sha384_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -2835,49 +3010,40 @@ DECLSPEC void sha384_hmac_final_vector (sha384_hmac_ctx_vector_t *ctx)
{ {
sha384_final_vector (&ctx->ipad); sha384_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = h32_from_64 (ctx->ipad.h[0]);
u32x t1[4]; ctx->opad.w0[1] = l32_from_64 (ctx->ipad.h[0]);
u32x t2[4]; ctx->opad.w0[2] = h32_from_64 (ctx->ipad.h[1]);
u32x t3[4]; ctx->opad.w0[3] = l32_from_64 (ctx->ipad.h[1]);
u32x t4[4]; ctx->opad.w1[0] = h32_from_64 (ctx->ipad.h[2]);
u32x t5[4]; ctx->opad.w1[1] = l32_from_64 (ctx->ipad.h[2]);
u32x t6[4]; ctx->opad.w1[2] = h32_from_64 (ctx->ipad.h[3]);
u32x t7[4]; ctx->opad.w1[3] = l32_from_64 (ctx->ipad.h[3]);
ctx->opad.w2[0] = h32_from_64 (ctx->ipad.h[4]);
ctx->opad.w2[1] = l32_from_64 (ctx->ipad.h[4]);
ctx->opad.w2[2] = h32_from_64 (ctx->ipad.h[5]);
ctx->opad.w2[3] = l32_from_64 (ctx->ipad.h[5]);
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
ctx->opad.w4[0] = 0;
ctx->opad.w4[1] = 0;
ctx->opad.w4[2] = 0;
ctx->opad.w4[3] = 0;
ctx->opad.w5[0] = 0;
ctx->opad.w5[1] = 0;
ctx->opad.w5[2] = 0;
ctx->opad.w5[3] = 0;
ctx->opad.w6[0] = 0;
ctx->opad.w6[1] = 0;
ctx->opad.w6[2] = 0;
ctx->opad.w6[3] = 0;
ctx->opad.w7[0] = 0;
ctx->opad.w7[1] = 0;
ctx->opad.w7[2] = 0;
ctx->opad.w7[3] = 0;
t0[0] = h32_from_64 (ctx->ipad.h[0]); ctx->opad.len += 48;
t0[1] = l32_from_64 (ctx->ipad.h[0]);
t0[2] = h32_from_64 (ctx->ipad.h[1]);
t0[3] = l32_from_64 (ctx->ipad.h[1]);
t1[0] = h32_from_64 (ctx->ipad.h[2]);
t1[1] = l32_from_64 (ctx->ipad.h[2]);
t1[2] = h32_from_64 (ctx->ipad.h[3]);
t1[3] = l32_from_64 (ctx->ipad.h[3]);
t2[0] = h32_from_64 (ctx->ipad.h[4]);
t2[1] = l32_from_64 (ctx->ipad.h[4]);
t2[2] = h32_from_64 (ctx->ipad.h[5]);
t2[3] = l32_from_64 (ctx->ipad.h[5]);
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
t4[0] = 0;
t4[1] = 0;
t4[2] = 0;
t4[3] = 0;
t5[0] = 0;
t5[1] = 0;
t5[2] = 0;
t5[3] = 0;
t6[0] = 0;
t6[1] = 0;
t6[2] = 0;
t6[3] = 0;
t7[0] = 0;
t7[1] = 0;
t7[2] = 0;
t7[3] = 0;
sha384_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 48);
sha384_final_vector (&ctx->opad); sha384_final_vector (&ctx->opad);
} }

View File

@ -62,30 +62,6 @@
#define SHA384_EXPAND(x,y,z,w) (SHA384_S3 (x) + y + SHA384_S2 (z) + w) #define SHA384_EXPAND(x,y,z,w) (SHA384_S3 (x) + y + SHA384_S2 (z) + w)
CONSTANT_AS u64a k_sha384[80] =
{
SHA512C00, SHA512C01, SHA512C02, SHA512C03,
SHA512C04, SHA512C05, SHA512C06, SHA512C07,
SHA512C08, SHA512C09, SHA512C0a, SHA512C0b,
SHA512C0c, SHA512C0d, SHA512C0e, SHA512C0f,
SHA512C10, SHA512C11, SHA512C12, SHA512C13,
SHA512C14, SHA512C15, SHA512C16, SHA512C17,
SHA512C18, SHA512C19, SHA512C1a, SHA512C1b,
SHA512C1c, SHA512C1d, SHA512C1e, SHA512C1f,
SHA512C20, SHA512C21, SHA512C22, SHA512C23,
SHA512C24, SHA512C25, SHA512C26, SHA512C27,
SHA512C28, SHA512C29, SHA512C2a, SHA512C2b,
SHA512C2c, SHA512C2d, SHA512C2e, SHA512C2f,
SHA512C30, SHA512C31, SHA512C32, SHA512C33,
SHA512C34, SHA512C35, SHA512C36, SHA512C37,
SHA512C38, SHA512C39, SHA512C3a, SHA512C3b,
SHA512C3c, SHA512C3d, SHA512C3e, SHA512C3f,
SHA512C40, SHA512C41, SHA512C42, SHA512C43,
SHA512C44, SHA512C45, SHA512C46, SHA512C47,
SHA512C48, SHA512C49, SHA512C4a, SHA512C4b,
SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f,
};
typedef struct sha384_ctx typedef struct sha384_ctx
{ {
u64 h[8]; u64 h[8];
@ -141,10 +117,10 @@ DECLSPEC void sha384_update (sha384_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_update_swap (sha384_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha384_update_swap (sha384_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_update_utf16le (sha384_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha384_update_utf16le (sha384_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_update_utf16le_swap (sha384_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha384_update_utf16le_swap (sha384_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_update_global (sha384_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha384_update_global (sha384_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha384_update_global_swap (sha384_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha384_update_global_swap (sha384_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha384_update_global_utf16le (sha384_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha384_update_global_utf16le (sha384_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha384_final (sha384_ctx_t *ctx); DECLSPEC void sha384_final (sha384_ctx_t *ctx);
DECLSPEC void sha384_hmac_init_128 (sha384_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7); DECLSPEC void sha384_hmac_init_128 (sha384_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7);
DECLSPEC void sha384_hmac_init (sha384_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha384_hmac_init (sha384_hmac_ctx_t *ctx, const u32 *w, const int len);
@ -156,10 +132,10 @@ DECLSPEC void sha384_hmac_update (sha384_hmac_ctx_t *ctx, const u32 *w, const in
DECLSPEC void sha384_hmac_update_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha384_hmac_update_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_hmac_update_utf16le (sha384_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha384_hmac_update_utf16le (sha384_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_hmac_update_utf16le_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha384_hmac_update_utf16le_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_hmac_update_global (sha384_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha384_hmac_update_global (sha384_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha384_hmac_update_global_swap (sha384_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha384_hmac_update_global_swap (sha384_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha384_hmac_update_global_utf16le (sha384_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha384_hmac_update_global_utf16le (sha384_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha384_hmac_update_global_utf16le_swap (sha384_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha384_hmac_update_global_utf16le_swap (sha384_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha384_hmac_final (sha384_hmac_ctx_t *ctx); DECLSPEC void sha384_hmac_final (sha384_hmac_ctx_t *ctx);
DECLSPEC void sha384_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7, u64x *digest); DECLSPEC void sha384_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7, u64x *digest);
DECLSPEC void sha384_init_vector (sha384_ctx_vector_t *ctx); DECLSPEC void sha384_init_vector (sha384_ctx_vector_t *ctx);

File diff suppressed because it is too large Load Diff

View File

@ -62,30 +62,6 @@
#define SHA512_EXPAND(x,y,z,w) (SHA512_S3 (x) + y + SHA512_S2 (z) + w) #define SHA512_EXPAND(x,y,z,w) (SHA512_S3 (x) + y + SHA512_S2 (z) + w)
CONSTANT_AS u64a k_sha512[80] =
{
SHA512C00, SHA512C01, SHA512C02, SHA512C03,
SHA512C04, SHA512C05, SHA512C06, SHA512C07,
SHA512C08, SHA512C09, SHA512C0a, SHA512C0b,
SHA512C0c, SHA512C0d, SHA512C0e, SHA512C0f,
SHA512C10, SHA512C11, SHA512C12, SHA512C13,
SHA512C14, SHA512C15, SHA512C16, SHA512C17,
SHA512C18, SHA512C19, SHA512C1a, SHA512C1b,
SHA512C1c, SHA512C1d, SHA512C1e, SHA512C1f,
SHA512C20, SHA512C21, SHA512C22, SHA512C23,
SHA512C24, SHA512C25, SHA512C26, SHA512C27,
SHA512C28, SHA512C29, SHA512C2a, SHA512C2b,
SHA512C2c, SHA512C2d, SHA512C2e, SHA512C2f,
SHA512C30, SHA512C31, SHA512C32, SHA512C33,
SHA512C34, SHA512C35, SHA512C36, SHA512C37,
SHA512C38, SHA512C39, SHA512C3a, SHA512C3b,
SHA512C3c, SHA512C3d, SHA512C3e, SHA512C3f,
SHA512C40, SHA512C41, SHA512C42, SHA512C43,
SHA512C44, SHA512C45, SHA512C46, SHA512C47,
SHA512C48, SHA512C49, SHA512C4a, SHA512C4b,
SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f,
};
typedef struct sha512_ctx typedef struct sha512_ctx
{ {
u64 h[8]; u64 h[8];
@ -141,10 +117,10 @@ DECLSPEC void sha512_update (sha512_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_update_swap (sha512_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha512_update_swap (sha512_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_update_utf16le (sha512_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha512_update_utf16le (sha512_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_update_utf16le_swap (sha512_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha512_update_utf16le_swap (sha512_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_update_global (sha512_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha512_update_global (sha512_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha512_update_global_swap (sha512_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha512_update_global_swap (sha512_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha512_update_global_utf16le (sha512_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha512_update_global_utf16le (sha512_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha512_update_global_utf16le_swap (sha512_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha512_update_global_utf16le_swap (sha512_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha512_final (sha512_ctx_t *ctx); DECLSPEC void sha512_final (sha512_ctx_t *ctx);
DECLSPEC void sha512_hmac_init_128 (sha512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7); DECLSPEC void sha512_hmac_init_128 (sha512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7);
DECLSPEC void sha512_hmac_init (sha512_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha512_hmac_init (sha512_hmac_ctx_t *ctx, const u32 *w, const int len);
@ -156,10 +132,10 @@ DECLSPEC void sha512_hmac_update (sha512_hmac_ctx_t *ctx, const u32 *w, const in
DECLSPEC void sha512_hmac_update_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha512_hmac_update_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_hmac_update_utf16le (sha512_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha512_hmac_update_utf16le (sha512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_hmac_update_utf16le_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void sha512_hmac_update_utf16le_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_hmac_update_global (sha512_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha512_hmac_update_global (sha512_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha512_hmac_update_global_swap (sha512_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha512_hmac_update_global_swap (sha512_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha512_hmac_update_global_utf16le (sha512_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha512_hmac_update_global_utf16le (sha512_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha512_hmac_update_global_utf16le_swap (sha512_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void sha512_hmac_update_global_utf16le_swap (sha512_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void sha512_hmac_final (sha512_hmac_ctx_t *ctx); DECLSPEC void sha512_hmac_final (sha512_hmac_ctx_t *ctx);
DECLSPEC void sha512_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7, u64x *digest); DECLSPEC void sha512_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7, u64x *digest);
DECLSPEC void sha512_init_vector (sha512_ctx_vector_t *ctx); DECLSPEC void sha512_init_vector (sha512_ctx_vector_t *ctx);

File diff suppressed because it is too large Load Diff

View File

@ -6,590 +6,6 @@
#ifndef _INC_HASH_STREEBOG256_H #ifndef _INC_HASH_STREEBOG256_H
#define _INC_HASH_STREEBOG256_H #define _INC_HASH_STREEBOG256_H
CONSTANT_AS u64a sbob_sl64[8][256] =
{
{
0xd031c397ce553fe6, 0x16ba5b01b006b525, 0xa89bade6296e70c8, 0x6a1f525d77d3435b,
0x6e103570573dfa0b, 0x660efb2a17fc95ab, 0x76327a9e97634bf6, 0x4bad9d6462458bf5,
0xf1830caedbc3f748, 0xc5c8f542669131ff, 0x95044a1cdc48b0cb, 0x892962df3cf8b866,
0xb0b9e208e930c135, 0xa14fb3f0611a767c, 0x8d2605f21c160136, 0xd6b71922fecc549e,
0x37089438a5907d8b, 0x0b5da38e5803d49c, 0x5a5bcc9cea6f3cbc, 0xedae246d3b73ffe5,
0xd2b87e0fde22edce, 0x5e54abb1ca8185ec, 0x1de7f88fe80561b9, 0xad5e1a870135a08c,
0x2f2adbd665cecc76, 0x5780b5a782f58358, 0x3edc8a2eede47b3f, 0xc9d95c3506bee70f,
0x83be111d6c4e05ee, 0xa603b90959367410, 0x103c81b4809fde5d, 0x2c69b6027d0c774a,
0x399080d7d5c87953, 0x09d41e16487406b4, 0xcdd63b1826505e5f, 0xf99dc2f49b0298e8,
0x9cd0540a943cb67f, 0xbca84b7f891f17c5, 0x723d1db3b78df2a6, 0x78aa6e71e73b4f2e,
0x1433e699a071670d, 0x84f21be454620782, 0x98df3327b4d20f2f, 0xf049dce2d3769e5c,
0xdb6c60199656eb7a, 0x648746b2078b4783, 0x32cd23598dcbadcf, 0x1ea4955bf0c7da85,
0xe9a143401b9d46b5, 0xfd92a5d9bbec21b8, 0xc8138c790e0b8e1b, 0x2ee00b9a6d7ba562,
0xf85712b893b7f1fc, 0xeb28fed80bea949d, 0x564a65eb8a40ea4c, 0x6c9988e8474a2823,
0x4535898b121d8f2d, 0xabd8c03231accbf4, 0xba2e91cab9867cbd, 0x7960be3def8e263a,
0x0c11a977602fd6f0, 0xcb50e1ad16c93527, 0xeae22e94035ffd89, 0x2866d12f5de2ce1a,
0xff1b1841ab9bf390, 0x9f9339de8cfe0d43, 0x964727c8c48a0bf7, 0x524502c6aaae531c,
0x9b9c5ef3ac10b413, 0x4fa2fa4942ab32a5, 0x3f165a62e551122b, 0xc74148da76e6e3d7,
0x924840e5e464b2a7, 0xd372ae43d69784da, 0x233b72a105e11a86, 0xa48a04914941a638,
0xb4b68525c9de7865, 0xddeabaaca6cf8002, 0x0a9773c250b6bd88, 0xc284ffbb5ebd3393,
0x8ba0df472c8f6a4e, 0x2aef6cb74d951c32, 0x427983722a318d41, 0x73f7cdffbf389bb2,
0x074c0af9382c026c, 0x8a6a0f0b243a035a, 0x6fdae53c5f88931f, 0xc68b98967e538ac3,
0x44ff59c71aa8e639, 0xe2fce0ce439e9229, 0xa20cde2479d8cd40, 0x19e89fa2c8ebd8e9,
0xf446bbcff398270c, 0x43b3533e2284e455, 0xd82f0dcd8e945046, 0x51066f12b26ce820,
0xe73957af6bc5426d, 0x081ece5a40c16fa0, 0x3b193d4fc5bfab7b, 0x7fe66488df174d42,
0x0e9814ef705804d8, 0x8137ac857c39d7c6, 0xb1733244e185a821, 0x695c3f896f11f867,
0xf6cf0657e3eff524, 0x1aabf276d02963d5, 0x2da3664e75b91e5e, 0x0289bd981077d228,
0x90c1fd7df413608f, 0x3c5537b6fd93a917, 0xaa12107e3919a2e0, 0x0686dab530996b78,
0xdaa6b0559ee3826e, 0xc34e2ff756085a87, 0x6d5358a44fff4137, 0xfc587595b35948ac,
0x7ca5095cc7d5f67e, 0xfb147f6c8b754ac0, 0xbfeb26ab91ddacf9, 0x6896efc567a49173,
0xca9a31e11e7c5c33, 0xbbe44186b13315a9, 0x0ddb793b689abfe4, 0x70b4a02ba7fa208e,
0xe47a3a7b7307f951, 0x8cecd5be14a36822, 0xeeed49b923b144d9, 0x17708b4db8b3dc31,
0x6088219f2765fed3, 0xb3fa8fdcf1f27a09, 0x910b2d31fca6099b, 0x0f52c4a378ed6dcc,
0x50ccbf5ebad98134, 0x6bd582117f662a4f, 0x94ce9a50d4fdd9df, 0x2b25bcfb45207526,
0x67c42b661f49fcbf, 0x492420fc723259dd, 0x03436dd418c2bb3c, 0x1f6e4517f872b391,
0xa08563bc69af1f68, 0xd43ea4baeebb86b6, 0x01cad04c08b56914, 0xac94cacb0980c998,
0x54c3d8739a373864, 0x26fec5c02dbacac2, 0xdea9d778be0d3b3e, 0x040f672d20eeb950,
0xe5b0ea377bb29045, 0xf30ab136cbb42560, 0x62019c0737122cfb, 0xe86b930c13282fa1,
0xcc1ceb542ee5374b, 0x538fd28aa21b3a08, 0x1b61223ad89c0ac1, 0x36c24474ad25149f,
0x7a23d3e9f74c9d06, 0xbe21f6e79968c5ed, 0xcf5f868036278c77, 0xf705d61beb5a9c30,
0x4d2b47d152dce08d, 0x5f9e7bfdc234ecf8, 0x247778583dcd18ea, 0x867ba67c4415d5aa,
0x4ce1979d5a698999, 0x0000000000000000, 0xec64f42133c696f1, 0xb57c5569c16b1171,
0xc1c7926f467f88af, 0x654d96fe0f3e2e97, 0x15f936d5a8c40e19, 0xb8a72c52a9f1ae95,
0xa9517daa21db19dc, 0x58d27104fa18ee94, 0x5918a148f2ad8780, 0x5cdd1629daf657c4,
0x8274c15164fb6cfa, 0xd1fb13dbc6e056f2, 0x7d6fd910cf609f6a, 0xb63f38bdd9a9aa4d,
0x3d9fe7faf526c003, 0x74bbc706871499de, 0xdf630734b6b8522a, 0x3ad3ed03cd0ac26f,
0xfadeaf2083c023d4, 0xc00d42234ecae1bb, 0x8538cba85cd76e96, 0xc402250e6e2458eb,
0x47bc3413026a5d05, 0xafd7a71f114272a4, 0x978df784cc3f62e3, 0xb96dfc1ea144c781,
0x21b2cf391596c8ae, 0x318e4e8d950916f3, 0xce9556cc3e92e563, 0x385a509bdd7d1047,
0x358129a0b5e7afa3, 0xe6f387e363702b79, 0xe0755d5653e94001, 0x7be903a5fff9f412,
0x12b53c2c90e80c75, 0x3307f315857ec4db, 0x8fafb86a0c61d31e, 0xd9e5dd8186213952,
0x77f8aad29fd622e2, 0x25bda814357871fe, 0x7571174a8fa1f0ca, 0x137fec60985d6561,
0x30449ec19dbc7fe7, 0xa540d4dd41f4cf2c, 0xdc206ae0ae7ae916, 0x5b911cd0e2da55a8,
0xb2305f90f947131d, 0x344bf9ecbd52c6b7, 0x5d17c665d2433ed0, 0x18224feec05eb1fd,
0x9e59e992844b6457, 0x9a568ebfa4a5dd07, 0xa3c60e68716da454, 0x7e2cb4c4d7a22456,
0x87b176304ca0bcbe, 0x413aeea632f3367d, 0x9915e36bbc67663b, 0x40f03eea3a465f69,
0x1c2d28c3e0b008ad, 0x4e682a054a1e5bb1, 0x05c5b761285bd044, 0xe1bf8d1a5b5c2915,
0xf2c0617ac3014c74, 0xb7f5e8f1d11cc359, 0x63cb4c4b3fa745ef, 0x9d1a84469c89df6b,
0xe33630824b2bfb3d, 0xd5f474f6e60eefa2, 0xf58c6b83fb2d4e18, 0x4676e45f0adf3411,
0x20781f751d23a1ba, 0xbd629b3381aa7ed1, 0xae1d775319f71bb0, 0xfed1c80da32e9a84,
0x5509083f92825170, 0x29ac01635557a70e, 0xa7c9694551831d04, 0x8e65682604d4ba0a,
0x11f651f8882ab749, 0xd77dc96ef6793d8a, 0xef2799f52b042dcd, 0x48eef0b07a8730c9,
0x22f1a2ed0d547392, 0x6142f1d32fd097c7, 0x4a674d286af0e2e1, 0x80fd7cc9748cbed2,
0x717e7067af4f499a, 0x938290a9ecd1dbb3, 0x88e3b293344dd172, 0x2734158c250fa3d6,
},
{
0x7e37e62dfc7d40c3, 0x776f25a4ee939e5b, 0xe045c850dd8fb5ad, 0x86ed5ba711ff1952,
0xe91d0bd9cf616b35, 0x37e0ab256e408ffb, 0x9607f6c031025a7a, 0x0b02f5e116d23c9d,
0xf3d8486bfb50650c, 0x621cff27c40875f5, 0x7d40cb71fa5fd34a, 0x6daa6616daa29062,
0x9f5f354923ec84e2, 0xec847c3dc507c3b3, 0x025a3668043ce205, 0xa8bf9e6c4dac0b19,
0xfa808be2e9bebb94, 0xb5b99c5277c74fa3, 0x78d9bc95f0397bcc, 0xe332e50cdbad2624,
0xc74fce129332797e, 0x1729eceb2ea709ab, 0xc2d6b9f69954d1f8, 0x5d898cbfbab8551a,
0x859a76fb17dd8adb, 0x1be85886362f7fb5, 0xf6413f8ff136cd8a, 0xd3110fa5bbb7e35c,
0x0a2feed514cc4d11, 0xe83010edcd7f1ab9, 0xa1e75de55f42d581, 0xeede4a55c13b21b6,
0xf2f5535ff94e1480, 0x0cc1b46d1888761e, 0xbce15fdb6529913b, 0x2d25e8975a7181c2,
0x71817f1ce2d7a554, 0x2e52c5cb5c53124b, 0xf9f7a6beef9c281d, 0x9e722e7d21f2f56e,
0xce170d9b81dca7e6, 0x0e9b82051cb4941b, 0x1e712f623c49d733, 0x21e45cfa42f9f7dc,
0xcb8e7a7f8bba0f60, 0x8e98831a010fb646, 0x474ccf0d8e895b23, 0xa99285584fb27a95,
0x8cc2b57205335443, 0x42d5b8e984eff3a5, 0x012d1b34021e718c, 0x57a6626aae74180b,
0xff19fc06e3d81312, 0x35ba9d4d6a7c6dfe, 0xc9d44c178f86ed65, 0x506523e6a02e5288,
0x03772d5c06229389, 0x8b01f4fe0b691ec0, 0xf8dabd8aed825991, 0x4c4e3aec985b67be,
0xb10df0827fbf96a9, 0x6a69279ad4f8dae1, 0xe78689dcd3d5ff2e, 0x812e1a2b1fa553d1,
0xfbad90d6eba0ca18, 0x1ac543b234310e39, 0x1604f7df2cb97827, 0xa6241c6951189f02,
0x753513cceaaf7c5e, 0x64f2a59fc84c4efa, 0x247d2b1e489f5f5a, 0xdb64d718ab474c48,
0x79f4a7a1f2270a40, 0x1573da832a9bebae, 0x3497867968621c72, 0x514838d2a2302304,
0xf0af6537fd72f685, 0x1d06023e3a6b44ba, 0x678588c3ce6edd73, 0x66a893f7cc70acff,
0xd4d24e29b5eda9df, 0x3856321470ea6a6c, 0x07c3418c0e5a4a83, 0x2bcbb22f5635bacd,
0x04b46cd00878d90a, 0x06ee5ab80c443b0f, 0x3b211f4876c8f9e5, 0x0958c38912eede98,
0xd14b39cdbf8b0159, 0x397b292072f41be0, 0x87c0409313e168de, 0xad26e98847caa39f,
0x4e140c849c6785bb, 0xd5ff551db7f3d853, 0xa0ca46d15d5ca40d, 0xcd6020c787fe346f,
0x84b76dcf15c3fb57, 0xdefda0fca121e4ce, 0x4b8d7b6096012d3d, 0x9ac642ad298a2c64,
0x0875d8bd10f0af14, 0xb357c6ea7b8374ac, 0x4d6321d89a451632, 0xeda96709c719b23f,
0xf76c24bbf328bc06, 0xc662d526912c08f2, 0x3ce25ec47892b366, 0xb978283f6f4f39bd,
0xc08c8f9e9d6833fd, 0x4f3917b09e79f437, 0x593de06fb2c08c10, 0xd6887841b1d14bda,
0x19b26eee32139db0, 0xb494876675d93e2f, 0x825937771987c058, 0x90e9ac783d466175,
0xf1827e03ff6c8709, 0x945dc0a8353eb87f, 0x4516f9658ab5b926, 0x3f9573987eb020ef,
0xb855330b6d514831, 0x2ae6a91b542bcb41, 0x6331e413c6160479, 0x408f8e8180d311a0,
0xeff35161c325503a, 0xd06622f9bd9570d5, 0x8876d9a20d4b8d49, 0xa5533135573a0c8b,
0xe168d364df91c421, 0xf41b09e7f50a2f8f, 0x12b09b0f24c1a12d, 0xda49cc2ca9593dc4,
0x1f5c34563e57a6bf, 0x54d14f36a8568b82, 0xaf7cdfe043f6419a, 0xea6a2685c943f8bc,
0xe5dcbfb4d7e91d2b, 0xb27addde799d0520, 0x6b443caed6e6ab6d, 0x7bae91c9f61be845,
0x3eb868ac7cae5163, 0x11c7b65322e332a4, 0xd23c1491b9a992d0, 0x8fb5982e0311c7ca,
0x70ac6428e0c9d4d8, 0x895bc2960f55fcc5, 0x76423e90ec8defd7, 0x6ff0507ede9e7267,
0x3dcf45f07a8cc2ea, 0x4aa06054941f5cb1, 0x5810fb5bb0defd9c, 0x5efea1e3bc9ac693,
0x6edd4b4adc8003eb, 0x741808f8e8b10dd2, 0x145ec1b728859a22, 0x28bc9f7350172944,
0x270a06424ebdccd3, 0x972aedf4331c2bf6, 0x059977e40a66a886, 0x2550302a4a812ed6,
0xdd8a8da0a7037747, 0xc515f87a970e9b7b, 0x3023eaa9601ac578, 0xb7e3aa3a73fbada6,
0x0fb699311eaae597, 0x0000000000000000, 0x310ef19d6204b4f4, 0x229371a644db6455,
0x0decaf591a960792, 0x5ca4978bb8a62496, 0x1c2b190a38753536, 0x41a295b582cd602c,
0x3279dcc16426277d, 0xc1a194aa9f764271, 0x139d803b26dfd0a1, 0xae51c4d441e83016,
0xd813fa44ad65dfc1, 0xac0bf2bc45d4d213, 0x23be6a9246c515d9, 0x49d74d08923dcf38,
0x9d05032127d066e7, 0x2f7fdeff5e4d63c7, 0xa47e2a0155247d07, 0x99b16ff12fa8bfed,
0x4661d4398c972aaf, 0xdfd0bbc8a33f9542, 0xdca79694a51d06cb, 0xb020ebb67da1e725,
0xba0f0563696daa34, 0xe4f1a480d5f76ca7, 0xc438e34e9510eaf7, 0x939e81243b64f2fc,
0x8defae46072d25cf, 0x2c08f3a3586ff04e, 0xd7a56375b3cf3a56, 0x20c947ce40e78650,
0x43f8a3dd86f18229, 0x568b795eac6a6987, 0x8003011f1dbb225d, 0xf53612d3f7145e03,
0x189f75da300dec3c, 0x9570db9c3720c9f3, 0xbb221e576b73dbb8, 0x72f65240e4f536dd,
0x443be25188abc8aa, 0xe21ffe38d9b357a8, 0xfd43ca6ee7e4f117, 0xcaa3614b89a47eec,
0xfe34e732e1c6629e, 0x83742c431b99b1d4, 0xcf3a16af83c2d66a, 0xaae5a8044990e91c,
0x26271d764ca3bd5f, 0x91c4b74c3f5810f9, 0x7c6dd045f841a2c6, 0x7f1afd19fe63314f,
0xc8f957238d989ce9, 0xa709075d5306ee8e, 0x55fc5402aa48fa0e, 0x48fa563c9023beb4,
0x65dfbeabca523f76, 0x6c877d22d8bce1ee, 0xcc4d3bf385e045e3, 0xbebb69b36115733e,
0x10eaad6720fd4328, 0xb6ceb10e71e5dc2a, 0xbdcc44ef6737e0b7, 0x523f158ea412b08d,
0x989c74c52db6ce61, 0x9beb59992b945de8, 0x8a2cefca09776f4c, 0xa3bd6b8d5b7e3784,
0xeb473db1cb5d8930, 0xc3fba2c29b4aa074, 0x9c28181525ce176b, 0x683311f2d0c438e4,
0x5fd3bad7be84b71f, 0xfc6ed15ae5fa809b, 0x36cdb0116c5efe77, 0x29918447520958c8,
0xa29070b959604608, 0x53120ebaa60cc101, 0x3a0c047c74d68869, 0x691e0ac6d2da4968,
0x73db4974e6eb4751, 0x7a838afdf40599c9, 0x5a4acd33b4e21f99, 0x6046c94fc03497f0,
0xe6ab92e8d1cb8ea2, 0x3354c7f5663856f1, 0xd93ee170af7bae4d, 0x616bd27bc22ae67c,
0x92b39a10397a8370, 0xabc8b3304b8e9890, 0xbf967287630b02b2, 0x5b67d607b6fc6e15,
},
{
0x8ab0a96846e06a6d, 0x43c7e80b4bf0b33a, 0x08c9b3546b161ee5, 0x39f1c235eba990be,
0xc1bef2376606c7b2, 0x2c209233614569aa, 0xeb01523b6fc3289a, 0x946953ab935acedd,
0x272838f63e13340e, 0x8b0455eca12ba052, 0x77a1b2c4978ff8a2, 0xa55122ca13e54086,
0x2276135862d3f1cd, 0xdb8ddfde08b76cfe, 0x5d1e12c89e4a178a, 0x0e56816b03969867,
0xee5f79953303ed59, 0xafed748bab78d71d, 0x6d929f2df93e53ee, 0xf5d8a8f8ba798c2a,
0xf619b1698e39cf6b, 0x95ddaf2f749104e2, 0xec2a9c80e0886427, 0xce5c8fd8825b95ea,
0xc4e0d9993ac60271, 0x4699c3a5173076f9, 0x3d1b151f50a29f42, 0x9ed505ea2bc75946,
0x34665acfdc7f4b98, 0x61b1fb53292342f7, 0xc721c0080e864130, 0x8693cd1696fd7b74,
0x872731927136b14b, 0xd3446c8a63a1721b, 0x669a35e8a6680e4a, 0xcab658f239509a16,
0xa4e5de4ef42e8ab9, 0x37a7435ee83f08d9, 0x134e6239e26c7f96, 0x82791a3c2df67488,
0x3f6ef00a8329163c, 0x8e5a7e42fdeb6591, 0x5caaee4c7981ddb5, 0x19f234785af1e80d,
0x255ddde3ed98bd70, 0x50898a32a99cccac, 0x28ca4519da4e6656, 0xae59880f4cb31d22,
0x0d9798fa37d6db26, 0x32f968f0b4ffcd1a, 0xa00f09644f258545, 0xfa3ad5175e24de72,
0xf46c547c5db24615, 0x713e80fbff0f7e20, 0x7843cf2b73d2aafa, 0xbd17ea36aedf62b4,
0xfd111bacd16f92cf, 0x4abaa7dbc72d67e0, 0xb3416b5dad49fad3, 0xbca316b24914a88b,
0x15d150068aecf914, 0xe27c1debe31efc40, 0x4fe48c759beda223, 0x7edcfd141b522c78,
0x4e5070f17c26681c, 0xe696cac15815f3bc, 0x35d2a64b3bb481a7, 0x800cff29fe7dfdf6,
0x1ed9fac3d5baa4b0, 0x6c2663a91ef599d1, 0x03c1199134404341, 0xf7ad4ded69f20554,
0xcd9d9649b61bd6ab, 0xc8c3bde7eadb1368, 0xd131899fb02afb65, 0x1d18e352e1fae7f1,
0xda39235aef7ca6c1, 0xa1bbf5e0a8ee4f7a, 0x91377805cf9a0b1e, 0x3138716180bf8e5b,
0xd9f83acbdb3ce580, 0x0275e515d38b897e, 0x472d3f21f0fbbcc6, 0x2d946eb7868ea395,
0xba3c248d21942e09, 0xe7223645bfde3983, 0xff64feb902e41bb1, 0xc97741630d10d957,
0xc3cb1722b58d4ecc, 0xa27aec719cae0c3b, 0x99fecb51a48c15fb, 0x1465ac826d27332b,
0xe1bd047ad75ebf01, 0x79f733af941960c5, 0x672ec96c41a3c475, 0xc27feba6524684f3,
0x64efd0fd75e38734, 0xed9e60040743ae18, 0xfb8e2993b9ef144d, 0x38453eb10c625a81,
0x6978480742355c12, 0x48cf42ce14a6ee9e, 0x1cac1fd606312dce, 0x7b82d6ba4792e9bb,
0x9d141c7b1f871a07, 0x5616b80dc11c4a2e, 0xb849c198f21fa777, 0x7ca91801c8d9a506,
0xb1348e487ec273ad, 0x41b20d1e987b3a44, 0x7460ab55a3cfbbe3, 0x84e628034576f20a,
0x1b87d16d897a6173, 0x0fe27defe45d5258, 0x83cde6b8ca3dbeb7, 0x0c23647ed01d1119,
0x7a362a3ea0592384, 0xb61f40f3f1893f10, 0x75d457d1440471dc, 0x4558da34237035b8,
0xdca6116587fc2043, 0x8d9b67d3c9ab26d0, 0x2b0b5c88ee0e2517, 0x6fe77a382ab5da90,
0x269cc472d9d8fe31, 0x63c41e46faa8cb89, 0xb7abbc771642f52f, 0x7d1de4852f126f39,
0xa8c6ba3024339ba0, 0x600507d7cee888c8, 0x8fee82c61a20afae, 0x57a2448926d78011,
0xfca5e72836a458f0, 0x072bcebb8f4b4cbd, 0x497bbe4af36d24a1, 0x3cafe99bb769557d,
0x12fa9ebd05a7b5a9, 0xe8c04baa5b836bdb, 0x4273148fac3b7905, 0x908384812851c121,
0xe557d3506c55b0fd, 0x72ff996acb4f3d61, 0x3eda0c8e64e2dc03, 0xf0868356e6b949e9,
0x04ead72abb0b0ffc, 0x17a4b5135967706a, 0xe3c8e16f04d5367f, 0xf84f30028daf570c,
0x1846c8fcbd3a2232, 0x5b8120f7f6ca9108, 0xd46fa231ecea3ea6, 0x334d947453340725,
0x58403966c28ad249, 0xbed6f3a79a9f21f5, 0x68ccb483a5fe962d, 0xd085751b57e1315a,
0xfed0023de52fd18e, 0x4b0e5b5f20e6addf, 0x1a332de96eb1ab4c, 0xa3ce10f57b65c604,
0x108f7ba8d62c3cd7, 0xab07a3a11073d8e1, 0x6b0dad1291bed56c, 0xf2f366433532c097,
0x2e557726b2cee0d4, 0x0000000000000000, 0xcb02a476de9b5029, 0xe4e32fd48b9e7ac2,
0x734b65ee2c84f75e, 0x6e5386bccd7e10af, 0x01b4fc84e7cbca3f, 0xcfe8735c65905fd5,
0x3613bfda0ff4c2e6, 0x113b872c31e7f6e8, 0x2fe18ba255052aeb, 0xe974b72ebc48a1e4,
0x0abc5641b89d979b, 0xb46aa5e62202b66e, 0x44ec26b0c4bbff87, 0xa6903b5b27a503c7,
0x7f680190fc99e647, 0x97a84a3aa71a8d9c, 0xdd12ede16037ea7c, 0xc554251ddd0dc84e,
0x88c54c7d956be313, 0x4d91696048662b5d, 0xb08072cc9909b992, 0xb5de5962c5c97c51,
0x81b803ad19b637c9, 0xb2f597d94a8230ec, 0x0b08aac55f565da4, 0xf1327fd2017283d6,
0xad98919e78f35e63, 0x6ab9519676751f53, 0x24e921670a53774f, 0xb9fd3d1c15d46d48,
0x92f66194fbda485f, 0x5a35dc7311015b37, 0xded3f4705477a93d, 0xc00a0eb381cd0d8d,
0xbb88d809c65fe436, 0x16104997beacba55, 0x21b70ac95693b28c, 0x59f4c5e225411876,
0xd5db5eb50b21f499, 0x55d7a19cf55c096f, 0xa97246b4c3f8519f, 0x8552d487a2bd3835,
0x54635d181297c350, 0x23c2efdc85183bf2, 0x9f61f96ecc0c9379, 0x534893a39ddc8fed,
0x5edf0b59aa0a54cb, 0xac2c6d1a9f38945c, 0xd7aebba0d8aa7de7, 0x2abfa00c09c5ef28,
0xd84cc64f3cf72fbf, 0x2003f64db15878b3, 0xa724c7dfc06ec9f8, 0x069f323f68808682,
0xcc296acd51d01c94, 0x055e2bae5cc0c5c3, 0x6270e2c21d6301b6, 0x3b842720382219c0,
0xd2f0900e846ab824, 0x52fc6f277a1745d2, 0xc6953c8ce94d8b0f, 0xe009f8fe3095753e,
0x655b2c7992284d0b, 0x984a37d54347dfc4, 0xeab5aebf8808e2a5, 0x9a3fd2c090cc56ba,
0x9ca0e0fff84cd038, 0x4c2595e4afade162, 0xdf6708f4b3bc6302, 0xbf620f237d54ebca,
0x93429d101c118260, 0x097d4fd08cddd4da, 0x8c2f9b572e60ecef, 0x708a7c7f18c4b41f,
0x3a30dba4dfe9d3ff, 0x4006f19a7fb0f07b, 0x5f6bf7dd4dc19ef4, 0x1f6d064732716e8f,
0xf9fbcc866a649d33, 0x308c8de567744464, 0x8971b0f972a0292c, 0xd61a47243f61b7d8,
0xefeb8511d4c82766, 0x961cb6be40d147a3, 0xaab35f25f7b812de, 0x76154e407044329d,
0x513d76b64e570693, 0xf3479ac7d2f90aa8, 0x9b8b2e4477079c85, 0x297eb99d3d85ac69,
},
{
0x3ef29d249b2c0a19, 0xe9e16322b6f8622f, 0x5536994047757f7a, 0x9f4d56d5a47b0b33,
0x822567466aa1174c, 0xb8f5057deb082fb2, 0xcc48c10bf4475f53, 0x373088d4275dec3a,
0x968f4325180aed10, 0x173d232cf7016151, 0xae4ed09f946fcc13, 0xfd4b4741c4539873,
0x1b5b3f0dd9933765, 0x2ffcb0967b644052, 0xe02376d20a89840c, 0xa3ae3a70329b18d7,
0x419cbd2335de8526, 0xfafebf115b7c3199, 0x0397074f85aa9b0d, 0xc58ad4fb4836b970,
0xbec60be3fc4104a8, 0x1eff36dc4b708772, 0x131fdc33ed8453b6, 0x0844e33e341764d3,
0x0ff11b6eab38cd39, 0x64351f0a7761b85a, 0x3b5694f509cfba0e, 0x30857084b87245d0,
0x47afb3bd2297ae3c, 0xf2ba5c2f6f6b554a, 0x74bdc4761f4f70e1, 0xcfdfc64471edc45e,
0xe610784c1dc0af16, 0x7aca29d63c113f28, 0x2ded411776a859af, 0xac5f211e99a3d5ee,
0xd484f949a87ef33b, 0x3ce36ca596e013e4, 0xd120f0983a9d432c, 0x6bc40464dc597563,
0x69d5f5e5d1956c9e, 0x9ae95f043698bb24, 0xc9ecc8da66a4ef44, 0xd69508c8a5b2eac6,
0xc40c2235c0503b80, 0x38c193ba8c652103, 0x1ceec75d46bc9e8f, 0xd331011937515ad1,
0xd8e2e56886eca50f, 0xb137108d5779c991, 0x709f3b6905ca4206, 0x4feb50831680caef,
0xec456af3241bd238, 0x58d673afe181abbe, 0x242f54e7cad9bf8c, 0x0211f1810dcc19fd,
0x90bc4dbb0f43c60a, 0x9518446a9da0761d, 0xa1bfcbf13f57012a, 0x2bde4f8961e172b5,
0x27b853a84f732481, 0xb0b1e643df1f4b61, 0x18cc38425c39ac68, 0xd2b7f7d7bf37d821,
0x3103864a3014c720, 0x14aa246372abfa5c, 0x6e600db54ebac574, 0x394765740403a3f3,
0x09c215f0bc71e623, 0x2a58b947e987f045, 0x7b4cdf18b477bdd8, 0x9709b5eb906c6fe0,
0x73083c268060d90b, 0xfedc400e41f9037e, 0x284948c6e44be9b8, 0x728ecae808065bfb,
0x06330e9e17492b1a, 0x5950856169e7294e, 0xbae4f4fce6c4364f, 0xca7bcf95e30e7449,
0x7d7fd186a33e96c2, 0x52836110d85ad690, 0x4dfaa1021b4cd312, 0x913abb75872544fa,
0xdd46ecb9140f1518, 0x3d659a6b1e869114, 0xc23f2cabd719109a, 0xd713fe062dd46836,
0xd0a60656b2fbc1dc, 0x221c5a79dd909496, 0xefd26dbca1b14935, 0x0e77eda0235e4fc9,
0xcbfd395b6b68f6b9, 0x0de0eaefa6f4d4c4, 0x0422ff1f1a8532e7, 0xf969b85eded6aa94,
0x7f6e2007aef28f3f, 0x3ad0623b81a938fe, 0x6624ee8b7aada1a7, 0xb682e8ddc856607b,
0xa78cc56f281e2a30, 0xc79b257a45faa08d, 0x5b4174e0642b30b3, 0x5f638bff7eae0254,
0x4bc9af9c0c05f808, 0xce59308af98b46ae, 0x8fc58da9cc55c388, 0x803496c7676d0eb1,
0xf33caae1e70dd7ba, 0xbb6202326ea2b4bf, 0xd5020f87201871cb, 0x9d5ca754a9b712ce,
0x841669d87de83c56, 0x8a6184785eb6739f, 0x420bba6cb0741e2b, 0xf12d5b60eac1ce47,
0x76ac35f71283691c, 0x2c6bb7d9fecedb5f, 0xfccdb18f4c351a83, 0x1f79c012c3160582,
0xf0abadae62a74cb7, 0xe1a5801c82ef06fc, 0x67a21845f2cb2357, 0x5114665f5df04d9d,
0xbf40fd2d74278658, 0xa0393d3fb73183da, 0x05a409d192e3b017, 0xa9fb28cf0b4065f9,
0x25a9a22942bf3d7c, 0xdb75e22703463e02, 0xb326e10c5ab5d06c, 0xe7968e8295a62de6,
0xb973f3b3636ead42, 0xdf571d3819c30ce5, 0xee549b7229d7cbc5, 0x12992afd65e2d146,
0xf8ef4e9056b02864, 0xb7041e134030e28b, 0xc02edd2adad50967, 0x932b4af48ae95d07,
0x6fe6fb7bc6dc4784, 0x239aacb755f61666, 0x401a4bedbdb807d6, 0x485ea8d389af6305,
0xa41bc220adb4b13d, 0x753b32b89729f211, 0x997e584bb3322029, 0x1d683193ceda1c7f,
0xff5ab6c0c99f818e, 0x16bbd5e27f67e3a1, 0xa59d34ee25d233cd, 0x98f8ae853b54a2d9,
0x6df70afacb105e79, 0x795d2e99b9bba425, 0x8e437b6744334178, 0x0186f6ce886682f0,
0xebf092a3bb347bd2, 0xbcd7fa62f18d1d55, 0xadd9d7d011c5571e, 0x0bd3e471b1bdffde,
0xaa6c2f808eeafef4, 0x5ee57d31f6c880a4, 0xf50fa47ff044fca0, 0x1addc9c351f5b595,
0xea76646d3352f922, 0x0000000000000000, 0x85909f16f58ebea6, 0x46294573aaf12ccc,
0x0a5512bf39db7d2e, 0x78dbd85731dd26d5, 0x29cfbe086c2d6b48, 0x218b5d36583a0f9b,
0x152cd2adfacd78ac, 0x83a39188e2c795bc, 0xc3b9da655f7f926a, 0x9ecba01b2c1d89c3,
0x07b5f8509f2fa9ea, 0x7ee8d6c926940dcf, 0x36b67e1aaf3b6eca, 0x86079859702425ab,
0xfb7849dfd31ab369, 0x4c7c57cc932a51e2, 0xd96413a60e8a27ff, 0x263ea566c715a671,
0x6c71fc344376dc89, 0x4a4f595284637af8, 0xdaf314e98b20bcf2, 0x572768c14ab96687,
0x1088db7c682ec8bb, 0x887075f9537a6a62, 0x2e7a4658f302c2a2, 0x619116dbe582084d,
0xa87dde018326e709, 0xdcc01a779c6997e8, 0xedc39c3dac7d50c8, 0xa60a33a1a078a8c0,
0xc1a82be452b38b97, 0x3f746bea134a88e9, 0xa228ccbebafd9a27, 0xabead94e068c7c04,
0xf48952b178227e50, 0x5cf48cb0fb049959, 0x6017e0156de48abd, 0x4438b4f2a73d3531,
0x8c528ae649ff5885, 0xb515ef924dfcfb76, 0x0c661c212e925634, 0xb493195cc59a7986,
0x9cda519a21d1903e, 0x32948105b5be5c2d, 0x194ace8cd45f2e98, 0x438d4ca238129cdb,
0x9b6fa9cabefe39d4, 0x81b26009ef0b8c41, 0xded1ebf691a58e15, 0x4e6da64d9ee6481f,
0x54b06f8ecf13fd8a, 0x49d85e1d01c9e1f5, 0xafc826511c094ee3, 0xf698a33075ee67ad,
0x5ac7822eec4db243, 0x8dd47c28c199da75, 0x89f68337db1ce892, 0xcdce37c57c21dda3,
0x530597de503c5460, 0x6a42f2aa543ff793, 0x5d727a7e73621ba9, 0xe232875307459df1,
0x56a19e0fc2dfe477, 0xc61dd3b4cd9c227d, 0xe5877f03986a341b, 0x949eb2a415c6f4ed,
0x6206119460289340, 0x6380e75ae84e11b0, 0x8be772b6d6d0f16f, 0x50929091d596cf6d,
0xe86795ec3e9ee0df, 0x7cf927482b581432, 0xc86a3e14eec26db4, 0x7119cda78dacc0f6,
0xe40189cd100cb6eb, 0x92adbc3a028fdff7, 0xb2a017c2d2d3529c, 0x200dabf8d05c8d6b,
0x34a78f9ba2f77737, 0xe3b4719d8f231f01, 0x45be423c2f5bb7c1, 0xf71e55fefd88e55d,
0x6853032b59f3ee6e, 0x65b3e9c4ff073aaa, 0x772ac3399ae5ebec, 0x87816e97f842a75b,
0x110e2db2e0484a4b, 0x331277cb3dd8dedd, 0xbd510cac79eb9fa5, 0x352179552a91f5c7,
},
{
0x05ba7bc82c9b3220, 0x31a54665f8b65e4f, 0xb1b651f77547f4d4, 0x8bfa0d857ba46682,
0x85a96c5aa16a98bb, 0x990faef908eb79c9, 0xa15e37a247f4a62d, 0x76857dcd5d27741e,
0xf8c50b800a1820bc, 0xbe65dcb201f7a2b4, 0x666d1b986f9426e7, 0x4cc921bf53c4e648,
0x95410a0f93d9ca42, 0x20cdccaa647ba4ef, 0x429a4060890a1871, 0x0c4ea4f69b32b38b,
0xccda362dde354cd3, 0x96dc23bc7c5b2fa9, 0xc309bb68aa851ab3, 0xd26131a73648e013,
0x021dc52941fc4db2, 0xcd5adab7704be48a, 0xa77965d984ed71e6, 0x32386fd61734bba4,
0xe82d6dd538ab7245, 0x5c2147ea6177b4b1, 0x5da1ab70cf091ce8, 0xac907fce72b8bdff,
0x57c85dfd972278a8, 0xa4e44c6a6b6f940d, 0x3851995b4f1fdfe4, 0x62578ccaed71bc9e,
0xd9882bb0c01d2c0a, 0x917b9d5d113c503b, 0xa2c31e11a87643c6, 0xe463c923a399c1ce,
0xf71686c57ea876dc, 0x87b4a973e096d509, 0xaf0d567d9d3a5814, 0xb40c2a3f59dcc6f4,
0x3602f88495d121dd, 0xd3e1dd3d9836484a, 0xf945e71aa46688e5, 0x7518547eb2a591f5,
0x9366587450c01d89, 0x9ea81018658c065b, 0x4f54080cbc4603a3, 0x2d0384c65137bf3d,
0xdc325078ec861e2a, 0xea30a8fc79573ff7, 0x214d2030ca050cb6, 0x65f0322b8016c30c,
0x69be96dd1b247087, 0xdb95ee9981e161b8, 0xd1fc1814d9ca05f8, 0x820ed2bbcc0de729,
0x63d76050430f14c7, 0x3bccb0e8a09d3a0f, 0x8e40764d573f54a2, 0x39d175c1e16177bd,
0x12f5a37c734f1f4b, 0xab37c12f1fdfc26d, 0x5648b167395cd0f1, 0x6c04ed1537bf42a7,
0xed97161d14304065, 0x7d6c67daab72b807, 0xec17fa87ba4ee83c, 0xdfaf79cb0304fbc1,
0x733f060571bc463e, 0x78d61c1287e98a27, 0xd07cf48e77b4ada1, 0xb9c262536c90dd26,
0xe2449b5860801605, 0x8fc09ad7f941fcfb, 0xfad8cea94be46d0e, 0xa343f28b0608eb9f,
0x9b126bd04917347b, 0x9a92874ae7699c22, 0x1b017c42c4e69ee0, 0x3a4c5c720ee39256,
0x4b6e9f5e3ea399da, 0x6ba353f45ad83d35, 0xe7fee0904c1b2425, 0x22d009832587e95d,
0x842980c00f1430e2, 0xc6b3c0a0861e2893, 0x087433a419d729f2, 0x341f3dadd42d6c6f,
0xee0a3faefbb2a58e, 0x4aee73c490dd3183, 0xaab72db5b1a16a34, 0xa92a04065e238fdf,
0x7b4b35a1686b6fcc, 0x6a23bf6ef4a6956c, 0x191cb96b851ad352, 0x55d598d4d6de351a,
0xc9604de5f2ae7ef3, 0x1ca6c2a3a981e172, 0xde2f9551ad7a5398, 0x3025aaff56c8f616,
0x15521d9d1e2860d9, 0x506fe31cfa45073a, 0x189c55f12b647b0b, 0x0180ec9aae7ea859,
0x7cec8b40050c105e, 0x2350e5198bf94104, 0xef8ad33455cc0dd7, 0x07a7bee16d677f92,
0xe5e325b90de76997, 0x5a061591a26e637a, 0xb611ef1618208b46, 0x09f4df3eb7a981ab,
0x1ebb078ae87dacc0, 0xb791038cb65e231f, 0x0fd38d4574b05660, 0x67edf702c1ea8ebe,
0xba5f4be0831238cd, 0xe3c477c2cefebe5c, 0x0dce486c354c1bd2, 0x8c5db36416c31910,
0x26ea9ed1a7627324, 0x039d29b3ef82e5eb, 0x9f28fc82cbf2ae02, 0xa8aae89cf05d2786,
0x431aacfa2774b028, 0xcf471f9e31b7a938, 0x581bd0b8e3922ec8, 0xbc78199b400bef06,
0x90fb71c7bf42f862, 0x1f3beb1046030499, 0x683e7a47b55ad8de, 0x988f4263a695d190,
0xd808c72a6e638453, 0x0627527bc319d7cb, 0xebb04466d72997ae, 0xe67e0c0ae2658c7c,
0x14d2f107b056c880, 0x7122c32c30400b8c, 0x8a7ae11fd5dacedb, 0xa0dedb38e98a0e74,
0xad109354dcc615a6, 0x0be91a17f655cc19, 0x8ddd5ffeb8bdb149, 0xbfe53028af890aed,
0xd65ba6f5b4ad7a6a, 0x7956f0882997227e, 0x10e8665532b352f9, 0x0e5361dfdacefe39,
0xcec7f3049fc90161, 0xff62b561677f5f2e, 0x975ccf26d22587f0, 0x51ef0f86543baf63,
0x2f1e41ef10cbf28f, 0x52722635bbb94a88, 0xae8dbae73344f04d, 0x410769d36688fd9a,
0xb3ab94de34bbb966, 0x801317928df1aa9b, 0xa564a0f0c5113c54, 0xf131d4bebdb1a117,
0x7f71a2f3ea8ef5b5, 0x40878549c8f655c3, 0x7ef14e6944f05dec, 0xd44663dcf55137d8,
0xf2acfd0d523344fc, 0x0000000000000000, 0x5fbc6e598ef5515a, 0x16cf342ef1aa8532,
0xb036bd6ddb395c8d, 0x13754fe6dd31b712, 0xbbdfa77a2d6c9094, 0x89e7c8ac3a582b30,
0x3c6b0e09cdfa459d, 0xc4ae0589c7e26521, 0x49735a777f5fd468, 0xcafd64561d2c9b18,
0xda1502032f9fc9e1, 0x8867243694268369, 0x3782141e3baf8984, 0x9cb5d53124704be9,
0xd7db4a6f1ad3d233, 0xa6f989432a93d9bf, 0x9d3539ab8a0ee3b0, 0x53f2caaf15c7e2d1,
0x6e19283c76430f15, 0x3debe2936384edc4, 0x5e3c82c3208bf903, 0x33b8834cb94a13fd,
0x6470deb12e686b55, 0x359fd1377a53c436, 0x61caa57902f35975, 0x043a975282e59a79,
0xfd7f70482683129c, 0xc52ee913699ccd78, 0x28b9ff0e7dac8d1d, 0x5455744e78a09d43,
0xcb7d88ccb3523341, 0x44bd121b4a13cfba, 0x4d49cd25fdba4e11, 0x3e76cb208c06082f,
0x3ff627ba2278a076, 0xc28957f204fbb2ea, 0x453dfe81e46d67e3, 0x94c1e6953da7621b,
0x2c83685cff491764, 0xf32c1197fc4deca5, 0x2b24d6bd922e68f6, 0xb22b78449ac5113f,
0x48f3b6edd1217c31, 0x2e9ead75beb55ad6, 0x174fd8b45fd42d6b, 0x4ed4e4961238abfa,
0x92e6b4eefebeb5d0, 0x46a0d7320bef8208, 0x47203ba8a5912a51, 0x24f75bf8e69e3e96,
0xf0b1382413cf094e, 0xfee259fbc901f777, 0x276a724b091cdb7d, 0xbdf8f501ee75475f,
0x599b3c224dec8691, 0x6d84018f99c1eafe, 0x7498b8e41cdb39ac, 0xe0595e71217c5bb7,
0x2aa43a273c50c0af, 0xf50b43ec3f543b6e, 0x838e3e2162734f70, 0xc09492db4507ff58,
0x72bfea9fdfc2ee67, 0x11688acf9ccdfaa0, 0x1a8190d86a9836b9, 0x7acbd93bc615c795,
0xc7332c3a286080ca, 0x863445e94ee87d50, 0xf6966a5fd0d6de85, 0xe9ad814f96d5da1c,
0x70a22fb69e3ea3d5, 0x0a69f68d582b6440, 0xb8428ec9c2ee757f, 0x604a49e3ac8df12c,
0x5b86f90b0c10cb23, 0xe1d9b2eb8f02f3ee, 0x29391394d3d22544, 0xc8e0a17f5cd0d6aa,
0xb58cc6a5f7a26ead, 0x8193fb08238f02c2, 0xd5c68f465b2f9f81, 0xfcff9cd288fdbac5,
0x77059157f359dc47, 0x1d262e3907ff492b, 0xfb582233e59ac557, 0xddb2bce242f8b673,
0x2577b76248e096cf, 0x6f99c4a6d83da74c, 0xc1147e41eb795701, 0xf48baf76912a9337,
},
{
0x45b268a93acde4cc, 0xaf7f0be884549d08, 0x048354b3c1468263, 0x925435c2c80efed2,
0xee4e37f27fdffba7, 0x167a33920c60f14d, 0xfb123b52ea03e584, 0x4a0cab53fdbb9007,
0x9deaf6380f788a19, 0xcb48ec558f0cb32a, 0xb59dc4b2d6fef7e0, 0xdcdbca22f4f3ecb6,
0x11df5813549a9c40, 0xe33fdedf568aced3, 0xa0c1c8124322e9c3, 0x07a56b8158fa6d0d,
0x77279579b1e1f3dd, 0xd9b18b74422ac004, 0xb8ec2d9fffabc294, 0xf4acf8a82d75914f,
0x7bbf69b1ef2b6878, 0xc4f62faf487ac7e1, 0x76ce809cc67e5d0c, 0x6711d88f92e4c14c,
0x627b99d9243dedfe, 0x234aa5c3dfb68b51, 0x909b1f15262dbf6d, 0x4f66ea054b62bcb5,
0x1ae2cf5a52aa6ae8, 0xbea053fbd0ce0148, 0xed6808c0e66314c9, 0x43fe16cd15a82710,
0xcd049231a06970f6, 0xe7bc8a6c97cc4cb0, 0x337ce835fcb3b9c0, 0x65def2587cc780f3,
0x52214ede4132bb50, 0x95f15e4390f493df, 0x870839625dd2e0f1, 0x41313c1afb8b66af,
0x91720af051b211bc, 0x477d427ed4eea573, 0x2e3b4ceef6e3be25, 0x82627834eb0bcc43,
0x9c03e3dd78e724c8, 0x2877328ad9867df9, 0x14b51945e243b0f2, 0x574b0f88f7eb97e2,
0x88b6fa989aa4943a, 0x19c4f068cb168586, 0x50ee6409af11faef, 0x7df317d5c04eaba4,
0x7a567c5498b4c6a9, 0xb6bbfb804f42188e, 0x3cc22bcf3bc5cd0b, 0xd04336eaaa397713,
0xf02fac1bec33132c, 0x2506dba7f0d3488d, 0xd7e65d6bf2c31a1e, 0x5eb9b2161ff820f5,
0x842e0650c46e0f9f, 0x716beb1d9e843001, 0xa933758cab315ed4, 0x3fe414fda2792265,
0x27c9f1701ef00932, 0x73a4c1ca70a771be, 0x94184ba6e76b3d0e, 0x40d829ff8c14c87e,
0x0fbec3fac77674cb, 0x3616a9634a6a9572, 0x8f139119c25ef937, 0xf545ed4d5aea3f9e,
0xe802499650ba387b, 0x6437e7bd0b582e22, 0xe6559f89e053e261, 0x80ad52e305288dfc,
0x6dc55a23e34b9935, 0xde14e0f51ad0ad09, 0xc6390578a659865e, 0x96d7617109487cb1,
0xe2d6cb3a21156002, 0x01e915e5779faed1, 0xadb0213f6a77dcb7, 0x9880b76eb9a1a6ab,
0x5d9f8d248644cf9b, 0xfd5e4536c5662658, 0xf1c6b9fe9bacbdfd, 0xeacd6341be9979c4,
0xefa7221708405576, 0x510771ecd88e543e, 0xc2ba51cb671f043d, 0x0ad482ac71af5879,
0xfe787a045cdac936, 0xb238af338e049aed, 0xbd866cc94972ee26, 0x615da6ebbd810290,
0x3295fdd08b2c1711, 0xf834046073bf0aea, 0xf3099329758ffc42, 0x1caeb13e7dcfa934,
0xba2307481188832b, 0x24efce42874ce65c, 0x0e57d61fb0e9da1a, 0xb3d1bad6f99b343c,
0xc0757b1c893c4582, 0x2b510db8403a9297, 0x5c7698c1f1db614a, 0x3e0d0118d5e68cb4,
0xd60f488e855cb4cf, 0xae961e0df3cb33d9, 0x3a8e55ab14a00ed7, 0x42170328623789c1,
0x838b6dd19c946292, 0x895fef7ded3b3aeb, 0xcfcbb8e64e4a3149, 0x064c7e642f65c3dc,
0x3d2b3e2a4c5a63da, 0x5bd3f340a9210c47, 0xb474d157a1615931, 0xac5934da1de87266,
0x6ee365117af7765b, 0xc86ed36716b05c44, 0x9ba6885c201d49c5, 0xb905387a88346c45,
0x131072c4bab9ddff, 0xbf49461ea751af99, 0xd52977bc1ce05ba1, 0xb0f785e46027db52,
0x546d30ba6e57788c, 0x305ad707650f56ae, 0xc987c682612ff295, 0xa5ab8944f5fbc571,
0x7ed528e759f244ca, 0x8ddcbbce2c7db888, 0xaa154abe328db1ba, 0x1e619be993ece88b,
0x09f2bd9ee813b717, 0x7401aa4b285d1cb3, 0x21858f143195caee, 0x48c381841398d1b8,
0xfcb750d3b2f98889, 0x39a86a998d1ce1b9, 0x1f888e0ce473465a, 0x7899568376978716,
0x02cf2ad7ee2341bf, 0x85c713b5b3f1a14e, 0xff916fe12b4567e7, 0x7c1a0230b7d10575,
0x0c98fcc85eca9ba5, 0xa3e7f720da9e06ad, 0x6a6031a2bbb1f438, 0x973e74947ed7d260,
0x2cf4663918c0ff9a, 0x5f50a7f368678e24, 0x34d983b4a449d4cd, 0x68af1b755592b587,
0x7f3c3d022e6dea1b, 0xabfc5f5b45121f6b, 0x0d71e92d29553574, 0xdffdf5106d4f03d8,
0x081ba87b9f8c19c6, 0xdb7ea1a3ac0981bb, 0xbbca12ad66172dfa, 0x79704366010829c7,
0x179326777bff5f9c, 0x0000000000000000, 0xeb2476a4c906d715, 0x724dd42f0738df6f,
0xb752ee6538ddb65f, 0x37ffbc863df53ba3, 0x8efa84fcb5c157e6, 0xe9eb5c73272596aa,
0x1b0bdabf2535c439, 0x86e12c872a4d4e20, 0x9969a28bce3e087a, 0xfafb2eb79d9c4b55,
0x056a4156b6d92cb2, 0x5a3ae6a5debea296, 0x22a3b026a8292580, 0x53c85b3b36ad1581,
0xb11e900117b87583, 0xc51f3a4a3fe56930, 0xe019e1edcf3621bd, 0xec811d2591fcba18,
0x445b7d4c4d524a1d, 0xa8da6069dcaef005, 0x58f5cc72309de329, 0xd4c062596b7ff570,
0xce22ad0339d59f98, 0x591cd99747024df8, 0x8b90c5aa03187b54, 0xf663d27fc356d0f0,
0xd8589e9135b56ed5, 0x35309651d3d67a1c, 0x12f96721cd26732e, 0xd28c1c3d441a36ac,
0x492a946164077f69, 0x2d1d73dc6f5f514b, 0x6f0a70f40d68d88a, 0x60b4b30eca1eac41,
0xd36509d83385987d, 0x0b3d97490630f6a8, 0x9eccc90a96c46577, 0xa20ee2c5ad01a87c,
0xe49ab55e0e70a3de, 0xa4429ca182646ba0, 0xda97b446db962f6a, 0xcced87d4d7f6de27,
0x2ab8185d37a53c46, 0x9f25dcefe15bcba6, 0xc19c6ef9fea3eb53, 0xa764a3931bd884ce,
0x2fd2590b817c10f4, 0x56a21a6d80743933, 0xe573a0bb79ef0d0f, 0x155c0ca095dc1e23,
0x6c2c4fc694d437e4, 0x10364df623053291, 0xdd32dfc7836c4267, 0x03263f3299bcef6e,
0x66f8cd6ae57b6f9d, 0x8c35ae2b5be21659, 0x31b3c2e21290f87f, 0x93bd2027bf915003,
0x69460e90220d1b56, 0x299e276fae19d328, 0x63928c3c53a2432f, 0x7082fef8e91b9ed0,
0xbc6f792c3eed40f7, 0x4c40d537d2de53db, 0x75e8bfae5fc2b262, 0x4da9c0d2a541fd0a,
0x4e8fffe03cfd1264, 0x2620e495696fa7e3, 0xe1f0f408b8a98f6c, 0xd1aa230fdda6d9c2,
0xc7d0109dd1c6288f, 0x8a79d04f7487d585, 0x4694579ba3710ba2, 0x38417f7cfa834f68,
0x1d47a4db0a5007e5, 0x206c9af1460a643f, 0xa128ddf734bd4712, 0x8144470672b7232d,
0xf2e086cc02105293, 0x182de58dbc892b57, 0xcaa1f9b0f8931dfb, 0x6b892447cc2e5ae9,
0xf9dd11850420a43b, 0x4be5beb68a243ed6, 0x5584255f19c8d65d, 0x3b67404e633fa006,
0xa68db6766c472a1f, 0xf78ac79ab4c97e21, 0xc353442e1080aaec, 0x9a4f9db95782e714,
},
{
0xc811a8058c3f55de, 0x65f5b43196b50619, 0xf74f96b1d6706e43, 0x859d1e8bcb43d336,
0x5aab8a85ccfa3d84, 0xf9c7bf99c295fcfd, 0xa21fd5a1de4b630f, 0xcdb3ef763b8b456d,
0x803f59f87cf7c385, 0xb27c73be5f31913c, 0x98e3ac6633b04821, 0xbf61674c26b8f818,
0x0ffbc995c4c130c8, 0xaaa0862010761a98, 0x6057f342210116aa, 0xf63c760c0654cc35,
0x2ddb45cc667d9042, 0xbcf45a964bd40382, 0x68e8a0c3ef3c6f3d, 0xa7bd92d269ff73bc,
0x290ae20201ed2287, 0xb7de34cde885818f, 0xd901eea7dd61059b, 0xd6fa273219a03553,
0xd56f1ae874cccec9, 0xea31245c2e83f554, 0x7034555da07be499, 0xce26d2ac56e7bef7,
0xfd161857a5054e38, 0x6a0e7da4527436d1, 0x5bd86a381cde9ff2, 0xcaf7756231770c32,
0xb09aaed9e279c8d0, 0x5def1091c60674db, 0x111046a2515e5045, 0x23536ce4729802fc,
0xc50cbcf7f5b63cfa, 0x73a16887cd171f03, 0x7d2941afd9f28dbd, 0x3f5e3eb45a4f3b9d,
0x84eefe361b677140, 0x3db8e3d3e7076271, 0x1a3a28f9f20fd248, 0x7ebc7c75b49e7627,
0x74e5f293c7eb565c, 0x18dcf59e4f478ba4, 0x0c6ef44fa9adcb52, 0xc699812d98dac760,
0x788b06dc6e469d0e, 0xfc65f8ea7521ec4e, 0x30a5f7219e8e0b55, 0x2bec3f65bca57b6b,
0xddd04969baf1b75e, 0x99904cdbe394ea57, 0x14b201d1e6ea40f6, 0xbbb0c08241284add,
0x50f20463bf8f1dff, 0xe8d7f93b93cbacb8, 0x4d8cb68e477c86e8, 0xc1dd1b3992268e3f,
0x7c5aa11209d62fcb, 0x2f3d98abdb35c9ae, 0x671369562bfd5ff5, 0x15c1e16c36cee280,
0x1d7eb2edf8f39b17, 0xda94d37db00dfe01, 0x877bc3ec760b8ada, 0xcb8495dfe153ae44,
0x05a24773b7b410b3, 0x12857b783c32abdf, 0x8eb770d06812513b, 0x536739b9d2e3e665,
0x584d57e271b26468, 0xd789c78fc9849725, 0xa935bbfa7d1ae102, 0x8b1537a3dfa64188,
0xd0cd5d9bc378de7a, 0x4ac82c9a4d80cfb7, 0x42777f1b83bdb620, 0x72d2883a1d33bd75,
0x5e7a2d4bab6a8f41, 0xf4daab6bbb1c95d9, 0x905cffe7fd8d31b6, 0x83aa6422119b381f,
0xc0aefb8442022c49, 0xa0f908c663033ae3, 0xa428af0804938826, 0xade41c341a8a53c7,
0xae7121ee77e6a85d, 0xc47f5c4a25929e8c, 0xb538e9aa55cdd863, 0x06377aa9dad8eb29,
0xa18ae87bb3279895, 0x6edfda6a35e48414, 0x6b7d9d19825094a7, 0xd41cfa55a4e86cbf,
0xe5caedc9ea42c59c, 0xa36c351c0e6fc179, 0x5181e4de6fabbf89, 0xfff0c530184d17d4,
0x9d41eb1584045892, 0x1c0d525028d73961, 0xf178ec180ca8856a, 0x9a0571018ef811cd,
0x4091a27c3ef5efcc, 0x19af15239f6329d2, 0x347450eff91eb990, 0xe11b4a078dd27759,
0xb9561de5fc601331, 0x912f1f5a2da993c0, 0x1654dcb65ba2191a, 0x3e2dde098a6b99eb,
0x8a66d71e0f82e3fe, 0x8c51adb7d55a08d7, 0x4533e50f8941ff7f, 0x02e6dd67bd4859ec,
0xe068aaba5df6d52f, 0xc24826e3ff4a75a5, 0x6c39070d88acddf8, 0x6486548c4691a46f,
0xd1bebd26135c7c0c, 0xb30f93038f15334a, 0x82d9849fc1bf9a69, 0x9c320ba85420fae4,
0xfa528243aff90767, 0x9ed4d6cfe968a308, 0xb825fd582c44b147, 0x9b7691bc5edcb3bb,
0xc7ea619048fe6516, 0x1063a61f817af233, 0x47d538683409a693, 0x63c2ce984c6ded30,
0x2a9fdfd86c81d91d, 0x7b1e3b06032a6694, 0x666089ebfbd9fd83, 0x0a598ee67375207b,
0x07449a140afc495f, 0x2ca8a571b6593234, 0x1f986f8a45bbc2fb, 0x381aa4a050b372c2,
0x5423a3add81faf3a, 0x17273c0b8b86bb6c, 0xfe83258dc869b5a2, 0x287902bfd1c980f1,
0xf5a94bd66b3837af, 0x88800a79b2caba12, 0x55504310083b0d4c, 0xdf36940e07b9eeb2,
0x04d1a7ce6790b2c5, 0x612413fff125b4dc, 0x26f12b97c52c124f, 0x86082351a62f28ac,
0xef93632f9937e5e7, 0x3507b052293a1be6, 0xe72c30ae570a9c70, 0xd3586041ae1425e0,
0xde4574b3d79d4cc4, 0x92ba228040c5685a, 0xf00b0ca5dc8c271c, 0xbe1287f1f69c5a6e,
0xf39e317fb1e0dc86, 0x495d114020ec342d, 0x699b407e3f18cd4b, 0xdca3a9d46ad51528,
0x0d1d14f279896924, 0x0000000000000000, 0x593eb75fa196c61e, 0x2e4e78160b116bd8,
0x6d4ae7b058887f8e, 0xe65fd013872e3e06, 0x7a6ddbbbd30ec4e2, 0xac97fc89caaef1b1,
0x09ccb33c1e19dbe1, 0x89f3eac462ee1864, 0x7770cf49aa87adc6, 0x56c57eca6557f6d6,
0x03953dda6d6cfb9a, 0x36928d884456e07c, 0x1eeb8f37959f608d, 0x31d6179c4eaaa923,
0x6fac3ad7e5c02662, 0x43049fa653991456, 0xabd3669dc052b8ee, 0xaf02c153a7c20a2b,
0x3ccb036e3723c007, 0x93c9c23d90e1ca2c, 0xc33bc65e2f6ed7d3, 0x4cff56339758249e,
0xb1e94e64325d6aa6, 0x37e16d359472420a, 0x79f8e661be623f78, 0x5214d90402c74413,
0x482ef1fdf0c8965b, 0x13f69bc5ec1609a9, 0x0e88292814e592be, 0x4e198b542a107d72,
0xccc00fcbebafe71b, 0x1b49c844222b703e, 0x2564164da840e9d5, 0x20c6513e1ff4f966,
0xbac3203f910ce8ab, 0xf2edd1c261c47ef0, 0x814cb945acd361f3, 0x95feb8944a392105,
0x5c9cf02c1622d6ad, 0x971865f3f77178e9, 0xbd87ba2b9bf0a1f4, 0x444005b259655d09,
0xed75be48247fbc0b, 0x7596122e17cff42a, 0xb44b091785e97a15, 0x966b854e2755da9f,
0xeee0839249134791, 0x32432a4623c652b9, 0xa8465b47ad3e4374, 0xf8b45f2412b15e8b,
0x2417f6f078644ba3, 0xfb2162fe7fdda511, 0x4bbbcc279da46dc1, 0x0173e0bdd024a276,
0x22208c59a2bca08a, 0x8fc4906db836f34d, 0xe4b90d743a6667ea, 0x7147b5e0705f46ef,
0x2782cb2a1508b039, 0xec065ef5f45b1e7d, 0x21b5b183cfd05b10, 0xdbe733c060295c77,
0x9fa73672394c017e, 0xcf55321186c31c81, 0xd8720e1a0d45a7ed, 0x3b8f997a3ddf8958,
0x3afc79c7edfb2b2e, 0xe9a4198643ef0ece, 0x5f09cdf67b4e2d37, 0x4f6a6be9fa34df04,
0xb6add47038a123f9, 0x8d224d0a057eaaa1, 0xc96248b85c1bf7a8, 0xe3fd9760309a2eb5,
0x0b2a6e5ba351820d, 0xeb42c4e1fea75722, 0x948d58299a1d8373, 0x7fcf9cc864bad451,
0xa55b4fb5d4b72a50, 0x08bf5381ce3d7997, 0x46a6d8d5e42d04e5, 0xd22b80fc7e308796,
0x57b69e77b57354a0, 0x3969441d8097d0b4, 0x3330cafbf3e2f0cf, 0xe28e77dde0be8cc3,
0x62b12e259c494f46, 0xa6ce726fb9dbd1ca, 0x41e242c1eed14dba, 0x76032ff47aa30fb0,
},
{
0xe6f87e5c5b711fd0, 0x258377800924fa16, 0xc849e07e852ea4a8, 0x5b4686a18f06c16a,
0x0b32e9a2d77b416e, 0xabda37a467815c66, 0xf61796a81a686676, 0xf5dc0b706391954b,
0x4862f38db7e64bf1, 0xff5c629a68bd85c5, 0xcb827da6fcd75795, 0x66d36daf69b9f089,
0x356c9f74483d83b0, 0x7cbcecb1238c99a1, 0x36a702ac31c4708d, 0x9eb6a8d02fbcdfd6,
0x8b19fa51e5b3ae37, 0x9ccfb5408a127d0b, 0xbc0c78b508208f5a, 0xe533e3842288eced,
0xcec2c7d377c15fd2, 0xec7817b6505d0f5e, 0xb94cc2c08336871d, 0x8c205db4cb0b04ad,
0x763c855b28a0892f, 0x588d1b79f6ff3257, 0x3fecf69e4311933e, 0x0fc0d39f803a18c9,
0xee010a26f5f3ad83, 0x10efe8f4411979a6, 0x5dcda10c7de93a10, 0x4a1bee1d1248e92c,
0x53bff2db21847339, 0xb4f50ccfa6a23d09, 0x5fb4bc9cd84798cd, 0xe88a2d8b071c56f9,
0x7f7771695a756a9c, 0xc5f02e71a0ba1ebc, 0xa663f9ab4215e672, 0x2eb19e22de5fbb78,
0x0db9ce0f2594ba14, 0x82520e6397664d84, 0x2f031e6a0208ea98, 0x5c7f2144a1be6bf0,
0x7a37cb1cd16362db, 0x83e08e2b4b311c64, 0xcf70479bab960e32, 0x856ba986b9dee71e,
0xb5478c877af56ce9, 0xb8fe42885f61d6fd, 0x1bdd0156966238c8, 0x622157923ef8a92e,
0xfc97ff42114476f8, 0x9d7d350856452ceb, 0x4c90c9b0e0a71256, 0x2308502dfbcb016c,
0x2d7a03faa7a64845, 0xf46e8b38bfc6c4ab, 0xbdbef8fdd477deba, 0x3aac4cebc8079b79,
0xf09cb105e8879d0c, 0x27fa6a10ac8a58cb, 0x8960e7c1401d0cea, 0x1a6f811e4a356928,
0x90c4fb0773d196ff, 0x43501a2f609d0a9f, 0xf7a516e0c63f3796, 0x1ce4a6b3b8da9252,
0x1324752c38e08a9b, 0xa5a864733bec154f, 0x2bf124575549b33f, 0xd766db15440dc5c7,
0xa7d179e39e42b792, 0xdadf151a61997fd3, 0x86a0345ec0271423, 0x38d5517b6da939a4,
0x6518f077104003b4, 0x02791d90a5aea2dd, 0x88d267899c4a5d0a, 0x930f66df0a2865c2,
0x4ee9d4204509b08b, 0x325538916685292a, 0x412907bfc533a842, 0xb27e2b62544dc673,
0x6c5304456295e007, 0x5af406e95351908a, 0x1f2f3b6bc123616f, 0xc37b09dc5255e5c6,
0x3967d133b1fe6844, 0x298839c7f0e711e2, 0x409b87f71964f9a2, 0xe938adc3db4b0719,
0x0c0b4e47f9c3ebf4, 0x5534d576d36b8843, 0x4610a05aeb8b02d8, 0x20c3cdf58232f251,
0x6de1840dbec2b1e7, 0xa0e8de06b0fa1d08, 0x7b854b540d34333b, 0x42e29a67bcca5b7f,
0xd8a6088ac437dd0e, 0xc63bb3a9d943ed81, 0x21714dbd5e65a3b1, 0x6761ede7b5eea169,
0x2431f7c8d573abf6, 0xd51fc685e1a3671a, 0x5e063cd40410c92d, 0x283ab98f2cb04002,
0x8febc06cb2f2f790, 0x17d64f116fa1d33c, 0xe07359f1a99ee4aa, 0x784ed68c74cdc006,
0x6e2a19d5c73b42da, 0x8712b4161c7045c3, 0x371582e4ed93216d, 0xace390414939f6fc,
0x7ec5f12186223b7c, 0xc0b094042bac16fb, 0xf9d745379a527ebf, 0x737c3f2ea3b68168,
0x33e7b8d9bad278ca, 0xa9a32a34c22ffebb, 0xe48163ccfedfbd0d, 0x8e5940246ea5a670,
0x51c6ef4b842ad1e4, 0x22bad065279c508c, 0xd91488c218608cee, 0x319ea5491f7cda17,
0xd394e128134c9c60, 0x094bf43272d5e3b3, 0x9bf612a5a4aad791, 0xccbbda43d26ffd0f,
0x34de1f3c946ad250, 0x4f5b5468995ee16b, 0xdf9faf6fea8f7794, 0x2648ea5870dd092b,
0xbfc7e56d71d97c67, 0xdde6b2ff4f21d549, 0x3c276b463ae86003, 0x91767b4faf86c71f,
0x68a13e7835d4b9a0, 0xb68c115f030c9fd4, 0x141dd2c916582001, 0x983d8f7ddd5324ac,
0x64aa703fcc175254, 0xc2c989948e02b426, 0x3e5e76d69f46c2de, 0x50746f03587d8004,
0x45db3d829272f1e5, 0x60584a029b560bf3, 0xfbae58a73ffcdc62, 0xa15a5e4e6cad4ce8,
0x4ba96e55ce1fb8cc, 0x08f9747aae82b253, 0xc102144cf7fb471b, 0x9f042898f3eb8e36,
0x068b27adf2effb7a, 0xedca97fe8c0a5ebe, 0x778e0513f4f7d8cf, 0x302c2501c32b8bf7,
0x8d92ddfc175c554d, 0xf865c57f46052f5f, 0xeaf3301ba2b2f424, 0xaa68b7ecbbd60d86,
0x998f0f350104754c, 0x0000000000000000, 0xf12e314d34d0ccec, 0x710522be061823b5,
0xaf280d9930c005c1, 0x97fd5ce25d693c65, 0x19a41cc633cc9a15, 0x95844172f8c79eb8,
0xdc5432b7937684a9, 0x9436c13a2490cf58, 0x802b13f332c8ef59, 0xc442ae397ced4f5c,
0xfa1cd8efe3ab8d82, 0xf2e5ac954d293fd1, 0x6ad823e8907a1b7d, 0x4d2249f83cf043b6,
0x03cb9dd879f9f33d, 0xde2d2f2736d82674, 0x2a43a41f891ee2df, 0x6f98999d1b6c133a,
0xd4ad46cd3df436fa, 0xbb35df50269825c0, 0x964fdcaa813e6d85, 0xeb41b0537ee5a5c4,
0x0540ba758b160847, 0xa41ae43be7bb44af, 0xe3b8c429d0671797, 0x819993bbee9fbeb9,
0xae9a8dd1ec975421, 0xf3572cdd917e6e31, 0x6393d7dae2aff8ce, 0x47a2201237dc5338,
0xa32343dec903ee35, 0x79fc56c4a89a91e6, 0x01b28048dc5751e0, 0x1296f564e4b7db7b,
0x75f7188351597a12, 0xdb6d9552bdce2e33, 0x1e9dbb231d74308f, 0x520d7293fdd322d9,
0xe20a44610c304677, 0xfeeee2d2b4ead425, 0xca30fdee20800675, 0x61eaca4a47015a13,
0xe74afe1487264e30, 0x2cc883b27bf119a5, 0x1664cf59b3f682dc, 0xa811aa7c1e78af5b,
0x1d5626fb648dc3b2, 0xb73e9117df5bce34, 0xd05f7cf06ab56f5d, 0xfd257f0acd132718,
0x574dc8e676c52a9e, 0x0739a7e52eb8aa9a, 0x5486553e0f3cd9a3, 0x56ff48aeaa927b7e,
0xbe756525ad8e2d87, 0x7d0e6cf9ffdbc841, 0x3b1ecca31450ca99, 0x6913be30e983e840,
0xad511009956ea71c, 0xb1b5b6ba2db4354e, 0x4469bdca4e25a005, 0x15af5281ca0f71e1,
0x744598cb8d0e2bf2, 0x593f9b312aa863b7, 0xefb38a6e29a4fc63, 0x6b6aa3a04c2d4a9d,
0x3d95eb0ee6bf31e3, 0xa291c3961554bfd5, 0x18169c8eef9bcbf5, 0x115d68bc9d4e2846,
0xba875f18facf7420, 0xd1edfcb8b6e23ebd, 0xb00736f2f1e364ae, 0x84d929ce6589b6fe,
0x70b7a2f6da4f7255, 0x0e7253d75c6d4929, 0x04f23a3d574159a7, 0x0a8069ea0b2c108e,
0x49d073c56bb11a11, 0x8aab7a1939e4ffd7, 0xcd095a0b0e38acef, 0xc9fb60365979f548,
0x92bde697d67f3422, 0xc78933e10514bc61, 0xe1c1d9b975c9b54a, 0xd2266160cf1bcd80,
0x9a4492ed78fd8671, 0xb3ccab2a881a9793, 0x72cebf667fe1d088, 0xd6d45b5d985a9427,
},
};
CONSTANT_AS u64a sbob_rc64[12][8] =
{
{
0xe9daca1eda5b08b1, 0x1f7c65c0812fcbeb, 0x16d0452e43766a2f, 0xfcc485758db84e71,
0x0169679291e07c4b, 0x15d360a4082a42a2, 0x234d74cc36747605, 0x0745a6f2596580dd,
},
{
0x1a2f9da98ab5a36f, 0xd7b5700f469de34f, 0x982b230a72eafef3, 0x3101b5160f5ed561,
0x5899d6126b17b59a, 0xcaa70adbc261b55c, 0x56cdcbd71ba2dd55, 0xb79bb121700479e6,
},
{
0xc72fce2bacdc74f5, 0x35843d6a28fc390a, 0x8b1f9c525f5ef106, 0x7b7b29b11475eaf2,
0xb19e3590e40fe2d3, 0x09db6260373ac9c1, 0x31db7a8643f4b6c2, 0xb20aba0af5961e99,
},
{
0xd26615e8b3df1fef, 0xdde4715da0e148f9, 0x7d3c5c337e858e48, 0x3f355e68ad1c729d,
0x75d603ed822cd7a9, 0xbe0352933313b7d8, 0xf137e893a1ea5334, 0x2ed1e384bcbe0c22,
},
{
0x994747adac6bea4b, 0x6323a96c0c413f9a, 0x4a1086161f1c157f, 0xbdff0f80d7359e35,
0xa3f53a254717cdbf, 0x161a2723b700ffdf, 0xf563eaa97ea2567a, 0x57fe6c7cfd581760,
},
{
0xd9d33a1daeae4fae, 0xc039307a3bc3a46f, 0x6ca44251f9c4662d, 0xc68ef09ab49a7f18,
0xb4b79a1cb7a6facf, 0xb6c6bec2661ff20a, 0x354f903672c571bf, 0x6e7d64467a4068fa,
},
{
0xecc5aaee160ec7f4, 0x540924bffe86ac51, 0xc987bfe6c7c69e39, 0xc9937a19333e47d3,
0x372c822dc5ab9209, 0x04054a2883694706, 0xf34a3ca24c451735, 0x93d4143a4d568688,
},
{
0xa7c9934d425b1f9b, 0x41416e0c02aae703, 0x1ede369c71f8b74e, 0x9ac4db4d3b44b489,
0x90069b92cb2b89f4, 0x2fc4a5d12b8dd169, 0xd9a8515935c2ac36, 0x1ee702bfd40d7fa4,
},
{
0x9b223116545a8f37, 0xde5f16ecd89a4c94, 0x244289251b3a7d3a, 0x84090de0b755d93c,
0xb1ceb2db0b440a80, 0x549c07a69a8a2b7b, 0x602a1fcb92dc380e, 0xdb5a238351446172,
},
{
0x526f0580a6debeab, 0xf3f3e4b248e52a38, 0xdb788aff1ce74189, 0x0361331b8ae1ff1f,
0x4b3369af0267e79f, 0xf452763b306c1e7a, 0xc3b63b15d1fa9836, 0xed9c4598fbc7b474,
},
{
0xfb89c8efd09ecd7b, 0x94fe5a63cdc60230, 0x6107abebbb6bfad8, 0x7966841421800120,
0xcab948eaef711d8a, 0x986e477d1dcdbaef, 0x5dd86fc04a59a2de, 0x1b2df381cda4ca6b,
},
{
0xba3116f167e78e37, 0x7ab14904b08013d2, 0x771ddfbc323ca4cd, 0x9b9f2130d41220f8,
0x86cc91189def805d, 0x5228e188aaa41de7, 0x991bb2d9d517f4fa, 0x20d71bf14a92bc48,
},
};
#if VECT_SIZE == 1 #if VECT_SIZE == 1
#define BOX(S,n,i) ((S)[(n)][(i)]) #define BOX(S,n,i) ((S)[(n)][(i)])
@ -677,7 +93,7 @@ DECLSPEC void streebog256_transform (streebog256_ctx_t *ctx, const u32 *w0, cons
DECLSPEC void streebog256_update_64 (streebog256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len); DECLSPEC void streebog256_update_64 (streebog256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void streebog256_update (streebog256_ctx_t *ctx, const u32 *w, int len); DECLSPEC void streebog256_update (streebog256_ctx_t *ctx, const u32 *w, int len);
DECLSPEC void streebog256_update_swap (streebog256_ctx_t *ctx, const u32 *w, int len); DECLSPEC void streebog256_update_swap (streebog256_ctx_t *ctx, const u32 *w, int len);
DECLSPEC void streebog256_update_global_swap (streebog256_ctx_t *ctx, const GLOBAL_AS u32 *w, int len); DECLSPEC void streebog256_update_global_swap (streebog256_ctx_t *ctx, GLOBAL_AS const u32 *w, int len);
DECLSPEC void streebog256_final (streebog256_ctx_t *ctx); DECLSPEC void streebog256_final (streebog256_ctx_t *ctx);
DECLSPEC void streebog256_hmac_init_64 (streebog256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256]); DECLSPEC void streebog256_hmac_init_64 (streebog256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog256_hmac_init (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]); DECLSPEC void streebog256_hmac_init (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]);
@ -685,7 +101,7 @@ DECLSPEC void streebog256_hmac_init_swap (streebog256_hmac_ctx_t *ctx, const u32
DECLSPEC void streebog256_hmac_update_64 (streebog256_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len); DECLSPEC void streebog256_hmac_update_64 (streebog256_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void streebog256_hmac_update (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void streebog256_hmac_update (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void streebog256_hmac_update_swap (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void streebog256_hmac_update_swap (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void streebog256_hmac_update_global_swap (streebog256_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void streebog256_hmac_update_global_swap (streebog256_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void streebog256_hmac_final (streebog256_hmac_ctx_t *ctx); DECLSPEC void streebog256_hmac_final (streebog256_hmac_ctx_t *ctx);
DECLSPEC void streebog256_init_vector (streebog256_ctx_vector_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256]); DECLSPEC void streebog256_init_vector (streebog256_ctx_vector_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog256_add_vector (u64x *x, const u64x *y); DECLSPEC void streebog256_add_vector (u64x *x, const u64x *y);

File diff suppressed because it is too large Load Diff

View File

@ -6,590 +6,6 @@
#ifndef _INC_HASH_STREEBOG512_H #ifndef _INC_HASH_STREEBOG512_H
#define _INC_HASH_STREEBOG512_H #define _INC_HASH_STREEBOG512_H
CONSTANT_AS u64a sbob_sl64[8][256] =
{
{
0xd031c397ce553fe6, 0x16ba5b01b006b525, 0xa89bade6296e70c8, 0x6a1f525d77d3435b,
0x6e103570573dfa0b, 0x660efb2a17fc95ab, 0x76327a9e97634bf6, 0x4bad9d6462458bf5,
0xf1830caedbc3f748, 0xc5c8f542669131ff, 0x95044a1cdc48b0cb, 0x892962df3cf8b866,
0xb0b9e208e930c135, 0xa14fb3f0611a767c, 0x8d2605f21c160136, 0xd6b71922fecc549e,
0x37089438a5907d8b, 0x0b5da38e5803d49c, 0x5a5bcc9cea6f3cbc, 0xedae246d3b73ffe5,
0xd2b87e0fde22edce, 0x5e54abb1ca8185ec, 0x1de7f88fe80561b9, 0xad5e1a870135a08c,
0x2f2adbd665cecc76, 0x5780b5a782f58358, 0x3edc8a2eede47b3f, 0xc9d95c3506bee70f,
0x83be111d6c4e05ee, 0xa603b90959367410, 0x103c81b4809fde5d, 0x2c69b6027d0c774a,
0x399080d7d5c87953, 0x09d41e16487406b4, 0xcdd63b1826505e5f, 0xf99dc2f49b0298e8,
0x9cd0540a943cb67f, 0xbca84b7f891f17c5, 0x723d1db3b78df2a6, 0x78aa6e71e73b4f2e,
0x1433e699a071670d, 0x84f21be454620782, 0x98df3327b4d20f2f, 0xf049dce2d3769e5c,
0xdb6c60199656eb7a, 0x648746b2078b4783, 0x32cd23598dcbadcf, 0x1ea4955bf0c7da85,
0xe9a143401b9d46b5, 0xfd92a5d9bbec21b8, 0xc8138c790e0b8e1b, 0x2ee00b9a6d7ba562,
0xf85712b893b7f1fc, 0xeb28fed80bea949d, 0x564a65eb8a40ea4c, 0x6c9988e8474a2823,
0x4535898b121d8f2d, 0xabd8c03231accbf4, 0xba2e91cab9867cbd, 0x7960be3def8e263a,
0x0c11a977602fd6f0, 0xcb50e1ad16c93527, 0xeae22e94035ffd89, 0x2866d12f5de2ce1a,
0xff1b1841ab9bf390, 0x9f9339de8cfe0d43, 0x964727c8c48a0bf7, 0x524502c6aaae531c,
0x9b9c5ef3ac10b413, 0x4fa2fa4942ab32a5, 0x3f165a62e551122b, 0xc74148da76e6e3d7,
0x924840e5e464b2a7, 0xd372ae43d69784da, 0x233b72a105e11a86, 0xa48a04914941a638,
0xb4b68525c9de7865, 0xddeabaaca6cf8002, 0x0a9773c250b6bd88, 0xc284ffbb5ebd3393,
0x8ba0df472c8f6a4e, 0x2aef6cb74d951c32, 0x427983722a318d41, 0x73f7cdffbf389bb2,
0x074c0af9382c026c, 0x8a6a0f0b243a035a, 0x6fdae53c5f88931f, 0xc68b98967e538ac3,
0x44ff59c71aa8e639, 0xe2fce0ce439e9229, 0xa20cde2479d8cd40, 0x19e89fa2c8ebd8e9,
0xf446bbcff398270c, 0x43b3533e2284e455, 0xd82f0dcd8e945046, 0x51066f12b26ce820,
0xe73957af6bc5426d, 0x081ece5a40c16fa0, 0x3b193d4fc5bfab7b, 0x7fe66488df174d42,
0x0e9814ef705804d8, 0x8137ac857c39d7c6, 0xb1733244e185a821, 0x695c3f896f11f867,
0xf6cf0657e3eff524, 0x1aabf276d02963d5, 0x2da3664e75b91e5e, 0x0289bd981077d228,
0x90c1fd7df413608f, 0x3c5537b6fd93a917, 0xaa12107e3919a2e0, 0x0686dab530996b78,
0xdaa6b0559ee3826e, 0xc34e2ff756085a87, 0x6d5358a44fff4137, 0xfc587595b35948ac,
0x7ca5095cc7d5f67e, 0xfb147f6c8b754ac0, 0xbfeb26ab91ddacf9, 0x6896efc567a49173,
0xca9a31e11e7c5c33, 0xbbe44186b13315a9, 0x0ddb793b689abfe4, 0x70b4a02ba7fa208e,
0xe47a3a7b7307f951, 0x8cecd5be14a36822, 0xeeed49b923b144d9, 0x17708b4db8b3dc31,
0x6088219f2765fed3, 0xb3fa8fdcf1f27a09, 0x910b2d31fca6099b, 0x0f52c4a378ed6dcc,
0x50ccbf5ebad98134, 0x6bd582117f662a4f, 0x94ce9a50d4fdd9df, 0x2b25bcfb45207526,
0x67c42b661f49fcbf, 0x492420fc723259dd, 0x03436dd418c2bb3c, 0x1f6e4517f872b391,
0xa08563bc69af1f68, 0xd43ea4baeebb86b6, 0x01cad04c08b56914, 0xac94cacb0980c998,
0x54c3d8739a373864, 0x26fec5c02dbacac2, 0xdea9d778be0d3b3e, 0x040f672d20eeb950,
0xe5b0ea377bb29045, 0xf30ab136cbb42560, 0x62019c0737122cfb, 0xe86b930c13282fa1,
0xcc1ceb542ee5374b, 0x538fd28aa21b3a08, 0x1b61223ad89c0ac1, 0x36c24474ad25149f,
0x7a23d3e9f74c9d06, 0xbe21f6e79968c5ed, 0xcf5f868036278c77, 0xf705d61beb5a9c30,
0x4d2b47d152dce08d, 0x5f9e7bfdc234ecf8, 0x247778583dcd18ea, 0x867ba67c4415d5aa,
0x4ce1979d5a698999, 0x0000000000000000, 0xec64f42133c696f1, 0xb57c5569c16b1171,
0xc1c7926f467f88af, 0x654d96fe0f3e2e97, 0x15f936d5a8c40e19, 0xb8a72c52a9f1ae95,
0xa9517daa21db19dc, 0x58d27104fa18ee94, 0x5918a148f2ad8780, 0x5cdd1629daf657c4,
0x8274c15164fb6cfa, 0xd1fb13dbc6e056f2, 0x7d6fd910cf609f6a, 0xb63f38bdd9a9aa4d,
0x3d9fe7faf526c003, 0x74bbc706871499de, 0xdf630734b6b8522a, 0x3ad3ed03cd0ac26f,
0xfadeaf2083c023d4, 0xc00d42234ecae1bb, 0x8538cba85cd76e96, 0xc402250e6e2458eb,
0x47bc3413026a5d05, 0xafd7a71f114272a4, 0x978df784cc3f62e3, 0xb96dfc1ea144c781,
0x21b2cf391596c8ae, 0x318e4e8d950916f3, 0xce9556cc3e92e563, 0x385a509bdd7d1047,
0x358129a0b5e7afa3, 0xe6f387e363702b79, 0xe0755d5653e94001, 0x7be903a5fff9f412,
0x12b53c2c90e80c75, 0x3307f315857ec4db, 0x8fafb86a0c61d31e, 0xd9e5dd8186213952,
0x77f8aad29fd622e2, 0x25bda814357871fe, 0x7571174a8fa1f0ca, 0x137fec60985d6561,
0x30449ec19dbc7fe7, 0xa540d4dd41f4cf2c, 0xdc206ae0ae7ae916, 0x5b911cd0e2da55a8,
0xb2305f90f947131d, 0x344bf9ecbd52c6b7, 0x5d17c665d2433ed0, 0x18224feec05eb1fd,
0x9e59e992844b6457, 0x9a568ebfa4a5dd07, 0xa3c60e68716da454, 0x7e2cb4c4d7a22456,
0x87b176304ca0bcbe, 0x413aeea632f3367d, 0x9915e36bbc67663b, 0x40f03eea3a465f69,
0x1c2d28c3e0b008ad, 0x4e682a054a1e5bb1, 0x05c5b761285bd044, 0xe1bf8d1a5b5c2915,
0xf2c0617ac3014c74, 0xb7f5e8f1d11cc359, 0x63cb4c4b3fa745ef, 0x9d1a84469c89df6b,
0xe33630824b2bfb3d, 0xd5f474f6e60eefa2, 0xf58c6b83fb2d4e18, 0x4676e45f0adf3411,
0x20781f751d23a1ba, 0xbd629b3381aa7ed1, 0xae1d775319f71bb0, 0xfed1c80da32e9a84,
0x5509083f92825170, 0x29ac01635557a70e, 0xa7c9694551831d04, 0x8e65682604d4ba0a,
0x11f651f8882ab749, 0xd77dc96ef6793d8a, 0xef2799f52b042dcd, 0x48eef0b07a8730c9,
0x22f1a2ed0d547392, 0x6142f1d32fd097c7, 0x4a674d286af0e2e1, 0x80fd7cc9748cbed2,
0x717e7067af4f499a, 0x938290a9ecd1dbb3, 0x88e3b293344dd172, 0x2734158c250fa3d6,
},
{
0x7e37e62dfc7d40c3, 0x776f25a4ee939e5b, 0xe045c850dd8fb5ad, 0x86ed5ba711ff1952,
0xe91d0bd9cf616b35, 0x37e0ab256e408ffb, 0x9607f6c031025a7a, 0x0b02f5e116d23c9d,
0xf3d8486bfb50650c, 0x621cff27c40875f5, 0x7d40cb71fa5fd34a, 0x6daa6616daa29062,
0x9f5f354923ec84e2, 0xec847c3dc507c3b3, 0x025a3668043ce205, 0xa8bf9e6c4dac0b19,
0xfa808be2e9bebb94, 0xb5b99c5277c74fa3, 0x78d9bc95f0397bcc, 0xe332e50cdbad2624,
0xc74fce129332797e, 0x1729eceb2ea709ab, 0xc2d6b9f69954d1f8, 0x5d898cbfbab8551a,
0x859a76fb17dd8adb, 0x1be85886362f7fb5, 0xf6413f8ff136cd8a, 0xd3110fa5bbb7e35c,
0x0a2feed514cc4d11, 0xe83010edcd7f1ab9, 0xa1e75de55f42d581, 0xeede4a55c13b21b6,
0xf2f5535ff94e1480, 0x0cc1b46d1888761e, 0xbce15fdb6529913b, 0x2d25e8975a7181c2,
0x71817f1ce2d7a554, 0x2e52c5cb5c53124b, 0xf9f7a6beef9c281d, 0x9e722e7d21f2f56e,
0xce170d9b81dca7e6, 0x0e9b82051cb4941b, 0x1e712f623c49d733, 0x21e45cfa42f9f7dc,
0xcb8e7a7f8bba0f60, 0x8e98831a010fb646, 0x474ccf0d8e895b23, 0xa99285584fb27a95,
0x8cc2b57205335443, 0x42d5b8e984eff3a5, 0x012d1b34021e718c, 0x57a6626aae74180b,
0xff19fc06e3d81312, 0x35ba9d4d6a7c6dfe, 0xc9d44c178f86ed65, 0x506523e6a02e5288,
0x03772d5c06229389, 0x8b01f4fe0b691ec0, 0xf8dabd8aed825991, 0x4c4e3aec985b67be,
0xb10df0827fbf96a9, 0x6a69279ad4f8dae1, 0xe78689dcd3d5ff2e, 0x812e1a2b1fa553d1,
0xfbad90d6eba0ca18, 0x1ac543b234310e39, 0x1604f7df2cb97827, 0xa6241c6951189f02,
0x753513cceaaf7c5e, 0x64f2a59fc84c4efa, 0x247d2b1e489f5f5a, 0xdb64d718ab474c48,
0x79f4a7a1f2270a40, 0x1573da832a9bebae, 0x3497867968621c72, 0x514838d2a2302304,
0xf0af6537fd72f685, 0x1d06023e3a6b44ba, 0x678588c3ce6edd73, 0x66a893f7cc70acff,
0xd4d24e29b5eda9df, 0x3856321470ea6a6c, 0x07c3418c0e5a4a83, 0x2bcbb22f5635bacd,
0x04b46cd00878d90a, 0x06ee5ab80c443b0f, 0x3b211f4876c8f9e5, 0x0958c38912eede98,
0xd14b39cdbf8b0159, 0x397b292072f41be0, 0x87c0409313e168de, 0xad26e98847caa39f,
0x4e140c849c6785bb, 0xd5ff551db7f3d853, 0xa0ca46d15d5ca40d, 0xcd6020c787fe346f,
0x84b76dcf15c3fb57, 0xdefda0fca121e4ce, 0x4b8d7b6096012d3d, 0x9ac642ad298a2c64,
0x0875d8bd10f0af14, 0xb357c6ea7b8374ac, 0x4d6321d89a451632, 0xeda96709c719b23f,
0xf76c24bbf328bc06, 0xc662d526912c08f2, 0x3ce25ec47892b366, 0xb978283f6f4f39bd,
0xc08c8f9e9d6833fd, 0x4f3917b09e79f437, 0x593de06fb2c08c10, 0xd6887841b1d14bda,
0x19b26eee32139db0, 0xb494876675d93e2f, 0x825937771987c058, 0x90e9ac783d466175,
0xf1827e03ff6c8709, 0x945dc0a8353eb87f, 0x4516f9658ab5b926, 0x3f9573987eb020ef,
0xb855330b6d514831, 0x2ae6a91b542bcb41, 0x6331e413c6160479, 0x408f8e8180d311a0,
0xeff35161c325503a, 0xd06622f9bd9570d5, 0x8876d9a20d4b8d49, 0xa5533135573a0c8b,
0xe168d364df91c421, 0xf41b09e7f50a2f8f, 0x12b09b0f24c1a12d, 0xda49cc2ca9593dc4,
0x1f5c34563e57a6bf, 0x54d14f36a8568b82, 0xaf7cdfe043f6419a, 0xea6a2685c943f8bc,
0xe5dcbfb4d7e91d2b, 0xb27addde799d0520, 0x6b443caed6e6ab6d, 0x7bae91c9f61be845,
0x3eb868ac7cae5163, 0x11c7b65322e332a4, 0xd23c1491b9a992d0, 0x8fb5982e0311c7ca,
0x70ac6428e0c9d4d8, 0x895bc2960f55fcc5, 0x76423e90ec8defd7, 0x6ff0507ede9e7267,
0x3dcf45f07a8cc2ea, 0x4aa06054941f5cb1, 0x5810fb5bb0defd9c, 0x5efea1e3bc9ac693,
0x6edd4b4adc8003eb, 0x741808f8e8b10dd2, 0x145ec1b728859a22, 0x28bc9f7350172944,
0x270a06424ebdccd3, 0x972aedf4331c2bf6, 0x059977e40a66a886, 0x2550302a4a812ed6,
0xdd8a8da0a7037747, 0xc515f87a970e9b7b, 0x3023eaa9601ac578, 0xb7e3aa3a73fbada6,
0x0fb699311eaae597, 0x0000000000000000, 0x310ef19d6204b4f4, 0x229371a644db6455,
0x0decaf591a960792, 0x5ca4978bb8a62496, 0x1c2b190a38753536, 0x41a295b582cd602c,
0x3279dcc16426277d, 0xc1a194aa9f764271, 0x139d803b26dfd0a1, 0xae51c4d441e83016,
0xd813fa44ad65dfc1, 0xac0bf2bc45d4d213, 0x23be6a9246c515d9, 0x49d74d08923dcf38,
0x9d05032127d066e7, 0x2f7fdeff5e4d63c7, 0xa47e2a0155247d07, 0x99b16ff12fa8bfed,
0x4661d4398c972aaf, 0xdfd0bbc8a33f9542, 0xdca79694a51d06cb, 0xb020ebb67da1e725,
0xba0f0563696daa34, 0xe4f1a480d5f76ca7, 0xc438e34e9510eaf7, 0x939e81243b64f2fc,
0x8defae46072d25cf, 0x2c08f3a3586ff04e, 0xd7a56375b3cf3a56, 0x20c947ce40e78650,
0x43f8a3dd86f18229, 0x568b795eac6a6987, 0x8003011f1dbb225d, 0xf53612d3f7145e03,
0x189f75da300dec3c, 0x9570db9c3720c9f3, 0xbb221e576b73dbb8, 0x72f65240e4f536dd,
0x443be25188abc8aa, 0xe21ffe38d9b357a8, 0xfd43ca6ee7e4f117, 0xcaa3614b89a47eec,
0xfe34e732e1c6629e, 0x83742c431b99b1d4, 0xcf3a16af83c2d66a, 0xaae5a8044990e91c,
0x26271d764ca3bd5f, 0x91c4b74c3f5810f9, 0x7c6dd045f841a2c6, 0x7f1afd19fe63314f,
0xc8f957238d989ce9, 0xa709075d5306ee8e, 0x55fc5402aa48fa0e, 0x48fa563c9023beb4,
0x65dfbeabca523f76, 0x6c877d22d8bce1ee, 0xcc4d3bf385e045e3, 0xbebb69b36115733e,
0x10eaad6720fd4328, 0xb6ceb10e71e5dc2a, 0xbdcc44ef6737e0b7, 0x523f158ea412b08d,
0x989c74c52db6ce61, 0x9beb59992b945de8, 0x8a2cefca09776f4c, 0xa3bd6b8d5b7e3784,
0xeb473db1cb5d8930, 0xc3fba2c29b4aa074, 0x9c28181525ce176b, 0x683311f2d0c438e4,
0x5fd3bad7be84b71f, 0xfc6ed15ae5fa809b, 0x36cdb0116c5efe77, 0x29918447520958c8,
0xa29070b959604608, 0x53120ebaa60cc101, 0x3a0c047c74d68869, 0x691e0ac6d2da4968,
0x73db4974e6eb4751, 0x7a838afdf40599c9, 0x5a4acd33b4e21f99, 0x6046c94fc03497f0,
0xe6ab92e8d1cb8ea2, 0x3354c7f5663856f1, 0xd93ee170af7bae4d, 0x616bd27bc22ae67c,
0x92b39a10397a8370, 0xabc8b3304b8e9890, 0xbf967287630b02b2, 0x5b67d607b6fc6e15,
},
{
0x8ab0a96846e06a6d, 0x43c7e80b4bf0b33a, 0x08c9b3546b161ee5, 0x39f1c235eba990be,
0xc1bef2376606c7b2, 0x2c209233614569aa, 0xeb01523b6fc3289a, 0x946953ab935acedd,
0x272838f63e13340e, 0x8b0455eca12ba052, 0x77a1b2c4978ff8a2, 0xa55122ca13e54086,
0x2276135862d3f1cd, 0xdb8ddfde08b76cfe, 0x5d1e12c89e4a178a, 0x0e56816b03969867,
0xee5f79953303ed59, 0xafed748bab78d71d, 0x6d929f2df93e53ee, 0xf5d8a8f8ba798c2a,
0xf619b1698e39cf6b, 0x95ddaf2f749104e2, 0xec2a9c80e0886427, 0xce5c8fd8825b95ea,
0xc4e0d9993ac60271, 0x4699c3a5173076f9, 0x3d1b151f50a29f42, 0x9ed505ea2bc75946,
0x34665acfdc7f4b98, 0x61b1fb53292342f7, 0xc721c0080e864130, 0x8693cd1696fd7b74,
0x872731927136b14b, 0xd3446c8a63a1721b, 0x669a35e8a6680e4a, 0xcab658f239509a16,
0xa4e5de4ef42e8ab9, 0x37a7435ee83f08d9, 0x134e6239e26c7f96, 0x82791a3c2df67488,
0x3f6ef00a8329163c, 0x8e5a7e42fdeb6591, 0x5caaee4c7981ddb5, 0x19f234785af1e80d,
0x255ddde3ed98bd70, 0x50898a32a99cccac, 0x28ca4519da4e6656, 0xae59880f4cb31d22,
0x0d9798fa37d6db26, 0x32f968f0b4ffcd1a, 0xa00f09644f258545, 0xfa3ad5175e24de72,
0xf46c547c5db24615, 0x713e80fbff0f7e20, 0x7843cf2b73d2aafa, 0xbd17ea36aedf62b4,
0xfd111bacd16f92cf, 0x4abaa7dbc72d67e0, 0xb3416b5dad49fad3, 0xbca316b24914a88b,
0x15d150068aecf914, 0xe27c1debe31efc40, 0x4fe48c759beda223, 0x7edcfd141b522c78,
0x4e5070f17c26681c, 0xe696cac15815f3bc, 0x35d2a64b3bb481a7, 0x800cff29fe7dfdf6,
0x1ed9fac3d5baa4b0, 0x6c2663a91ef599d1, 0x03c1199134404341, 0xf7ad4ded69f20554,
0xcd9d9649b61bd6ab, 0xc8c3bde7eadb1368, 0xd131899fb02afb65, 0x1d18e352e1fae7f1,
0xda39235aef7ca6c1, 0xa1bbf5e0a8ee4f7a, 0x91377805cf9a0b1e, 0x3138716180bf8e5b,
0xd9f83acbdb3ce580, 0x0275e515d38b897e, 0x472d3f21f0fbbcc6, 0x2d946eb7868ea395,
0xba3c248d21942e09, 0xe7223645bfde3983, 0xff64feb902e41bb1, 0xc97741630d10d957,
0xc3cb1722b58d4ecc, 0xa27aec719cae0c3b, 0x99fecb51a48c15fb, 0x1465ac826d27332b,
0xe1bd047ad75ebf01, 0x79f733af941960c5, 0x672ec96c41a3c475, 0xc27feba6524684f3,
0x64efd0fd75e38734, 0xed9e60040743ae18, 0xfb8e2993b9ef144d, 0x38453eb10c625a81,
0x6978480742355c12, 0x48cf42ce14a6ee9e, 0x1cac1fd606312dce, 0x7b82d6ba4792e9bb,
0x9d141c7b1f871a07, 0x5616b80dc11c4a2e, 0xb849c198f21fa777, 0x7ca91801c8d9a506,
0xb1348e487ec273ad, 0x41b20d1e987b3a44, 0x7460ab55a3cfbbe3, 0x84e628034576f20a,
0x1b87d16d897a6173, 0x0fe27defe45d5258, 0x83cde6b8ca3dbeb7, 0x0c23647ed01d1119,
0x7a362a3ea0592384, 0xb61f40f3f1893f10, 0x75d457d1440471dc, 0x4558da34237035b8,
0xdca6116587fc2043, 0x8d9b67d3c9ab26d0, 0x2b0b5c88ee0e2517, 0x6fe77a382ab5da90,
0x269cc472d9d8fe31, 0x63c41e46faa8cb89, 0xb7abbc771642f52f, 0x7d1de4852f126f39,
0xa8c6ba3024339ba0, 0x600507d7cee888c8, 0x8fee82c61a20afae, 0x57a2448926d78011,
0xfca5e72836a458f0, 0x072bcebb8f4b4cbd, 0x497bbe4af36d24a1, 0x3cafe99bb769557d,
0x12fa9ebd05a7b5a9, 0xe8c04baa5b836bdb, 0x4273148fac3b7905, 0x908384812851c121,
0xe557d3506c55b0fd, 0x72ff996acb4f3d61, 0x3eda0c8e64e2dc03, 0xf0868356e6b949e9,
0x04ead72abb0b0ffc, 0x17a4b5135967706a, 0xe3c8e16f04d5367f, 0xf84f30028daf570c,
0x1846c8fcbd3a2232, 0x5b8120f7f6ca9108, 0xd46fa231ecea3ea6, 0x334d947453340725,
0x58403966c28ad249, 0xbed6f3a79a9f21f5, 0x68ccb483a5fe962d, 0xd085751b57e1315a,
0xfed0023de52fd18e, 0x4b0e5b5f20e6addf, 0x1a332de96eb1ab4c, 0xa3ce10f57b65c604,
0x108f7ba8d62c3cd7, 0xab07a3a11073d8e1, 0x6b0dad1291bed56c, 0xf2f366433532c097,
0x2e557726b2cee0d4, 0x0000000000000000, 0xcb02a476de9b5029, 0xe4e32fd48b9e7ac2,
0x734b65ee2c84f75e, 0x6e5386bccd7e10af, 0x01b4fc84e7cbca3f, 0xcfe8735c65905fd5,
0x3613bfda0ff4c2e6, 0x113b872c31e7f6e8, 0x2fe18ba255052aeb, 0xe974b72ebc48a1e4,
0x0abc5641b89d979b, 0xb46aa5e62202b66e, 0x44ec26b0c4bbff87, 0xa6903b5b27a503c7,
0x7f680190fc99e647, 0x97a84a3aa71a8d9c, 0xdd12ede16037ea7c, 0xc554251ddd0dc84e,
0x88c54c7d956be313, 0x4d91696048662b5d, 0xb08072cc9909b992, 0xb5de5962c5c97c51,
0x81b803ad19b637c9, 0xb2f597d94a8230ec, 0x0b08aac55f565da4, 0xf1327fd2017283d6,
0xad98919e78f35e63, 0x6ab9519676751f53, 0x24e921670a53774f, 0xb9fd3d1c15d46d48,
0x92f66194fbda485f, 0x5a35dc7311015b37, 0xded3f4705477a93d, 0xc00a0eb381cd0d8d,
0xbb88d809c65fe436, 0x16104997beacba55, 0x21b70ac95693b28c, 0x59f4c5e225411876,
0xd5db5eb50b21f499, 0x55d7a19cf55c096f, 0xa97246b4c3f8519f, 0x8552d487a2bd3835,
0x54635d181297c350, 0x23c2efdc85183bf2, 0x9f61f96ecc0c9379, 0x534893a39ddc8fed,
0x5edf0b59aa0a54cb, 0xac2c6d1a9f38945c, 0xd7aebba0d8aa7de7, 0x2abfa00c09c5ef28,
0xd84cc64f3cf72fbf, 0x2003f64db15878b3, 0xa724c7dfc06ec9f8, 0x069f323f68808682,
0xcc296acd51d01c94, 0x055e2bae5cc0c5c3, 0x6270e2c21d6301b6, 0x3b842720382219c0,
0xd2f0900e846ab824, 0x52fc6f277a1745d2, 0xc6953c8ce94d8b0f, 0xe009f8fe3095753e,
0x655b2c7992284d0b, 0x984a37d54347dfc4, 0xeab5aebf8808e2a5, 0x9a3fd2c090cc56ba,
0x9ca0e0fff84cd038, 0x4c2595e4afade162, 0xdf6708f4b3bc6302, 0xbf620f237d54ebca,
0x93429d101c118260, 0x097d4fd08cddd4da, 0x8c2f9b572e60ecef, 0x708a7c7f18c4b41f,
0x3a30dba4dfe9d3ff, 0x4006f19a7fb0f07b, 0x5f6bf7dd4dc19ef4, 0x1f6d064732716e8f,
0xf9fbcc866a649d33, 0x308c8de567744464, 0x8971b0f972a0292c, 0xd61a47243f61b7d8,
0xefeb8511d4c82766, 0x961cb6be40d147a3, 0xaab35f25f7b812de, 0x76154e407044329d,
0x513d76b64e570693, 0xf3479ac7d2f90aa8, 0x9b8b2e4477079c85, 0x297eb99d3d85ac69,
},
{
0x3ef29d249b2c0a19, 0xe9e16322b6f8622f, 0x5536994047757f7a, 0x9f4d56d5a47b0b33,
0x822567466aa1174c, 0xb8f5057deb082fb2, 0xcc48c10bf4475f53, 0x373088d4275dec3a,
0x968f4325180aed10, 0x173d232cf7016151, 0xae4ed09f946fcc13, 0xfd4b4741c4539873,
0x1b5b3f0dd9933765, 0x2ffcb0967b644052, 0xe02376d20a89840c, 0xa3ae3a70329b18d7,
0x419cbd2335de8526, 0xfafebf115b7c3199, 0x0397074f85aa9b0d, 0xc58ad4fb4836b970,
0xbec60be3fc4104a8, 0x1eff36dc4b708772, 0x131fdc33ed8453b6, 0x0844e33e341764d3,
0x0ff11b6eab38cd39, 0x64351f0a7761b85a, 0x3b5694f509cfba0e, 0x30857084b87245d0,
0x47afb3bd2297ae3c, 0xf2ba5c2f6f6b554a, 0x74bdc4761f4f70e1, 0xcfdfc64471edc45e,
0xe610784c1dc0af16, 0x7aca29d63c113f28, 0x2ded411776a859af, 0xac5f211e99a3d5ee,
0xd484f949a87ef33b, 0x3ce36ca596e013e4, 0xd120f0983a9d432c, 0x6bc40464dc597563,
0x69d5f5e5d1956c9e, 0x9ae95f043698bb24, 0xc9ecc8da66a4ef44, 0xd69508c8a5b2eac6,
0xc40c2235c0503b80, 0x38c193ba8c652103, 0x1ceec75d46bc9e8f, 0xd331011937515ad1,
0xd8e2e56886eca50f, 0xb137108d5779c991, 0x709f3b6905ca4206, 0x4feb50831680caef,
0xec456af3241bd238, 0x58d673afe181abbe, 0x242f54e7cad9bf8c, 0x0211f1810dcc19fd,
0x90bc4dbb0f43c60a, 0x9518446a9da0761d, 0xa1bfcbf13f57012a, 0x2bde4f8961e172b5,
0x27b853a84f732481, 0xb0b1e643df1f4b61, 0x18cc38425c39ac68, 0xd2b7f7d7bf37d821,
0x3103864a3014c720, 0x14aa246372abfa5c, 0x6e600db54ebac574, 0x394765740403a3f3,
0x09c215f0bc71e623, 0x2a58b947e987f045, 0x7b4cdf18b477bdd8, 0x9709b5eb906c6fe0,
0x73083c268060d90b, 0xfedc400e41f9037e, 0x284948c6e44be9b8, 0x728ecae808065bfb,
0x06330e9e17492b1a, 0x5950856169e7294e, 0xbae4f4fce6c4364f, 0xca7bcf95e30e7449,
0x7d7fd186a33e96c2, 0x52836110d85ad690, 0x4dfaa1021b4cd312, 0x913abb75872544fa,
0xdd46ecb9140f1518, 0x3d659a6b1e869114, 0xc23f2cabd719109a, 0xd713fe062dd46836,
0xd0a60656b2fbc1dc, 0x221c5a79dd909496, 0xefd26dbca1b14935, 0x0e77eda0235e4fc9,
0xcbfd395b6b68f6b9, 0x0de0eaefa6f4d4c4, 0x0422ff1f1a8532e7, 0xf969b85eded6aa94,
0x7f6e2007aef28f3f, 0x3ad0623b81a938fe, 0x6624ee8b7aada1a7, 0xb682e8ddc856607b,
0xa78cc56f281e2a30, 0xc79b257a45faa08d, 0x5b4174e0642b30b3, 0x5f638bff7eae0254,
0x4bc9af9c0c05f808, 0xce59308af98b46ae, 0x8fc58da9cc55c388, 0x803496c7676d0eb1,
0xf33caae1e70dd7ba, 0xbb6202326ea2b4bf, 0xd5020f87201871cb, 0x9d5ca754a9b712ce,
0x841669d87de83c56, 0x8a6184785eb6739f, 0x420bba6cb0741e2b, 0xf12d5b60eac1ce47,
0x76ac35f71283691c, 0x2c6bb7d9fecedb5f, 0xfccdb18f4c351a83, 0x1f79c012c3160582,
0xf0abadae62a74cb7, 0xe1a5801c82ef06fc, 0x67a21845f2cb2357, 0x5114665f5df04d9d,
0xbf40fd2d74278658, 0xa0393d3fb73183da, 0x05a409d192e3b017, 0xa9fb28cf0b4065f9,
0x25a9a22942bf3d7c, 0xdb75e22703463e02, 0xb326e10c5ab5d06c, 0xe7968e8295a62de6,
0xb973f3b3636ead42, 0xdf571d3819c30ce5, 0xee549b7229d7cbc5, 0x12992afd65e2d146,
0xf8ef4e9056b02864, 0xb7041e134030e28b, 0xc02edd2adad50967, 0x932b4af48ae95d07,
0x6fe6fb7bc6dc4784, 0x239aacb755f61666, 0x401a4bedbdb807d6, 0x485ea8d389af6305,
0xa41bc220adb4b13d, 0x753b32b89729f211, 0x997e584bb3322029, 0x1d683193ceda1c7f,
0xff5ab6c0c99f818e, 0x16bbd5e27f67e3a1, 0xa59d34ee25d233cd, 0x98f8ae853b54a2d9,
0x6df70afacb105e79, 0x795d2e99b9bba425, 0x8e437b6744334178, 0x0186f6ce886682f0,
0xebf092a3bb347bd2, 0xbcd7fa62f18d1d55, 0xadd9d7d011c5571e, 0x0bd3e471b1bdffde,
0xaa6c2f808eeafef4, 0x5ee57d31f6c880a4, 0xf50fa47ff044fca0, 0x1addc9c351f5b595,
0xea76646d3352f922, 0x0000000000000000, 0x85909f16f58ebea6, 0x46294573aaf12ccc,
0x0a5512bf39db7d2e, 0x78dbd85731dd26d5, 0x29cfbe086c2d6b48, 0x218b5d36583a0f9b,
0x152cd2adfacd78ac, 0x83a39188e2c795bc, 0xc3b9da655f7f926a, 0x9ecba01b2c1d89c3,
0x07b5f8509f2fa9ea, 0x7ee8d6c926940dcf, 0x36b67e1aaf3b6eca, 0x86079859702425ab,
0xfb7849dfd31ab369, 0x4c7c57cc932a51e2, 0xd96413a60e8a27ff, 0x263ea566c715a671,
0x6c71fc344376dc89, 0x4a4f595284637af8, 0xdaf314e98b20bcf2, 0x572768c14ab96687,
0x1088db7c682ec8bb, 0x887075f9537a6a62, 0x2e7a4658f302c2a2, 0x619116dbe582084d,
0xa87dde018326e709, 0xdcc01a779c6997e8, 0xedc39c3dac7d50c8, 0xa60a33a1a078a8c0,
0xc1a82be452b38b97, 0x3f746bea134a88e9, 0xa228ccbebafd9a27, 0xabead94e068c7c04,
0xf48952b178227e50, 0x5cf48cb0fb049959, 0x6017e0156de48abd, 0x4438b4f2a73d3531,
0x8c528ae649ff5885, 0xb515ef924dfcfb76, 0x0c661c212e925634, 0xb493195cc59a7986,
0x9cda519a21d1903e, 0x32948105b5be5c2d, 0x194ace8cd45f2e98, 0x438d4ca238129cdb,
0x9b6fa9cabefe39d4, 0x81b26009ef0b8c41, 0xded1ebf691a58e15, 0x4e6da64d9ee6481f,
0x54b06f8ecf13fd8a, 0x49d85e1d01c9e1f5, 0xafc826511c094ee3, 0xf698a33075ee67ad,
0x5ac7822eec4db243, 0x8dd47c28c199da75, 0x89f68337db1ce892, 0xcdce37c57c21dda3,
0x530597de503c5460, 0x6a42f2aa543ff793, 0x5d727a7e73621ba9, 0xe232875307459df1,
0x56a19e0fc2dfe477, 0xc61dd3b4cd9c227d, 0xe5877f03986a341b, 0x949eb2a415c6f4ed,
0x6206119460289340, 0x6380e75ae84e11b0, 0x8be772b6d6d0f16f, 0x50929091d596cf6d,
0xe86795ec3e9ee0df, 0x7cf927482b581432, 0xc86a3e14eec26db4, 0x7119cda78dacc0f6,
0xe40189cd100cb6eb, 0x92adbc3a028fdff7, 0xb2a017c2d2d3529c, 0x200dabf8d05c8d6b,
0x34a78f9ba2f77737, 0xe3b4719d8f231f01, 0x45be423c2f5bb7c1, 0xf71e55fefd88e55d,
0x6853032b59f3ee6e, 0x65b3e9c4ff073aaa, 0x772ac3399ae5ebec, 0x87816e97f842a75b,
0x110e2db2e0484a4b, 0x331277cb3dd8dedd, 0xbd510cac79eb9fa5, 0x352179552a91f5c7,
},
{
0x05ba7bc82c9b3220, 0x31a54665f8b65e4f, 0xb1b651f77547f4d4, 0x8bfa0d857ba46682,
0x85a96c5aa16a98bb, 0x990faef908eb79c9, 0xa15e37a247f4a62d, 0x76857dcd5d27741e,
0xf8c50b800a1820bc, 0xbe65dcb201f7a2b4, 0x666d1b986f9426e7, 0x4cc921bf53c4e648,
0x95410a0f93d9ca42, 0x20cdccaa647ba4ef, 0x429a4060890a1871, 0x0c4ea4f69b32b38b,
0xccda362dde354cd3, 0x96dc23bc7c5b2fa9, 0xc309bb68aa851ab3, 0xd26131a73648e013,
0x021dc52941fc4db2, 0xcd5adab7704be48a, 0xa77965d984ed71e6, 0x32386fd61734bba4,
0xe82d6dd538ab7245, 0x5c2147ea6177b4b1, 0x5da1ab70cf091ce8, 0xac907fce72b8bdff,
0x57c85dfd972278a8, 0xa4e44c6a6b6f940d, 0x3851995b4f1fdfe4, 0x62578ccaed71bc9e,
0xd9882bb0c01d2c0a, 0x917b9d5d113c503b, 0xa2c31e11a87643c6, 0xe463c923a399c1ce,
0xf71686c57ea876dc, 0x87b4a973e096d509, 0xaf0d567d9d3a5814, 0xb40c2a3f59dcc6f4,
0x3602f88495d121dd, 0xd3e1dd3d9836484a, 0xf945e71aa46688e5, 0x7518547eb2a591f5,
0x9366587450c01d89, 0x9ea81018658c065b, 0x4f54080cbc4603a3, 0x2d0384c65137bf3d,
0xdc325078ec861e2a, 0xea30a8fc79573ff7, 0x214d2030ca050cb6, 0x65f0322b8016c30c,
0x69be96dd1b247087, 0xdb95ee9981e161b8, 0xd1fc1814d9ca05f8, 0x820ed2bbcc0de729,
0x63d76050430f14c7, 0x3bccb0e8a09d3a0f, 0x8e40764d573f54a2, 0x39d175c1e16177bd,
0x12f5a37c734f1f4b, 0xab37c12f1fdfc26d, 0x5648b167395cd0f1, 0x6c04ed1537bf42a7,
0xed97161d14304065, 0x7d6c67daab72b807, 0xec17fa87ba4ee83c, 0xdfaf79cb0304fbc1,
0x733f060571bc463e, 0x78d61c1287e98a27, 0xd07cf48e77b4ada1, 0xb9c262536c90dd26,
0xe2449b5860801605, 0x8fc09ad7f941fcfb, 0xfad8cea94be46d0e, 0xa343f28b0608eb9f,
0x9b126bd04917347b, 0x9a92874ae7699c22, 0x1b017c42c4e69ee0, 0x3a4c5c720ee39256,
0x4b6e9f5e3ea399da, 0x6ba353f45ad83d35, 0xe7fee0904c1b2425, 0x22d009832587e95d,
0x842980c00f1430e2, 0xc6b3c0a0861e2893, 0x087433a419d729f2, 0x341f3dadd42d6c6f,
0xee0a3faefbb2a58e, 0x4aee73c490dd3183, 0xaab72db5b1a16a34, 0xa92a04065e238fdf,
0x7b4b35a1686b6fcc, 0x6a23bf6ef4a6956c, 0x191cb96b851ad352, 0x55d598d4d6de351a,
0xc9604de5f2ae7ef3, 0x1ca6c2a3a981e172, 0xde2f9551ad7a5398, 0x3025aaff56c8f616,
0x15521d9d1e2860d9, 0x506fe31cfa45073a, 0x189c55f12b647b0b, 0x0180ec9aae7ea859,
0x7cec8b40050c105e, 0x2350e5198bf94104, 0xef8ad33455cc0dd7, 0x07a7bee16d677f92,
0xe5e325b90de76997, 0x5a061591a26e637a, 0xb611ef1618208b46, 0x09f4df3eb7a981ab,
0x1ebb078ae87dacc0, 0xb791038cb65e231f, 0x0fd38d4574b05660, 0x67edf702c1ea8ebe,
0xba5f4be0831238cd, 0xe3c477c2cefebe5c, 0x0dce486c354c1bd2, 0x8c5db36416c31910,
0x26ea9ed1a7627324, 0x039d29b3ef82e5eb, 0x9f28fc82cbf2ae02, 0xa8aae89cf05d2786,
0x431aacfa2774b028, 0xcf471f9e31b7a938, 0x581bd0b8e3922ec8, 0xbc78199b400bef06,
0x90fb71c7bf42f862, 0x1f3beb1046030499, 0x683e7a47b55ad8de, 0x988f4263a695d190,
0xd808c72a6e638453, 0x0627527bc319d7cb, 0xebb04466d72997ae, 0xe67e0c0ae2658c7c,
0x14d2f107b056c880, 0x7122c32c30400b8c, 0x8a7ae11fd5dacedb, 0xa0dedb38e98a0e74,
0xad109354dcc615a6, 0x0be91a17f655cc19, 0x8ddd5ffeb8bdb149, 0xbfe53028af890aed,
0xd65ba6f5b4ad7a6a, 0x7956f0882997227e, 0x10e8665532b352f9, 0x0e5361dfdacefe39,
0xcec7f3049fc90161, 0xff62b561677f5f2e, 0x975ccf26d22587f0, 0x51ef0f86543baf63,
0x2f1e41ef10cbf28f, 0x52722635bbb94a88, 0xae8dbae73344f04d, 0x410769d36688fd9a,
0xb3ab94de34bbb966, 0x801317928df1aa9b, 0xa564a0f0c5113c54, 0xf131d4bebdb1a117,
0x7f71a2f3ea8ef5b5, 0x40878549c8f655c3, 0x7ef14e6944f05dec, 0xd44663dcf55137d8,
0xf2acfd0d523344fc, 0x0000000000000000, 0x5fbc6e598ef5515a, 0x16cf342ef1aa8532,
0xb036bd6ddb395c8d, 0x13754fe6dd31b712, 0xbbdfa77a2d6c9094, 0x89e7c8ac3a582b30,
0x3c6b0e09cdfa459d, 0xc4ae0589c7e26521, 0x49735a777f5fd468, 0xcafd64561d2c9b18,
0xda1502032f9fc9e1, 0x8867243694268369, 0x3782141e3baf8984, 0x9cb5d53124704be9,
0xd7db4a6f1ad3d233, 0xa6f989432a93d9bf, 0x9d3539ab8a0ee3b0, 0x53f2caaf15c7e2d1,
0x6e19283c76430f15, 0x3debe2936384edc4, 0x5e3c82c3208bf903, 0x33b8834cb94a13fd,
0x6470deb12e686b55, 0x359fd1377a53c436, 0x61caa57902f35975, 0x043a975282e59a79,
0xfd7f70482683129c, 0xc52ee913699ccd78, 0x28b9ff0e7dac8d1d, 0x5455744e78a09d43,
0xcb7d88ccb3523341, 0x44bd121b4a13cfba, 0x4d49cd25fdba4e11, 0x3e76cb208c06082f,
0x3ff627ba2278a076, 0xc28957f204fbb2ea, 0x453dfe81e46d67e3, 0x94c1e6953da7621b,
0x2c83685cff491764, 0xf32c1197fc4deca5, 0x2b24d6bd922e68f6, 0xb22b78449ac5113f,
0x48f3b6edd1217c31, 0x2e9ead75beb55ad6, 0x174fd8b45fd42d6b, 0x4ed4e4961238abfa,
0x92e6b4eefebeb5d0, 0x46a0d7320bef8208, 0x47203ba8a5912a51, 0x24f75bf8e69e3e96,
0xf0b1382413cf094e, 0xfee259fbc901f777, 0x276a724b091cdb7d, 0xbdf8f501ee75475f,
0x599b3c224dec8691, 0x6d84018f99c1eafe, 0x7498b8e41cdb39ac, 0xe0595e71217c5bb7,
0x2aa43a273c50c0af, 0xf50b43ec3f543b6e, 0x838e3e2162734f70, 0xc09492db4507ff58,
0x72bfea9fdfc2ee67, 0x11688acf9ccdfaa0, 0x1a8190d86a9836b9, 0x7acbd93bc615c795,
0xc7332c3a286080ca, 0x863445e94ee87d50, 0xf6966a5fd0d6de85, 0xe9ad814f96d5da1c,
0x70a22fb69e3ea3d5, 0x0a69f68d582b6440, 0xb8428ec9c2ee757f, 0x604a49e3ac8df12c,
0x5b86f90b0c10cb23, 0xe1d9b2eb8f02f3ee, 0x29391394d3d22544, 0xc8e0a17f5cd0d6aa,
0xb58cc6a5f7a26ead, 0x8193fb08238f02c2, 0xd5c68f465b2f9f81, 0xfcff9cd288fdbac5,
0x77059157f359dc47, 0x1d262e3907ff492b, 0xfb582233e59ac557, 0xddb2bce242f8b673,
0x2577b76248e096cf, 0x6f99c4a6d83da74c, 0xc1147e41eb795701, 0xf48baf76912a9337,
},
{
0x45b268a93acde4cc, 0xaf7f0be884549d08, 0x048354b3c1468263, 0x925435c2c80efed2,
0xee4e37f27fdffba7, 0x167a33920c60f14d, 0xfb123b52ea03e584, 0x4a0cab53fdbb9007,
0x9deaf6380f788a19, 0xcb48ec558f0cb32a, 0xb59dc4b2d6fef7e0, 0xdcdbca22f4f3ecb6,
0x11df5813549a9c40, 0xe33fdedf568aced3, 0xa0c1c8124322e9c3, 0x07a56b8158fa6d0d,
0x77279579b1e1f3dd, 0xd9b18b74422ac004, 0xb8ec2d9fffabc294, 0xf4acf8a82d75914f,
0x7bbf69b1ef2b6878, 0xc4f62faf487ac7e1, 0x76ce809cc67e5d0c, 0x6711d88f92e4c14c,
0x627b99d9243dedfe, 0x234aa5c3dfb68b51, 0x909b1f15262dbf6d, 0x4f66ea054b62bcb5,
0x1ae2cf5a52aa6ae8, 0xbea053fbd0ce0148, 0xed6808c0e66314c9, 0x43fe16cd15a82710,
0xcd049231a06970f6, 0xe7bc8a6c97cc4cb0, 0x337ce835fcb3b9c0, 0x65def2587cc780f3,
0x52214ede4132bb50, 0x95f15e4390f493df, 0x870839625dd2e0f1, 0x41313c1afb8b66af,
0x91720af051b211bc, 0x477d427ed4eea573, 0x2e3b4ceef6e3be25, 0x82627834eb0bcc43,
0x9c03e3dd78e724c8, 0x2877328ad9867df9, 0x14b51945e243b0f2, 0x574b0f88f7eb97e2,
0x88b6fa989aa4943a, 0x19c4f068cb168586, 0x50ee6409af11faef, 0x7df317d5c04eaba4,
0x7a567c5498b4c6a9, 0xb6bbfb804f42188e, 0x3cc22bcf3bc5cd0b, 0xd04336eaaa397713,
0xf02fac1bec33132c, 0x2506dba7f0d3488d, 0xd7e65d6bf2c31a1e, 0x5eb9b2161ff820f5,
0x842e0650c46e0f9f, 0x716beb1d9e843001, 0xa933758cab315ed4, 0x3fe414fda2792265,
0x27c9f1701ef00932, 0x73a4c1ca70a771be, 0x94184ba6e76b3d0e, 0x40d829ff8c14c87e,
0x0fbec3fac77674cb, 0x3616a9634a6a9572, 0x8f139119c25ef937, 0xf545ed4d5aea3f9e,
0xe802499650ba387b, 0x6437e7bd0b582e22, 0xe6559f89e053e261, 0x80ad52e305288dfc,
0x6dc55a23e34b9935, 0xde14e0f51ad0ad09, 0xc6390578a659865e, 0x96d7617109487cb1,
0xe2d6cb3a21156002, 0x01e915e5779faed1, 0xadb0213f6a77dcb7, 0x9880b76eb9a1a6ab,
0x5d9f8d248644cf9b, 0xfd5e4536c5662658, 0xf1c6b9fe9bacbdfd, 0xeacd6341be9979c4,
0xefa7221708405576, 0x510771ecd88e543e, 0xc2ba51cb671f043d, 0x0ad482ac71af5879,
0xfe787a045cdac936, 0xb238af338e049aed, 0xbd866cc94972ee26, 0x615da6ebbd810290,
0x3295fdd08b2c1711, 0xf834046073bf0aea, 0xf3099329758ffc42, 0x1caeb13e7dcfa934,
0xba2307481188832b, 0x24efce42874ce65c, 0x0e57d61fb0e9da1a, 0xb3d1bad6f99b343c,
0xc0757b1c893c4582, 0x2b510db8403a9297, 0x5c7698c1f1db614a, 0x3e0d0118d5e68cb4,
0xd60f488e855cb4cf, 0xae961e0df3cb33d9, 0x3a8e55ab14a00ed7, 0x42170328623789c1,
0x838b6dd19c946292, 0x895fef7ded3b3aeb, 0xcfcbb8e64e4a3149, 0x064c7e642f65c3dc,
0x3d2b3e2a4c5a63da, 0x5bd3f340a9210c47, 0xb474d157a1615931, 0xac5934da1de87266,
0x6ee365117af7765b, 0xc86ed36716b05c44, 0x9ba6885c201d49c5, 0xb905387a88346c45,
0x131072c4bab9ddff, 0xbf49461ea751af99, 0xd52977bc1ce05ba1, 0xb0f785e46027db52,
0x546d30ba6e57788c, 0x305ad707650f56ae, 0xc987c682612ff295, 0xa5ab8944f5fbc571,
0x7ed528e759f244ca, 0x8ddcbbce2c7db888, 0xaa154abe328db1ba, 0x1e619be993ece88b,
0x09f2bd9ee813b717, 0x7401aa4b285d1cb3, 0x21858f143195caee, 0x48c381841398d1b8,
0xfcb750d3b2f98889, 0x39a86a998d1ce1b9, 0x1f888e0ce473465a, 0x7899568376978716,
0x02cf2ad7ee2341bf, 0x85c713b5b3f1a14e, 0xff916fe12b4567e7, 0x7c1a0230b7d10575,
0x0c98fcc85eca9ba5, 0xa3e7f720da9e06ad, 0x6a6031a2bbb1f438, 0x973e74947ed7d260,
0x2cf4663918c0ff9a, 0x5f50a7f368678e24, 0x34d983b4a449d4cd, 0x68af1b755592b587,
0x7f3c3d022e6dea1b, 0xabfc5f5b45121f6b, 0x0d71e92d29553574, 0xdffdf5106d4f03d8,
0x081ba87b9f8c19c6, 0xdb7ea1a3ac0981bb, 0xbbca12ad66172dfa, 0x79704366010829c7,
0x179326777bff5f9c, 0x0000000000000000, 0xeb2476a4c906d715, 0x724dd42f0738df6f,
0xb752ee6538ddb65f, 0x37ffbc863df53ba3, 0x8efa84fcb5c157e6, 0xe9eb5c73272596aa,
0x1b0bdabf2535c439, 0x86e12c872a4d4e20, 0x9969a28bce3e087a, 0xfafb2eb79d9c4b55,
0x056a4156b6d92cb2, 0x5a3ae6a5debea296, 0x22a3b026a8292580, 0x53c85b3b36ad1581,
0xb11e900117b87583, 0xc51f3a4a3fe56930, 0xe019e1edcf3621bd, 0xec811d2591fcba18,
0x445b7d4c4d524a1d, 0xa8da6069dcaef005, 0x58f5cc72309de329, 0xd4c062596b7ff570,
0xce22ad0339d59f98, 0x591cd99747024df8, 0x8b90c5aa03187b54, 0xf663d27fc356d0f0,
0xd8589e9135b56ed5, 0x35309651d3d67a1c, 0x12f96721cd26732e, 0xd28c1c3d441a36ac,
0x492a946164077f69, 0x2d1d73dc6f5f514b, 0x6f0a70f40d68d88a, 0x60b4b30eca1eac41,
0xd36509d83385987d, 0x0b3d97490630f6a8, 0x9eccc90a96c46577, 0xa20ee2c5ad01a87c,
0xe49ab55e0e70a3de, 0xa4429ca182646ba0, 0xda97b446db962f6a, 0xcced87d4d7f6de27,
0x2ab8185d37a53c46, 0x9f25dcefe15bcba6, 0xc19c6ef9fea3eb53, 0xa764a3931bd884ce,
0x2fd2590b817c10f4, 0x56a21a6d80743933, 0xe573a0bb79ef0d0f, 0x155c0ca095dc1e23,
0x6c2c4fc694d437e4, 0x10364df623053291, 0xdd32dfc7836c4267, 0x03263f3299bcef6e,
0x66f8cd6ae57b6f9d, 0x8c35ae2b5be21659, 0x31b3c2e21290f87f, 0x93bd2027bf915003,
0x69460e90220d1b56, 0x299e276fae19d328, 0x63928c3c53a2432f, 0x7082fef8e91b9ed0,
0xbc6f792c3eed40f7, 0x4c40d537d2de53db, 0x75e8bfae5fc2b262, 0x4da9c0d2a541fd0a,
0x4e8fffe03cfd1264, 0x2620e495696fa7e3, 0xe1f0f408b8a98f6c, 0xd1aa230fdda6d9c2,
0xc7d0109dd1c6288f, 0x8a79d04f7487d585, 0x4694579ba3710ba2, 0x38417f7cfa834f68,
0x1d47a4db0a5007e5, 0x206c9af1460a643f, 0xa128ddf734bd4712, 0x8144470672b7232d,
0xf2e086cc02105293, 0x182de58dbc892b57, 0xcaa1f9b0f8931dfb, 0x6b892447cc2e5ae9,
0xf9dd11850420a43b, 0x4be5beb68a243ed6, 0x5584255f19c8d65d, 0x3b67404e633fa006,
0xa68db6766c472a1f, 0xf78ac79ab4c97e21, 0xc353442e1080aaec, 0x9a4f9db95782e714,
},
{
0xc811a8058c3f55de, 0x65f5b43196b50619, 0xf74f96b1d6706e43, 0x859d1e8bcb43d336,
0x5aab8a85ccfa3d84, 0xf9c7bf99c295fcfd, 0xa21fd5a1de4b630f, 0xcdb3ef763b8b456d,
0x803f59f87cf7c385, 0xb27c73be5f31913c, 0x98e3ac6633b04821, 0xbf61674c26b8f818,
0x0ffbc995c4c130c8, 0xaaa0862010761a98, 0x6057f342210116aa, 0xf63c760c0654cc35,
0x2ddb45cc667d9042, 0xbcf45a964bd40382, 0x68e8a0c3ef3c6f3d, 0xa7bd92d269ff73bc,
0x290ae20201ed2287, 0xb7de34cde885818f, 0xd901eea7dd61059b, 0xd6fa273219a03553,
0xd56f1ae874cccec9, 0xea31245c2e83f554, 0x7034555da07be499, 0xce26d2ac56e7bef7,
0xfd161857a5054e38, 0x6a0e7da4527436d1, 0x5bd86a381cde9ff2, 0xcaf7756231770c32,
0xb09aaed9e279c8d0, 0x5def1091c60674db, 0x111046a2515e5045, 0x23536ce4729802fc,
0xc50cbcf7f5b63cfa, 0x73a16887cd171f03, 0x7d2941afd9f28dbd, 0x3f5e3eb45a4f3b9d,
0x84eefe361b677140, 0x3db8e3d3e7076271, 0x1a3a28f9f20fd248, 0x7ebc7c75b49e7627,
0x74e5f293c7eb565c, 0x18dcf59e4f478ba4, 0x0c6ef44fa9adcb52, 0xc699812d98dac760,
0x788b06dc6e469d0e, 0xfc65f8ea7521ec4e, 0x30a5f7219e8e0b55, 0x2bec3f65bca57b6b,
0xddd04969baf1b75e, 0x99904cdbe394ea57, 0x14b201d1e6ea40f6, 0xbbb0c08241284add,
0x50f20463bf8f1dff, 0xe8d7f93b93cbacb8, 0x4d8cb68e477c86e8, 0xc1dd1b3992268e3f,
0x7c5aa11209d62fcb, 0x2f3d98abdb35c9ae, 0x671369562bfd5ff5, 0x15c1e16c36cee280,
0x1d7eb2edf8f39b17, 0xda94d37db00dfe01, 0x877bc3ec760b8ada, 0xcb8495dfe153ae44,
0x05a24773b7b410b3, 0x12857b783c32abdf, 0x8eb770d06812513b, 0x536739b9d2e3e665,
0x584d57e271b26468, 0xd789c78fc9849725, 0xa935bbfa7d1ae102, 0x8b1537a3dfa64188,
0xd0cd5d9bc378de7a, 0x4ac82c9a4d80cfb7, 0x42777f1b83bdb620, 0x72d2883a1d33bd75,
0x5e7a2d4bab6a8f41, 0xf4daab6bbb1c95d9, 0x905cffe7fd8d31b6, 0x83aa6422119b381f,
0xc0aefb8442022c49, 0xa0f908c663033ae3, 0xa428af0804938826, 0xade41c341a8a53c7,
0xae7121ee77e6a85d, 0xc47f5c4a25929e8c, 0xb538e9aa55cdd863, 0x06377aa9dad8eb29,
0xa18ae87bb3279895, 0x6edfda6a35e48414, 0x6b7d9d19825094a7, 0xd41cfa55a4e86cbf,
0xe5caedc9ea42c59c, 0xa36c351c0e6fc179, 0x5181e4de6fabbf89, 0xfff0c530184d17d4,
0x9d41eb1584045892, 0x1c0d525028d73961, 0xf178ec180ca8856a, 0x9a0571018ef811cd,
0x4091a27c3ef5efcc, 0x19af15239f6329d2, 0x347450eff91eb990, 0xe11b4a078dd27759,
0xb9561de5fc601331, 0x912f1f5a2da993c0, 0x1654dcb65ba2191a, 0x3e2dde098a6b99eb,
0x8a66d71e0f82e3fe, 0x8c51adb7d55a08d7, 0x4533e50f8941ff7f, 0x02e6dd67bd4859ec,
0xe068aaba5df6d52f, 0xc24826e3ff4a75a5, 0x6c39070d88acddf8, 0x6486548c4691a46f,
0xd1bebd26135c7c0c, 0xb30f93038f15334a, 0x82d9849fc1bf9a69, 0x9c320ba85420fae4,
0xfa528243aff90767, 0x9ed4d6cfe968a308, 0xb825fd582c44b147, 0x9b7691bc5edcb3bb,
0xc7ea619048fe6516, 0x1063a61f817af233, 0x47d538683409a693, 0x63c2ce984c6ded30,
0x2a9fdfd86c81d91d, 0x7b1e3b06032a6694, 0x666089ebfbd9fd83, 0x0a598ee67375207b,
0x07449a140afc495f, 0x2ca8a571b6593234, 0x1f986f8a45bbc2fb, 0x381aa4a050b372c2,
0x5423a3add81faf3a, 0x17273c0b8b86bb6c, 0xfe83258dc869b5a2, 0x287902bfd1c980f1,
0xf5a94bd66b3837af, 0x88800a79b2caba12, 0x55504310083b0d4c, 0xdf36940e07b9eeb2,
0x04d1a7ce6790b2c5, 0x612413fff125b4dc, 0x26f12b97c52c124f, 0x86082351a62f28ac,
0xef93632f9937e5e7, 0x3507b052293a1be6, 0xe72c30ae570a9c70, 0xd3586041ae1425e0,
0xde4574b3d79d4cc4, 0x92ba228040c5685a, 0xf00b0ca5dc8c271c, 0xbe1287f1f69c5a6e,
0xf39e317fb1e0dc86, 0x495d114020ec342d, 0x699b407e3f18cd4b, 0xdca3a9d46ad51528,
0x0d1d14f279896924, 0x0000000000000000, 0x593eb75fa196c61e, 0x2e4e78160b116bd8,
0x6d4ae7b058887f8e, 0xe65fd013872e3e06, 0x7a6ddbbbd30ec4e2, 0xac97fc89caaef1b1,
0x09ccb33c1e19dbe1, 0x89f3eac462ee1864, 0x7770cf49aa87adc6, 0x56c57eca6557f6d6,
0x03953dda6d6cfb9a, 0x36928d884456e07c, 0x1eeb8f37959f608d, 0x31d6179c4eaaa923,
0x6fac3ad7e5c02662, 0x43049fa653991456, 0xabd3669dc052b8ee, 0xaf02c153a7c20a2b,
0x3ccb036e3723c007, 0x93c9c23d90e1ca2c, 0xc33bc65e2f6ed7d3, 0x4cff56339758249e,
0xb1e94e64325d6aa6, 0x37e16d359472420a, 0x79f8e661be623f78, 0x5214d90402c74413,
0x482ef1fdf0c8965b, 0x13f69bc5ec1609a9, 0x0e88292814e592be, 0x4e198b542a107d72,
0xccc00fcbebafe71b, 0x1b49c844222b703e, 0x2564164da840e9d5, 0x20c6513e1ff4f966,
0xbac3203f910ce8ab, 0xf2edd1c261c47ef0, 0x814cb945acd361f3, 0x95feb8944a392105,
0x5c9cf02c1622d6ad, 0x971865f3f77178e9, 0xbd87ba2b9bf0a1f4, 0x444005b259655d09,
0xed75be48247fbc0b, 0x7596122e17cff42a, 0xb44b091785e97a15, 0x966b854e2755da9f,
0xeee0839249134791, 0x32432a4623c652b9, 0xa8465b47ad3e4374, 0xf8b45f2412b15e8b,
0x2417f6f078644ba3, 0xfb2162fe7fdda511, 0x4bbbcc279da46dc1, 0x0173e0bdd024a276,
0x22208c59a2bca08a, 0x8fc4906db836f34d, 0xe4b90d743a6667ea, 0x7147b5e0705f46ef,
0x2782cb2a1508b039, 0xec065ef5f45b1e7d, 0x21b5b183cfd05b10, 0xdbe733c060295c77,
0x9fa73672394c017e, 0xcf55321186c31c81, 0xd8720e1a0d45a7ed, 0x3b8f997a3ddf8958,
0x3afc79c7edfb2b2e, 0xe9a4198643ef0ece, 0x5f09cdf67b4e2d37, 0x4f6a6be9fa34df04,
0xb6add47038a123f9, 0x8d224d0a057eaaa1, 0xc96248b85c1bf7a8, 0xe3fd9760309a2eb5,
0x0b2a6e5ba351820d, 0xeb42c4e1fea75722, 0x948d58299a1d8373, 0x7fcf9cc864bad451,
0xa55b4fb5d4b72a50, 0x08bf5381ce3d7997, 0x46a6d8d5e42d04e5, 0xd22b80fc7e308796,
0x57b69e77b57354a0, 0x3969441d8097d0b4, 0x3330cafbf3e2f0cf, 0xe28e77dde0be8cc3,
0x62b12e259c494f46, 0xa6ce726fb9dbd1ca, 0x41e242c1eed14dba, 0x76032ff47aa30fb0,
},
{
0xe6f87e5c5b711fd0, 0x258377800924fa16, 0xc849e07e852ea4a8, 0x5b4686a18f06c16a,
0x0b32e9a2d77b416e, 0xabda37a467815c66, 0xf61796a81a686676, 0xf5dc0b706391954b,
0x4862f38db7e64bf1, 0xff5c629a68bd85c5, 0xcb827da6fcd75795, 0x66d36daf69b9f089,
0x356c9f74483d83b0, 0x7cbcecb1238c99a1, 0x36a702ac31c4708d, 0x9eb6a8d02fbcdfd6,
0x8b19fa51e5b3ae37, 0x9ccfb5408a127d0b, 0xbc0c78b508208f5a, 0xe533e3842288eced,
0xcec2c7d377c15fd2, 0xec7817b6505d0f5e, 0xb94cc2c08336871d, 0x8c205db4cb0b04ad,
0x763c855b28a0892f, 0x588d1b79f6ff3257, 0x3fecf69e4311933e, 0x0fc0d39f803a18c9,
0xee010a26f5f3ad83, 0x10efe8f4411979a6, 0x5dcda10c7de93a10, 0x4a1bee1d1248e92c,
0x53bff2db21847339, 0xb4f50ccfa6a23d09, 0x5fb4bc9cd84798cd, 0xe88a2d8b071c56f9,
0x7f7771695a756a9c, 0xc5f02e71a0ba1ebc, 0xa663f9ab4215e672, 0x2eb19e22de5fbb78,
0x0db9ce0f2594ba14, 0x82520e6397664d84, 0x2f031e6a0208ea98, 0x5c7f2144a1be6bf0,
0x7a37cb1cd16362db, 0x83e08e2b4b311c64, 0xcf70479bab960e32, 0x856ba986b9dee71e,
0xb5478c877af56ce9, 0xb8fe42885f61d6fd, 0x1bdd0156966238c8, 0x622157923ef8a92e,
0xfc97ff42114476f8, 0x9d7d350856452ceb, 0x4c90c9b0e0a71256, 0x2308502dfbcb016c,
0x2d7a03faa7a64845, 0xf46e8b38bfc6c4ab, 0xbdbef8fdd477deba, 0x3aac4cebc8079b79,
0xf09cb105e8879d0c, 0x27fa6a10ac8a58cb, 0x8960e7c1401d0cea, 0x1a6f811e4a356928,
0x90c4fb0773d196ff, 0x43501a2f609d0a9f, 0xf7a516e0c63f3796, 0x1ce4a6b3b8da9252,
0x1324752c38e08a9b, 0xa5a864733bec154f, 0x2bf124575549b33f, 0xd766db15440dc5c7,
0xa7d179e39e42b792, 0xdadf151a61997fd3, 0x86a0345ec0271423, 0x38d5517b6da939a4,
0x6518f077104003b4, 0x02791d90a5aea2dd, 0x88d267899c4a5d0a, 0x930f66df0a2865c2,
0x4ee9d4204509b08b, 0x325538916685292a, 0x412907bfc533a842, 0xb27e2b62544dc673,
0x6c5304456295e007, 0x5af406e95351908a, 0x1f2f3b6bc123616f, 0xc37b09dc5255e5c6,
0x3967d133b1fe6844, 0x298839c7f0e711e2, 0x409b87f71964f9a2, 0xe938adc3db4b0719,
0x0c0b4e47f9c3ebf4, 0x5534d576d36b8843, 0x4610a05aeb8b02d8, 0x20c3cdf58232f251,
0x6de1840dbec2b1e7, 0xa0e8de06b0fa1d08, 0x7b854b540d34333b, 0x42e29a67bcca5b7f,
0xd8a6088ac437dd0e, 0xc63bb3a9d943ed81, 0x21714dbd5e65a3b1, 0x6761ede7b5eea169,
0x2431f7c8d573abf6, 0xd51fc685e1a3671a, 0x5e063cd40410c92d, 0x283ab98f2cb04002,
0x8febc06cb2f2f790, 0x17d64f116fa1d33c, 0xe07359f1a99ee4aa, 0x784ed68c74cdc006,
0x6e2a19d5c73b42da, 0x8712b4161c7045c3, 0x371582e4ed93216d, 0xace390414939f6fc,
0x7ec5f12186223b7c, 0xc0b094042bac16fb, 0xf9d745379a527ebf, 0x737c3f2ea3b68168,
0x33e7b8d9bad278ca, 0xa9a32a34c22ffebb, 0xe48163ccfedfbd0d, 0x8e5940246ea5a670,
0x51c6ef4b842ad1e4, 0x22bad065279c508c, 0xd91488c218608cee, 0x319ea5491f7cda17,
0xd394e128134c9c60, 0x094bf43272d5e3b3, 0x9bf612a5a4aad791, 0xccbbda43d26ffd0f,
0x34de1f3c946ad250, 0x4f5b5468995ee16b, 0xdf9faf6fea8f7794, 0x2648ea5870dd092b,
0xbfc7e56d71d97c67, 0xdde6b2ff4f21d549, 0x3c276b463ae86003, 0x91767b4faf86c71f,
0x68a13e7835d4b9a0, 0xb68c115f030c9fd4, 0x141dd2c916582001, 0x983d8f7ddd5324ac,
0x64aa703fcc175254, 0xc2c989948e02b426, 0x3e5e76d69f46c2de, 0x50746f03587d8004,
0x45db3d829272f1e5, 0x60584a029b560bf3, 0xfbae58a73ffcdc62, 0xa15a5e4e6cad4ce8,
0x4ba96e55ce1fb8cc, 0x08f9747aae82b253, 0xc102144cf7fb471b, 0x9f042898f3eb8e36,
0x068b27adf2effb7a, 0xedca97fe8c0a5ebe, 0x778e0513f4f7d8cf, 0x302c2501c32b8bf7,
0x8d92ddfc175c554d, 0xf865c57f46052f5f, 0xeaf3301ba2b2f424, 0xaa68b7ecbbd60d86,
0x998f0f350104754c, 0x0000000000000000, 0xf12e314d34d0ccec, 0x710522be061823b5,
0xaf280d9930c005c1, 0x97fd5ce25d693c65, 0x19a41cc633cc9a15, 0x95844172f8c79eb8,
0xdc5432b7937684a9, 0x9436c13a2490cf58, 0x802b13f332c8ef59, 0xc442ae397ced4f5c,
0xfa1cd8efe3ab8d82, 0xf2e5ac954d293fd1, 0x6ad823e8907a1b7d, 0x4d2249f83cf043b6,
0x03cb9dd879f9f33d, 0xde2d2f2736d82674, 0x2a43a41f891ee2df, 0x6f98999d1b6c133a,
0xd4ad46cd3df436fa, 0xbb35df50269825c0, 0x964fdcaa813e6d85, 0xeb41b0537ee5a5c4,
0x0540ba758b160847, 0xa41ae43be7bb44af, 0xe3b8c429d0671797, 0x819993bbee9fbeb9,
0xae9a8dd1ec975421, 0xf3572cdd917e6e31, 0x6393d7dae2aff8ce, 0x47a2201237dc5338,
0xa32343dec903ee35, 0x79fc56c4a89a91e6, 0x01b28048dc5751e0, 0x1296f564e4b7db7b,
0x75f7188351597a12, 0xdb6d9552bdce2e33, 0x1e9dbb231d74308f, 0x520d7293fdd322d9,
0xe20a44610c304677, 0xfeeee2d2b4ead425, 0xca30fdee20800675, 0x61eaca4a47015a13,
0xe74afe1487264e30, 0x2cc883b27bf119a5, 0x1664cf59b3f682dc, 0xa811aa7c1e78af5b,
0x1d5626fb648dc3b2, 0xb73e9117df5bce34, 0xd05f7cf06ab56f5d, 0xfd257f0acd132718,
0x574dc8e676c52a9e, 0x0739a7e52eb8aa9a, 0x5486553e0f3cd9a3, 0x56ff48aeaa927b7e,
0xbe756525ad8e2d87, 0x7d0e6cf9ffdbc841, 0x3b1ecca31450ca99, 0x6913be30e983e840,
0xad511009956ea71c, 0xb1b5b6ba2db4354e, 0x4469bdca4e25a005, 0x15af5281ca0f71e1,
0x744598cb8d0e2bf2, 0x593f9b312aa863b7, 0xefb38a6e29a4fc63, 0x6b6aa3a04c2d4a9d,
0x3d95eb0ee6bf31e3, 0xa291c3961554bfd5, 0x18169c8eef9bcbf5, 0x115d68bc9d4e2846,
0xba875f18facf7420, 0xd1edfcb8b6e23ebd, 0xb00736f2f1e364ae, 0x84d929ce6589b6fe,
0x70b7a2f6da4f7255, 0x0e7253d75c6d4929, 0x04f23a3d574159a7, 0x0a8069ea0b2c108e,
0x49d073c56bb11a11, 0x8aab7a1939e4ffd7, 0xcd095a0b0e38acef, 0xc9fb60365979f548,
0x92bde697d67f3422, 0xc78933e10514bc61, 0xe1c1d9b975c9b54a, 0xd2266160cf1bcd80,
0x9a4492ed78fd8671, 0xb3ccab2a881a9793, 0x72cebf667fe1d088, 0xd6d45b5d985a9427,
},
};
CONSTANT_AS u64a sbob_rc64[12][8] =
{
{
0xe9daca1eda5b08b1, 0x1f7c65c0812fcbeb, 0x16d0452e43766a2f, 0xfcc485758db84e71,
0x0169679291e07c4b, 0x15d360a4082a42a2, 0x234d74cc36747605, 0x0745a6f2596580dd,
},
{
0x1a2f9da98ab5a36f, 0xd7b5700f469de34f, 0x982b230a72eafef3, 0x3101b5160f5ed561,
0x5899d6126b17b59a, 0xcaa70adbc261b55c, 0x56cdcbd71ba2dd55, 0xb79bb121700479e6,
},
{
0xc72fce2bacdc74f5, 0x35843d6a28fc390a, 0x8b1f9c525f5ef106, 0x7b7b29b11475eaf2,
0xb19e3590e40fe2d3, 0x09db6260373ac9c1, 0x31db7a8643f4b6c2, 0xb20aba0af5961e99,
},
{
0xd26615e8b3df1fef, 0xdde4715da0e148f9, 0x7d3c5c337e858e48, 0x3f355e68ad1c729d,
0x75d603ed822cd7a9, 0xbe0352933313b7d8, 0xf137e893a1ea5334, 0x2ed1e384bcbe0c22,
},
{
0x994747adac6bea4b, 0x6323a96c0c413f9a, 0x4a1086161f1c157f, 0xbdff0f80d7359e35,
0xa3f53a254717cdbf, 0x161a2723b700ffdf, 0xf563eaa97ea2567a, 0x57fe6c7cfd581760,
},
{
0xd9d33a1daeae4fae, 0xc039307a3bc3a46f, 0x6ca44251f9c4662d, 0xc68ef09ab49a7f18,
0xb4b79a1cb7a6facf, 0xb6c6bec2661ff20a, 0x354f903672c571bf, 0x6e7d64467a4068fa,
},
{
0xecc5aaee160ec7f4, 0x540924bffe86ac51, 0xc987bfe6c7c69e39, 0xc9937a19333e47d3,
0x372c822dc5ab9209, 0x04054a2883694706, 0xf34a3ca24c451735, 0x93d4143a4d568688,
},
{
0xa7c9934d425b1f9b, 0x41416e0c02aae703, 0x1ede369c71f8b74e, 0x9ac4db4d3b44b489,
0x90069b92cb2b89f4, 0x2fc4a5d12b8dd169, 0xd9a8515935c2ac36, 0x1ee702bfd40d7fa4,
},
{
0x9b223116545a8f37, 0xde5f16ecd89a4c94, 0x244289251b3a7d3a, 0x84090de0b755d93c,
0xb1ceb2db0b440a80, 0x549c07a69a8a2b7b, 0x602a1fcb92dc380e, 0xdb5a238351446172,
},
{
0x526f0580a6debeab, 0xf3f3e4b248e52a38, 0xdb788aff1ce74189, 0x0361331b8ae1ff1f,
0x4b3369af0267e79f, 0xf452763b306c1e7a, 0xc3b63b15d1fa9836, 0xed9c4598fbc7b474,
},
{
0xfb89c8efd09ecd7b, 0x94fe5a63cdc60230, 0x6107abebbb6bfad8, 0x7966841421800120,
0xcab948eaef711d8a, 0x986e477d1dcdbaef, 0x5dd86fc04a59a2de, 0x1b2df381cda4ca6b,
},
{
0xba3116f167e78e37, 0x7ab14904b08013d2, 0x771ddfbc323ca4cd, 0x9b9f2130d41220f8,
0x86cc91189def805d, 0x5228e188aaa41de7, 0x991bb2d9d517f4fa, 0x20d71bf14a92bc48,
},
};
#if VECT_SIZE == 1 #if VECT_SIZE == 1
#define BOX(S,n,i) ((S)[(n)][(i)]) #define BOX(S,n,i) ((S)[(n)][(i)])
@ -677,7 +93,7 @@ DECLSPEC void streebog512_transform (streebog512_ctx_t *ctx, const u32 *w0, cons
DECLSPEC void streebog512_update_64 (streebog512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len); DECLSPEC void streebog512_update_64 (streebog512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void streebog512_update (streebog512_ctx_t *ctx, const u32 *w, int len); DECLSPEC void streebog512_update (streebog512_ctx_t *ctx, const u32 *w, int len);
DECLSPEC void streebog512_update_swap (streebog512_ctx_t *ctx, const u32 *w, int len); DECLSPEC void streebog512_update_swap (streebog512_ctx_t *ctx, const u32 *w, int len);
DECLSPEC void streebog512_update_global_swap (streebog512_ctx_t *ctx, const GLOBAL_AS u32 *w, int len); DECLSPEC void streebog512_update_global_swap (streebog512_ctx_t *ctx, GLOBAL_AS const u32 *w, int len);
DECLSPEC void streebog512_final (streebog512_ctx_t *ctx); DECLSPEC void streebog512_final (streebog512_ctx_t *ctx);
DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256]); DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]); DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]);
@ -685,7 +101,7 @@ DECLSPEC void streebog512_hmac_init_swap (streebog512_hmac_ctx_t *ctx, const u32
DECLSPEC void streebog512_hmac_update_64 (streebog512_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len); DECLSPEC void streebog512_hmac_update_64 (streebog512_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void streebog512_hmac_update (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void streebog512_hmac_update (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void streebog512_hmac_update_swap (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len); DECLSPEC void streebog512_hmac_update_swap (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void streebog512_hmac_update_global_swap (streebog512_hmac_ctx_t *ctx, const GLOBAL_AS u32 *w, const int len); DECLSPEC void streebog512_hmac_update_global_swap (streebog512_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void streebog512_hmac_final (streebog512_hmac_ctx_t *ctx); DECLSPEC void streebog512_hmac_final (streebog512_hmac_ctx_t *ctx);
DECLSPEC void streebog512_init_vector (streebog512_ctx_vector_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256]); DECLSPEC void streebog512_init_vector (streebog512_ctx_vector_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog512_add_vector (u64x *x, const u64x *y); DECLSPEC void streebog512_add_vector (u64x *x, const u64x *y);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2588,8 +2588,8 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs,
u32 ks1[44]; u32 ks1[44];
u32 ks2[60]; u32 ks2[60];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -2621,8 +2621,8 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs,
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -2648,7 +2648,7 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs,
u32 ks1[44]; u32 ks1[44];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -2675,7 +2675,7 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs,
u32 ks1[60]; u32 ks1[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -2709,8 +2709,8 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs,
u32 ks1[44]; u32 ks1[44];
u32 ks2[44]; u32 ks2[44];
aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -2749,8 +2749,8 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs,
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -2788,8 +2788,8 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs,
u32 ks1[44]; u32 ks1[44];
u32 ks2[60]; u32 ks2[60];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_cbc_essiv128 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_essiv128 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -2817,8 +2817,8 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs,
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_cbc_essiv256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_essiv256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -2840,7 +2840,7 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs,
u32 ks1[44]; u32 ks1[44];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
luks_decrypt_sector_aes_cbc_plain128 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_plain128 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -2863,7 +2863,7 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs,
u32 ks1[60]; u32 ks1[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
luks_decrypt_sector_aes_cbc_plain256 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_plain256 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -2897,8 +2897,8 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs,
u32 ks1[44]; u32 ks1[44];
u32 ks2[44]; u32 ks2[44];
aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_xts_plain256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_xts_plain256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -2937,8 +2937,8 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs,
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_xts_plain512 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_xts_plain512 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -2979,8 +2979,8 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[44]; u32 ks1[44];
u32 ks2[60]; u32 ks2[60];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3012,8 +3012,8 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3039,7 +3039,7 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[44]; u32 ks1[44];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3066,7 +3066,7 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[60]; u32 ks1[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3100,8 +3100,8 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[44]; u32 ks1[44];
u32 ks2[44]; u32 ks2[44];
aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3140,8 +3140,8 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3175,8 +3175,8 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[44]; u32 ks1[44];
u32 ks2[60]; u32 ks2[60];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_cbc_essiv128 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_essiv128 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3200,8 +3200,8 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_cbc_essiv256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_essiv256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3219,7 +3219,7 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[44]; u32 ks1[44];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
luks_decrypt_sector_aes_cbc_plain128 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_plain128 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3238,7 +3238,7 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[60]; u32 ks1[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
luks_decrypt_sector_aes_cbc_plain256 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_plain256 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3264,8 +3264,8 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[44]; u32 ks1[44];
u32 ks2[44]; u32 ks2[44];
aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_xts_plain256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_xts_plain256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3296,8 +3296,8 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_xts_plain512 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_xts_plain512 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3357,8 +3357,8 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[44]; u32 ks1[44];
u32 ks2[60]; u32 ks2[60];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3390,8 +3390,8 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3417,7 +3417,7 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[44]; u32 ks1[44];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3444,7 +3444,7 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[60]; u32 ks1[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3478,8 +3478,8 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[44]; u32 ks1[44];
u32 ks2[44]; u32 ks2[44];
aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3518,8 +3518,8 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3553,8 +3553,8 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[44]; u32 ks1[44];
u32 ks2[60]; u32 ks2[60];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_cbc_essiv128 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_essiv128 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3578,8 +3578,8 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_cbc_essiv256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_essiv256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3597,7 +3597,7 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[44]; u32 ks1[44];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
luks_decrypt_sector_aes_cbc_plain128 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_plain128 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3616,7 +3616,7 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[60]; u32 ks1[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
luks_decrypt_sector_aes_cbc_plain256 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_plain256 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3642,8 +3642,8 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[44]; u32 ks1[44];
u32 ks2[44]; u32 ks2[44];
aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_xts_plain256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_xts_plain256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3674,8 +3674,8 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (GLOBAL_AS const luks_t *luks_bufs
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_xts_plain512 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_xts_plain512 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3716,8 +3716,8 @@ DECLSPEC void luks_af_ripemd160_then_aes_decrypt (GLOBAL_AS const luks_t *luks_b
u32 ks1[44]; u32 ks1[44];
u32 ks2[60]; u32 ks2[60];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3749,8 +3749,8 @@ DECLSPEC void luks_af_ripemd160_then_aes_decrypt (GLOBAL_AS const luks_t *luks_b
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3776,7 +3776,7 @@ DECLSPEC void luks_af_ripemd160_then_aes_decrypt (GLOBAL_AS const luks_t *luks_b
u32 ks1[44]; u32 ks1[44];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3803,7 +3803,7 @@ DECLSPEC void luks_af_ripemd160_then_aes_decrypt (GLOBAL_AS const luks_t *luks_b
u32 ks1[60]; u32 ks1[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3837,8 +3837,8 @@ DECLSPEC void luks_af_ripemd160_then_aes_decrypt (GLOBAL_AS const luks_t *luks_b
u32 ks1[44]; u32 ks1[44];
u32 ks2[44]; u32 ks2[44];
aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3877,8 +3877,8 @@ DECLSPEC void luks_af_ripemd160_then_aes_decrypt (GLOBAL_AS const luks_t *luks_b
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
int sector = 0; int sector = 0;
int offset = 0; int offset = 0;
@ -3912,8 +3912,8 @@ DECLSPEC void luks_af_ripemd160_then_aes_decrypt (GLOBAL_AS const luks_t *luks_b
u32 ks1[44]; u32 ks1[44];
u32 ks2[60]; u32 ks2[60];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_cbc_essiv128 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_essiv128 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3937,8 +3937,8 @@ DECLSPEC void luks_af_ripemd160_then_aes_decrypt (GLOBAL_AS const luks_t *luks_b
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, essivhash, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_cbc_essiv256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_essiv256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3956,7 +3956,7 @@ DECLSPEC void luks_af_ripemd160_then_aes_decrypt (GLOBAL_AS const luks_t *luks_b
u32 ks1[44]; u32 ks1[44];
aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
luks_decrypt_sector_aes_cbc_plain128 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_plain128 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -3975,7 +3975,7 @@ DECLSPEC void luks_af_ripemd160_then_aes_decrypt (GLOBAL_AS const luks_t *luks_b
u32 ks1[60]; u32 ks1[60];
aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
luks_decrypt_sector_aes_cbc_plain256 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_cbc_plain256 (luks_bufs->ct_buf, pt_buf, ks1, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -4001,8 +4001,8 @@ DECLSPEC void luks_af_ripemd160_then_aes_decrypt (GLOBAL_AS const luks_t *luks_b
u32 ks1[44]; u32 ks1[44];
u32 ks2[44]; u32 ks2[44];
aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes128_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_xts_plain256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_xts_plain256 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }
@ -4033,8 +4033,8 @@ DECLSPEC void luks_af_ripemd160_then_aes_decrypt (GLOBAL_AS const luks_t *luks_b
u32 ks1[60]; u32 ks1[60];
u32 ks2[60]; u32 ks2[60];
aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks1, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks2, ukey2, s_te0, s_te1, s_te2, s_te3);
luks_decrypt_sector_aes_xts_plain512 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); luks_decrypt_sector_aes_xts_plain512 (luks_bufs->ct_buf, pt_buf, ks1, ks2, 0, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
} }

View File

@ -8,6 +8,10 @@
#include "inc_common.h" #include "inc_common.h"
#include "inc_rp.h" #include "inc_rp.h"
#ifndef MAYBE_UNUSED
#define MAYBE_UNUSED
#endif
#ifdef REAL_SHM #ifdef REAL_SHM
#define COPY_PW(x) \ #define COPY_PW(x) \
LOCAL_AS pw_t s_pws[64]; \ LOCAL_AS pw_t s_pws[64]; \
@ -676,24 +680,28 @@ DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p
{ {
if ((len + 4) >= RP_PASSWORD_SIZE) return (len); // cheap way to not need to check for overflow of i + 1 if ((len + 4) >= RP_PASSWORD_SIZE) return (len); // cheap way to not need to check for overflow of i + 1
mangle_lrest_ufirst (0, 0, buf, len);
for (int i = 0, idx = 0; i < len; i += 4, idx += 1) for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
{ {
const u32 v = buf[idx]; const u32 t = buf[idx];
buf[idx] = t | generate_cmask (t);
u32 out0 = 0; u32 out0 = 0;
u32 out1 = 0; u32 out1 = 0;
if (((v >> 0) & 0xff) == p0) out0 |= 0x0000ff00; if (((t >> 0) & 0xff) == p0) out0 |= 0x0000ff00;
if (((v >> 8) & 0xff) == p0) out0 |= 0x00ff0000; if (((t >> 8) & 0xff) == p0) out0 |= 0x00ff0000;
if (((v >> 16) & 0xff) == p0) out0 |= 0xff000000; if (((t >> 16) & 0xff) == p0) out0 |= 0xff000000;
if (((v >> 24) & 0xff) == p0) out1 |= 0x000000ff; if (((t >> 24) & 0xff) == p0) out1 |= 0x000000ff;
buf[idx + 0] &= ~(generate_cmask (buf[idx + 0]) & out0); buf[idx + 0] &= ~(generate_cmask (buf[idx + 0]) & out0);
buf[idx + 1] &= ~(generate_cmask (buf[idx + 1]) & out1); buf[idx + 1] &= ~(generate_cmask (buf[idx + 1]) & out1);
} }
const u32 t = buf[0];
buf[0] = t & ~(0x00000020 & generate_cmask (t));
return (len); return (len);
} }

View File

@ -6,6 +6,10 @@
#ifndef _INC_RP_H #ifndef _INC_RP_H
#define _INC_RP_H #define _INC_RP_H
#ifndef DECLSPEC
#define DECLSPEC
#endif
#ifndef MAYBE_UNUSED #ifndef MAYBE_UNUSED
#define MAYBE_UNUSED #define MAYBE_UNUSED
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,10 @@
#ifndef _INC_RP_OPTIMIZED_H #ifndef _INC_RP_OPTIMIZED_H
#define _INC_RP_OPTIMIZED_H #define _INC_RP_OPTIMIZED_H
#ifndef DECLSPEC
#define DECLSPEC
#endif
#ifndef MAYBE_UNUSED #ifndef MAYBE_UNUSED
#define MAYBE_UNUSED #define MAYBE_UNUSED
#endif #endif
@ -64,17 +68,17 @@
#define RULE_OP_MANGLE_DUPEBLOCK_LAST 'Y' #define RULE_OP_MANGLE_DUPEBLOCK_LAST 'Y'
#define RULE_OP_MANGLE_TITLE 'E' #define RULE_OP_MANGLE_TITLE 'E'
DECLSPEC u32 generate_cmask (const u32 value); DECLSPEC u32 generate_cmask_optimized (const u32 value);
DECLSPEC void truncate_right (u32 *buf0, u32 *buf1, const u32 offset); DECLSPEC void truncate_right_optimized (u32 *buf0, u32 *buf1, const u32 offset);
DECLSPEC void truncate_left (u32 *buf0, u32 *buf1, const u32 offset); DECLSPEC void truncate_left_optimized (u32 *buf0, u32 *buf1, const u32 offset);
DECLSPEC void lshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1); DECLSPEC void lshift_block_optimized (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1);
DECLSPEC void rshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1); DECLSPEC void rshift_block_optimized (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1);
DECLSPEC void lshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num); DECLSPEC void lshift_block_optimized_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num);
DECLSPEC void rshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num); DECLSPEC void rshift_block_optimized_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num);
DECLSPEC void append_block1 (const u32 offset, u32 *buf0, u32 *buf1, const u32 src_r0); DECLSPEC void append_block1_optimized (const u32 offset, u32 *buf0, u32 *buf1, const u32 src_r0);
DECLSPEC void append_block8 (const u32 offset, u32 *buf0, u32 *buf1, const u32 *src_l0, const u32 *src_l1, const u32 *src_r0, const u32 *src_r1); DECLSPEC void append_block8_optimized (const u32 offset, u32 *buf0, u32 *buf1, const u32 *src_l0, const u32 *src_l1, const u32 *src_r0, const u32 *src_r1);
DECLSPEC void reverse_block (u32 *in0, u32 *in1, u32 *out0, u32 *out1, const u32 len); DECLSPEC void reverse_block_optimized (u32 *in0, u32 *in1, u32 *out0, u32 *out1, const u32 len);
DECLSPEC void exchange_byte (u32 *buf, const int off_src, const int off_dst); DECLSPEC void exchange_byte_optimized (u32 *buf, const int off_src, const int off_dst);
DECLSPEC u32 rule_op_mangle_lrest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len); DECLSPEC u32 rule_op_mangle_lrest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
DECLSPEC u32 rule_op_mangle_urest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len); DECLSPEC u32 rule_op_mangle_urest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
DECLSPEC u32 rule_op_mangle_lrest_ufirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len); DECLSPEC u32 rule_op_mangle_lrest_ufirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
@ -117,8 +121,8 @@ DECLSPEC u32 rule_op_mangle_dupeblock_first (MAYBE_UNUSED const u32 p0, MAYBE_UN
DECLSPEC u32 rule_op_mangle_dupeblock_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len); DECLSPEC u32 rule_op_mangle_dupeblock_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
DECLSPEC u32 toggle_on_register (const u32 in, const u32 r); DECLSPEC u32 toggle_on_register (const u32 in, const u32 r);
DECLSPEC u32 rule_op_mangle_title_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len); DECLSPEC u32 rule_op_mangle_title_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
DECLSPEC u32 apply_rule (const u32 name, const u32 p0, const u32 p1, u32 *buf0, u32 *buf1, const u32 in_len); DECLSPEC u32 apply_rule_optimized (const u32 name, const u32 p0, const u32 p1, u32 *buf0, u32 *buf1, const u32 in_len);
DECLSPEC u32 apply_rules (CONSTANT_AS const u32 *cmds, u32 *buf0, u32 *buf1, const u32 len); DECLSPEC u32 apply_rules_optimized (CONSTANT_AS const u32 *cmds, u32 *buf0, u32 *buf1, const u32 len);
DECLSPEC u32x apply_rules_vect (const u32 *pw_buf0, const u32 *pw_buf1, const u32 pw_len, CONSTANT_AS const kernel_rule_t *rules_buf, const u32 il_pos, u32x *buf0, u32x *buf1); DECLSPEC u32x apply_rules_vect_optimized (const u32 *pw_buf0, const u32 *pw_buf1, const u32 pw_len, CONSTANT_AS const kernel_rule_t *rules_buf, const u32 il_pos, u32x *buf0, u32x *buf1);
#endif // _INC_RP_OPTIMIZED_H #endif // _INC_RP_OPTIMIZED_H

View File

@ -8,6 +8,74 @@
#include "inc_common.h" #include "inc_common.h"
#include "inc_truecrypt_crc32.h" #include "inc_truecrypt_crc32.h"
CONSTANT_AS u32a crc32tab[0x100] =
{
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
DECLSPEC u32 round_crc32 (u32 a, const u32 v) DECLSPEC u32 round_crc32 (u32 a, const u32 v)
{ {
const u32 k = (a ^ v) & 0xff; const u32 k = (a ^ v) & 0xff;

View File

@ -6,74 +6,6 @@
#ifndef _INC_TRUECRYPT_CRC32_H #ifndef _INC_TRUECRYPT_CRC32_H
#define _INC_TRUECRYPT_CRC32_H #define _INC_TRUECRYPT_CRC32_H
CONSTANT_AS u32a crc32tab[0x100] =
{
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
DECLSPEC u32 round_crc32 (u32 a, const u32 v); DECLSPEC u32 round_crc32 (u32 a, const u32 v);
DECLSPEC u32 round_crc32_4 (const u32 w, const u32 iv); DECLSPEC u32 round_crc32_4 (const u32 w, const u32 iv);

View File

@ -31,7 +31,7 @@ DECLSPEC void aes256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, cons
out[2] = in[2]; out[2] = in[2];
out[3] = in[3]; out[3] = in[3];
aes256_set_encrypt_key (ks, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_set_encrypt_key (ks, ukey2, s_te0, s_te1, s_te2, s_te3);
aes256_encrypt (ks, S, T, s_te0, s_te1, s_te2, s_te3, s_te4); aes256_encrypt (ks, S, T, s_te0, s_te1, s_te2, s_te3, s_te4);
out[0] ^= T[0]; out[0] ^= T[0];
@ -39,7 +39,7 @@ DECLSPEC void aes256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, cons
out[2] ^= T[2]; out[2] ^= T[2];
out[3] ^= T[3]; out[3] ^= T[3];
aes256_set_decrypt_key (ks, ukey1, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_set_decrypt_key (ks, ukey1, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
aes256_decrypt (ks, out, out, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_decrypt (ks, out, out, s_td0, s_td1, s_td2, s_td3, s_td4);
out[0] ^= T[0]; out[0] ^= T[0];

View File

@ -6,10 +6,17 @@
#ifndef _INC_TYPES_H #ifndef _INC_TYPES_H
#define _INC_TYPES_H #define _INC_TYPES_H
#ifdef KERNEL_STATIC
typedef uchar u8; typedef uchar u8;
typedef ushort u16; typedef ushort u16;
typedef uint u32; typedef uint u32;
typedef ulong u64; typedef ulong u64;
#else
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
#endif
//testwise disabled //testwise disabled
//typedef u8 u8a __attribute__ ((aligned (8))); //typedef u8 u8a __attribute__ ((aligned (8)));
@ -30,11 +37,12 @@ typedef u64 u64a;
#define CONCAT(a, b) a##b #define CONCAT(a, b) a##b
#define VTYPE(type, width) CONCAT(type, width) #define VTYPE(type, width) CONCAT(type, width)
// emulated is always VECT_SIZE = 1
#if VECT_SIZE == 1 #if VECT_SIZE == 1
typedef uchar u8x; typedef u8 u8x;
typedef ushort u16x; typedef u16 u16x;
typedef uint u32x; typedef u32 u32x;
typedef ulong u64x; typedef u64 u64x;
#else #else
typedef VTYPE(uchar, VECT_SIZE) u8x; typedef VTYPE(uchar, VECT_SIZE) u8x;
typedef VTYPE(ushort, VECT_SIZE) u16x; typedef VTYPE(ushort, VECT_SIZE) u16x;
@ -823,11 +831,13 @@ typedef enum combinator_mode
} combinator_mode_t; } combinator_mode_t;
#ifdef KERNEL_STATIC
typedef struct digest typedef struct digest
{ {
u32 digest_buf[DGST_ELEM]; u32 digest_buf[DGST_ELEM];
} digest_t; } digest_t;
#endif
typedef struct salt typedef struct salt
{ {

View File

@ -18,6 +18,14 @@
#define KERNEL_FQ __kernel #define KERNEL_FQ __kernel
#endif #endif
#ifndef MAYBE_VOLATILE
#define MAYBE_VOLATILE
#endif
#ifndef MAYBE_UNUSED
#define MAYBE_UNUSED
#endif
/** /**
* device type * device type
*/ */
@ -76,13 +84,14 @@
/** /**
* function declarations can have a large influence depending on the opencl runtime * function declarations can have a large influence depending on the opencl runtime
* fast but pure kernels on rocm is a good example
*/ */
#if defined IS_CPU #if defined IS_CPU
#define DECLSPEC inline #define DECLSPEC inline
#elif defined IS_GPU #elif defined IS_GPU
#if defined IS_AMD #if defined IS_AMD
#define DECLSPEC inline #define DECLSPEC inline static
#else #else
#define DECLSPEC #define DECLSPEC
#endif #endif

View File

@ -11,6 +11,8 @@
#include "inc_cipher_twofish.h" #include "inc_cipher_twofish.h"
#include "inc_cipher_camellia.h" #include "inc_cipher_camellia.h"
#include "inc_cipher_kuznyechik.h" #include "inc_cipher_kuznyechik.h"
#include "inc_truecrypt_crc32.h"
#include "inc_truecrypt_xts.h"
#include "inc_veracrypt_xts.h" #include "inc_veracrypt_xts.h"
DECLSPEC void camellia256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks) DECLSPEC void camellia256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks)

View File

@ -56,7 +56,7 @@ KERNEL_FQ void m00000_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
append_0x80_2x4_VV (w0, w1, out_len); append_0x80_2x4_VV (w0, w1, out_len);
@ -203,7 +203,7 @@ KERNEL_FQ void m00000_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
append_0x80_2x4_VV (w0, w1, out_len); append_0x80_2x4_VV (w0, w1, out_len);

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00000_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -99,7 +99,7 @@ KERNEL_FQ void m00000_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }

View File

@ -84,7 +84,7 @@ KERNEL_FQ void m00010_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
/** /**
* append salt * append salt
@ -305,7 +305,7 @@ KERNEL_FQ void m00010_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
/** /**
* append salt * append salt

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00010_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }
@ -103,7 +103,7 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00010_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }
@ -97,7 +97,7 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00010_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -41,7 +41,7 @@ KERNEL_FQ void m00010_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }
@ -110,7 +110,7 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -119,7 +119,7 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }

View File

@ -84,7 +84,7 @@ KERNEL_FQ void m00020_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
/** /**
* prepend salt * prepend salt
@ -285,7 +285,7 @@ KERNEL_FQ void m00020_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
/** /**
* prepend salt * prepend salt

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00020_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -105,7 +105,7 @@ KERNEL_FQ void m00020_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }

View File

@ -84,7 +84,7 @@ KERNEL_FQ void m00030_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
make_utf16le (w1, w2, w3); make_utf16le (w1, w2, w3);
make_utf16le (w0, w0, w1); make_utf16le (w0, w0, w1);
@ -310,7 +310,7 @@ KERNEL_FQ void m00030_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
make_utf16le (w1, w2, w3); make_utf16le (w1, w2, w3);
make_utf16le (w0, w0, w1); make_utf16le (w0, w0, w1);

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00030_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }
@ -103,7 +103,7 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00030_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }
@ -97,7 +97,7 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00030_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -41,7 +41,7 @@ KERNEL_FQ void m00030_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }
@ -110,7 +110,7 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -119,7 +119,7 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }

View File

@ -84,7 +84,7 @@ KERNEL_FQ void m00040_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
make_utf16le (w1, w2, w3); make_utf16le (w1, w2, w3);
make_utf16le (w0, w0, w1); make_utf16le (w0, w0, w1);
@ -290,7 +290,7 @@ KERNEL_FQ void m00040_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
make_utf16le (w1, w2, w3); make_utf16le (w1, w2, w3);
make_utf16le (w0, w0, w1); make_utf16le (w0, w0, w1);

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00040_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -105,7 +105,7 @@ KERNEL_FQ void m00040_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }

View File

@ -169,7 +169,7 @@ KERNEL_FQ void m00050_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
/** /**
* pads * pads
@ -294,7 +294,7 @@ KERNEL_FQ void m00050_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
/** /**
* pads * pads

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }
@ -101,7 +101,7 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 }; u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -41,7 +41,7 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }
@ -122,7 +122,7 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 }; u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -131,7 +131,7 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -41,7 +41,7 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }
@ -108,7 +108,7 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -117,7 +117,7 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }

View File

@ -156,8 +156,6 @@ KERNEL_FQ void m00060_m04 (KERN_ATTR_RULES ())
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14]; salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15]; salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/** /**
* pads * pads
*/ */
@ -200,7 +198,7 @@ KERNEL_FQ void m00060_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
append_0x80_2x4_VV (w0, w1, out_len); append_0x80_2x4_VV (w0, w1, out_len);
@ -293,8 +291,6 @@ KERNEL_FQ void m00060_s04 (KERN_ATTR_RULES ())
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14]; salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15]; salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/** /**
* pads * pads
*/ */
@ -349,7 +345,7 @@ KERNEL_FQ void m00060_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
append_0x80_2x4_VV (w0, w1, out_len); append_0x80_2x4_VV (w0, w1, out_len);

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }
@ -103,7 +103,7 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }

View File

@ -154,8 +154,6 @@ KERNEL_FQ void m00060_m04 (KERN_ATTR_BASIC ())
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14]; salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15]; salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/** /**
* pads * pads
*/ */
@ -332,8 +330,6 @@ KERNEL_FQ void m00060_s04 (KERN_ATTR_BASIC ())
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14]; salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15]; salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/** /**
* pads * pads
*/ */

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 }; u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -41,7 +41,7 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }
@ -124,7 +124,7 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 }; u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -133,7 +133,7 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }

View File

@ -133,8 +133,6 @@ DECLSPEC void m00060m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14]; salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15]; salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/** /**
* pads * pads
*/ */
@ -238,8 +236,6 @@ DECLSPEC void m00060s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14]; salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15]; salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/** /**
* pads * pads
*/ */

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -41,7 +41,7 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }
@ -110,7 +110,7 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -119,7 +119,7 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = salt_bufs[salt_pos].salt_buf[idx]; s[idx] = salt_bufs[salt_pos].salt_buf[idx];
} }

View File

@ -56,7 +56,7 @@ KERNEL_FQ void m00100_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
append_0x80_2x4_VV (w0, w1, out_len); append_0x80_2x4_VV (w0, w1, out_len);
@ -254,7 +254,7 @@ KERNEL_FQ void m00100_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
append_0x80_2x4_VV (w0, w1, out_len); append_0x80_2x4_VV (w0, w1, out_len);

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00100_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -99,7 +99,7 @@ KERNEL_FQ void m00100_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }

View File

@ -84,7 +84,7 @@ KERNEL_FQ void m00110_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
/** /**
* append salt * append salt
@ -355,7 +355,7 @@ KERNEL_FQ void m00110_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
/** /**
* append salt * append salt

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00110_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }
@ -103,7 +103,7 @@ KERNEL_FQ void m00110_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00110_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }
@ -97,7 +97,7 @@ KERNEL_FQ void m00110_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00110_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -41,7 +41,7 @@ KERNEL_FQ void m00110_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }
@ -110,7 +110,7 @@ KERNEL_FQ void m00110_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -119,7 +119,7 @@ KERNEL_FQ void m00110_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }

View File

@ -96,7 +96,7 @@ KERNEL_FQ void m00120_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
/** /**
* prepend salt * prepend salt
@ -347,7 +347,7 @@ KERNEL_FQ void m00120_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
/** /**
* prepend salt * prepend salt

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00120_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -105,7 +105,7 @@ KERNEL_FQ void m00120_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }

View File

@ -84,7 +84,7 @@ KERNEL_FQ void m00130_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
make_utf16le (w1, w2, w3); make_utf16le (w1, w2, w3);
make_utf16le (w0, w0, w1); make_utf16le (w0, w0, w1);
@ -360,7 +360,7 @@ KERNEL_FQ void m00130_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
make_utf16le (w1, w2, w3); make_utf16le (w1, w2, w3);
make_utf16le (w0, w0, w1); make_utf16le (w0, w0, w1);

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00130_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }
@ -103,7 +103,7 @@ KERNEL_FQ void m00130_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00130_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }
@ -97,7 +97,7 @@ KERNEL_FQ void m00130_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00130_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -41,7 +41,7 @@ KERNEL_FQ void m00130_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }
@ -110,7 +110,7 @@ KERNEL_FQ void m00130_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -119,7 +119,7 @@ KERNEL_FQ void m00130_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }

View File

@ -84,7 +84,7 @@ KERNEL_FQ void m00140_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
make_utf16le (w1, w2, w3); make_utf16le (w1, w2, w3);
make_utf16le (w0, w0, w1); make_utf16le (w0, w0, w1);
@ -340,7 +340,7 @@ KERNEL_FQ void m00140_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
make_utf16le (w1, w2, w3); make_utf16le (w1, w2, w3);
make_utf16le (w0, w0, w1); make_utf16le (w0, w0, w1);

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00140_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -105,7 +105,7 @@ KERNEL_FQ void m00140_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }

View File

@ -173,7 +173,7 @@ KERNEL_FQ void m00150_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
w0[0] = hc_swap32 (w0[0]); w0[0] = hc_swap32 (w0[0]);
w0[1] = hc_swap32 (w0[1]); w0[1] = hc_swap32 (w0[1]);
@ -307,7 +307,7 @@ KERNEL_FQ void m00150_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
w0[0] = hc_swap32 (w0[0]); w0[0] = hc_swap32 (w0[0]);
w0[1] = hc_swap32 (w0[1]); w0[1] = hc_swap32 (w0[1]);

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00150_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }
@ -101,7 +101,7 @@ KERNEL_FQ void m00150_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00150_mxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 }; u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = hc_swap32_S (pws[gid].i[idx]); w[idx] = hc_swap32_S (pws[gid].i[idx]);
} }
@ -41,7 +41,7 @@ KERNEL_FQ void m00150_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }
@ -122,7 +122,7 @@ KERNEL_FQ void m00150_sxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 }; u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = hc_swap32_S (pws[gid].i[idx]); w[idx] = hc_swap32_S (pws[gid].i[idx]);
} }
@ -131,7 +131,7 @@ KERNEL_FQ void m00150_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00150_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -41,7 +41,7 @@ KERNEL_FQ void m00150_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }
@ -108,7 +108,7 @@ KERNEL_FQ void m00150_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 }; u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
@ -117,7 +117,7 @@ KERNEL_FQ void m00150_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 }; u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }

View File

@ -160,8 +160,6 @@ KERNEL_FQ void m00160_m04 (KERN_ATTR_RULES ())
salt_buf3[2] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[14]); salt_buf3[2] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[14]);
salt_buf3[3] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[15]); salt_buf3[3] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[15]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/** /**
* pads * pads
*/ */
@ -204,7 +202,7 @@ KERNEL_FQ void m00160_m04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
append_0x80_2x4_VV (w0, w1, out_len); append_0x80_2x4_VV (w0, w1, out_len);
@ -297,8 +295,6 @@ KERNEL_FQ void m00160_s04 (KERN_ATTR_RULES ())
salt_buf3[2] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[14]); salt_buf3[2] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[14]);
salt_buf3[3] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[15]); salt_buf3[3] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[15]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/** /**
* pads * pads
*/ */
@ -353,7 +349,7 @@ KERNEL_FQ void m00160_s04 (KERN_ATTR_RULES ())
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
append_0x80_2x4_VV (w0, w1, out_len); append_0x80_2x4_VV (w0, w1, out_len);

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00160_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }
@ -103,7 +103,7 @@ KERNEL_FQ void m00160_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }

View File

@ -158,8 +158,6 @@ KERNEL_FQ void m00160_m04 (KERN_ATTR_BASIC ())
salt_buf3[2] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[14]); salt_buf3[2] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[14]);
salt_buf3[3] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[15]); salt_buf3[3] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[15]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/** /**
* pads * pads
*/ */
@ -355,8 +353,6 @@ KERNEL_FQ void m00160_s04 (KERN_ATTR_BASIC ())
salt_buf3[2] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[14]); salt_buf3[2] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[14]);
salt_buf3[3] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[15]); salt_buf3[3] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[15]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/** /**
* pads * pads
*/ */

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00160_mxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 }; u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = hc_swap32_S (pws[gid].i[idx]); w[idx] = hc_swap32_S (pws[gid].i[idx]);
} }
@ -41,7 +41,7 @@ KERNEL_FQ void m00160_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }
@ -124,7 +124,7 @@ KERNEL_FQ void m00160_sxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 }; u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{ {
w[idx] = hc_swap32_S (pws[gid].i[idx]); w[idx] = hc_swap32_S (pws[gid].i[idx]);
} }
@ -133,7 +133,7 @@ KERNEL_FQ void m00160_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 }; u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{ {
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]); s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
} }

Some files were not shown because too many files have changed in this diff Show More