xref: /titanic_51/usr/src/common/crypto/skein/skein_impl.h (revision 45818ee124adeaaf947698996b4f4c722afc6d1f)
1*45818ee1SMatthew Ahrens /*
2*45818ee1SMatthew Ahrens  * Internal definitions for Skein hashing.
3*45818ee1SMatthew Ahrens  * Source code author: Doug Whiting, 2008.
4*45818ee1SMatthew Ahrens  * This algorithm and source code is released to the public domain.
5*45818ee1SMatthew Ahrens  *
6*45818ee1SMatthew Ahrens  * The following compile-time switches may be defined to control some
7*45818ee1SMatthew Ahrens  * tradeoffs between speed, code size, error checking, and security.
8*45818ee1SMatthew Ahrens  *
9*45818ee1SMatthew Ahrens  * The "default" note explains what happens when the switch is not defined.
10*45818ee1SMatthew Ahrens  *
11*45818ee1SMatthew Ahrens  *  SKEIN_DEBUG            -- make callouts from inside Skein code
12*45818ee1SMatthew Ahrens  *                            to examine/display intermediate values.
13*45818ee1SMatthew Ahrens  *                            [default: no callouts (no overhead)]
14*45818ee1SMatthew Ahrens  *
15*45818ee1SMatthew Ahrens  *  SKEIN_ERR_CHECK        -- how error checking is handled inside Skein
16*45818ee1SMatthew Ahrens  *                            code. If not defined, most error checking
17*45818ee1SMatthew Ahrens  *                            is disabled (for performance). Otherwise,
18*45818ee1SMatthew Ahrens  *                            the switch value is interpreted as:
19*45818ee1SMatthew Ahrens  *                                0: use assert()      to flag errors
20*45818ee1SMatthew Ahrens  *                                1: return SKEIN_FAIL to flag errors
21*45818ee1SMatthew Ahrens  */
22*45818ee1SMatthew Ahrens /* Copyright 2013 Doug Whiting. This code is released to the public domain. */
23*45818ee1SMatthew Ahrens 
24*45818ee1SMatthew Ahrens #ifndef	_SKEIN_IMPL_H_
25*45818ee1SMatthew Ahrens #define	_SKEIN_IMPL_H_
26*45818ee1SMatthew Ahrens 
27*45818ee1SMatthew Ahrens #include <sys/skein.h>
28*45818ee1SMatthew Ahrens #include "skein_impl.h"
29*45818ee1SMatthew Ahrens #include "skein_port.h"
30*45818ee1SMatthew Ahrens 
31*45818ee1SMatthew Ahrens /* determine where we can get bcopy/bzero declarations */
32*45818ee1SMatthew Ahrens #ifdef	_KERNEL
33*45818ee1SMatthew Ahrens #include <sys/systm.h>
34*45818ee1SMatthew Ahrens #else
35*45818ee1SMatthew Ahrens #include <strings.h>
36*45818ee1SMatthew Ahrens #endif
37*45818ee1SMatthew Ahrens 
38*45818ee1SMatthew Ahrens /*
39*45818ee1SMatthew Ahrens  * "Internal" Skein definitions
40*45818ee1SMatthew Ahrens  *    -- not needed for sequential hashing API, but will be
41*45818ee1SMatthew Ahrens  *           helpful for other uses of Skein (e.g., tree hash mode).
42*45818ee1SMatthew Ahrens  *    -- included here so that they can be shared between
43*45818ee1SMatthew Ahrens  *           reference and optimized code.
44*45818ee1SMatthew Ahrens  */
45*45818ee1SMatthew Ahrens 
46*45818ee1SMatthew Ahrens /* tweak word T[1]: bit field starting positions */
47*45818ee1SMatthew Ahrens /* offset 64 because it's the second word  */
48*45818ee1SMatthew Ahrens #define	SKEIN_T1_BIT(BIT)	((BIT) - 64)
49*45818ee1SMatthew Ahrens 
50*45818ee1SMatthew Ahrens /* bits 112..118: level in hash tree */
51*45818ee1SMatthew Ahrens #define	SKEIN_T1_POS_TREE_LVL	SKEIN_T1_BIT(112)
52*45818ee1SMatthew Ahrens /* bit  119: partial final input byte */
53*45818ee1SMatthew Ahrens #define	SKEIN_T1_POS_BIT_PAD	SKEIN_T1_BIT(119)
54*45818ee1SMatthew Ahrens /* bits 120..125: type field */
55*45818ee1SMatthew Ahrens #define	SKEIN_T1_POS_BLK_TYPE	SKEIN_T1_BIT(120)
56*45818ee1SMatthew Ahrens /* bits 126: first block flag */
57*45818ee1SMatthew Ahrens #define	SKEIN_T1_POS_FIRST	SKEIN_T1_BIT(126)
58*45818ee1SMatthew Ahrens /* bit  127: final block flag */
59*45818ee1SMatthew Ahrens #define	SKEIN_T1_POS_FINAL	SKEIN_T1_BIT(127)
60*45818ee1SMatthew Ahrens 
61*45818ee1SMatthew Ahrens /* tweak word T[1]: flag bit definition(s) */
62*45818ee1SMatthew Ahrens #define	SKEIN_T1_FLAG_FIRST	(((uint64_t)1) << SKEIN_T1_POS_FIRST)
63*45818ee1SMatthew Ahrens #define	SKEIN_T1_FLAG_FINAL	(((uint64_t)1) << SKEIN_T1_POS_FINAL)
64*45818ee1SMatthew Ahrens #define	SKEIN_T1_FLAG_BIT_PAD	(((uint64_t)1) << SKEIN_T1_POS_BIT_PAD)
65*45818ee1SMatthew Ahrens 
66*45818ee1SMatthew Ahrens /* tweak word T[1]: tree level bit field mask */
67*45818ee1SMatthew Ahrens #define	SKEIN_T1_TREE_LVL_MASK	(((uint64_t)0x7F) << SKEIN_T1_POS_TREE_LVL)
68*45818ee1SMatthew Ahrens #define	SKEIN_T1_TREE_LEVEL(n)	(((uint64_t)(n)) << SKEIN_T1_POS_TREE_LVL)
69*45818ee1SMatthew Ahrens 
70*45818ee1SMatthew Ahrens /* tweak word T[1]: block type field */
71*45818ee1SMatthew Ahrens #define	SKEIN_BLK_TYPE_KEY	(0)	/* key, for MAC and KDF */
72*45818ee1SMatthew Ahrens #define	SKEIN_BLK_TYPE_CFG	(4)	/* configuration block */
73*45818ee1SMatthew Ahrens #define	SKEIN_BLK_TYPE_PERS	(8)	/* personalization string */
74*45818ee1SMatthew Ahrens #define	SKEIN_BLK_TYPE_PK	(12)	/* public key (for signature hashing) */
75*45818ee1SMatthew Ahrens #define	SKEIN_BLK_TYPE_KDF	(16)	/* key identifier for KDF */
76*45818ee1SMatthew Ahrens #define	SKEIN_BLK_TYPE_NONCE	(20)	/* nonce for PRNG */
77*45818ee1SMatthew Ahrens #define	SKEIN_BLK_TYPE_MSG	(48)	/* message processing */
78*45818ee1SMatthew Ahrens #define	SKEIN_BLK_TYPE_OUT	(63)	/* output stage */
79*45818ee1SMatthew Ahrens #define	SKEIN_BLK_TYPE_MASK	(63)	/* bit field mask */
80*45818ee1SMatthew Ahrens 
81*45818ee1SMatthew Ahrens #define	SKEIN_T1_BLK_TYPE(T)	\
82*45818ee1SMatthew Ahrens 	(((uint64_t)(SKEIN_BLK_TYPE_##T)) << SKEIN_T1_POS_BLK_TYPE)
83*45818ee1SMatthew Ahrens /* key, for MAC and KDF */
84*45818ee1SMatthew Ahrens #define	SKEIN_T1_BLK_TYPE_KEY	SKEIN_T1_BLK_TYPE(KEY)
85*45818ee1SMatthew Ahrens /* configuration block */
86*45818ee1SMatthew Ahrens #define	SKEIN_T1_BLK_TYPE_CFG	SKEIN_T1_BLK_TYPE(CFG)
87*45818ee1SMatthew Ahrens /* personalization string */
88*45818ee1SMatthew Ahrens #define	SKEIN_T1_BLK_TYPE_PERS	SKEIN_T1_BLK_TYPE(PERS)
89*45818ee1SMatthew Ahrens /* public key (for digital signature hashing) */
90*45818ee1SMatthew Ahrens #define	SKEIN_T1_BLK_TYPE_PK	SKEIN_T1_BLK_TYPE(PK)
91*45818ee1SMatthew Ahrens /* key identifier for KDF */
92*45818ee1SMatthew Ahrens #define	SKEIN_T1_BLK_TYPE_KDF	SKEIN_T1_BLK_TYPE(KDF)
93*45818ee1SMatthew Ahrens /* nonce for PRNG */
94*45818ee1SMatthew Ahrens #define	SKEIN_T1_BLK_TYPE_NONCE	SKEIN_T1_BLK_TYPE(NONCE)
95*45818ee1SMatthew Ahrens /* message processing */
96*45818ee1SMatthew Ahrens #define	SKEIN_T1_BLK_TYPE_MSG	SKEIN_T1_BLK_TYPE(MSG)
97*45818ee1SMatthew Ahrens /* output stage */
98*45818ee1SMatthew Ahrens #define	SKEIN_T1_BLK_TYPE_OUT	SKEIN_T1_BLK_TYPE(OUT)
99*45818ee1SMatthew Ahrens /* field bit mask */
100*45818ee1SMatthew Ahrens #define	SKEIN_T1_BLK_TYPE_MASK	SKEIN_T1_BLK_TYPE(MASK)
101*45818ee1SMatthew Ahrens 
102*45818ee1SMatthew Ahrens #define	SKEIN_T1_BLK_TYPE_CFG_FINAL	\
103*45818ee1SMatthew Ahrens 	(SKEIN_T1_BLK_TYPE_CFG | SKEIN_T1_FLAG_FINAL)
104*45818ee1SMatthew Ahrens #define	SKEIN_T1_BLK_TYPE_OUT_FINAL	\
105*45818ee1SMatthew Ahrens 	(SKEIN_T1_BLK_TYPE_OUT | SKEIN_T1_FLAG_FINAL)
106*45818ee1SMatthew Ahrens 
107*45818ee1SMatthew Ahrens #define	SKEIN_VERSION		(1)
108*45818ee1SMatthew Ahrens 
109*45818ee1SMatthew Ahrens #ifndef	SKEIN_ID_STRING_LE	/* allow compile-time personalization */
110*45818ee1SMatthew Ahrens #define	SKEIN_ID_STRING_LE	(0x33414853)	/* "SHA3" (little-endian) */
111*45818ee1SMatthew Ahrens #endif
112*45818ee1SMatthew Ahrens 
113*45818ee1SMatthew Ahrens #define	SKEIN_MK_64(hi32, lo32)	((lo32) + (((uint64_t)(hi32)) << 32))
114*45818ee1SMatthew Ahrens #define	SKEIN_SCHEMA_VER	SKEIN_MK_64(SKEIN_VERSION, SKEIN_ID_STRING_LE)
115*45818ee1SMatthew Ahrens #define	SKEIN_KS_PARITY		SKEIN_MK_64(0x1BD11BDA, 0xA9FC1A22)
116*45818ee1SMatthew Ahrens 
117*45818ee1SMatthew Ahrens #define	SKEIN_CFG_STR_LEN	(4*8)
118*45818ee1SMatthew Ahrens 
119*45818ee1SMatthew Ahrens /* bit field definitions in config block treeInfo word */
120*45818ee1SMatthew Ahrens #define	SKEIN_CFG_TREE_LEAF_SIZE_POS	(0)
121*45818ee1SMatthew Ahrens #define	SKEIN_CFG_TREE_NODE_SIZE_POS	(8)
122*45818ee1SMatthew Ahrens #define	SKEIN_CFG_TREE_MAX_LEVEL_POS	(16)
123*45818ee1SMatthew Ahrens 
124*45818ee1SMatthew Ahrens #define	SKEIN_CFG_TREE_LEAF_SIZE_MSK	\
125*45818ee1SMatthew Ahrens 	(((uint64_t)0xFF) << SKEIN_CFG_TREE_LEAF_SIZE_POS)
126*45818ee1SMatthew Ahrens #define	SKEIN_CFG_TREE_NODE_SIZE_MSK	\
127*45818ee1SMatthew Ahrens 	(((uint64_t)0xFF) << SKEIN_CFG_TREE_NODE_SIZE_POS)
128*45818ee1SMatthew Ahrens #define	SKEIN_CFG_TREE_MAX_LEVEL_MSK	\
129*45818ee1SMatthew Ahrens 	(((uint64_t)0xFF) << SKEIN_CFG_TREE_MAX_LEVEL_POS)
130*45818ee1SMatthew Ahrens 
131*45818ee1SMatthew Ahrens #define	SKEIN_CFG_TREE_INFO(leaf, node, maxLvl)			\
132*45818ee1SMatthew Ahrens 	((((uint64_t)(leaf)) << SKEIN_CFG_TREE_LEAF_SIZE_POS) |	\
133*45818ee1SMatthew Ahrens 	(((uint64_t)(node)) << SKEIN_CFG_TREE_NODE_SIZE_POS) |	\
134*45818ee1SMatthew Ahrens 	(((uint64_t)(maxLvl)) << SKEIN_CFG_TREE_MAX_LEVEL_POS))
135*45818ee1SMatthew Ahrens 
136*45818ee1SMatthew Ahrens /* use as treeInfo in InitExt() call for sequential processing */
137*45818ee1SMatthew Ahrens #define	SKEIN_CFG_TREE_INFO_SEQUENTIAL	SKEIN_CFG_TREE_INFO(0, 0, 0)
138*45818ee1SMatthew Ahrens 
139*45818ee1SMatthew Ahrens /*
140*45818ee1SMatthew Ahrens  * Skein macros for getting/setting tweak words, etc.
141*45818ee1SMatthew Ahrens  * These are useful for partial input bytes, hash tree init/update, etc.
142*45818ee1SMatthew Ahrens  */
143*45818ee1SMatthew Ahrens #define	Skein_Get_Tweak(ctxPtr, TWK_NUM)	((ctxPtr)->h.T[TWK_NUM])
144*45818ee1SMatthew Ahrens #define	Skein_Set_Tweak(ctxPtr, TWK_NUM, tVal)		\
145*45818ee1SMatthew Ahrens 	do {						\
146*45818ee1SMatthew Ahrens 		(ctxPtr)->h.T[TWK_NUM] = (tVal);	\
147*45818ee1SMatthew Ahrens 		_NOTE(CONSTCOND)			\
148*45818ee1SMatthew Ahrens 	} while (0)
149*45818ee1SMatthew Ahrens 
150*45818ee1SMatthew Ahrens #define	Skein_Get_T0(ctxPtr)		Skein_Get_Tweak(ctxPtr, 0)
151*45818ee1SMatthew Ahrens #define	Skein_Get_T1(ctxPtr)		Skein_Get_Tweak(ctxPtr, 1)
152*45818ee1SMatthew Ahrens #define	Skein_Set_T0(ctxPtr, T0)	Skein_Set_Tweak(ctxPtr, 0, T0)
153*45818ee1SMatthew Ahrens #define	Skein_Set_T1(ctxPtr, T1)	Skein_Set_Tweak(ctxPtr, 1, T1)
154*45818ee1SMatthew Ahrens 
155*45818ee1SMatthew Ahrens /* set both tweak words at once */
156*45818ee1SMatthew Ahrens #define	Skein_Set_T0_T1(ctxPtr, T0, T1)		\
157*45818ee1SMatthew Ahrens 	do {					\
158*45818ee1SMatthew Ahrens 		Skein_Set_T0(ctxPtr, (T0));	\
159*45818ee1SMatthew Ahrens 		Skein_Set_T1(ctxPtr, (T1));	\
160*45818ee1SMatthew Ahrens 		_NOTE(CONSTCOND)		\
161*45818ee1SMatthew Ahrens 	} while (0)
162*45818ee1SMatthew Ahrens 
163*45818ee1SMatthew Ahrens #define	Skein_Set_Type(ctxPtr, BLK_TYPE)	\
164*45818ee1SMatthew Ahrens 	Skein_Set_T1(ctxPtr, SKEIN_T1_BLK_TYPE_##BLK_TYPE)
165*45818ee1SMatthew Ahrens 
166*45818ee1SMatthew Ahrens /*
167*45818ee1SMatthew Ahrens  * set up for starting with a new type: h.T[0]=0; h.T[1] = NEW_TYPE; h.bCnt=0;
168*45818ee1SMatthew Ahrens  */
169*45818ee1SMatthew Ahrens #define	Skein_Start_New_Type(ctxPtr, BLK_TYPE)				\
170*45818ee1SMatthew Ahrens 	do {								\
171*45818ee1SMatthew Ahrens 		Skein_Set_T0_T1(ctxPtr, 0, SKEIN_T1_FLAG_FIRST |	\
172*45818ee1SMatthew Ahrens 		    SKEIN_T1_BLK_TYPE_ ## BLK_TYPE);			\
173*45818ee1SMatthew Ahrens 		(ctxPtr)->h.bCnt = 0;	\
174*45818ee1SMatthew Ahrens 		_NOTE(CONSTCOND)					\
175*45818ee1SMatthew Ahrens 	} while (0)
176*45818ee1SMatthew Ahrens 
177*45818ee1SMatthew Ahrens #define	Skein_Clear_First_Flag(hdr)					\
178*45818ee1SMatthew Ahrens 	do {								\
179*45818ee1SMatthew Ahrens 		(hdr).T[1] &= ~SKEIN_T1_FLAG_FIRST;			\
180*45818ee1SMatthew Ahrens 		_NOTE(CONSTCOND)					\
181*45818ee1SMatthew Ahrens 	} while (0)
182*45818ee1SMatthew Ahrens #define	Skein_Set_Bit_Pad_Flag(hdr)					\
183*45818ee1SMatthew Ahrens 	do {								\
184*45818ee1SMatthew Ahrens 		(hdr).T[1] |=  SKEIN_T1_FLAG_BIT_PAD;			\
185*45818ee1SMatthew Ahrens 		_NOTE(CONSTCOND)					\
186*45818ee1SMatthew Ahrens 	} while (0)
187*45818ee1SMatthew Ahrens 
188*45818ee1SMatthew Ahrens #define	Skein_Set_Tree_Level(hdr, height)				\
189*45818ee1SMatthew Ahrens 	do {								\
190*45818ee1SMatthew Ahrens 		(hdr).T[1] |= SKEIN_T1_TREE_LEVEL(height);		\
191*45818ee1SMatthew Ahrens 		_NOTE(CONSTCOND)					\
192*45818ee1SMatthew Ahrens 	} while (0)
193*45818ee1SMatthew Ahrens 
194*45818ee1SMatthew Ahrens /*
195*45818ee1SMatthew Ahrens  * "Internal" Skein definitions for debugging and error checking
196*45818ee1SMatthew Ahrens  * Note: in Illumos we always disable debugging features.
197*45818ee1SMatthew Ahrens  */
198*45818ee1SMatthew Ahrens #define	Skein_Show_Block(bits, ctx, X, blkPtr, wPtr, ksEvenPtr, ksOddPtr)
199*45818ee1SMatthew Ahrens #define	Skein_Show_Round(bits, ctx, r, X)
200*45818ee1SMatthew Ahrens #define	Skein_Show_R_Ptr(bits, ctx, r, X_ptr)
201*45818ee1SMatthew Ahrens #define	Skein_Show_Final(bits, ctx, cnt, outPtr)
202*45818ee1SMatthew Ahrens #define	Skein_Show_Key(bits, ctx, key, keyBytes)
203*45818ee1SMatthew Ahrens 
204*45818ee1SMatthew Ahrens /* run-time checks (e.g., bad params, uninitialized context)? */
205*45818ee1SMatthew Ahrens #ifndef	SKEIN_ERR_CHECK
206*45818ee1SMatthew Ahrens /* default: ignore all Asserts, for performance */
207*45818ee1SMatthew Ahrens #define	Skein_Assert(x, retCode)
208*45818ee1SMatthew Ahrens #define	Skein_assert(x)
209*45818ee1SMatthew Ahrens #elif	defined(SKEIN_ASSERT)
210*45818ee1SMatthew Ahrens #include <sys/debug.h>
211*45818ee1SMatthew Ahrens #define	Skein_Assert(x, retCode)	ASSERT(x)
212*45818ee1SMatthew Ahrens #define	Skein_assert(x)			ASSERT(x)
213*45818ee1SMatthew Ahrens #else
214*45818ee1SMatthew Ahrens #include <sys/debug.h>
215*45818ee1SMatthew Ahrens /*  caller error */
216*45818ee1SMatthew Ahrens #define	Skein_Assert(x, retCode)		\
217*45818ee1SMatthew Ahrens 	do {					\
218*45818ee1SMatthew Ahrens 		if (!(x))			\
219*45818ee1SMatthew Ahrens 			return (retCode);	\
220*45818ee1SMatthew Ahrens 		_NOTE(CONSTCOND)		\
221*45818ee1SMatthew Ahrens 	} while (0)
222*45818ee1SMatthew Ahrens /* internal error */
223*45818ee1SMatthew Ahrens #define	Skein_assert(x)	ASSERT(x)
224*45818ee1SMatthew Ahrens #endif
225*45818ee1SMatthew Ahrens 
226*45818ee1SMatthew Ahrens /*
227*45818ee1SMatthew Ahrens  * Skein block function constants (shared across Ref and Opt code)
228*45818ee1SMatthew Ahrens  */
229*45818ee1SMatthew Ahrens enum {
230*45818ee1SMatthew Ahrens 	/* Skein_256 round rotation constants */
231*45818ee1SMatthew Ahrens 	R_256_0_0 = 14, R_256_0_1 = 16,
232*45818ee1SMatthew Ahrens 	R_256_1_0 = 52, R_256_1_1 = 57,
233*45818ee1SMatthew Ahrens 	R_256_2_0 = 23, R_256_2_1 = 40,
234*45818ee1SMatthew Ahrens 	R_256_3_0 = 5, R_256_3_1 = 37,
235*45818ee1SMatthew Ahrens 	R_256_4_0 = 25, R_256_4_1 = 33,
236*45818ee1SMatthew Ahrens 	R_256_5_0 = 46, R_256_5_1 = 12,
237*45818ee1SMatthew Ahrens 	R_256_6_0 = 58, R_256_6_1 = 22,
238*45818ee1SMatthew Ahrens 	R_256_7_0 = 32, R_256_7_1 = 32,
239*45818ee1SMatthew Ahrens 
240*45818ee1SMatthew Ahrens 	/* Skein_512 round rotation constants */
241*45818ee1SMatthew Ahrens 	R_512_0_0 = 46, R_512_0_1 = 36, R_512_0_2 = 19, R_512_0_3 = 37,
242*45818ee1SMatthew Ahrens 	R_512_1_0 = 33, R_512_1_1 = 27, R_512_1_2 = 14, R_512_1_3 = 42,
243*45818ee1SMatthew Ahrens 	R_512_2_0 = 17, R_512_2_1 = 49, R_512_2_2 = 36, R_512_2_3 = 39,
244*45818ee1SMatthew Ahrens 	R_512_3_0 = 44, R_512_3_1 = 9, R_512_3_2 = 54, R_512_3_3 = 56,
245*45818ee1SMatthew Ahrens 	R_512_4_0 = 39, R_512_4_1 = 30, R_512_4_2 = 34, R_512_4_3 = 24,
246*45818ee1SMatthew Ahrens 	R_512_5_0 = 13, R_512_5_1 = 50, R_512_5_2 = 10, R_512_5_3 = 17,
247*45818ee1SMatthew Ahrens 	R_512_6_0 = 25, R_512_6_1 = 29, R_512_6_2 = 39, R_512_6_3 = 43,
248*45818ee1SMatthew Ahrens 	R_512_7_0 = 8, R_512_7_1 = 35, R_512_7_2 = 56, R_512_7_3 = 22,
249*45818ee1SMatthew Ahrens 
250*45818ee1SMatthew Ahrens 	/* Skein1024 round rotation constants */
251*45818ee1SMatthew Ahrens 	R1024_0_0 = 24, R1024_0_1 = 13, R1024_0_2 = 8, R1024_0_3 =
252*45818ee1SMatthew Ahrens 	    47, R1024_0_4 = 8, R1024_0_5 = 17, R1024_0_6 = 22, R1024_0_7 = 37,
253*45818ee1SMatthew Ahrens 	R1024_1_0 = 38, R1024_1_1 = 19, R1024_1_2 = 10, R1024_1_3 =
254*45818ee1SMatthew Ahrens 	    55, R1024_1_4 = 49, R1024_1_5 = 18, R1024_1_6 = 23, R1024_1_7 = 52,
255*45818ee1SMatthew Ahrens 	R1024_2_0 = 33, R1024_2_1 = 4, R1024_2_2 = 51, R1024_2_3 =
256*45818ee1SMatthew Ahrens 	    13, R1024_2_4 = 34, R1024_2_5 = 41, R1024_2_6 = 59, R1024_2_7 = 17,
257*45818ee1SMatthew Ahrens 	R1024_3_0 = 5, R1024_3_1 = 20, R1024_3_2 = 48, R1024_3_3 =
258*45818ee1SMatthew Ahrens 	    41, R1024_3_4 = 47, R1024_3_5 = 28, R1024_3_6 = 16, R1024_3_7 = 25,
259*45818ee1SMatthew Ahrens 	R1024_4_0 = 41, R1024_4_1 = 9, R1024_4_2 = 37, R1024_4_3 =
260*45818ee1SMatthew Ahrens 	    31, R1024_4_4 = 12, R1024_4_5 = 47, R1024_4_6 = 44, R1024_4_7 = 30,
261*45818ee1SMatthew Ahrens 	R1024_5_0 = 16, R1024_5_1 = 34, R1024_5_2 = 56, R1024_5_3 =
262*45818ee1SMatthew Ahrens 	    51, R1024_5_4 = 4, R1024_5_5 = 53, R1024_5_6 = 42, R1024_5_7 = 41,
263*45818ee1SMatthew Ahrens 	R1024_6_0 = 31, R1024_6_1 = 44, R1024_6_2 = 47, R1024_6_3 =
264*45818ee1SMatthew Ahrens 	    46, R1024_6_4 = 19, R1024_6_5 = 42, R1024_6_6 = 44, R1024_6_7 = 25,
265*45818ee1SMatthew Ahrens 	R1024_7_0 = 9, R1024_7_1 = 48, R1024_7_2 = 35, R1024_7_3 =
266*45818ee1SMatthew Ahrens 	    52, R1024_7_4 = 23, R1024_7_5 = 31, R1024_7_6 = 37, R1024_7_7 = 20
267*45818ee1SMatthew Ahrens };
268*45818ee1SMatthew Ahrens 
269*45818ee1SMatthew Ahrens /* number of rounds for the different block sizes */
270*45818ee1SMatthew Ahrens #define	SKEIN_256_ROUNDS_TOTAL	(72)
271*45818ee1SMatthew Ahrens #define	SKEIN_512_ROUNDS_TOTAL	(72)
272*45818ee1SMatthew Ahrens #define	SKEIN1024_ROUNDS_TOTAL	(80)
273*45818ee1SMatthew Ahrens 
274*45818ee1SMatthew Ahrens 
275*45818ee1SMatthew Ahrens extern const uint64_t SKEIN_256_IV_128[];
276*45818ee1SMatthew Ahrens extern const uint64_t SKEIN_256_IV_160[];
277*45818ee1SMatthew Ahrens extern const uint64_t SKEIN_256_IV_224[];
278*45818ee1SMatthew Ahrens extern const uint64_t SKEIN_256_IV_256[];
279*45818ee1SMatthew Ahrens extern const uint64_t SKEIN_512_IV_128[];
280*45818ee1SMatthew Ahrens extern const uint64_t SKEIN_512_IV_160[];
281*45818ee1SMatthew Ahrens extern const uint64_t SKEIN_512_IV_224[];
282*45818ee1SMatthew Ahrens extern const uint64_t SKEIN_512_IV_256[];
283*45818ee1SMatthew Ahrens extern const uint64_t SKEIN_512_IV_384[];
284*45818ee1SMatthew Ahrens extern const uint64_t SKEIN_512_IV_512[];
285*45818ee1SMatthew Ahrens extern const uint64_t SKEIN1024_IV_384[];
286*45818ee1SMatthew Ahrens extern const uint64_t SKEIN1024_IV_512[];
287*45818ee1SMatthew Ahrens extern const uint64_t SKEIN1024_IV_1024[];
288*45818ee1SMatthew Ahrens 
289*45818ee1SMatthew Ahrens #endif	/* _SKEIN_IMPL_H_ */
290