1 --- XFree86-4.0.1/xc/config/cf/xf86site.def~ Wed Nov 8 18:24:28 2000
2 +++ XFree86-4.0.1/xc/config/cf/xf86site.def Wed Nov 8 18:37:12 2000
5 * If you want XDMAUTH support (if you have Wraphelp.c), uncomment this.
7 -#define HasXdmAuth YES
9 +#define HasXdmAuth YES
12 * If you have Linux DECnet support, and want to build XFree86 with support
13 --- /dev/null Tue May 27 20:49:58 1997
14 +++ XFree86-4.0.1/xc/lib/Xdmcp/Wraphelp.c Sat Feb 26 02:04:11 2000
17 + * This program implements the
18 + * Proposed Federal Information Processing
19 + * Data Encryption Standard.
20 + * See Federal Register, March 17, 1975 (40FR12134)
24 + * Initial permutation,
27 + 58,50,42,34,26,18,10, 2,
28 + 60,52,44,36,28,20,12, 4,
29 + 62,54,46,38,30,22,14, 6,
30 + 64,56,48,40,32,24,16, 8,
31 + 57,49,41,33,25,17, 9, 1,
32 + 59,51,43,35,27,19,11, 3,
33 + 61,53,45,37,29,21,13, 5,
34 + 63,55,47,39,31,23,15, 7,
38 + * Final permutation, FP = IP^(-1)
41 + 40, 8,48,16,56,24,64,32,
42 + 39, 7,47,15,55,23,63,31,
43 + 38, 6,46,14,54,22,62,30,
44 + 37, 5,45,13,53,21,61,29,
45 + 36, 4,44,12,52,20,60,28,
46 + 35, 3,43,11,51,19,59,27,
47 + 34, 2,42,10,50,18,58,26,
48 + 33, 1,41, 9,49,17,57,25,
52 + * Permuted-choice 1 from the key bits
54 + * Note that bits 8,16... are left out:
55 + * They are intended for a parity check.
57 +static char PC1_C[] = {
58 + 57,49,41,33,25,17, 9,
59 + 1,58,50,42,34,26,18,
60 + 10, 2,59,51,43,35,27,
61 + 19,11, 3,60,52,44,36,
64 +static char PC1_D[] = {
65 + 63,55,47,39,31,23,15,
66 + 7,62,54,46,38,30,22,
67 + 14, 6,61,53,45,37,29,
68 + 21,13, 5,28,20,12, 4,
72 + * Sequence of shifts used for the key schedule.
74 +static char shifts[] = {
75 + 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1,
79 + * Permuted-choice 2, to pick out the bits from
80 + * the CD array that generate the key schedule.
82 +static char PC2_C[] = {
89 +static char PC2_D[] = {
97 + * The C and D arrays used to calculate the key schedule.
104 + * The key schedule.
105 + * Generated from the key.
107 +static char KS[16][48];
110 + * The E bit-selection table.
125 + * Set up the key schedule from the key.
137 + * First, generate C and D by permuting
138 + * the key. The low order bit of each
139 + * 8-bit char is not used, so C and D are only 28
142 + for (i=0; i<28; i++) {
143 + C[i] = key[PC1_C[i]-1];
144 + D[i] = key[PC1_D[i]-1];
147 + * To generate Ki, rotate C and D according
148 + * to schedule and pick up a permutation
151 + for (i=0; i<16; i++) {
155 + for (k=0; k<shifts[i]; k++) {
158 + for (j=0; j<28-1; j++)
166 + for (j=0; j<28-1; j++)
174 + * get Ki. Note C and D are concatenated.
177 + for (j=0; j<24; j++) {
178 + ptr[j] = C[PC2_C[j]-1];
179 + ptr[j+24] = D[PC2_D[j]-28-1];
188 + * The 8 selection functions.
189 + * For some reason, they give a 0-origin
190 + * index, unlike everything else.
192 +static char S[8][64] = {
193 + 14, 4,13, 1, 2,15,11, 8, 3,10, 6,12, 5, 9, 0, 7,
194 + 0,15, 7, 4,14, 2,13, 1,10, 6,12,11, 9, 5, 3, 8,
195 + 4, 1,14, 8,13, 6, 2,11,15,12, 9, 7, 3,10, 5, 0,
196 + 15,12, 8, 2, 4, 9, 1, 7, 5,11, 3,14,10, 0, 6,13,
198 + 15, 1, 8,14, 6,11, 3, 4, 9, 7, 2,13,12, 0, 5,10,
199 + 3,13, 4, 7,15, 2, 8,14,12, 0, 1,10, 6, 9,11, 5,
200 + 0,14, 7,11,10, 4,13, 1, 5, 8,12, 6, 9, 3, 2,15,
201 + 13, 8,10, 1, 3,15, 4, 2,11, 6, 7,12, 0, 5,14, 9,
203 + 10, 0, 9,14, 6, 3,15, 5, 1,13,12, 7,11, 4, 2, 8,
204 + 13, 7, 0, 9, 3, 4, 6,10, 2, 8, 5,14,12,11,15, 1,
205 + 13, 6, 4, 9, 8,15, 3, 0,11, 1, 2,12, 5,10,14, 7,
206 + 1,10,13, 0, 6, 9, 8, 7, 4,15,14, 3,11, 5, 2,12,
208 + 7,13,14, 3, 0, 6, 9,10, 1, 2, 8, 5,11,12, 4,15,
209 + 13, 8,11, 5, 6,15, 0, 3, 4, 7, 2,12, 1,10,14, 9,
210 + 10, 6, 9, 0,12,11, 7,13,15, 1, 3,14, 5, 2, 8, 4,
211 + 3,15, 0, 6,10, 1,13, 8, 9, 4, 5,11,12, 7, 2,14,
213 + 2,12, 4, 1, 7,10,11, 6, 8, 5, 3,15,13, 0,14, 9,
214 + 14,11, 2,12, 4, 7,13, 1, 5, 0,15,10, 3, 9, 8, 6,
215 + 4, 2, 1,11,10,13, 7, 8,15, 9,12, 5, 6, 3, 0,14,
216 + 11, 8,12, 7, 1,14, 2,13, 6,15, 0, 9,10, 4, 5, 3,
218 + 12, 1,10,15, 9, 2, 6, 8, 0,13, 3, 4,14, 7, 5,11,
219 + 10,15, 4, 2, 7,12, 9, 5, 6, 1,13,14, 0,11, 3, 8,
220 + 9,14,15, 5, 2, 8,12, 3, 7, 0, 4,10, 1,13,11, 6,
221 + 4, 3, 2,12, 9, 5,15,10,11,14, 1, 7, 6, 0, 8,13,
223 + 4,11, 2,14,15, 0, 8,13, 3,12, 9, 7, 5,10, 6, 1,
224 + 13, 0,11, 7, 4, 9, 1,10,14, 3, 5,12, 2,15, 8, 6,
225 + 1, 4,11,13,12, 3, 7,14,10,15, 6, 8, 0, 5, 9, 2,
226 + 6,11,13, 8, 1, 4,10, 7, 9, 5, 0,15,14, 2, 3,12,
228 + 13, 2, 8, 4, 6,15,11, 1,10, 9, 3,14, 5, 0,12, 7,
229 + 1,15,13, 8,10, 3, 7, 4,12, 5, 6,11, 0,14, 9, 2,
230 + 7,11, 4, 1, 9,12,14, 2, 0, 6,10,13,15, 3, 5, 8,
231 + 2, 1,14, 7, 4,10, 8,13,15,12, 9, 0, 3, 5, 6,11,
235 + * P is a permutation on the selected combination
236 + * of the current L and key.
250 + * The current block, divided into 2 halves.
255 +static char tempL[32];
259 + * The combination of the key and the input, before selection.
261 +static char preS[48];
264 + * The payoff: encrypt a block.
268 +encrypt (block, edflag)
275 + * First, permute the bits in the input
277 + for (j=0; j<64; j++)
278 + L[j] = block[IP[j]-1];
280 + * Perform an encryption operation 16 times.
282 + for (ii=0; ii<16; ii++) {
283 +/* print_bits ("L R", L); */
292 + * Save the R array,
293 + * which will be the new L.
295 + for (j=0; j<32; j++)
298 + * Expand R to 48 bits using the E selector;
299 + * exclusive-or with the current key bits.
301 + for (j=0; j<48; j++)
302 + preS[j] = R[E[j]-1] ^ KS[i][j];
304 + * The pre-select bits are now considered
305 + * in 8 groups of 6 bits each.
306 + * The 8 selection functions map these
307 + * 6-bit quantities into 4-bit quantities
308 + * and the results permuted
309 + * to make an f(R, K).
310 + * The indexing into the selection functions
311 + * is peculiar; it could be simplified by
312 + * rewriting the tables.
314 + for (j=0; j<8; j++) {
316 + k = S[j][(preS[t+0]<<5)+
323 + f[t+0] = (k>>3)&01;
324 + f[t+1] = (k>>2)&01;
325 + f[t+2] = (k>>1)&01;
326 + f[t+3] = (k>>0)&01;
329 + * The new R is L ^ f(R, K).
330 + * The f here has to be permuted first, though.
332 + for (j=0; j<32; j++)
333 + R[j] = L[j] ^ f[P[j]-1];
335 + * Finally, the new L (the original R)
338 + for (j=0; j<32; j++)
342 + * The output L and R are reversed.
344 + for (j=0; j<32; j++) {
351 + * gets the inverse permutation of the very original.
353 + for (j=0; j<64; j++)
354 + block[j] = L[FP[j]-1];
358 +bytes_to_bits (bytes, bits)
359 + unsigned char *bytes;
362 + int bit, byte, value;
364 + for (byte = 0; byte < 8; byte++)
367 + for (bit = 0; bit < 8; bit++)
368 + *bits++ = (value >> (7-bit)) & 1;
373 +bits_to_bytes (bits, bytes)
375 + unsigned char *bytes;
377 + int bit, byte, value;
379 + for (byte = 0; byte < 8; byte++)
382 + for (bit = 0; bit < 8; bit++)
383 + value |= *bits++ << (7-bit);
389 + * Interface compatible with Kerberos DES implementation
395 +_XdmcpAuthSetup (key, schedule)
397 + auth_wrapper_schedule schedule;
399 + char expand_key[64];
401 + bytes_to_bits ((unsigned char *) key, expand_key);
402 + setkey (expand_key);
406 +_XdmcpAuthDoIt (input, output, schedule, edflag)
407 + auth_cblock input, output;
408 + auth_wrapper_schedule schedule;
411 + char expand_input[64];
413 + bytes_to_bits ((unsigned char *) input, expand_input);
414 + encrypt (expand_input, !edflag);
415 + bits_to_bytes (expand_input, (unsigned char *) output);