Print this page
3882 remove xmod & friends


  20  */
  21 
  22 /*
  23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*      Copyright (c) 1988 AT&T     */
  28 /*        All Rights Reserved   */
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 #pragma weak _des_encrypt1 = des_encrypt1
  33 
  34 #include <sys/types.h>
  35 
  36 void
  37 des_encrypt1(char *block, char *L, char *IP, char *R, char *preS, char *E,
  38         char KS[][48], char S[][64], char *f, char *tempL, char *P, char *FP)
  39 {
  40 /* EXPORT DELETE START */
  41         int     i;
  42         int     t, j, k;
  43         char    t2;
  44 
  45         /*
  46          * First, permute the bits in the input
  47          */
  48         for (j = 0; j < 64; j++)
  49                 L[j] = block[IP[j]-1];
  50         /*
  51          * Perform an encryption operation 16 times.
  52          */
  53         for (i = 0; i < 16; i++) {
  54                 /*
  55                  * Save the R array,
  56                  * which will be the new L.
  57                  */
  58                 for (j = 0; j < 32; j++)
  59                         tempL[j] = R[j];
  60                 /*


  98                  * Finally, the new L (the original R)
  99                  * is copied back.
 100                  */
 101                 for (j = 0; j < 32; j++)
 102                         L[j] = tempL[j];
 103         }
 104         /*
 105          * The output L and R are reversed.
 106          */
 107         for (j = 0; j < 32; j++) {
 108                 t2 = L[j];
 109                 L[j] = R[j];
 110                 R[j] = t2;
 111         }
 112         /*
 113          * The final output
 114          * gets the inverse permutation of the very original.
 115          */
 116         for (j = 0; j < 64; j++)
 117                 block[j] = L[FP[j]-1];
 118 /* EXPORT DELETE END */
 119 }


  20  */
  21 
  22 /*
  23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*      Copyright (c) 1988 AT&T     */
  28 /*        All Rights Reserved   */
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 #pragma weak _des_encrypt1 = des_encrypt1
  33 
  34 #include <sys/types.h>
  35 
  36 void
  37 des_encrypt1(char *block, char *L, char *IP, char *R, char *preS, char *E,
  38         char KS[][48], char S[][64], char *f, char *tempL, char *P, char *FP)
  39 {

  40         int     i;
  41         int     t, j, k;
  42         char    t2;
  43 
  44         /*
  45          * First, permute the bits in the input
  46          */
  47         for (j = 0; j < 64; j++)
  48                 L[j] = block[IP[j]-1];
  49         /*
  50          * Perform an encryption operation 16 times.
  51          */
  52         for (i = 0; i < 16; i++) {
  53                 /*
  54                  * Save the R array,
  55                  * which will be the new L.
  56                  */
  57                 for (j = 0; j < 32; j++)
  58                         tempL[j] = R[j];
  59                 /*


  97                  * Finally, the new L (the original R)
  98                  * is copied back.
  99                  */
 100                 for (j = 0; j < 32; j++)
 101                         L[j] = tempL[j];
 102         }
 103         /*
 104          * The output L and R are reversed.
 105          */
 106         for (j = 0; j < 32; j++) {
 107                 t2 = L[j];
 108                 L[j] = R[j];
 109                 R[j] = t2;
 110         }
 111         /*
 112          * The final output
 113          * gets the inverse permutation of the very original.
 114          */
 115         for (j = 0; j < 64; j++)
 116                 block[j] = L[FP[j]-1];

 117 }