Go to the documentation of this file.
59 #ifndef HEADER_BF_LOCL_H
60 #define HEADER_BF_LOCL_H
64 #define c2l(c,l) (l =((unsigned long)(*((c)++))) , \
65 l|=((unsigned long)(*((c)++)))<< 8L, \
66 l|=((unsigned long)(*((c)++)))<<16L, \
67 l|=((unsigned long)(*((c)++)))<<24L)
71 #define c2ln(c,l1,l2,n) { \
75 case 8: l2 =((unsigned long)(*(--(c))))<<24L; \
76 case 7: l2|=((unsigned long)(*(--(c))))<<16L; \
77 case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \
78 case 5: l2|=((unsigned long)(*(--(c)))); \
79 case 4: l1 =((unsigned long)(*(--(c))))<<24L; \
80 case 3: l1|=((unsigned long)(*(--(c))))<<16L; \
81 case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \
82 case 1: l1|=((unsigned long)(*(--(c)))); \
87 #define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
88 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
89 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
90 *((c)++)=(unsigned char)(((l)>>24L)&0xff))
94 #define l2cn(l1,l2,c,n) { \
97 case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \
98 case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \
99 case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \
100 case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \
101 case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \
102 case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \
103 case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \
104 case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \
109 #define n2ln(c,l1,l2,n) { \
113 case 8: l2 =((unsigned long)(*(--(c)))) ; \
114 case 7: l2|=((unsigned long)(*(--(c))))<< 8; \
115 case 6: l2|=((unsigned long)(*(--(c))))<<16; \
116 case 5: l2|=((unsigned long)(*(--(c))))<<24; \
117 case 4: l1 =((unsigned long)(*(--(c)))) ; \
118 case 3: l1|=((unsigned long)(*(--(c))))<< 8; \
119 case 2: l1|=((unsigned long)(*(--(c))))<<16; \
120 case 1: l1|=((unsigned long)(*(--(c))))<<24; \
125 #define l2nn(l1,l2,c,n) { \
128 case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \
129 case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \
130 case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \
131 case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \
132 case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \
133 case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \
134 case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \
135 case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \
140 #define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \
141 l|=((unsigned long)(*((c)++)))<<16L, \
142 l|=((unsigned long)(*((c)++)))<< 8L, \
143 l|=((unsigned long)(*((c)++))))
146 #define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \
147 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
148 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
149 *((c)++)=(unsigned char)(((l) )&0xff))
164 #define BF_ENC(LL,R,KEY,Pi) (\
166 t= KEY[BF_ROUNDS+2 + 0 + ((R>>24)&0xFF)], \
167 t+= KEY[BF_ROUNDS+2 + 256 + ((R>>16)&0xFF)], \
168 t^= KEY[BF_ROUNDS+2 + 512 + ((R>>8 )&0xFF)], \
169 t+= KEY[BF_ROUNDS+2 + 768 + ((R )&0xFF)], \
173 #elif defined(BF_PTR)
176 #define BF_LONG_LOG2 2
178 #define BF_M (0xFF<<BF_LONG_LOG2)
179 #define BF_0 (24-BF_LONG_LOG2)
180 #define BF_1 (16-BF_LONG_LOG2)
181 #define BF_2 ( 8-BF_LONG_LOG2)
182 #define BF_3 BF_LONG_LOG2
193 #define BF_ENC(LL,R,S,P) ( \
195 LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \
196 *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \
197 *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \
198 *(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M))) \
210 #define BF_ENC(LL,R,S,P) ( \
212 LL^=((( S[ ((int)(R>>24)&0xff)] + \
213 S[0x0100+((int)(R>>16)&0xff)])^ \
214 S[0x0200+((int)(R>> 8)&0xff)])+ \
215 S[0x0300+((int)(R )&0xff)])&0xffffffffL \