summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortholo <>1996-03-25 22:31:46 +0000
committertholo <>1996-03-25 22:31:46 +0000
commitf9c09c1d7fff6cc5150b3496cf49ccc6c4168674 (patch)
tree95ed80888f3e538a481b2a807c9a360ac6c16d7c
parent60fdcd77ab879ee06640599bcf2fbbea95088eac (diff)
downloadopenbsd-f9c09c1d7fff6cc5150b3496cf49ccc6c4168674.tar.gz
openbsd-f9c09c1d7fff6cc5150b3496cf49ccc6c4168674.tar.bz2
openbsd-f9c09c1d7fff6cc5150b3496cf49ccc6c4168674.zip
Update prototypes to match declarations
Remove unused variables Install all man-page links
-rw-r--r--src/lib/libc/crypt/Makefile.inc5
-rw-r--r--src/lib/libc/crypt/crypt.c22
-rw-r--r--src/lib/libc/crypt/morecrypt.c26
3 files changed, 24 insertions, 29 deletions
diff --git a/src/lib/libc/crypt/Makefile.inc b/src/lib/libc/crypt/Makefile.inc
index 782615f38e..78b5168fb9 100644
--- a/src/lib/libc/crypt/Makefile.inc
+++ b/src/lib/libc/crypt/Makefile.inc
@@ -1,8 +1,9 @@
1# $Id: Makefile.inc,v 1.1 1995-12-16 12:55:27 deraadt Exp $ 1# $Id: Makefile.inc,v 1.2 1996-03-25 22:31:44 tholo Exp $
2 2
3.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/crypt ${.CURDIR}/crypt 3.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/crypt ${.CURDIR}/crypt
4 4
5SRCS+= crypt.c morecrypt.c 5SRCS+= crypt.c morecrypt.c
6 6
7MAN+= crypt.3 7MAN+= crypt.3
8MLINKS+=crypt.3 encrypt.3 crypt.3 setkey.3 8MLINKS+=crypt.3 encrypt.3 crypt.3 setkey.3 crypt.3 des_cipher.3
9MLINKS+=crypt.3 des_setkey.3
diff --git a/src/lib/libc/crypt/crypt.c b/src/lib/libc/crypt/crypt.c
index 3680900baf..521b638542 100644
--- a/src/lib/libc/crypt/crypt.c
+++ b/src/lib/libc/crypt/crypt.c
@@ -1,4 +1,4 @@
1/* $Id: crypt.c,v 1.2 1995/12/18 17:59:55 deraadt Exp $ */ 1/* $Id: crypt.c,v 1.3 1996/03/25 22:31:45 tholo Exp $ */
2 2
3/* 3/*
4 * FreeSec: libcrypt 4 * FreeSec: libcrypt
@@ -53,6 +53,7 @@
53#include <sys/types.h> 53#include <sys/types.h>
54#include <sys/param.h> 54#include <sys/param.h>
55#include <pwd.h> 55#include <pwd.h>
56#include <string.h>
56 57
57#ifdef DEBUG 58#ifdef DEBUG
58# include <stdio.h> 59# include <stdio.h>
@@ -182,7 +183,7 @@ static u_char ascii64[] =
182/* 0000000000111111111122222222223333333333444444444455555555556666 */ 183/* 0000000000111111111122222222223333333333444444444455555555556666 */
183/* 0123456789012345678901234567890123456789012345678901234567890123 */ 184/* 0123456789012345678901234567890123456789012345678901234567890123 */
184 185
185static inline int 186static __inline int
186ascii_to_bin(ch) 187ascii_to_bin(ch)
187 char ch; 188 char ch;
188{ 189{
@@ -358,7 +359,7 @@ des_setkey(key)
358 const char *key; 359 const char *key;
359{ 360{
360 u_int32_t k0, k1, rawkey0, rawkey1; 361 u_int32_t k0, k1, rawkey0, rawkey1;
361 int shifts, i, b, round; 362 int shifts, round;
362 363
363 if (!des_initialised) 364 if (!des_initialised)
364 des_init(); 365 des_init();
@@ -405,7 +406,6 @@ des_setkey(key)
405 shifts = 0; 406 shifts = 0;
406 for (round = 0; round < 16; round++) { 407 for (round = 0; round < 16; round++) {
407 u_int32_t t0, t1; 408 u_int32_t t0, t1;
408 int bit;
409 409
410 shifts += key_shifts[round]; 410 shifts += key_shifts[round];
411 411
@@ -443,9 +443,9 @@ do_des(l_in, r_in, l_out, r_out, count)
443 /* 443 /*
444 * l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format. 444 * l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format.
445 */ 445 */
446 u_int32_t mask, rawl, rawr, l, r, *kl, *kr, *kl1, *kr1; 446 u_int32_t l, r, *kl, *kr, *kl1, *kr1;
447 u_int32_t f, r48l, r48r; 447 u_int32_t f, r48l, r48r;
448 int i, j, b, round; 448 int round;
449 449
450 if (count == 0) { 450 if (count == 0) {
451 return(1); 451 return(1);
@@ -592,8 +592,8 @@ des_cipher(in, out, salt, count)
592 592
593char * 593char *
594crypt(key, setting) 594crypt(key, setting)
595 char *key; 595 const char *key;
596 char *setting; 596 const char *setting;
597{ 597{
598 int i; 598 int i;
599 u_int32_t count, salt, l, r0, r1, keybuf[2]; 599 u_int32_t count, salt, l, r0, r1, keybuf[2];
@@ -644,7 +644,7 @@ crypt(key, setting)
644 if (des_setkey((u_char *) keybuf)) 644 if (des_setkey((u_char *) keybuf))
645 return(NULL); 645 return(NULL);
646 } 646 }
647 strncpy(output, setting, 9); 647 strncpy((char *)output, setting, 9);
648 648
649 /* 649 /*
650 * Double check that we weren't given a short setting. 650 * Double check that we weren't given a short setting.
@@ -654,7 +654,7 @@ crypt(key, setting)
654 * NUL in it. 654 * NUL in it.
655 */ 655 */
656 output[9] = '\0'; 656 output[9] = '\0';
657 p = output + strlen(output); 657 p = output + strlen((const char *)output);
658 } else { 658 } else {
659 /* 659 /*
660 * "old"-style: 660 * "old"-style:
@@ -704,5 +704,5 @@ crypt(key, setting)
704 *p++ = ascii64[l & 0x3f]; 704 *p++ = ascii64[l & 0x3f];
705 *p = 0; 705 *p = 0;
706 706
707 return(output); 707 return((char *)output);
708} 708}
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];
178static u_int32_t comp_maskl[8][128], comp_maskr[8][128]; 178static u_int32_t comp_maskl[8][128], comp_maskr[8][128];
179static u_int32_t old_rawkey0, old_rawkey1; 179static u_int32_t old_rawkey0, old_rawkey1;
180 180
181static u_char ascii64[] = 181static __inline int
182 "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
183/* 0000000000111111111122222222223333333333444444444455555555556666 */
184/* 0123456789012345678901234567890123456789012345678901234567890123 */
185
186static inline int
187ascii_to_bin(ch) 182ascii_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
476des_cipher(in, out, salt, count) 471des_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
594int 588int
595setkey(key) 589setkey(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++)