Go to the documentation of this file.
62 #ifdef OPENSSL_SYS_WIN32
68 #define c2l(c,l) (l =((unsigned long)(*((c)++))) , \
69 l|=((unsigned long)(*((c)++)))<< 8L, \
70 l|=((unsigned long)(*((c)++)))<<16L, \
71 l|=((unsigned long)(*((c)++)))<<24L)
75 #define c2ln(c,l1,l2,n) { \
79 case 8: l2 =((unsigned long)(*(--(c))))<<24L; \
80 case 7: l2|=((unsigned long)(*(--(c))))<<16L; \
81 case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \
82 case 5: l2|=((unsigned long)(*(--(c)))); \
83 case 4: l1 =((unsigned long)(*(--(c))))<<24L; \
84 case 3: l1|=((unsigned long)(*(--(c))))<<16L; \
85 case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \
86 case 1: l1|=((unsigned long)(*(--(c)))); \
91 #define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
92 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
93 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
94 *((c)++)=(unsigned char)(((l)>>24L)&0xff))
98 #define l2cn(l1,l2,c,n) { \
101 case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \
102 case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \
103 case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \
104 case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \
105 case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \
106 case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \
107 case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \
108 case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \
113 #define n2ln(c,l1,l2,n) { \
117 case 8: l2 =((unsigned long)(*(--(c)))) ; \
118 case 7: l2|=((unsigned long)(*(--(c))))<< 8; \
119 case 6: l2|=((unsigned long)(*(--(c))))<<16; \
120 case 5: l2|=((unsigned long)(*(--(c))))<<24; \
121 case 4: l1 =((unsigned long)(*(--(c)))) ; \
122 case 3: l1|=((unsigned long)(*(--(c))))<< 8; \
123 case 2: l1|=((unsigned long)(*(--(c))))<<16; \
124 case 1: l1|=((unsigned long)(*(--(c))))<<24; \
129 #define l2nn(l1,l2,c,n) { \
132 case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \
133 case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \
134 case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \
135 case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \
136 case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \
137 case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \
138 case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \
139 case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \
144 #define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \
145 l|=((unsigned long)(*((c)++)))<<16L, \
146 l|=((unsigned long)(*((c)++)))<< 8L, \
147 l|=((unsigned long)(*((c)++))))
150 #define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \
151 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
152 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
153 *((c)++)=(unsigned char)(((l) )&0xff))
155 #if defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER)
156 #define ROTL(a,n) (_lrotl(a,n))
158 #define ROTL(a,n) ((((a)<<(n))&0xffffffffL)|((a)>>(32-(n))))
168 #if defined(CAST_PTR)
169 #define E_CAST(n,key,L,R,OP1,OP2,OP3) \
172 t=(key[n*2] OP1 R)&0xffffffffL; \
175 L^= (((((*(CAST_LONG *)((unsigned char *) \
176 CAST_S_table0+((t>>C_2)&C_M)) OP2 \
177 *(CAST_LONG *)((unsigned char *) \
178 CAST_S_table1+((t<<C_3)&C_M)))&0xffffffffL) OP3 \
179 *(CAST_LONG *)((unsigned char *) \
180 CAST_S_table2+((t>>C_0)&C_M)))&0xffffffffL) OP1 \
181 *(CAST_LONG *)((unsigned char *) \
182 CAST_S_table3+((t>>C_1)&C_M)))&0xffffffffL; \
184 #elif defined(CAST_PTR2)
185 #define E_CAST(n,key,L,R,OP1,OP2,OP3) \
189 w=(key[n*2] OP1 R)&0xffffffffL; \
196 t= *(CAST_LONG *)((unsigned char *)CAST_S_table0+u); \
198 t=(t OP2 *(CAST_LONG *)((unsigned char *)CAST_S_table1+v))&0xffffffffL;\
202 t=(t OP3 *(CAST_LONG *)((unsigned char *)CAST_S_table2+u)&0xffffffffL);\
203 t=(t OP1 *(CAST_LONG *)((unsigned char *)CAST_S_table3+v)&0xffffffffL);\
207 #define E_CAST(n,key,L,R,OP1,OP2,OP3) \
210 t=(key[n*2] OP1 R)&0xffffffff; \
211 t=ROTL(t,(key[n*2+1])); \
212 a=CAST_S_table0[(t>> 8)&0xff]; \
213 b=CAST_S_table1[(t )&0xff]; \
214 c=CAST_S_table2[(t>>24)&0xff]; \
215 d=CAST_S_table3[(t>>16)&0xff]; \
216 L^=(((((a OP2 b)&0xffffffffL) OP3 c)&0xffffffffL) OP1 d)&0xffffffffL; \