aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/lib/Makefile
Commit message (Expand)AuthorAge
* net, lib: kill arch_fast_hash library bitsDaniel Borkmann2014-12-10
* Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...Linus Torvalds2014-10-13
|\
| * x86/lib/Makefile: Remove the unnecessary "+= thunk_64.o"Oleg Nesterov2014-09-24
* | locking/rwlock, x86: Delete unused asm/rwlock.h and rwlock.SWaiman Long2014-09-10
|/
* x86, boot: Carve out early cmdline parsing functionBorislav Petkov2014-05-20
* lib: introduce arch optimized hash libraryFrancesco Fusco2013-12-17
* x86: Improve the printout of the SMP bootup CPU tableBorislav Petkov2013-09-28
* x86, 386 removal: Remove CONFIG_CMPXCHGH. Peter Anvin2012-11-29
* Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...Linus Torvalds2011-07-22
|\
| * x86: Unify rwsem assembly implementationJan Beulich2011-07-21
| * x86: Unify rwlock assembly implementationJan Beulich2011-07-21
* | x86, perf: Make copy_from_user_nmi() a library functionRobert Richter2011-07-21
|/
* percpu, x86: Add arch-specific this_cpu_cmpxchg_double() supportChristoph Lameter2011-02-28
* x86, asm: Move cmpxchg emulation code to arch/x86/libH. Peter Anvin2010-07-28
* Merge branch 'x86-atomic-for-linus' of git://git.kernel.org/pub/scm/linux/ker...Linus Torvalds2010-05-18
|\
| * Merge branch 'x86/asm' into x86/atomicH. Peter Anvin2010-04-29
| |\
| * | x86-32: Rewrite 32-bit atomic64 functions in assemblyLuca Barbieri2010-02-25
* | | perf, x86: Add INSTRUCTION_DECODER config flagIngo Molnar2010-03-10
| |/ |/|
* | Merge branch 'x86-rwsem-for-linus' of git://git.kernel.org/pub/scm/linux/kern...Linus Torvalds2010-02-28
|\ \
| * | x86-64: support native xadd rwsem implementationLinus Torvalds2010-01-14
| |/
* | Merge branch 'x86-io-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/...Linus Torvalds2010-02-28
|\ \
| * | x86: Clean up mem*io functions.Brian Gerst2010-02-05
| |/
* / x86, lib: Add wbinvd smp helpersBorislav Petkov2010-01-22
|/
* Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kern...Linus Torvalds2009-12-19
|\
| * x86, msr: msrs_alloc/free for CONFIG_SMP=nBorislav Petkov2009-12-16
* | x86 insn: Delete empty or incomplete inat-tables.cMasami Hiramatsu2009-12-07
* | x86: Compile insn.c and inat.c only for KPROBESOGAWA Hirofumi2009-12-07
|/
* Merge commit 'v2.6.32-rc5' into perf/probesIngo Molnar2009-10-17
|\
| * x86: Don't generate cmpxchg8b_emu if CONFIG_X86_CMPXCHG64=yEric Dumazet2009-10-01
| * x86: Provide an alternative() based cmpxchg64()Arjan van de Ven2009-09-30
* | Merge commit 'linus/master' into tracing/kprobesFrederic Weisbecker2009-09-23
|\|
| * x86, msr: change msr-reg.o to obj-y, and export its symbolsH. Peter Anvin2009-09-04
| * x86, msr: Add rd/wrmsr interfaces with preset registersBorislav Petkov2009-08-31
* | x86: Instruction decoder APIMasami Hiramatsu2009-08-26
|/
* x86: atomic64: Export APIs to modulesIngo Molnar2009-07-03
* x86: atomic64: Move the 32-bit atomic64_t implementation to a .c fileIngo Molnar2009-07-03
* x86: MSR: add a struct representation of an MSRBorislav Petkov2009-06-10
* x86: drop -funroll-loops for csum_partial_64.cAndi Kleen2008-09-04
* Merge branch 'auto-ftrace-next' into tracing/for-linusIngo Molnar2008-07-14
|\
| * ftrace: trace irq disabled critical timingsSteven Rostedt2008-05-23
* | x86: merge putuser asm functions.Glauber Costa2008-07-09
* | x86: merge getuser asm functions.Glauber Costa2008-07-09
* | x86: integrate delay functions.Glauber Costa2008-07-09
|/
* x86, UML: remove x86-specific implementations of find_first_bitAlexander van Heukelum2008-04-26
* x86: change x86 to use generic find_next_bitAlexander van Heukelum2008-04-26
* iommu sg: kill __clear_bit_string and find_next_zero_stringFUJITA Tomonori2008-02-05
* x86: unify arch/x86/lib/Makefile(s)Sam Ravnborg2008-01-30
* x86_64: move libThomas Gleixner2007-10-11
* i386: move libThomas Gleixner2007-10-11
n714'>714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198
/*
 * Cryptographic API.
 *
 * Whirlpool hashing Algorithm
 *
 * The Whirlpool algorithm was developed by Paulo S. L. M. Barreto and
 * Vincent Rijmen.  It has been selected as one of cryptographic
 * primitives by the NESSIE project http://www.cryptonessie.org/
 *
 * The original authors have disclaimed all copyright interest in this
 * code and thus put it in the public domain. The subsequent authors
 * have put this under the GNU General Public License.
 *
 * By Aaron Grothe ajgrothe@yahoo.com, August 23, 2004
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 */
#include <crypto/internal/hash.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <asm/byteorder.h>
#include <linux/types.h>

