2 * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
4 * For copying and distribution information, please see the file
7 * This routine generates source code implementing the initial
8 * permutation of the DES.
11 #include <afsconfig.h>
12 #include <afs/param.h>
17 #include <mit-cpyright.h>
21 #include "des_internal.h"
26 #include "des_prototypes.h"
28 #define SWAP(x) swap_long_bytes_bit_number(swap_bit_pos_0_to_ansi(x))
34 #ifdef AFS_DARWIN80_ENV
37 #define swap_long_bytes_bit_number _darwin_swap_long_bytes_bit_number
38 #endif /* AFS_DARWIN80_ENV */
40 /* clear the output */
41 fprintf(stream, " L2 = 0; R2 = 0;\n");
43 #ifdef AFS_DARWIN80_ENV
45 fprintf(stream, _darwin_whichstr[j]);
48 #endif /* AFS_DARWIN80_ENV */
50 fprintf(stream, "/* IP operations */\n/* first left to left */\n");
52 /* first list mapping from left to left */
53 for (i = 0; i <= 31; i++)
55 test_set(stream, "L1", SWAP(IP[i]), "L2", i);
57 /* now mapping from right to left */
58 fprintf(stream, "\n/* now from right to left */\n");
59 for (i = 0; i <= 31; i++)
61 test_set(stream, "R1", SWAP(IP[i] - 32), "L2", i);
63 fprintf(stream, "\n/* now from left to right */\n");
64 /* list mapping from left to right */
65 for (i = 32; i <= 63; i++)
67 test_set(stream, "L1", SWAP(IP[i]), "R2", i - 32);
69 /* now mapping from right to right */
70 fprintf(stream, "\n/* last from right to right */\n");
71 for (i = 32; i <= 63; i++)
73 test_set(stream, "R1", SWAP(IP[i] - 32), "R2", i - 32);
74 #ifdef AFS_DARWIN80_ENV
75 _darwin_which = !_darwin_which;
77 #endif /* AFS_DARWIN80_ENV */