version 1.4, 1996/06/26 05:38:30 |
version 1.5, 1996/11/11 05:59:44 |
|
|
#include <unistd.h> |
#include <unistd.h> |
|
|
static unsigned char des_inbuf[10240], storage[10240], *store_ptr; |
static unsigned char 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; |
|
|
/* |
/* |
* NB: These routines will not function properly if NBIO |
* NB: These routines will not function properly if NBIO |
|
|
|
|
void |
void |
desrw_set_key(inkey, insched) |
desrw_set_key(inkey, insched) |
bit_64 *inkey; |
des_cblock *inkey; |
u_char *insched; |
des_key_schedule*insched; |
{ |
{ |
key = inkey; |
key = inkey; |
key_schedule = insched; |
key_schedule = insched; |
|
|
(void) des_pcbc_encrypt((des_cblock *)des_inbuf, /* inbuf */ |
(void) des_pcbc_encrypt((des_cblock *)des_inbuf, /* inbuf */ |
(des_cblock *)storage, /* outbuf */ |
(des_cblock *)storage, /* outbuf */ |
rd_len, /* length */ |
rd_len, /* length */ |
key_schedule, /* DES key */ |
*key_schedule, /* DES key */ |
(des_cblock *)key, /* IV */ |
key, /* IV */ |
DECRYPT); /* direction */ |
DECRYPT); /* direction */ |
|
|
if(net_len < 8) |
if(net_len < 8) |
|
|
(void) des_pcbc_encrypt((des_cblock *)((len < 8) ? garbage_buf : buf), |
(void) des_pcbc_encrypt((des_cblock *)((len < 8) ? garbage_buf : buf), |
(des_cblock *)des_outbuf, |
(des_cblock *)des_outbuf, |
(len < 8) ? 8 : len, |
(len < 8) ? 8 : len, |
key_schedule, /* DES key */ |
*key_schedule, /* DES key */ |
(des_cblock *)key, /* IV */ |
key, /* IV */ |
ENCRYPT); |
ENCRYPT); |
|
|
/* tell the other end the real amount, but send an 8-byte padded |
/* tell the other end the real amount, but send an 8-byte padded |