Fix lots of warnings.
authorUlf Möller <ulf@openssl.org>
Tue, 20 Apr 1999 22:50:42 +0000 (22:50 +0000)
committerUlf Möller <ulf@openssl.org>
Tue, 20 Apr 1999 22:50:42 +0000 (22:50 +0000)
Submitted by: Richard Levitte <levitte@stacken.kth.se>

17 files changed:
CHANGES
apps/ca.c
apps/nseq.c
apps/req.c
apps/s_socket.c
crypto/bio/b_sock.c
crypto/conf/test.c
crypto/des/destest.c
crypto/des/enc_read.c
crypto/des/enc_writ.c
crypto/des/str2key.c
crypto/evp/bio_ok.c
crypto/x509/by_dir.c
crypto/x509v3/v3_alt.c
crypto/x509v3/v3_conf.c
crypto/x509v3/v3_ia5.c
crypto/x509v3/v3_prn.c

diff --git a/CHANGES b/CHANGES
index dc90ee9..daebe64 100644 (file)
--- 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>]
 
index 7cdf14d..5ce0dc2 100644 (file)
--- 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>
index 3c70e4d..a36f29f 100644 (file)
@@ -57,6 +57,7 @@
  */
 
 #include <stdio.h>
+#include <string.h>
 #include "pem.h"
 #include "err.h"
 #include "apps.h"
index ce7e318..69f3716 100644 (file)
@@ -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;
index 19b9abb..9c08ec0 100644 (file)
@@ -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);
index d14a779..d3c1345 100644 (file)
@@ -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));
index c48b60f..9df6715 100644 (file)
@@ -59,6 +59,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "conf.h"
+#include "err.h"
 
 main()
        {
index fb69b12..61e8530 100644 (file)
@@ -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,
index a33e249..ed0f8f0 100644 (file)
@@ -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);
index 238c0a9..6690ff6 100644 (file)
@@ -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 */
                }
 
index 40f706b..7130626 100644 (file)
@@ -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);
index 183835b..fbd6d53 100644 (file)
@@ -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)
                {
index 95c7aa9..dfc71b4 100644 (file)
@@ -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;
index e9bfad8..3823339 100644 (file)
@@ -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;
        }
index d248582..8e42bd8 100644 (file)
@@ -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) {
index f404291..d590bef 100644 (file)
@@ -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;
        }
index d81f408..8ddc16b 100644 (file)
@@ -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;