From: Ulf Möller <ulf@openssl.org>
Date: Tue, 20 Apr 1999 22:50:42 +0000 (+0000)
Subject: Fix lots of warnings.
X-Git-Tag: OpenSSL_0_9_3beta1~294
X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=95dc05bc6d0dfe0f3f3681f5e27afbc3f7a35eea;p=oweals%2Fopenssl.git

Fix lots of warnings.

Submitted by: Richard Levitte <levitte@stacken.kth.se>
---

diff --git a/CHANGES b/CHANGES
index dc90ee9d15..daebe649e6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,13 @@
 
  Changes between 0.9.2b and 0.9.3
 
+  *) Fix lots of warnings.
+     [Richard Levitte <levitte@stacken.kth.se>]
+ 
+  *) In add_cert_dir() in crypto/x509/by_dir.c, break out of the loop if
+     the directory spec didn't end with a LIST_SEPARATOR_CHAR.
+	 [Richard Levitte <levitte@stacken.kth.se>]
+ 
   *) Fix problems with sizeof(long) == 8.
      [Andy Polyakov <appro@fy.chalmers.se>]
 
diff --git a/apps/ca.c b/apps/ca.c
index 7cdf14d7ca..5ce0dc202b 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -64,6 +64,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include "apps.h"
+#include "conf.h"
 #include "bio.h"
 #include "err.h"
 #include "bn.h"
@@ -73,7 +74,6 @@
 #include "x509v3.h"
 #include "objects.h"
 #include "pem.h"
-#include "conf.h"
 
 #ifndef W_OK
 #include <sys/file.h>
diff --git a/apps/nseq.c b/apps/nseq.c
index 3c70e4d2be..a36f29f518 100644
--- a/apps/nseq.c
+++ b/apps/nseq.c
@@ -57,6 +57,7 @@
  */
 
 #include <stdio.h>
+#include <string.h>
 #include "pem.h"
 #include "err.h"
 #include "apps.h"
