version 1.1, 1995/10/18 08:46:00 |
version 1.2, 1995/12/16 22:20:31 |
|
|
#endif |
#endif |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
#ifdef CRYPT |
|
#ifdef KERBEROS |
#ifdef KERBEROS |
#include <sys/param.h> |
#include <sys/param.h> |
|
|
|
|
#include <time.h> |
#include <time.h> |
#include <unistd.h> |
#include <unistd.h> |
|
|
static unsigned char des_inbuf[10240], storage[10240], *store_ptr; |
static des_cblock des_inbuf[10240], storage[10240], *store_ptr; |
static bit_64 *key; |
static des_cblock *key; |
static u_char *key_schedule; |
static des_key_schedule key_schedule; |
|
|
/* XXX these should be in a kerberos include file */ |
/* XXX these should be in a kerberos include file */ |
int krb_net_read __P((int, char *, int)); |
int krb_net_read __P((int, char *, int)); |
|
|
* and the insched is the DES Key unwrapped for faster decryption |
* and the insched is the DES Key unwrapped for faster decryption |
*/ |
*/ |
|
|
void |
int |
des_set_key(inkey, insched) |
des_set_key(inkey, insched) |
bit_64 *inkey; |
des_cblock *inkey; |
u_char *insched; |
des_key_schedule insched; |
{ |
{ |
key = inkey; |
key = inkey; |
key_schedule = insched; |
bcopy(insched, key_schedule, sizeof(key_schedule)); |
|
|
|
return 0; |
} |
} |
|
|
void |
void |
|
|
return(nreturned); |
return(nreturned); |
} |
} |
|
|
static unsigned char des_outbuf[10240]; /* > longest write */ |
static des_cblock des_outbuf[10240]; /* > longest write */ |
|
|
int |
int |
des_write(fd, buf, len) |
des_write(fd, buf, len) |
|
|
int len; |
int len; |
{ |
{ |
static int seeded = 0; |
static int seeded = 0; |
static char garbage_buf[8]; |
static des_cblock garbage_buf[8]; |
long net_len, garbage; |
long net_len, garbage; |
|
|
if(len < 8) { |
if(len < 8) { |
|
|
} |
} |
/* pcbc_encrypt outputs in 8-byte (64 bit) increments */ |
/* pcbc_encrypt outputs in 8-byte (64 bit) increments */ |
|
|
(void) des_pcbc_encrypt((len < 8) ? garbage_buf : buf, |
(void) des_pcbc_encrypt((len < 8) ? garbage_buf : (des_cblock *)buf, |
des_outbuf, |
des_outbuf, |
(len < 8) ? 8 : len, |
(len < 8) ? 8 : len, |
key_schedule, /* DES key */ |
key_schedule, /* DES key */ |
|
|
return(len); |
return(len); |
} |
} |
#endif /* KERBEROS */ |
#endif /* KERBEROS */ |
#endif /* CRYPT */ |
|