Remove some unnecessary(?) casting.

This commit is contained in:
Ben Laurie 1999-04-21 13:25:40 +00:00
parent 4997138a06
commit cb145b995b
2 changed files with 14 additions and 14 deletions

View File

@ -103,17 +103,17 @@ int des_enc_read(int fd, char *buf, int len, des_key_schedule sched,
if (tmpbuf == NULL) if (tmpbuf == NULL)
{ {
tmpbuf=(unsigned char *)Malloc(BSIZE); tmpbuf=Malloc(BSIZE);
if (tmpbuf == NULL) return(-1); if (tmpbuf == NULL) return(-1);
} }
if (net == NULL) if (net == NULL)
{ {
net=(unsigned char *)Malloc(BSIZE); net=Malloc(BSIZE);
if (net == NULL) return(-1); if (net == NULL) return(-1);
} }
if (unnet == NULL) if (unnet == NULL)
{ {
unnet=(unsigned char *)Malloc(BSIZE); unnet=Malloc(BSIZE);
if (unnet == NULL) return(-1); if (unnet == NULL) return(-1);
} }
/* left over data from last decrypt */ /* left over data from last decrypt */
@ -147,7 +147,7 @@ int des_enc_read(int fd, char *buf, int len, des_key_schedule sched,
/* first - get the length */ /* first - get the length */
while (net_num < HDRSIZE) while (net_num < HDRSIZE)
{ {
i=read(fd,&(net[net_num]),(unsigned int)HDRSIZE-net_num); i=read(fd,&(net[net_num]),HDRSIZE-net_num);
#ifdef EINTR #ifdef EINTR
if ((i == -1) && (errno == EINTR)) continue; if ((i == -1) && (errno == EINTR)) continue;
#endif #endif
@ -169,7 +169,7 @@ int des_enc_read(int fd, char *buf, int len, des_key_schedule sched,
net_num=0; net_num=0;
while (net_num < rnum) while (net_num < rnum)
{ {
i=read(fd,&(net[net_num]),(unsigned int)rnum-net_num); i=read(fd,&(net[net_num]),rnum-net_num);
#ifdef EINTR #ifdef EINTR
if ((i == -1) && (errno == EINTR)) continue; if ((i == -1) && (errno == EINTR)) continue;
#endif #endif
@ -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,(unsigned char*)buf,num, des_pcbc_encrypt(net,buf,num,sched,iv,
sched,iv,DES_DECRYPT); DES_DECRYPT);
else else
des_cbc_encrypt(net,(unsigned char*)buf,num, des_cbc_encrypt(net,buf,num,sched,iv,
sched,iv,DES_DECRYPT); DES_DECRYPT);
} }
} }
return((int)num); return((int)num);

View File

@ -96,7 +96,7 @@ int des_enc_write(int fd, const char *buf, int len, des_key_schedule sched,
if (outbuf == NULL) if (outbuf == NULL)
{ {
outbuf=(unsigned char *)Malloc(BSIZE+HDRSIZE); outbuf=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
@ -104,7 +104,7 @@ int des_enc_write(int fd, const char *buf, int len, des_key_schedule sched,
if (start) if (start)
{ {
start=0; start=0;
srandom((unsigned int)time(NULL)); srandom(time(NULL));
} }
/* lets recurse if we want to send the data in small chunks */ /* lets recurse if we want to send the data in small chunks */
@ -131,7 +131,7 @@ int des_enc_write(int fd, const char *buf, int len, des_key_schedule sched,
if (len < 8) if (len < 8)
{ {
cp=shortbuf; cp=shortbuf;
memcpy(shortbuf,buf,(unsigned int)len); memcpy(shortbuf,buf,len);
for (i=len; i<8; i++) for (i=len; i<8; i++)
shortbuf[i]=random(); shortbuf[i]=random();
rnum=8; rnum=8;
@ -150,13 +150,13 @@ int des_enc_write(int fd, const char *buf, int len, des_key_schedule sched,
DES_ENCRYPT); DES_ENCRYPT);
/* output */ /* output */
outnum=(int)rnum+HDRSIZE; outnum=rnum+HDRSIZE;
for (j=0; j<outnum; j+=i) for (j=0; j<outnum; j+=i)
{ {
/* eay 26/08/92 I was not doing writing from where we /* eay 26/08/92 I was not doing writing from where we
* got upto. */ * got upto. */
i=write(fd,&(outbuf[j]),(unsigned int)(outnum-j)); i=write(fd,&(outbuf[j]),outnum-j);
if (i == -1) if (i == -1)
{ {
if (errno == EINTR) if (errno == EINTR)