freebsd-dev/eBones/des/3ecb_enc.c
Geoff Rehmet 60643d379b Initial import of eBones.
(Including all changes for FreeBSD - importing the original eBones distribution
would be too complex at this stage, since I don't have access to Piero's 
CVS.)
(If you want to include eBones in your system, don't forget to include
MAKE_EBONES in /etc/make.conf.)
(This stuff is now also suppable from braae.ru.ac.za.)

Bones originally from MIT SIPB.
Original port to FreeBSD 1.x  by Piero Serini.
Moved to FreeBSD 2.0 by Doug Rabson and Geoff Rehmet.
Nice bug fixes from Doug Rabson.
1994-09-30 14:50:09 +00:00

36 lines
670 B
C

/* 3ecb_enc.c */
/* Copyright (C) 1993 Eric Young - see README for more details */
/*-
* $Id: 3ecb_enc.c,v 1.2 1994/07/19 19:21:38 g89r4222 Exp $
*/
#include "des_locl.h"
int des_3ecb_encrypt(input,output,ks1,ks2,encrypt)
des_cblock *input;
des_cblock *output;
des_key_schedule ks1,ks2;
int encrypt;
{
register unsigned long l0,l1,t;
register unsigned char *in,*out;
unsigned long ll[2];
in=(unsigned char *)input;
out=(unsigned char *)output;
c2l(in,l0);
c2l(in,l1);
ll[0]=l0;
ll[1]=l1;
des_encrypt(ll,ll,ks1,encrypt);
des_encrypt(ll,ll,ks2,!encrypt);
des_encrypt(ll,ll,ks1,encrypt);
l0=ll[0];
l1=ll[1];
l2c(l0,out);
l2c(l1,out);
return(0);
}