diff --git a/apps/req.c b/apps/req.c
index ce7e318777..69f371697b 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -826,7 +826,7 @@ end:
 static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, int attribs)
 	{
 	int ret=0,i;
-	unsigned char *p,*q;
+	char *p,*q;
 	X509_REQ_INFO *ri;
 	char buf[100];
 	int nid,min,max;
diff --git a/apps/s_socket.c b/apps/s_socket.c
index 19b9abbba6..9c08ec0985 100644
--- a/apps/s_socket.c
+++ b/apps/s_socket.c
@@ -208,7 +208,8 @@ int init_client_ip(int *sock, unsigned char ip[4], int port)
 
 int nbio_sock_error(int sock)
 	{
-	int j,i,size;
+	int j,i;
+	unsigned int size;
 
 	size=sizeof(int);
 	i=getsockopt(sock,SOL_SOCKET,SO_ERROR,(char *)&j,&size);
@@ -359,7 +360,7 @@ int do_accept(int acc_sock, int *sock, char **host)
 	int ret,i;
 	struct hostent *h1,*h2;
 	static struct sockaddr_in from;
-	int len;
+	unsigned int len;
 /*	struct linger ling; */
 
 	if (!sock_init()) return(0);
diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c
index d14a7797fd..d3c1345d0b 100644
--- a/crypto/bio/b_sock.c
+++ b/crypto/bio/b_sock.c
@@ -195,7 +195,8 @@ int BIO_get_port(const char *str, unsigned short *port_ptr)
 
 int BIO_sock_error(int sock)
 	{
-	int j,i,size;
+	int j,i;
+	unsigned int size;
 		 
 	size=sizeof(int);
 
@@ -592,7 +593,7 @@ int BIO_accept(int sock, char **addr)
 	static struct sockaddr_in from;
 	unsigned long l;
 	unsigned short port;
-	int len;
+	unsigned int len;
 	char *p;
 
 	memset((char *)&from,0,sizeof(from));
diff --git a/crypto/conf/test.c b/crypto/conf/test.c
index c48b60faf0..9df6715d55 100644
--- a/crypto/conf/test.c
+++ b/crypto/conf/test.c
@@ -59,6 +59,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "conf.h"
+#include "err.h"
 
 main()
 	{
diff --git a/crypto/des/destest.c b/crypto/des/destest.c
index fb69b123d5..61e8530465 100644
--- a/crypto/des/destest.c
+++ b/crypto/des/destest.c
@@ -229,7 +229,7 @@ static unsigned char cbc_iv  [8]={0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10};
 /* Changed the following text constant to binary so it will work on ebcdic
  * machines :-) */
 /* static char cbc_data[40]="7654321 Now is the time for \0001"; */
-static char cbc_data[40]={
+static unsigned char cbc_data[40]={
 	0x37,0x36,0x35,0x34,0x33,0x32,0x31,0x20,
 	0x4E,0x6F,0x77,0x20,0x69,0x73,0x20,0x74,
 	0x68,0x65,0x20,0x74,0x69,0x6D,0x65,0x20,
diff --git a/crypto/des/enc_read.c b/crypto/des/enc_read.c
index a33e2496b4..ed0f8f059d 100644
--- a/crypto/des/enc_read.c
+++ b/crypto/des/enc_read.c
@@ -93,17 +93,17 @@ int des_enc_read(int fd, char *buf, int len, des_key_schedule sched,
 	/* extra unencrypted data 
 	 * for when a block of 100 comes in but is des_read one byte at
 	 * a time. */
-	static char *unnet=NULL;
+	static unsigned char *unnet=NULL;
 	static int unnet_start=0;
 	static int unnet_left=0;
-	static char *tmpbuf=NULL;
+	static unsigned char *tmpbuf=NULL;
 	int i;
 	long num=0,rnum;
 	unsigned char *p;
 
 	if (tmpbuf == NULL)
 		{
-		tmpbuf=(char *)Malloc(BSIZE);
+		tmpbuf=(unsigned char *)Malloc(BSIZE);
 		if (tmpbuf == NULL) return(-1);
 		}
 	if (net == NULL)
@@ -113,7 +113,7 @@ int des_enc_read(int fd, char *buf, int len, des_key_schedule sched,
 		}
 	if (unnet == NULL)
 		{
-		unnet=(char *)Malloc(BSIZE);
+		unnet=(unsigned char *)Malloc(BSIZE);
 		if (unnet == NULL) return(-1);
 		}
 	/* left over data from last decrypt */
@@ -216,11 +216,11 @@ int des_enc_read(int fd, char *buf, int len, des_key_schedule sched,
 		else
 			{
 			if (des_rw_mode & DES_PCBC_MODE)
-				des_pcbc_encrypt(net,buf,num,sched,iv,
-						 DES_DECRYPT);
+				des_pcbc_encrypt(net,(unsigned char*)buf,num,
+						 sched,iv,DES_DECRYPT);
 			else
-				des_cbc_encrypt(net,buf,num,sched,iv,
-						DES_DECRYPT);
+				des_cbc_encrypt(net,(unsigned char*)buf,num,
+						sched,iv,DES_DECRYPT);
 			}
 		}
 	return((int)num);
diff --git a/crypto/des/enc_writ.c b/crypto/des/enc_writ.c
index 238c0a9c09..6690ff61d7 100644
--- a/crypto/des/enc_writ.c
+++ b/crypto/des/enc_writ.c
@@ -88,15 +88,15 @@ int des_enc_write(int fd, const char *buf, int len, des_key_schedule sched,
 
 	long rnum;
 	int i,j,k,outnum;
-	static char *outbuf=NULL;
-	char shortbuf[8];
+	static unsigned char *outbuf=NULL;
+	unsigned char shortbuf[8];
 	char *p;
-	const char *cp;
+	const unsigned char *cp;
 	static int start=1;
 
 	if (outbuf == NULL)
 		{
-		outbuf=(char *)Malloc(BSIZE+HDRSIZE);
+		outbuf=(unsigned char *)Malloc(BSIZE+HDRSIZE);
 		if (outbuf == NULL) return(-1);
 		}
 	/* If we are sending less than 8 bytes, the same char will look
@@ -138,7 +138,7 @@ int des_enc_write(int fd, const char *buf, int len, des_key_schedule sched,
 		}
 	else
 		{
-		cp=buf;
+		cp=(unsigned char*)buf;
 		rnum=((len+7)/8*8); /* round up to nearest eight */
 		}
 
diff --git a/crypto/des/str2key.c b/crypto/des/str2key.c
index 40f706beb7..7130626c0f 100644
--- a/crypto/des/str2key.c
+++ b/crypto/des/str2key.c
@@ -92,7 +92,7 @@ void des_string_to_key(const char *str, des_cblock key)
 	des_check_key=0;
 	des_set_key(key,ks);
 	des_check_key=i;
-	des_cbc_cksum(str,key,length,ks,key);
+	des_cbc_cksum((unsigned char*)str,key,length,ks,key);
 	memset(ks,0,sizeof(ks));
 	des_set_odd_parity(key);
 	}
@@ -153,9 +153,9 @@ void des_string_to_2keys(const char *str, des_cblock key1, des_cblock key2)
 	i=des_check_key;
 	des_check_key=0;
 	des_set_key(key1,ks);
-	des_cbc_cksum(str,key1,length,ks,key1);
+	des_cbc_cksum((unsigned char*)str,key1,length,ks,key1);
 	des_set_key(key2,ks);
-	des_cbc_cksum(str,key2,length,ks,key2);
+	des_cbc_cksum((unsigned char*)str,key2,length,ks,key2);
 	des_check_key=i;
 	memset(ks,0,sizeof(ks));
 	des_set_odd_parity(key1);
diff --git a/crypto/evp/bio_ok.c b/crypto/evp/bio_ok.c
index 183835b0b1..fbd6d532c6 100644
--- a/crypto/evp/bio_ok.c
+++ b/crypto/evp/bio_ok.c
@@ -468,7 +468,7 @@ static void sig_out(BIO* b)
 	longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size);
 	ctx->buf_len+= md->digest->md_size;
 
-	EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN));
+	EVP_DigestUpdate(md, (unsigned char*)WELLKNOWN, strlen(WELLKNOWN));
 	md->digest->final(&(ctx->buf[ctx->buf_len]), &(md->md.base[0]));
 	ctx->buf_len+= md->digest->md_size;
 	ctx->blockout= 1;
@@ -492,7 +492,7 @@ static void sig_in(BIO* b)
 	longswap(&(md->md.base[0]), md->digest->md_size);
 	ctx->buf_off+= md->digest->md_size;
 
-	EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN));
+	EVP_DigestUpdate(md, (unsigned char*)WELLKNOWN, strlen(WELLKNOWN));
 	md->digest->final(tmp, &(md->md.base[0]));
 	ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0;
 	ctx->buf_off+= md->digest->md_size;
@@ -525,7 +525,7 @@ static void block_out(BIO* b)
 	tl= swapem(tl);
 	memcpy(ctx->buf, &tl, OK_BLOCK_BLOCK);
 	tl= swapem(tl);
-	EVP_DigestUpdate(md, &(ctx->buf[OK_BLOCK_BLOCK]), tl);
+	EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl);
 	md->digest->final(&(ctx->buf[ctx->buf_len]), &(md->md.base[0]));
 	ctx->buf_len+= md->digest->md_size;
 	ctx->blockout= 1;
