X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fdes%2Fenc_read.c;h=5881caf3d54cf4ab0c73073790d58db2af41cdd5;hb=9e09eebf94c933686077a1b1b2d60248acb9ba67;hp=3e5ac09875b86d0d90cdbbdba247f80a8dbd5b2e;hpb=7c0f3d09b32ee1882ee309b660e82bc3077f42db;p=oweals%2Fopenssl.git diff --git a/crypto/des/enc_read.c b/crypto/des/enc_read.c index 3e5ac09875..5881caf3d5 100644 --- a/crypto/des/enc_read.c +++ b/crypto/des/enc_read.c @@ -63,7 +63,7 @@ /* This has some uglies in it but it works - even over sockets. */ /*extern int errno;*/ -int des_rw_mode=DES_PCBC_MODE; +OPENSSL_IMPLEMENT_GLOBAL(int,des_rw_mode)=DES_PCBC_MODE; /* @@ -84,12 +84,8 @@ int des_rw_mode=DES_PCBC_MODE; */ -int des_enc_read(fd, buf, len, sched, iv) -int fd; -char *buf; -int len; -des_key_schedule sched; -des_cblock iv; +int des_enc_read(int fd, void *buf, int len, des_key_schedule *sched, + des_cblock *iv) { /* data to be unencrypted */ int net_num=0; @@ -97,27 +93,27 @@ des_cblock iv; /* 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=OPENSSL_malloc(BSIZE); if (tmpbuf == NULL) return(-1); } if (net == NULL) { - net=(unsigned char *)Malloc(BSIZE); + net=OPENSSL_malloc(BSIZE); if (net == NULL) return(-1); } if (unnet == NULL) { - unnet=(char *)Malloc(BSIZE); + unnet=OPENSSL_malloc(BSIZE); if (unnet == NULL) return(-1); } /* left over data from last decrypt */ @@ -129,7 +125,7 @@ des_cblock iv; * with the number of bytes we have - should always * check the return value */ memcpy(buf,&(unnet[unnet_start]), - (unsigned int)unnet_left); + unnet_left); /* eay 26/08/92 I had the next 2 lines * reversed :-( */ i=unnet_left; @@ -137,7 +133,7 @@ des_cblock iv; } else { - memcpy(buf,&(unnet[unnet_start]),(unsigned int)len); + memcpy(buf,&(unnet[unnet_start]),len); unnet_start+=len; unnet_left-=len; i=len; @@ -151,7 +147,7 @@ des_cblock iv; /* first - get the length */ while (net_num < HDRSIZE) { - i=read(fd,&(net[net_num]),(unsigned int)HDRSIZE-net_num); + i=read(fd,(void *)&(net[net_num]),HDRSIZE-net_num); #ifdef EINTR if ((i == -1) && (errno == EINTR)) continue; #endif @@ -173,7 +169,7 @@ des_cblock iv; net_num=0; while (net_num < rnum) { - i=read(fd,&(net[net_num]),(unsigned int)rnum-net_num); + i=read(fd,(void *)&(net[net_num]),rnum-net_num); #ifdef EINTR if ((i == -1) && (errno == EINTR)) continue; #endif @@ -188,9 +184,9 @@ des_cblock iv; des_pcbc_encrypt(net,unnet,num,sched,iv,DES_DECRYPT); else des_cbc_encrypt(net,unnet,num,sched,iv,DES_DECRYPT); - memcpy(buf,unnet,(unsigned int)len); + memcpy(buf,unnet,len); unnet_start=len; - unnet_left=(int)num-len; + unnet_left=num-len; /* The following line is done because we return num * as the number of bytes read. */ @@ -215,7 +211,7 @@ des_cblock iv; /* eay 26/08/92 fix a bug that returned more * bytes than you asked for (returned len bytes :-( */ - memcpy(buf,tmpbuf,(unsigned int)num); + memcpy(buf,tmpbuf,num); } else { @@ -227,6 +223,6 @@ des_cblock iv; DES_DECRYPT); } } - return((int)num); + return num; }