summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortholo <>1996-12-14 06:49:39 +0000
committertholo <>1996-12-14 06:49:39 +0000
commita02c1dbdec1e34a65d6087bdbcb4ad090c5559d6 (patch)
tree804c0a39403d71933fe645283d36fa9f22b441ae /src/lib
parent585c056622af4adfe762a48f81c1ff7060880fea (diff)
downloadopenbsd-a02c1dbdec1e34a65d6087bdbcb4ad090c5559d6.tar.gz
openbsd-a02c1dbdec1e34a65d6087bdbcb4ad090c5559d6.tar.bz2
openbsd-a02c1dbdec1e34a65d6087bdbcb4ad090c5559d6.zip
Clean up lint and compile warnings
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libc/crypt/md5crypt.c36
-rw-r--r--src/lib/libc/net/res_mkquery.c4
2 files changed, 20 insertions, 20 deletions
diff --git a/src/lib/libc/crypt/md5crypt.c b/src/lib/libc/crypt/md5crypt.c
index 4b99360f10..e8af0cb08c 100644
--- a/src/lib/libc/crypt/md5crypt.c
+++ b/src/lib/libc/crypt/md5crypt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: md5crypt.c,v 1.6 1996/10/15 09:25:32 deraadt Exp $ */ 1/* $OpenBSD: md5crypt.c,v 1.7 1996/12/14 06:49:36 tholo Exp $ */
2 2
3/* 3/*
4 * ---------------------------------------------------------------------------- 4 * ----------------------------------------------------------------------------
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#if defined(LIBC_SCCS) && !defined(lint) 15#if defined(LIBC_SCCS) && !defined(lint)
16static char rcsid[] = "$OpenBSD: md5crypt.c,v 1.6 1996/10/15 09:25:32 deraadt Exp $"; 16static char rcsid[] = "$OpenBSD: md5crypt.c,v 1.7 1996/12/14 06:49:36 tholo Exp $";
17#endif /* LIBC_SCCS and not lint */ 17#endif /* LIBC_SCCS and not lint */
18 18
19#include <unistd.h> 19#include <unistd.h>
@@ -54,21 +54,21 @@ md5crypt(pw, salt)
54 * This string is magic for this algorithm. Having 54 * This string is magic for this algorithm. Having
55 * it this way, we can get get better later on 55 * it this way, we can get get better later on
56 */ 56 */
57 static char *magic = "$1$"; 57 static unsigned char *magic = (unsigned char *)"$1$";
58 58
59 static char passwd[120], *p; 59 static char passwd[120], *p;
60 static const char *sp,*ep; 60 static const unsigned char *sp,*ep;
61 unsigned char final[16]; 61 unsigned char final[16];
62 int sl,pl,i,j; 62 int sl,pl,i;
63 MD5_CTX ctx,ctx1; 63 MD5_CTX ctx,ctx1;
64 unsigned long l; 64 unsigned long l;
65 65
66 /* Refine the Salt first */ 66 /* Refine the Salt first */
67 sp = salt; 67 sp = (const unsigned char *)salt;
68 68
69 /* If it starts with the magic string, then skip that */ 69 /* If it starts with the magic string, then skip that */
70 if(!strncmp(sp,magic,strlen(magic))) 70 if(!strncmp((const char *)sp,(const char *)magic,strlen((const char *)magic)))
71 sp += strlen(magic); 71 sp += strlen((const char *)magic);
72 72
73 /* It stops at the first '$', max 8 chars */ 73 /* It stops at the first '$', max 8 chars */
74 for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++) 74 for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++)
@@ -80,19 +80,19 @@ md5crypt(pw, salt)
80 MD5Init(&ctx); 80 MD5Init(&ctx);
81 81
82 /* The password first, since that is what is most unknown */ 82 /* The password first, since that is what is most unknown */
83 MD5Update(&ctx,pw,strlen(pw)); 83 MD5Update(&ctx,(const unsigned char *)pw,strlen(pw));
84 84
85 /* Then our magic string */ 85 /* Then our magic string */
86 MD5Update(&ctx,magic,strlen(magic)); 86 MD5Update(&ctx,magic,strlen((const char *)magic));
87 87
88 /* Then the raw salt */ 88 /* Then the raw salt */
89 MD5Update(&ctx,sp,sl); 89 MD5Update(&ctx,sp,sl);
90 90
91 /* Then just as many characters of the MD5(pw,salt,pw) */ 91 /* Then just as many characters of the MD5(pw,salt,pw) */
92 MD5Init(&ctx1); 92 MD5Init(&ctx1);
93 MD5Update(&ctx1,pw,strlen(pw)); 93 MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
94 MD5Update(&ctx1,sp,sl); 94 MD5Update(&ctx1,sp,sl);
95 MD5Update(&ctx1,pw,strlen(pw)); 95 MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
96 MD5Final(final,&ctx1); 96 MD5Final(final,&ctx1);
97 for(pl = strlen(pw); pl > 0; pl -= 16) 97 for(pl = strlen(pw); pl > 0; pl -= 16)
98 MD5Update(&ctx,final,pl>16 ? 16 : pl); 98 MD5Update(&ctx,final,pl>16 ? 16 : pl);
@@ -105,11 +105,11 @@ md5crypt(pw, salt)
105 if(i&1) 105 if(i&1)
106 MD5Update(&ctx, final, 1); 106 MD5Update(&ctx, final, 1);
107 else 107 else
108 MD5Update(&ctx, pw, 1); 108 MD5Update(&ctx, (const unsigned char *)pw, 1);
109 109
110 /* Now make the output string */ 110 /* Now make the output string */
111 strcpy(passwd,magic); 111 strcpy(passwd,(const char *)magic);
112 strncat(passwd,sp,sl); 112 strncat(passwd,(const char *)sp,sl);
113 strcat(passwd,"$"); 113 strcat(passwd,"$");
114 114
115 MD5Final(final,&ctx); 115 MD5Final(final,&ctx);
@@ -122,7 +122,7 @@ md5crypt(pw, salt)
122 for(i=0;i<1000;i++) { 122 for(i=0;i<1000;i++) {
123 MD5Init(&ctx1); 123 MD5Init(&ctx1);
124 if(i & 1) 124 if(i & 1)
125 MD5Update(&ctx1,pw,strlen(pw)); 125 MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
126 else 126 else
127 MD5Update(&ctx1,final,16); 127 MD5Update(&ctx1,final,16);
128 128
@@ -130,12 +130,12 @@ md5crypt(pw, salt)
130 MD5Update(&ctx1,sp,sl); 130 MD5Update(&ctx1,sp,sl);
131 131
132 if(i % 7) 132 if(i % 7)
133 MD5Update(&ctx1,pw,strlen(pw)); 133 MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
134 134
135 if(i & 1) 135 if(i & 1)
136 MD5Update(&ctx1,final,16); 136 MD5Update(&ctx1,final,16);
137 else 137 else
138 MD5Update(&ctx1,pw,strlen(pw)); 138 MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
139 MD5Final(final,&ctx1); 139 MD5Final(final,&ctx1);
140 } 140 }
141 141
diff --git a/src/lib/libc/net/res_mkquery.c b/src/lib/libc/net/res_mkquery.c
index 02b64e9886..6fbd6a3859 100644
--- a/src/lib/libc/net/res_mkquery.c
+++ b/src/lib/libc/net/res_mkquery.c
@@ -52,7 +52,7 @@
52 */ 52 */
53 53
54#if defined(LIBC_SCCS) && !defined(lint) 54#if defined(LIBC_SCCS) && !defined(lint)
55static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.4 1996/09/15 09:31:20 tholo Exp $"; 55static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.5 1996/12/14 06:49:39 tholo Exp $";
56#endif /* LIBC_SCCS and not lint */ 56#endif /* LIBC_SCCS and not lint */
57 57
58#include <sys/param.h> 58#include <sys/param.h>
@@ -132,7 +132,7 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen)
132 * Make an additional record for completion domain. 132 * Make an additional record for completion domain.
133 */ 133 */
134 buflen -= RRFIXEDSZ; 134 buflen -= RRFIXEDSZ;
135 if ((n = dn_comp(data, cp, buflen, dnptrs, lastdnptr)) < 0) 135 if ((n = dn_comp((const char *)data, cp, buflen, dnptrs, lastdnptr)) < 0)
136 return (-1); 136 return (-1);
137 cp += n; 137 cp += n;
138 buflen -= n; 138 buflen -= n;