diff options
Diffstat (limited to 'src/lib/libc/crypt/morecrypt.c')
| -rw-r--r-- | src/lib/libc/crypt/morecrypt.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/lib/libc/crypt/morecrypt.c b/src/lib/libc/crypt/morecrypt.c index 64f152139a..4b36ac793b 100644 --- a/src/lib/libc/crypt/morecrypt.c +++ b/src/lib/libc/crypt/morecrypt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $Id: morecrypt.c,v 1.3 1995/12/18 17:59:56 deraadt Exp $ */ | 1 | /* $Id: morecrypt.c,v 1.4 1996/03/25 22:31:46 tholo Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * FreeSec: libcrypt | 4 | * FreeSec: libcrypt |
| @@ -178,12 +178,7 @@ static u_int32_t key_perm_maskl[8][128], key_perm_maskr[8][128]; | |||
| 178 | static u_int32_t comp_maskl[8][128], comp_maskr[8][128]; | 178 | static u_int32_t comp_maskl[8][128], comp_maskr[8][128]; |
| 179 | static u_int32_t old_rawkey0, old_rawkey1; | 179 | static u_int32_t old_rawkey0, old_rawkey1; |
| 180 | 180 | ||
| 181 | static u_char ascii64[] = | 181 | static __inline int |
| 182 | "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; | ||
| 183 | /* 0000000000111111111122222222223333333333444444444455555555556666 */ | ||
| 184 | /* 0123456789012345678901234567890123456789012345678901234567890123 */ | ||
| 185 | |||
| 186 | static inline int | ||
| 187 | ascii_to_bin(ch) | 182 | ascii_to_bin(ch) |
| 188 | char ch; | 183 | char ch; |
| 189 | { | 184 | { |
| @@ -362,9 +357,9 @@ do_des(l_in, r_in, l_out, r_out, count) | |||
| 362 | /* | 357 | /* |
| 363 | * l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format. | 358 | * l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format. |
| 364 | */ | 359 | */ |
| 365 | u_int32_t mask, rawl, rawr, l, r, *kl, *kr, *kl1, *kr1; | 360 | u_int32_t l, r, *kl, *kr, *kl1, *kr1; |
| 366 | u_int32_t f, r48l, r48r; | 361 | u_int32_t f, r48l, r48r; |
| 367 | int i, j, b, round; | 362 | int round; |
| 368 | 363 | ||
| 369 | if (count == 0) { | 364 | if (count == 0) { |
| 370 | return(1); | 365 | return(1); |
| @@ -476,7 +471,7 @@ int | |||
| 476 | des_cipher(in, out, salt, count) | 471 | des_cipher(in, out, salt, count) |
| 477 | const char *in; | 472 | const char *in; |
| 478 | char *out; | 473 | char *out; |
| 479 | int32_t salt; | 474 | long salt; |
| 480 | int count; | 475 | int count; |
| 481 | { | 476 | { |
| 482 | u_int32_t l_out, r_out, rawl, rawr; | 477 | u_int32_t l_out, r_out, rawl, rawr; |
| @@ -486,7 +481,7 @@ des_cipher(in, out, salt, count) | |||
| 486 | if (!des_initialised) | 481 | if (!des_initialised) |
| 487 | des_init(); | 482 | des_init(); |
| 488 | 483 | ||
| 489 | setup_salt(salt); | 484 | setup_salt((int32_t)salt); |
| 490 | 485 | ||
| 491 | #if 0 | 486 | #if 0 |
| 492 | rawl = ntohl(*((u_int32_t *) in)++); | 487 | rawl = ntohl(*((u_int32_t *) in)++); |
| @@ -514,7 +509,7 @@ des_setkey(key) | |||
| 514 | const char *key; | 509 | const char *key; |
| 515 | { | 510 | { |
| 516 | u_int32_t k0, k1, rawkey0, rawkey1; | 511 | u_int32_t k0, k1, rawkey0, rawkey1; |
| 517 | int shifts, i, b, round; | 512 | int shifts, round; |
| 518 | 513 | ||
| 519 | if (!des_initialised) | 514 | if (!des_initialised) |
| 520 | des_init(); | 515 | des_init(); |
| @@ -561,7 +556,6 @@ des_setkey(key) | |||
| 561 | shifts = 0; | 556 | shifts = 0; |
| 562 | for (round = 0; round < 16; round++) { | 557 | for (round = 0; round < 16; round++) { |
| 563 | u_int32_t t0, t1; | 558 | u_int32_t t0, t1; |
| 564 | int bit; | ||
| 565 | 559 | ||
| 566 | shifts += key_shifts[round]; | 560 | shifts += key_shifts[round]; |
| 567 | 561 | ||
| @@ -593,7 +587,7 @@ des_setkey(key) | |||
| 593 | 587 | ||
| 594 | int | 588 | int |
| 595 | setkey(key) | 589 | setkey(key) |
| 596 | char *key; | 590 | const char *key; |
| 597 | { | 591 | { |
| 598 | int i, j; | 592 | int i, j; |
| 599 | u_int32_t packed_keys[2]; | 593 | u_int32_t packed_keys[2]; |
| @@ -622,8 +616,8 @@ encrypt(block, flag) | |||
| 622 | if (!des_initialised) | 616 | if (!des_initialised) |
| 623 | des_init(); | 617 | des_init(); |
| 624 | 618 | ||
| 625 | setup_salt(0L); | 619 | setup_salt((int32_t)0); |
| 626 | p = block; | 620 | p = (u_char *)block; |
| 627 | for (i = 0; i < 2; i++) { | 621 | for (i = 0; i < 2; i++) { |
| 628 | io[i] = 0L; | 622 | io[i] = 0L; |
| 629 | for (j = 0; j < 32; j++) | 623 | for (j = 0; j < 32; j++) |
