提交 95dc05bc 编写于 作者: U Ulf Möller

Fix lots of warnings.

Submitted by: Richard Levitte <levitte@stacken.kth.se>
上级 f36cd05b
...@@ -5,6 +5,13 @@ ...@@ -5,6 +5,13 @@
Changes between 0.9.2b and 0.9.3 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. *) Fix problems with sizeof(long) == 8.
[Andy Polyakov <appro@fy.chalmers.se>] [Andy Polyakov <appro@fy.chalmers.se>]
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "apps.h" #include "apps.h"
#include "conf.h"
#include "bio.h" #include "bio.h"
#include "err.h" #include "err.h"
#include "bn.h" #include "bn.h"
...@@ -73,7 +74,6 @@ ...@@ -73,7 +74,6 @@
#include "x509v3.h" #include "x509v3.h"
#include "objects.h" #include "objects.h"
#include "pem.h" #include "pem.h"
#include "conf.h"
#ifndef W_OK #ifndef W_OK
#include <sys/file.h> #include <sys/file.h>
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "pem.h" #include "pem.h"
#include "err.h" #include "err.h"
#include "apps.h" #include "apps.h"
......
...@@ -826,7 +826,7 @@ end: ...@@ -826,7 +826,7 @@ end:
static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, int attribs) static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, int attribs)
{ {
int ret=0,i; int ret=0,i;
unsigned char *p,*q; char *p,*q;
X509_REQ_INFO *ri; X509_REQ_INFO *ri;
char buf[100]; char buf[100];
int nid,min,max; int nid,min,max;
......
...@@ -208,7 +208,8 @@ int init_client_ip(int *sock, unsigned char ip[4], int port) ...@@ -208,7 +208,8 @@ int init_client_ip(int *sock, unsigned char ip[4], int port)
int nbio_sock_error(int sock) int nbio_sock_error(int sock)
{ {
int j,i,size; int j,i;
unsigned int size;
size=sizeof(int); size=sizeof(int);
i=getsockopt(sock,SOL_SOCKET,SO_ERROR,(char *)&j,&size); i=getsockopt(sock,SOL_SOCKET,SO_ERROR,(char *)&j,&size);
...@@ -359,7 +360,7 @@ int do_accept(int acc_sock, int *sock, char **host) ...@@ -359,7 +360,7 @@ int do_accept(int acc_sock, int *sock, char **host)
int ret,i; int ret,i;
struct hostent *h1,*h2; struct hostent *h1,*h2;
static struct sockaddr_in from; static struct sockaddr_in from;
int len; unsigned int len;
/* struct linger ling; */ /* struct linger ling; */
if (!sock_init()) return(0); if (!sock_init()) return(0);
......
...@@ -195,7 +195,8 @@ int BIO_get_port(const char *str, unsigned short *port_ptr) ...@@ -195,7 +195,8 @@ int BIO_get_port(const char *str, unsigned short *port_ptr)
int BIO_sock_error(int sock) int BIO_sock_error(int sock)
{ {
int j,i,size; int j,i;
unsigned int size;
size=sizeof(int); size=sizeof(int);
...@@ -592,7 +593,7 @@ int BIO_accept(int sock, char **addr) ...@@ -592,7 +593,7 @@ int BIO_accept(int sock, char **addr)
static struct sockaddr_in from; static struct sockaddr_in from;
unsigned long l; unsigned long l;
unsigned short port; unsigned short port;
int len; unsigned int len;
char *p; char *p;
memset((char *)&from,0,sizeof(from)); memset((char *)&from,0,sizeof(from));
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "conf.h" #include "conf.h"
#include "err.h"
main() main()
{ {
......
...@@ -229,7 +229,7 @@ static unsigned char cbc_iv [8]={0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10}; ...@@ -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 /* Changed the following text constant to binary so it will work on ebcdic
* machines :-) */ * machines :-) */
/* static char cbc_data[40]="7654321 Now is the time for \0001"; */ /* 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, 0x37,0x36,0x35,0x34,0x33,0x32,0x31,0x20,
0x4E,0x6F,0x77,0x20,0x69,0x73,0x20,0x74, 0x4E,0x6F,0x77,0x20,0x69,0x73,0x20,0x74,
0x68,0x65,0x20,0x74,0x69,0x6D,0x65,0x20, 0x68,0x65,0x20,0x74,0x69,0x6D,0x65,0x20,
......
...@@ -93,17 +93,17 @@ int des_enc_read(int fd, char *buf, int len, des_key_schedule sched, ...@@ -93,17 +93,17 @@ int des_enc_read(int fd, char *buf, int len, des_key_schedule sched,
/* extra unencrypted data /* extra unencrypted data
* for when a block of 100 comes in but is des_read one byte at * for when a block of 100 comes in but is des_read one byte at
* a time. */ * a time. */
static char *unnet=NULL; static unsigned char *unnet=NULL;
static int unnet_start=0; static int unnet_start=0;
static int unnet_left=0; static int unnet_left=0;
static char *tmpbuf=NULL; static unsigned char *tmpbuf=NULL;
int i; int i;
long num=0,rnum; long num=0,rnum;
unsigned char *p; unsigned char *p;
if (tmpbuf == NULL) if (tmpbuf == NULL)
{ {
tmpbuf=(char *)Malloc(BSIZE); tmpbuf=(unsigned char *)Malloc(BSIZE);
if (tmpbuf == NULL) return(-1); if (tmpbuf == NULL) return(-1);
} }
if (net == NULL) if (net == NULL)
...@@ -113,7 +113,7 @@ int des_enc_read(int fd, char *buf, int len, des_key_schedule sched, ...@@ -113,7 +113,7 @@ int des_enc_read(int fd, char *buf, int len, des_key_schedule sched,
} }
if (unnet == NULL) if (unnet == NULL)
{ {
unnet=(char *)Malloc(BSIZE); unnet=(unsigned char *)Malloc(BSIZE);
if (unnet == NULL) return(-1); if (unnet == NULL) return(-1);
} }
/* left over data from last decrypt */ /* left over data from last decrypt */
...@@ -216,11 +216,11 @@ int des_enc_read(int fd, char *buf, int len, des_key_schedule sched, ...@@ -216,11 +216,11 @@ int des_enc_read(int fd, char *buf, int len, des_key_schedule sched,
else else
{ {
if (des_rw_mode & DES_PCBC_MODE) if (des_rw_mode & DES_PCBC_MODE)
des_pcbc_encrypt(net,buf,num,sched,iv, des_pcbc_encrypt(net,(unsigned char*)buf,num,
DES_DECRYPT); sched,iv,DES_DECRYPT);
else else
des_cbc_encrypt(net,buf,num,sched,iv, des_cbc_encrypt(net,(unsigned char*)buf,num,
DES_DECRYPT); sched,iv,DES_DECRYPT);
} }
} }
return((int)num); return((int)num);
......
...@@ -88,15 +88,15 @@ int des_enc_write(int fd, const char *buf, int len, des_key_schedule sched, ...@@ -88,15 +88,15 @@ int des_enc_write(int fd, const char *buf, int len, des_key_schedule sched,
long rnum; long rnum;
int i,j,k,outnum; int i,j,k,outnum;
static char *outbuf=NULL; static unsigned char *outbuf=NULL;
char shortbuf[8]; unsigned char shortbuf[8];
char *p; char *p;
const char *cp; const unsigned char *cp;
static int start=1; static int start=1;
if (outbuf == NULL) if (outbuf == NULL)
{ {
outbuf=(char *)Malloc(BSIZE+HDRSIZE); outbuf=(unsigned char *)Malloc(BSIZE+HDRSIZE);
if (outbuf == NULL) return(-1); if (outbuf == NULL) return(-1);
} }
/* If we are sending less than 8 bytes, the same char will look /* 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, ...@@ -138,7 +138,7 @@ int des_enc_write(int fd, const char *buf, int len, des_key_schedule sched,
} }
else else
{ {
cp=buf; cp=(unsigned char*)buf;
rnum=((len+7)/8*8); /* round up to nearest eight */ rnum=((len+7)/8*8); /* round up to nearest eight */
} }
......
...@@ -92,7 +92,7 @@ void des_string_to_key(const char *str, des_cblock key) ...@@ -92,7 +92,7 @@ void des_string_to_key(const char *str, des_cblock key)
des_check_key=0; des_check_key=0;
des_set_key(key,ks); des_set_key(key,ks);
des_check_key=i; 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)); memset(ks,0,sizeof(ks));
des_set_odd_parity(key); des_set_odd_parity(key);
} }
...@@ -153,9 +153,9 @@ void des_string_to_2keys(const char *str, des_cblock key1, des_cblock key2) ...@@ -153,9 +153,9 @@ void des_string_to_2keys(const char *str, des_cblock key1, des_cblock key2)
i=des_check_key; i=des_check_key;
des_check_key=0; des_check_key=0;
des_set_key(key1,ks); 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_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; des_check_key=i;
memset(ks,0,sizeof(ks)); memset(ks,0,sizeof(ks));
des_set_odd_parity(key1); des_set_odd_parity(key1);
......
...@@ -468,7 +468,7 @@ static void sig_out(BIO* b) ...@@ -468,7 +468,7 @@ static void sig_out(BIO* b)
longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size); longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size);
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])); md->digest->final(&(ctx->buf[ctx->buf_len]), &(md->md.base[0]));
ctx->buf_len+= md->digest->md_size; ctx->buf_len+= md->digest->md_size;
ctx->blockout= 1; ctx->blockout= 1;
...@@ -492,7 +492,7 @@ static void sig_in(BIO* b) ...@@ -492,7 +492,7 @@ static void sig_in(BIO* b)
longswap(&(md->md.base[0]), md->digest->md_size); longswap(&(md->md.base[0]), md->digest->md_size);
ctx->buf_off+= 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])); md->digest->final(tmp, &(md->md.base[0]));
ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0; ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0;
ctx->buf_off+= md->digest->md_size; ctx->buf_off+= md->digest->md_size;
...@@ -525,7 +525,7 @@ static void block_out(BIO* b) ...@@ -525,7 +525,7 @@ static void block_out(BIO* b)
tl= swapem(tl); tl= swapem(tl);
memcpy(ctx->buf, &tl, OK_BLOCK_BLOCK); memcpy(ctx->buf, &tl, OK_BLOCK_BLOCK);
tl= swapem(tl); 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])); md->digest->final(&(ctx->buf[ctx->buf_len]), &(md->md.base[0]));
ctx->buf_len+= md->digest->md_size; ctx->buf_len+= md->digest->md_size;
ctx->blockout= 1; ctx->blockout= 1;
...@@ -545,7 +545,7 @@ static void block_in(BIO* b) ...@@ -545,7 +545,7 @@ static void block_in(BIO* b)
tl= swapem(tl); tl= swapem(tl);
if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return; 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])); md->digest->final(tmp, &(md->md.base[0]));
if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) == 0) if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) == 0)
{ {
......
...@@ -197,7 +197,11 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) ...@@ -197,7 +197,11 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
ss=s; ss=s;
s=p+1; s=p+1;
len=(int)(p-ss); len=(int)(p-ss);
if (len == 0) continue; if (len == 0)
{
if (ss == p) break;
continue;
}
for (j=0; j<ctx->num_dirs; j++) for (j=0; j<ctx->num_dirs; j++)
if (strncmp(ctx->dirs[j],ss,(unsigned int)len) == 0) if (strncmp(ctx->dirs[j],ss,(unsigned int)len) == 0)
continue; continue;
......
...@@ -392,7 +392,8 @@ if(!name_cmp(name, "email")) { ...@@ -392,7 +392,8 @@ if(!name_cmp(name, "email")) {
if(is_string) { if(is_string) {
if(!(gen->d.ia5 = ASN1_IA5STRING_new()) || 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); X509V3err(X509V3_F_V2I_GENERAL_NAME,ERR_R_MALLOC_FAILURE);
goto err; goto err;
} }
......
...@@ -125,7 +125,7 @@ static X509_EXTENSION *do_ext_conf(LHASH *conf, X509V3_CTX *ctx, int ext_nid, ...@@ -125,7 +125,7 @@ static X509_EXTENSION *do_ext_conf(LHASH *conf, X509V3_CTX *ctx, int ext_nid,
X509V3_EXT_METHOD *method; X509V3_EXT_METHOD *method;
STACK *nval; STACK *nval;
char *ext_struc; char *ext_struc;
char *ext_der, *p; unsigned char *ext_der, *p;
int ext_len; int ext_len;
ASN1_OCTET_STRING *ext_oct; ASN1_OCTET_STRING *ext_oct;
if(ext_nid == NID_undef) { if(ext_nid == NID_undef) {
......
...@@ -110,7 +110,8 @@ static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ...@@ -110,7 +110,8 @@ static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method,
return NULL; return NULL;
} }
if(!(ia5 = ASN1_IA5STRING_new())) goto err; 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); ASN1_IA5STRING_free(ia5);
goto err; goto err;
} }
......
...@@ -87,7 +87,8 @@ void X509V3_EXT_val_prn(BIO *out, STACK *val, int indent, int ml) ...@@ -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) 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; X509V3_EXT_METHOD *method;
STACK *nval = NULL; STACK *nval = NULL;
int ok = 1; int ok = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册