19 *
20 * CDDL HEADER END
21 */
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
24
25
26 /*
27 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
29 */
30
31 #pragma ident "%Z%%M% %I% %E% SMI"
32 /*LINTLIBRARY*/
33
34 #include <sys/types.h>
35
36 void
37 _des_decrypt1(char *block, char *L, char *IP, char *R, char *preS, char *E, char KS[][48], char S[][64], char *f, char *tempL, char *P, char *FP)
38 {
39 /* EXPORT DELETE START */
40 int i, ii;
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 a decryption operation 16 times.
51 */
52 for (ii = 0; ii < 16; ii++) {
53 i = 15-ii;
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];
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 }
|
19 *
20 * CDDL HEADER END
21 */
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
24
25
26 /*
27 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
29 */
30
31 #pragma ident "%Z%%M% %I% %E% SMI"
32 /*LINTLIBRARY*/
33
34 #include <sys/types.h>
35
36 void
37 _des_decrypt1(char *block, char *L, char *IP, char *R, char *preS, char *E, char KS[][48], char S[][64], char *f, char *tempL, char *P, char *FP)
38 {
39 int i, ii;
40 int t, j, k;
41 char t2;
42
43 /*
44 * First, permute the bits in the input
45 */
46 for (j = 0; j < 64; j++)
47 L[j] = block[IP[j]-1];
48 /*
49 * Perform a decryption operation 16 times.
50 */
51 for (ii = 0; ii < 16; ii++) {
52 i = 15-ii;
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];
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 }
|