#define WP512_DIGEST_SIZE 64
#define WP384_DIGEST_SIZE 48
#define WP256_DIGEST_SIZE 32

#define WP512_BLOCK_SIZE  64
#define WP512_LENGTHBYTES 32

#define WHIRLPOOL_ROUNDS 10

struct wp512_ctx {
	u8  bitLength[WP512_LENGTHBYTES];
	u8  buffer[WP512_BLOCK_SIZE];
	int bufferBits;
	int bufferPos;
	u64 hash[WP512_DIGEST_SIZE/8];
};

/*
 * Though Whirlpool is endianness-neutral, the encryption tables are listed
 * in BIG-ENDIAN format, which is adopted throughout this implementation
 * (but little-endian notation would be equally suitable if consistently
 * employed).
 */

static const u64 C0[256] = {
	0x18186018c07830d8ULL, 0x23238c2305af4626ULL, 0xc6c63fc67ef991b8ULL,
	0xe8e887e8136fcdfbULL, 0x878726874ca113cbULL, 0xb8b8dab8a9626d11ULL,
	0x0101040108050209ULL, 0x4f4f214f426e9e0dULL, 0x3636d836adee6c9bULL,
	0xa6a6a2a6590451ffULL, 0xd2d26fd2debdb90cULL, 0xf5f5f3f5fb06f70eULL,
	0x7979f979ef80f296ULL, 0x6f6fa16f5fcede30ULL, 0x91917e91fcef3f6dULL,
	0x52525552aa07a4f8ULL, 0x60609d6027fdc047ULL, 0xbcbccabc89766535ULL,
	0x9b9b569baccd2b37ULL, 0x8e8e028e048c018aULL, 0xa3a3b6a371155bd2ULL,
	0x0c0c300c603c186cULL, 0x7b7bf17bff8af684ULL, 0x3535d435b5e16a80ULL,
	0x1d1d741de8693af5ULL, 0xe0e0a7e05347ddb3ULL, 0xd7d77bd7f6acb321ULL,
	0xc2c22fc25eed999cULL, 0x2e2eb82e6d965c43ULL, 0x4b4b314b627a9629ULL,
	0xfefedffea321e15dULL, 0x575741578216aed5ULL, 0x15155415a8412abdULL,
	0x7777c1779fb6eee8ULL, 0x3737dc37a5eb6e92ULL, 0xe5e5b3e57b56d79eULL,
	0x9f9f469f8cd92313ULL, 0xf0f0e7f0d317fd23ULL, 0x4a4a354a6a7f9420ULL,
	0xdada4fda9e95a944ULL, 0x58587d58fa25b0a2ULL, 0xc9c903c906ca8fcfULL,
	0x2929a429558d527cULL, 0x0a0a280a5022145aULL, 0xb1b1feb1e14f7f50ULL,
	0xa0a0baa0691a5dc9ULL, 0x6b6bb16b7fdad614ULL, 0x85852e855cab17d9ULL,
	0xbdbdcebd8173673cULL, 0x5d5d695dd234ba8fULL, 0x1010401080502090ULL,
	0xf4f4f7f4f303f507ULL, 0xcbcb0bcb16c08bddULL, 0x3e3ef83eedc67cd3ULL,
	0x0505140528110a2dULL, 0x676781671fe6ce78ULL, 0xe4e4b7e47353d597ULL,
	0x27279c2725bb4e02ULL, 0x4141194132588273ULL, 0x8b8b168b2c9d0ba7ULL,
	0xa7a7a6a7510153f6ULL, 0x7d7de97dcf94fab2ULL, 0x95956e95dcfb3749ULL,
	0xd8d847d88e9fad56ULL, 0xfbfbcbfb8b30eb70ULL, 0xeeee9fee2371c1cdULL,
	0x7c7ced7cc791f8bbULL, 0x6666856617e3cc71ULL, 0xdddd53dda68ea77bULL,
	0x17175c17b84b2eafULL, 0x4747014702468e45ULL, 0x9e9e429e84dc211aULL,
	0xcaca0fca1ec589d4ULL, 0x2d2db42d75995a58ULL, 0xbfbfc6bf9179632eULL,
	0x07071c07381b0e3fULL, 0xadad8ead012347acULL, 0x5a5a755aea2fb4b0ULL,
	0x838336836cb51befULL, 0x3333cc3385ff66b6ULL, 0x636391633ff2c65cULL,
	0x02020802100a0412ULL, 0xaaaa92aa39384993ULL, 0x7171d971afa8e2deULL,
	0xc8c807c80ecf8dc6ULL, 0x19196419c87d32d1ULL, 0x494939497270923bULL,
	0xd9d943d9869aaf5fULL, 0xf2f2eff2c31df931ULL, 0xe3e3abe34b48dba8ULL,
	0x5b5b715be22ab6b9ULL, 0x88881a8834920dbcULL, 0x9a9a529aa4c8293eULL,
	0x262698262dbe4c0bULL, 0x3232c8328dfa64bfULL, 0xb0b0fab0e94a7d59ULL,
	0xe9e983e91b6acff2ULL, 0x0f0f3c0f78331e77ULL, 0xd5d573d5e6a6b733ULL,
	0x80803a8074ba1df4ULL, 0xbebec2be997c6127ULL, 0xcdcd13cd26de87ebULL,
	0x3434d034bde46889ULL, 0x48483d487a759032ULL, 0xffffdbffab24e354ULL,
	0x7a7af57af78ff48dULL, 0x90907a90f4ea3d64ULL, 0x5f5f615fc23ebe9dULL,
	0x202080201da0403dULL, 0x6868bd6867d5d00fULL, 0x1a1a681ad07234caULL,
	0xaeae82ae192c41b7ULL, 0xb4b4eab4c95e757dULL, 0x54544d549a19a8ceULL,
	0x93937693ece53b7fULL, 0x222288220daa442fULL, 0x64648d6407e9c863ULL,
	0xf1f1e3f1db12ff2aULL, 0x7373d173bfa2e6ccULL, 0x12124812905a2482ULL,
	0x40401d403a5d807aULL, 0x0808200840281048ULL, 0xc3c32bc356e89b95ULL,
	0xecec97ec337bc5dfULL, 0xdbdb4bdb9690ab4dULL, 0xa1a1bea1611f5fc0ULL,
	0x8d8d0e8d1c830791ULL, 0x3d3df43df5c97ac8ULL, 0x97976697ccf1335bULL,
	0x0000000000000000ULL, 0xcfcf1bcf36d483f9ULL, 0x2b2bac2b4587566eULL,
	0x7676c57697b3ece1ULL, 0x8282328264b019e6ULL, 0xd6d67fd6fea9b128ULL,
	0x1b1b6c1bd87736c3ULL, 0xb5b5eeb5c15b7774ULL, 0xafaf86af112943beULL,
	0x6a6ab56a77dfd41dULL, 0x50505d50ba0da0eaULL, 0x45450945124c8a57ULL,
	0xf3f3ebf3cb18fb38ULL, 0x3030c0309df060adULL, 0xefef9bef2b74c3c4ULL,
	0x3f3ffc3fe5c37edaULL, 0x55554955921caac7ULL, 0xa2a2b2a2791059dbULL,
	0xeaea8fea0365c9e9ULL, 0x656589650fecca6aULL, 0xbabad2bab9686903ULL,
	0x2f2fbc2f65935e4aULL, 0xc0c027c04ee79d8eULL, 0xdede5fdebe81a160ULL,
	0x1c1c701ce06c38fcULL, 0xfdfdd3fdbb2ee746ULL, 0x4d4d294d52649a1fULL,
	0x92927292e4e03976ULL, 0x7575c9758fbceafaULL, 0x06061806301e0c36ULL,
	0x8a8a128a249809aeULL, 0xb2b2f2b2f940794bULL, 0xe6e6bfe66359d185ULL,
	0x0e0e380e70361c7eULL, 0x1f1f7c1ff8633ee7ULL, 0x6262956237f7c455ULL,
	0xd4d477d4eea3b53aULL, 0xa8a89aa829324d81ULL, 0x96966296c4f43152ULL,
	0xf9f9c3f99b3aef62ULL, 0xc5c533c566f697a3ULL, 0x2525942535b14a10ULL,
	0x59597959f220b2abULL, 0x84842a8454ae15d0ULL, 0x7272d572b7a7e4c5ULL,
	0x3939e439d5dd72ecULL, 0x4c4c2d4c5a619816ULL, 0x5e5e655eca3bbc94ULL,
	0x7878fd78e785f09fULL, 0x3838e038ddd870e5ULL, 0x8c8c0a8c14860598ULL,
	0xd1d163d1c6b2bf17ULL, 0xa5a5aea5410b57e4ULL, 0xe2e2afe2434dd9a1ULL,
	0x616199612ff8c24eULL, 0xb3b3f6b3f1457b42ULL, 0x2121842115a54234ULL,
	0x9c9c4a9c94d62508ULL, 0x1e1e781ef0663ceeULL, 0x4343114322528661ULL,
	0xc7c73bc776fc93b1ULL, 0xfcfcd7fcb32be54fULL, 0x0404100420140824ULL,
	0x51515951b208a2e3ULL, 0x99995e99bcc72f25ULL, 0x6d6da96d4fc4da22ULL,
	0x0d0d340d68391a65ULL, 0xfafacffa8335e979ULL, 0xdfdf5bdfb684a369ULL,
	0x7e7ee57ed79bfca9ULL, 0x242490243db44819ULL, 0x3b3bec3bc5d776feULL,
	0xabab96ab313d4b9aULL, 0xcece1fce3ed181f0ULL, 0x1111441188552299ULL,
	0x8f8f068f0c890383ULL, 0x4e4e254e4a6b9c04ULL, 0xb7b7e6b7d1517366ULL,
	0xebeb8beb0b60cbe0ULL, 0x3c3cf03cfdcc78c1ULL, 0x81813e817cbf1ffdULL,
	0x94946a94d4fe3540