diff --git a/cipher/Makefile.am b/cipher/Makefile.am deleted file mode 100644 index c0e6e0d3..00000000 --- a/cipher/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -## Process this file with automake to get Makefile.in - -noinst_LTLIBRARIES = libcipher.la - -INCLUDES = -I. -I$(top_builddir) -I$(top_srcdir)/src - -libcipher_la_SOURCES = cipher.c - -libcipher_la_LDFLAGS = - -noinst_HEADERS = cipher.h - -CFLAGS = @CFLAGS@ -DPKGLIBDIR="\"$(pkglibdir)/\"" diff --git a/cipher/cipher.c b/cipher/cipher.c deleted file mode 100644 index c9b7e3f5..00000000 --- a/cipher/cipher.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - cipher.c -- wrapper functions for encryption algorithms - Copyright (C) 1999,2000 Ivo Timmermans - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "config.h" - -#include -#include -#include - -#include - -#include - -#include "net.h" - -void (*blowfish_cfb64_encrypt) (unsigned char*, unsigned char*, int, - BF_KEY*, unsigned char*, int*, int) = NULL; -void (*blowfish_set_key) (BF_KEY*, int, char*) = NULL; - -unsigned char initvec[] = { 0x22, 0x7b, 0xad, 0x55, 0x41, 0xf4, 0x3e, 0xf3 }; -BF_KEY encryption_key; - -void low_crypt_key(unsigned char *in, unsigned char *out, BF_KEY *k, long len, int c) -{ - int count = 7; - unsigned char ivec[8]; - - memcpy(ivec, initvec, 8); - - blowfish_cfb64_encrypt(in, out, len, k, &ivec[0], &count, c); -} - -void do_encrypt(vpn_packet_t *in, real_packet_t *out, enc_key_t *key) -{ - unsigned char ivec[8]; - int r; - - memcpy(ivec, initvec, 8); - cipher_set_key(&encryption_key, key->length, key->key); - low_crypt_key((char*)(&in->data), (char*)(&out->data.data), - &encryption_key, in->len, BF_ENCRYPT); - - out->len = in->len + 2; - r = (in->len + 2) % 8; - if(r) - out->len += (8-r); - out->len += 8; - /* The smallest multiple of 8 greater - than or equal to in->len + 8 */ - - out->data.len = in->len; -} - -void do_decrypt(real_packet_t *in, vpn_packet_t *out, enc_key_t *key) -{ - unsigned char ivec[8]; - - memcpy(ivec, initvec, 8); - cipher_set_key(&encryption_key, key->length, key->key); - low_crypt_key((char*)(&in->data.data), (char*)(&out->data), - &encryption_key, in->data.len, BF_DECRYPT); - out->len = in->data.len; -} - -void cipher_set_key(BF_KEY *k, int l, char *t) -{ - blowfish_set_key(k, l, t); -} - -int cipher_init(int which) -{ - void *dlhandle; - char *error; - - blowfish_cfb64_encrypt = BF_cfb64_encrypt; - blowfish_set_key = BF_set_key; - - return 0; -} diff --git a/cipher/cipher.h b/cipher/cipher.h deleted file mode 100644 index 460ce5c1..00000000 --- a/cipher/cipher.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - cipher.c -- header file for cipher.c - Copyright (C) 1999,2000 Ivo Timmermans - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef __TINC_CIPHER_H__ -#define __TINC_CIPHER_H__ - -#include -#include "net.h" - -enum { - CIPHER_BLOWFISH = 1, - CIPHER_IDEA -}; - -extern BF_KEY encryption_key; - -void low_crypt_key(unsigned char*, unsigned char*, BF_KEY*, long, int); - -void do_encrypt(vpn_packet_t *in, real_packet_t *out, enc_key_t *); -void do_decrypt(real_packet_t *in, vpn_packet_t *out, enc_key_t *); - -void cipher_set_key(BF_KEY*, int, char*); -int cipher_init(int); - -#endif /* __TINC_CIPHER_H__ */