Print this page
3882 remove xmod & friends
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/gss_mechs/mech_krb5/crypto/des/afsstring2key.c
+++ new/usr/src/lib/gss_mechs/mech_krb5/crypto/des/afsstring2key.c
1 1 /*
2 2 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3 3 * Use is subject to license terms.
4 4 */
5 5
6 6
7 7 /*
8 8 * lib/crypto/des/string2key.c
9 9 *
10 10 * based on lib/crypto/des/string2key.c from MIT V5
11 11 * and on lib/des/afs_string_to_key.c from UMD.
12 12 * constructed by Mark Eichin, Cygnus Support, 1995.
13 13 * made thread-safe by Ken Raeburn, MIT, 2001.
14 14 */
15 15
16 16 /*
17 17 * Copyright 2001 by the Massachusetts Institute of Technology.
18 18 * All Rights Reserved.
19 19 *
20 20 * Export of this software from the United States of America may
21 21 * require a specific license from the United States Government.
22 22 * It is the responsibility of any person or organization contemplating
23 23 * export to obtain such a license before exporting.
24 24 *
25 25 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
26 26 * distribute this software and its documentation for any purpose and
27 27 * without fee is hereby granted, provided that the above copyright
28 28 * notice appear in all copies and that both that copyright notice and
29 29 * this permission notice appear in supporting documentation, and that
30 30 * the name of M.I.T. not be used in advertising or publicity pertaining
31 31 * to distribution of the software without specific, written prior
32 32 * permission. Furthermore if you modify this software you must label
33 33 * your software as modified software and not distribute it in such a
34 34 * fashion that it might be confused with the original M.I.T. software.
35 35 * M.I.T. makes no representations about the suitability of
36 36 * this software for any purpose. It is provided "as is" without express
37 37 * or implied warranty.
38 38 */
39 39
40 40 /*
41 41 * Copyright (C) 1998 by the FundsXpress, INC.
42 42 *
43 43 * All rights reserved.
44 44 *
45 45 * Export of this software from the United States of America may require
46 46 * a specific license from the United States Government. It is the
47 47 * responsibility of any person or organization contemplating export to
48 48 * obtain such a license before exporting.
49 49 *
50 50 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
51 51 * distribute this software and its documentation for any purpose and
52 52 * without fee is hereby granted, provided that the above copyright
53 53 * notice appear in all copies and that both that copyright notice and
54 54 * this permission notice appear in supporting documentation, and that
55 55 * the name of FundsXpress. not be used in advertising or publicity pertaining
56 56 * to distribution of the software without specific, written prior
57 57 * permission. FundsXpress makes no representations about the suitability of
58 58 * this software for any purpose. It is provided "as is" without express
59 59 * or implied warranty.
60 60 *
61 61 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
62 62 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
63 63 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
64 64 */
65 65
66 66 #include "k5-int.h"
67 67 #include "des_int.h"
68 68 #include <ctype.h>
69 69
70 70 #define afs_crypt mit_afs_crypt
71 71 char *afs_crypt (const char *, const char *, char *);
72 72
73 73 #undef min
↓ open down ↓ |
73 lines elided |
↑ open up ↑ |
74 74 #define min(a,b) ((a)>(b)?(b):(a))
75 75
76 76 /*ARGSUSED*/
77 77 krb5_error_code
78 78 mit_afs_string_to_key (krb5_context context,
79 79 krb5_keyblock *keyblock, const krb5_data *data,
80 80 const krb5_data *salt)
81 81 {
82 82 /* Solaris Kerberos */
83 83 krb5_error_code retval = KRB5_PROG_ETYPE_NOSUPP;
84 -/* EXPORT DELETE START */
85 84 /* totally different approach from MIT string2key. */
86 85 /* much of the work has already been done by the only caller
87 86 which is mit_des_string_to_key; in particular, *keyblock is already
88 87 set up. */
89 88
90 89 char *realm = salt->data;
91 90 unsigned int i, j;
92 91 krb5_octet *key = keyblock->contents;
93 92 /* Solaris Kerberos */
94 93 krb5_keyblock usekey;
95 94
96 95 if (data->length <= 8) {
97 96 /* One block only. Run afs_crypt and use the first eight
98 97 returned bytes after the copy of the (fixed) salt.
99 98
100 99 Since the returned bytes are alphanumeric, the output is
101 100 limited to 2**48 possibilities; for each byte, only 64
102 101 possible values can be used. */
103 102 unsigned char password[9]; /* trailing nul for crypt() */
104 103 char afs_crypt_buf[16];
105 104
106 105 memset (password, 0, sizeof (password));
107 106 memcpy (password, realm, min (salt->length, 8));
108 107 for (i=0; i<8; i++)
109 108 if (isupper(password[i]))
110 109 password[i] = tolower(password[i]);
111 110 for (i=0; i<data->length; i++)
112 111 password[i] ^= data->data[i];
113 112 for (i=0; i<8; i++)
114 113 if (password[i] == '\0')
115 114 password[i] = 'X';
116 115 password[8] = '\0';
117 116 /* Out-of-bounds salt characters are equivalent to a salt string
118 117 of "p1". */
119 118 strncpy((char *) key,
120 119 (char *) afs_crypt((char *) password, "#~", afs_crypt_buf) + 2,
121 120 8);
122 121 for (i=0; i<8; i++)
123 122 key[i] <<= 1;
124 123 /* now fix up key parity again */
125 124 mit_des_fixup_key_parity(key);
126 125 /* clean & free the input string */
127 126 memset(password, 0, (size_t) sizeof(password));
128 127
129 128 /* Solaris Kerberos: Success */
130 129 retval = 0;
131 130 } else {
132 131 /* Multiple blocks. Do a CBC checksum, twice, and use the
133 132 result as the new key. */
134 133 mit_des_cblock ikey, tkey;
135 134 unsigned int pw_len = salt->length+data->length;
136 135 unsigned char *password = malloc(pw_len+1);
137 136 if (!password) return ENOMEM;
138 137
139 138 /* Some bound checks from the original code are elided here as
140 139 the malloc above makes sure we have enough storage. */
141 140 memcpy (password, data->data, data->length);
142 141 for (i=data->length, j = 0; j < salt->length; i++, j++) {
143 142 password[i] = realm[j];
144 143 if (isupper(password[i]))
145 144 password[i] = tolower(password[i]);
146 145 }
147 146
148 147 memcpy (ikey, "kerberos", sizeof(ikey));
149 148 memcpy (tkey, ikey, sizeof(tkey));
150 149 mit_des_fixup_key_parity (tkey);
151 150
152 151 /* Solaris Kerberos */
153 152 usekey.enctype = ENCTYPE_DES_CBC_CRC;
154 153 usekey.contents = tkey;
155 154 usekey.length = 8;
156 155 retval = mit_des_cbc_cksum (context, (unsigned char *)password,
157 156 tkey, i, &usekey, ikey);
158 157
159 158 memcpy (ikey, tkey, sizeof(ikey));
160 159 mit_des_fixup_key_parity (tkey);
161 160 /* Solaris Kerberos */
162 161 if (usekey.hKey != CK_INVALID_HANDLE) {
163 162 (void) C_DestroyObject(krb_ctx_hSession(context), usekey.hKey);
164 163 usekey.hKey = CK_INVALID_HANDLE;
165 164 }
166 165 usekey.contents = tkey;
167 166 usekey.length = 8;
168 167 retval = mit_des_cbc_cksum (context, (unsigned char *) password,
169 168 key, i, &usekey, ikey);
170 169
171 170 /* now fix up key parity again */
172 171 mit_des_fixup_key_parity(key);
173 172
174 173 /* Solaris Kerberos */
175 174 if (usekey.hKey != CK_INVALID_HANDLE) {
176 175 (void) C_DestroyObject(krb_ctx_hSession(context), usekey.hKey);
177 176 usekey.hKey = CK_INVALID_HANDLE;
↓ open down ↓ |
83 lines elided |
↑ open up ↑ |
178 177 }
179 178 /* clean & free the input string */
180 179 memset(password, 0, (size_t) pw_len);
181 180 krb5_xfree(password);
182 181 }
183 182 #if 0
184 183 /* must free here because it was copied for this special case */
185 184 krb5_xfree(salt->data);
186 185 #endif
187 186
188 -/* EXPORT DELETE END */
189 187 return retval;
190 188 }
191 189
192 190
193 191 /* Portions of this code:
194 192 Copyright 1989 by the Massachusetts Institute of Technology
195 193 */
196 194
197 195 /*
198 196 * Copyright (c) 1990 Regents of The University of Michigan.
199 197 * All Rights Reserved.
200 198 *
201 199 * Permission to use, copy, modify, and distribute this software
202 200 * and its documentation for any purpose and without fee is hereby
203 201 * granted, provided that the above copyright notice appears in all
204 202 * copies and that both that copyright notice and this permission
205 203 * notice appear in supporting documentation, and that the name of
206 204 * The University of Michigan not be used in advertising or
207 205 * publicity pertaining to distribution of the software without
208 206 * specific, written prior permission. This software is supplied as
↓ open down ↓ |
10 lines elided |
↑ open up ↑ |
209 207 * is without expressed or implied warranties of any kind.
210 208 *
211 209 * ITD Research Systems
212 210 * University of Michigan
213 211 * 535 W. William Street
214 212 * Ann Arbor, Michigan
215 213 * +1-313-936-2652
216 214 * netatalk@terminator.cc.umich.edu
217 215 */
218 216
219 -/* EXPORT DELETE START */
220 -
221 217 static void krb5_afs_crypt_setkey (char*, char*, char(*)[48]);
222 218 static void krb5_afs_encrypt (char*,char*,char (*)[48]);
223 219
224 220 /*
225 221 * Initial permutation,
226 222 */
227 223 static const char IP[] = {
228 224 58,50,42,34,26,18,10, 2,
229 225 60,52,44,36,28,20,12, 4,
230 226 62,54,46,38,30,22,14, 6,
231 227 64,56,48,40,32,24,16, 8,
232 228 57,49,41,33,25,17, 9, 1,
233 229 59,51,43,35,27,19,11, 3,
234 230 61,53,45,37,29,21,13, 5,
235 231 63,55,47,39,31,23,15, 7,
236 232 };
237 233
238 234 /*
239 235 * Final permutation, FP = IP^(-1)
240 236 */
241 237 static const char FP[] = {
242 238 40, 8,48,16,56,24,64,32,
243 239 39, 7,47,15,55,23,63,31,
244 240 38, 6,46,14,54,22,62,30,
245 241 37, 5,45,13,53,21,61,29,
246 242 36, 4,44,12,52,20,60,28,
247 243 35, 3,43,11,51,19,59,27,
248 244 34, 2,42,10,50,18,58,26,
249 245 33, 1,41, 9,49,17,57,25,
250 246 };
251 247
252 248 /*
253 249 * Permuted-choice 1 from the key bits to yield C and D.
254 250 * Note that bits 8,16... are left out: They are intended for a parity check.
255 251 */
256 252 static const char PC1_C[] = {
257 253 57,49,41,33,25,17, 9,
258 254 1,58,50,42,34,26,18,
259 255 10, 2,59,51,43,35,27,
260 256 19,11, 3,60,52,44,36,
261 257 };
262 258
263 259 static const char PC1_D[] = {
264 260 63,55,47,39,31,23,15,
265 261 7,62,54,46,38,30,22,
266 262 14, 6,61,53,45,37,29,
267 263 21,13, 5,28,20,12, 4,
268 264 };
269 265
270 266 /*
271 267 * Sequence of shifts used for the key schedule.
272 268 */
273 269 static const char shifts[] = {
274 270 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1,
275 271 };
276 272
277 273 /*
278 274 * Permuted-choice 2, to pick out the bits from
279 275 * the CD array that generate the key schedule.
280 276 */
281 277 static const char PC2_C[] = {
282 278 14,17,11,24, 1, 5,
283 279 3,28,15, 6,21,10,
284 280 23,19,12, 4,26, 8,
285 281 16, 7,27,20,13, 2,
286 282 };
287 283
288 284 static const char PC2_D[] = {
289 285 41,52,31,37,47,55,
290 286 30,40,51,45,33,48,
291 287 44,49,39,56,34,53,
292 288 46,42,50,36,29,32,
293 289 };
294 290
295 291 /*
296 292 * The E bit-selection table.
297 293 */
298 294 static const char e[] = {
299 295 32, 1, 2, 3, 4, 5,
300 296 4, 5, 6, 7, 8, 9,
301 297 8, 9,10,11,12,13,
302 298 12,13,14,15,16,17,
303 299 16,17,18,19,20,21,
304 300 20,21,22,23,24,25,
305 301 24,25,26,27,28,29,
306 302 28,29,30,31,32, 1,
307 303 };
308 304
309 305 /*
310 306 * P is a permutation on the selected combination
311 307 * of the current L and key.
312 308 */
313 309 static const char P[] = {
314 310 16, 7,20,21,
315 311 29,12,28,17,
316 312 1,15,23,26,
317 313 5,18,31,10,
318 314 2, 8,24,14,
319 315 32,27, 3, 9,
320 316 19,13,30, 6,
321 317 22,11, 4,25,
322 318 };
323 319
324 320 /*
325 321 * The 8 selection functions.
326 322 * For some reason, they give a 0-origin
327 323 * index, unlike everything else.
328 324 */
329 325 static const char S[8][64] = {
330 326 {14, 4,13, 1, 2,15,11, 8, 3,10, 6,12, 5, 9, 0, 7,
331 327 0,15, 7, 4,14, 2,13, 1,10, 6,12,11, 9, 5, 3, 8,
332 328 4, 1,14, 8,13, 6, 2,11,15,12, 9, 7, 3,10, 5, 0,
333 329 15,12, 8, 2, 4, 9, 1, 7, 5,11, 3,14,10, 0, 6,13},
334 330
335 331 {15, 1, 8,14, 6,11, 3, 4, 9, 7, 2,13,12, 0, 5,10,
336 332 3,13, 4, 7,15, 2, 8,14,12, 0, 1,10, 6, 9,11, 5,
337 333 0,14, 7,11,10, 4,13, 1, 5, 8,12, 6, 9, 3, 2,15,
338 334 13, 8,10, 1, 3,15, 4, 2,11, 6, 7,12, 0, 5,14, 9},
339 335
340 336 {10, 0, 9,14, 6, 3,15, 5, 1,13,12, 7,11, 4, 2, 8,
341 337 13, 7, 0, 9, 3, 4, 6,10, 2, 8, 5,14,12,11,15, 1,
342 338 13, 6, 4, 9, 8,15, 3, 0,11, 1, 2,12, 5,10,14, 7,
343 339 1,10,13, 0, 6, 9, 8, 7, 4,15,14, 3,11, 5, 2,12},
344 340
345 341 { 7,13,14, 3, 0, 6, 9,10, 1, 2, 8, 5,11,12, 4,15,
346 342 13, 8,11, 5, 6,15, 0, 3, 4, 7, 2,12, 1,10,14, 9,
347 343 10, 6, 9, 0,12,11, 7,13,15, 1, 3,14, 5, 2, 8, 4,
348 344 3,15, 0, 6,10, 1,13, 8, 9, 4, 5,11,12, 7, 2,14},
349 345
350 346 { 2,12, 4, 1, 7,10,11, 6, 8, 5, 3,15,13, 0,14, 9,
351 347 14,11, 2,12, 4, 7,13, 1, 5, 0,15,10, 3, 9, 8, 6,
352 348 4, 2, 1,11,10,13, 7, 8,15, 9,12, 5, 6, 3, 0,14,
353 349 11, 8,12, 7, 1,14, 2,13, 6,15, 0, 9,10, 4, 5, 3},
354 350
355 351 {12, 1,10,15, 9, 2, 6, 8, 0,13, 3, 4,14, 7, 5,11,
356 352 10,15, 4, 2, 7,12, 9, 5, 6, 1,13,14, 0,11, 3, 8,
357 353 9,14,15, 5, 2, 8,12, 3, 7, 0, 4,10, 1,13,11, 6,
358 354 4, 3, 2,12, 9, 5,15,10,11,14, 1, 7, 6, 0, 8,13},
359 355
360 356 { 4,11, 2,14,15, 0, 8,13, 3,12, 9, 7, 5,10, 6, 1,
361 357 13, 0,11, 7, 4, 9, 1,10,14, 3, 5,12, 2,15, 8, 6,
362 358 1, 4,11,13,12, 3, 7,14,10,15, 6, 8, 0, 5, 9, 2,
363 359 6,11,13, 8, 1, 4,10, 7, 9, 5, 0,15,14, 2, 3,12},
364 360
365 361 {13, 2, 8, 4, 6,15,11, 1,10, 9, 3,14, 5, 0,12, 7,
366 362 1,15,13, 8,10, 3, 7, 4,12, 5, 6,11, 0,14, 9, 2,
367 363 7,11, 4, 1, 9,12,14, 2, 0, 6,10,13,15, 3, 5, 8,
368 364 2, 1,14, 7, 4,10, 8,13,15,12, 9, 0, 3, 5, 6,11},
369 365 };
370 366
371 367
372 368 char *afs_crypt(const char *pw, const char *salt,
373 369 /* must be at least 16 bytes */
374 370 char *iobuf)
375 371 {
376 372 int i, j, c;
377 373 int temp;
378 374 char block[66];
379 375 char E[48];
380 376 /*
381 377 * The key schedule.
382 378 * Generated from the key.
383 379 */
384 380 char KS[16][48];
385 381
386 382 for(i=0; i<66; i++)
387 383 block[i] = 0;
388 384 /* Solaris Kerberos */
389 385 for(i=0; ((c= *pw) != NULL) && i<64; pw++){
390 386 for(j=0; j<7; j++, i++)
391 387 block[i] = (c>>(6-j)) & 01;
392 388 i++;
393 389 }
394 390
395 391 krb5_afs_crypt_setkey(block, E, KS);
396 392
397 393 for(i=0; i<66; i++)
398 394 block[i] = 0;
399 395
400 396 for(i=0;i<2;i++){
401 397 c = *salt++;
402 398 iobuf[i] = c;
403 399 if(c>'Z') c -= 6;
404 400 if(c>'9') c -= 7;
405 401 c -= '.';
406 402 for(j=0;j<6;j++){
407 403 if((c>>j) & 01){
408 404 temp = E[6*i+j];
409 405 E[6*i+j] = E[6*i+j+24];
410 406 E[6*i+j+24] = temp;
411 407 }
412 408 }
413 409 }
414 410
415 411 for(i=0; i<25; i++)
416 412 krb5_afs_encrypt(block,E,KS);
417 413
418 414 for(i=0; i<11; i++){
419 415 c = 0;
420 416 for(j=0; j<6; j++){
421 417 c <<= 1;
422 418 c |= block[6*i+j];
423 419 }
424 420 c += '.';
425 421 if(c>'9') c += 7;
426 422 if(c>'Z') c += 6;
427 423 iobuf[i+2] = c;
428 424 }
429 425 iobuf[i+2] = 0;
430 426 if(iobuf[1]==0)
431 427 iobuf[1] = iobuf[0];
432 428 return(iobuf);
433 429 }
434 430
435 431 /*
436 432 * Set up the key schedule from the key.
437 433 */
438 434
439 435 static void krb5_afs_crypt_setkey(char *key, char *E, char (*KS)[48])
440 436 {
441 437 register int i, j, k;
442 438 int t;
443 439 /*
444 440 * The C and D arrays used to calculate the key schedule.
445 441 */
446 442 char C[28], D[28];
447 443
448 444 /*
449 445 * First, generate C and D by permuting
450 446 * the key. The low order bit of each
451 447 * 8-bit char is not used, so C and D are only 28
452 448 * bits apiece.
453 449 */
454 450 for (i=0; i<28; i++) {
455 451 C[i] = key[PC1_C[i]-1];
456 452 D[i] = key[PC1_D[i]-1];
457 453 }
458 454 /*
459 455 * To generate Ki, rotate C and D according
460 456 * to schedule and pick up a permutation
461 457 * using PC2.
462 458 */
463 459 for (i=0; i<16; i++) {
464 460 /*
465 461 * rotate.
466 462 */
467 463 for (k=0; k<shifts[i]; k++) {
468 464 t = C[0];
469 465 for (j=0; j<28-1; j++)
470 466 C[j] = C[j+1];
471 467 C[27] = t;
472 468 t = D[0];
473 469 for (j=0; j<28-1; j++)
474 470 D[j] = D[j+1];
475 471 D[27] = t;
476 472 }
477 473 /*
478 474 * get Ki. Note C and D are concatenated.
479 475 */
480 476 for (j=0; j<24; j++) {
481 477 KS[i][j] = C[PC2_C[j]-1];
482 478 KS[i][j+24] = D[PC2_D[j]-28-1];
483 479 }
484 480 }
485 481
486 482 #if 0
487 483 for(i=0;i<48;i++) {
488 484 E[i] = e[i];
489 485 }
490 486 #else
491 487 memcpy(E, e, 48);
492 488 #endif
493 489 }
494 490
495 491 /*
496 492 * The payoff: encrypt a block.
497 493 */
498 494
499 495 static void krb5_afs_encrypt(char *block, char *E, char (*KS)[48])
500 496 {
501 497 const long edflag = 0;
502 498 int i, ii;
503 499 int t, j, k;
504 500 char tempL[32];
505 501 char f[32];
506 502 /*
507 503 * The current block, divided into 2 halves.
508 504 */
509 505 char L[64];
510 506 char *const R = &L[32];
511 507 /*
512 508 * The combination of the key and the input, before selection.
513 509 */
514 510 char preS[48];
515 511
516 512 /*
517 513 * First, permute the bits in the input
518 514 */
519 515 for (j=0; j<64; j++)
520 516 L[j] = block[IP[j]-1];
521 517 /*
522 518 * Perform an encryption operation 16 times.
523 519 */
524 520 for (ii=0; ii<16; ii++) {
525 521 /*
526 522 * Set direction
527 523 */
528 524 if (edflag)
529 525 i = 15-ii;
530 526 else
531 527 i = ii;
532 528 /*
533 529 * Save the R array,
534 530 * which will be the new L.
535 531 */
536 532 #if 0
537 533 for (j=0; j<32; j++)
538 534 tempL[j] = R[j];
539 535 #else
540 536 memcpy(tempL, R, 32);
541 537 #endif
542 538 /*
543 539 * Expand R to 48 bits using the E selector;
544 540 * exclusive-or with the current key bits.
545 541 */
546 542 for (j=0; j<48; j++)
547 543 preS[j] = R[E[j]-1] ^ KS[i][j];
548 544 /*
549 545 * The pre-select bits are now considered
550 546 * in 8 groups of 6 bits each.
551 547 * The 8 selection functions map these
552 548 * 6-bit quantities into 4-bit quantities
553 549 * and the results permuted
554 550 * to make an f(R, K).
555 551 * The indexing into the selection functions
556 552 * is peculiar; it could be simplified by
557 553 * rewriting the tables.
558 554 */
559 555 for (j=0; j<8; j++) {
560 556 t = 6*j;
561 557 k = S[j][(preS[t+0]<<5)+
562 558 (preS[t+1]<<3)+
563 559 (preS[t+2]<<2)+
564 560 (preS[t+3]<<1)+
565 561 (preS[t+4]<<0)+
566 562 (preS[t+5]<<4)];
567 563 t = 4*j;
568 564 f[t+0] = (k>>3)&01;
569 565 f[t+1] = (k>>2)&01;
570 566 f[t+2] = (k>>1)&01;
571 567 f[t+3] = (k>>0)&01;
572 568 }
573 569 /*
574 570 * The new R is L ^ f(R, K).
575 571 * The f here has to be permuted first, though.
576 572 */
577 573 for (j=0; j<32; j++)
578 574 R[j] = L[j] ^ f[P[j]-1];
579 575 /*
580 576 * Finally, the new L (the original R)
581 577 * is copied back.
582 578 */
583 579 #if 0
584 580 for (j=0; j<32; j++)
585 581 L[j] = tempL[j];
586 582 #else
587 583 memcpy(L, tempL, 32);
588 584 #endif
589 585 }
590 586 /*
591 587 * The output L and R are reversed.
592 588 */
593 589 for (j=0; j<32; j++) {
594 590 t = L[j];
↓ open down ↓ |
364 lines elided |
↑ open up ↑ |
595 591 L[j] = R[j];
596 592 R[j] = t;
597 593 }
598 594 /*
599 595 * The final output
600 596 * gets the inverse permutation of the very original.
601 597 */
602 598 for (j=0; j<64; j++)
603 599 block[j] = L[FP[j]-1];
604 600 }
605 -/* EXPORT DELETE END */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX