1 /* SCTP reference Implementation
2  * Copyright (C) 1999 Cisco, Inc.
3  * Copyright (C) 1999 Motorola, Inc.
4  *
5  * This file originates from Randy Stewart's SCTP reference Implementation.
6  *
7  * The SCTP reference implementation is distributed in the hope that it
8  * will be useful, but WITHOUT ANY WARRANTY; without even the implied
9  *                 ************************
10  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with GNU CC; see the file COPYING.  If not, write to
15  * the Free Software Foundation, 59 Temple Place - Suite 330,
16  * Boston, MA 02111-1307, USA.
17  *
18  * Please send any bug reports or fixes you make to the
19  * email address(es):
20  *    lksctp developers <lksctp-developers@lists.sourceforge.net>
21  *
22  * Or submit a bug report through the following website:
23  *    http://www.sf.net/projects/lksctp
24  *
25  * Written or modified by:
26  *    Randy Stewart <rstewar1@email.mot.com>
27  *    Ken Morneau   <kmorneau@cisco.com>
28  *    Qiaobing Xie  <qxie1@email.mot.com>
29  */
30 
31 #ifndef __SLA1_h__
32 #define __SLA1_h__
33 
34 struct SLA_1_Context {
35 	unsigned int A;
36 	unsigned int B;
37 	unsigned int C;
38 	unsigned int D;
39 	unsigned int E;
40 	unsigned int H0;
41 	unsigned int H1;
42 	unsigned int H2;
43 	unsigned int H3;
44 	unsigned int H4;
45 	unsigned int words[80];
46 	unsigned int TEMP;
47 
48 	/* block I am collecting to process */
49 	char SLAblock[64];
50 
51 	/* collected so far */
52 	int howManyInBlock;
53 	unsigned int runningTotal;
54 };
55 
56 
57 #define F1(B,C,D) (((B & C) | ((~B) & D)))       /* 0  <= t <= 19 */
58 #define F2(B,C,D) (B ^ C ^ D)                   /* 20 <= t <= 39 */
59 #define F3(B,C,D) ((B & C) | (B & D) | (C & D)) /* 40 <= t <= 59 */
60 #define F4(B,C,D) (B ^ C ^ D)                   /*600 <= t <= 79 */
61 /* circular shift */
62 
63 #define CSHIFT(A,B) ((B << A) | (B >> (32-A)))
64 
65 #define K1 0x5a827999       /* 0  <= t <= 19 */
66 #define K2 0x6ed9eba1       /* 20 <= t <= 39 */
67 #define K3 0x8f1bbcdc       /* 40 <= t <= 59 */
68 #define K4 0xca62c1d6       /* 60 <= t <= 79 */
69 
70 #define H0INIT 0x67452301
71 #define H1INIT 0xefcdab89
72 #define H2INIT 0x98badcfe
73 #define H3INIT 0x10325476
74 #define H4INIT 0xc3d2e1f0
75 
76 extern void SLA1_Init(struct SLA_1_Context *);
77 extern void SLA1_Process(struct SLA_1_Context *, const unsigned char *, int);
78 extern void SLA1_Final(struct SLA_1_Context *, unsigned char *);
79 
80 #endif
81