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>
15 #include "mit-cpyright.h"
19 #include "des_internal.h"
24 #include "des_prototypes.h"
26 #define SWAP(x) swap_long_bytes_bit_number(swap_bit_pos_0_to_ansi(x))
32 #ifdef AFS_DARWIN80_ENV
35 #define swap_long_bytes_bit_number _darwin_swap_long_bytes_bit_number
36 #endif /* AFS_DARWIN80_ENV */
38 /* clear the output */
39 fprintf(stream, " L2 = 0; R2 = 0;\n");
41 #ifdef AFS_DARWIN80_ENV
43 fprintf(stream, "%s", _darwin_whichstr[j]);
46 #endif /* AFS_DARWIN80_ENV */
48 fprintf(stream, "/* IP operations */\n/* first left to left */\n");
50 /* first list mapping from left to left */
51 for (i = 0; i <= 31; i++)
53 test_set(stream, "L1", SWAP(IP[i]), "L2", i);
55 /* now mapping from right to left */
56 fprintf(stream, "\n/* now from right to left */\n");
57 for (i = 0; i <= 31; i++)
59 test_set(stream, "R1", SWAP(IP[i] - 32), "L2", i);
61 fprintf(stream, "\n/* now from left to right */\n");
62 /* list mapping from left to right */
63 for (i = 32; i <= 63; i++)
65 test_set(stream, "L1", SWAP(IP[i]), "R2", i - 32);
67 /* now mapping from right to right */
68 fprintf(stream, "\n/* last from right to right */\n");
69 for (i = 32; i <= 63; i++)
71 test_set(stream, "R1", SWAP(IP[i] - 32), "R2", i - 32);
72 #ifdef AFS_DARWIN80_ENV
73 _darwin_which = !_darwin_which;
75 #endif /* AFS_DARWIN80_ENV */