Annotation of 43BSDReno/kerberosIV/make_ip/make_ip.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * $Source: /mit/kerberos/src/lib/des/RCS/make_ip.c,v $
        !             3:  * $Author: jtkohl $
        !             4:  *
        !             5:  * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
        !             6:  *
        !             7:  * For copying and distribution information, please see the file
        !             8:  * <mit-copyright.h>.
        !             9:  *
        !            10:  * This routine generates source code implementing the initial
        !            11:  * permutation of the DES.
        !            12:  */
        !            13: 
        !            14: #include <mit-copyright.h>
        !            15: #include <stdio.h>
        !            16: #include "des_internal.h"
        !            17: #include "tables.h"
        !            18: 
        !            19: extern long swap_bit_pos_0();
        !            20: extern long rev_swap_bit_pos_0();
        !            21: 
        !            22: #define SWAP(x) swap_long_bytes_bit_number(swap_bit_pos_0_to_ansi(x))
        !            23: 
        !            24: void gen(stream)
        !            25:     FILE *stream;
        !            26: {
        !            27:     register i;
        !            28: 
        !            29:     /* clear the output */
        !            30:     fprintf(stream,"    L2 = 0; R2 = 0;\n");
        !            31: 
        !            32:     /* first setup IP */
        !            33:     fprintf(stream,"/* IP operations */\n/* first left to left */\n");
        !            34: 
        !            35:     /* first list mapping from left to left */
        !            36:     for (i = 0; i <= 31; i++)
        !            37:         if (IP[i] < 32)
        !            38:             test_set(stream, "L1", SWAP(IP[i]), "L2", i);
        !            39: 
        !            40:     /* now mapping from right to left */
        !            41:     fprintf(stream,"\n/* now from right to left */\n");
        !            42:     for (i = 0; i <= 31; i++)
        !            43:         if (IP[i] >= 32)
        !            44:             test_set(stream, "R1", SWAP(IP[i]-32), "L2", i);
        !            45: 
        !            46:     fprintf(stream,"\n/* now from left to right */\n");
        !            47:     /*  list mapping from left to right */
        !            48:     for (i = 32; i <= 63; i++)
        !            49:         if (IP[i] <32)
        !            50:             test_set(stream, "L1", SWAP(IP[i]), "R2", i-32);
        !            51: 
        !            52:     /* now mapping from right to right */
        !            53:     fprintf(stream,"\n/* last from right to right */\n");
        !            54:     for (i = 32; i <= 63; i++)
        !            55:         if (IP[i] >= 32)
        !            56:             test_set(stream, "R1", SWAP(IP[i]-32), "R2", i-32);
        !            57:     exit(0);
        !            58: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.