@@ -545,7 +545,7 @@ static void block_in(BIO* b)
 	tl= swapem(tl);
 	if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return;
  
-	EVP_DigestUpdate(md, &(ctx->buf[OK_BLOCK_BLOCK]), tl);
+	EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl);
 	md->digest->final(tmp, &(md->md.base[0]));
 	if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) == 0)
 		{
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
index 95c7aa92b0..dfc71b4159 100644
--- a/crypto/x509/by_dir.c
+++ b/crypto/x509/by_dir.c
@@ -197,7 +197,11 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
 			ss=s;
 			s=p+1;
 			len=(int)(p-ss);
-			if (len == 0) continue;
+			if (len == 0)
+				{
+				if (ss == p) break;
+				continue;
+				}
 			for (j=0; j<ctx->num_dirs; j++)
 				if (strncmp(ctx->dirs[j],ss,(unsigned int)len) == 0)
 					continue;
diff --git a/crypto/x509v3/v3_alt.c b/crypto/x509v3/v3_alt.c
index e9bfad8025..3823339650 100644
--- a/crypto/x509v3/v3_alt.c
+++ b/crypto/x509v3/v3_alt.c
@@ -392,7 +392,8 @@ if(!name_cmp(name, "email")) {
 
 if(is_string) {
 	if(!(gen->d.ia5 = ASN1_IA5STRING_new()) ||
-		      !ASN1_STRING_set(gen->d.ia5, value, strlen(value))) {
+		      !ASN1_STRING_set(gen->d.ia5, (unsigned char*)value,
+				       strlen(value))) {
 		X509V3err(X509V3_F_V2I_GENERAL_NAME,ERR_R_MALLOC_FAILURE);
 		goto err;
 	}
diff --git a/crypto/x509v3/v3_conf.c b/crypto/x509v3/v3_conf.c
index d2485827da..8e42bd8ac8 100644
--- a/crypto/x509v3/v3_conf.c
+++ b/crypto/x509v3/v3_conf.c
@@ -125,7 +125,7 @@ static X509_EXTENSION *do_ext_conf(LHASH *conf, X509V3_CTX *ctx, int ext_nid,
 	X509V3_EXT_METHOD *method;
 	STACK *nval;
 	char *ext_struc;
-	char *ext_der, *p;
+	unsigned char *ext_der, *p;
 	int ext_len;
 	ASN1_OCTET_STRING *ext_oct;
 	if(ext_nid == NID_undef) {
diff --git a/crypto/x509v3/v3_ia5.c b/crypto/x509v3/v3_ia5.c
index f4042915f0..d590bef0ac 100644
--- a/crypto/x509v3/v3_ia5.c
+++ b/crypto/x509v3/v3_ia5.c
@@ -110,7 +110,8 @@ static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method,
 		return NULL;
 	}
 	if(!(ia5 = ASN1_IA5STRING_new())) goto err;
-	if(!ASN1_STRING_set((ASN1_STRING *)ia5, str, strlen(str))) {
+	if(!ASN1_STRING_set((ASN1_STRING *)ia5, (unsigned char*)str,
+			    strlen(str))) {
 		ASN1_IA5STRING_free(ia5);
 		goto err;
 	}
diff --git a/crypto/x509v3/v3_prn.c b/crypto/x509v3/v3_prn.c
index d81f4088e0..8ddc16b7cd 100644
--- a/crypto/x509v3/v3_prn.c
+++ b/crypto/x509v3/v3_prn.c
@@ -87,7 +87,8 @@ void X509V3_EXT_val_prn(BIO *out, STACK *val, int indent, int ml)
 
 int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, int flag, int indent)
 {
-	char *ext_str = NULL, *p, *value = NULL;
+	char *ext_str = NULL, *value = NULL;
+	unsigned char *p;
 	X509V3_EXT_METHOD *method;	
 	STACK *nval = NULL;
 	int ok = 1;