00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef set_key
00025 #undef set_key
00026 #endif
00027 #ifdef cbc_encrypt
00028 #undef cbc_encrypt
00029 #endif
00030 #ifdef cbc_decrypt
00031 #undef cbc_decrypt
00032 #endif
00033 #ifdef des_set_key
00034 #undef des_set_key
00035 #endif
00036 #ifdef GCRYPT
00037 #include <gcrypt.h>
00038 #endif
00039
00040 struct crypto_struct {
00041 char *name;
00042 unsigned int blocksize;
00043 unsigned int keylen;
00044 #ifdef HAVE_LIBGCRYPT
00045 gcry_cipher_hd_t *key;
00046 #elif defined HAVE_LIBCRYPTO
00047 void *key;
00048 #endif
00049 unsigned int keysize;
00050 #ifdef HAVE_LIBGCRYPT
00051 void (*set_encrypt_key)(struct crypto_struct *cipher, void *key, void *IV);
00052 void (*set_decrypt_key)(struct crypto_struct *cipher, void *key, void *IV);
00053 void (*cbc_encrypt)(struct crypto_struct *cipher, void *in, void *out,unsigned long len);
00054 void (*cbc_decrypt)(struct crypto_struct *cipher, void *in, void *out,unsigned long len);
00055 #elif defined HAVE_LIBCRYPTO
00056 void (*set_encrypt_key)(struct crypto_struct *cipher, void *key);
00057 void (*set_decrypt_key)(struct crypto_struct *cipher, void *key);
00058 void (*cbc_encrypt)(struct crypto_struct *cipher, void *in, void *out,unsigned long len,void *IV);
00059 void (*cbc_decrypt)(struct crypto_struct *cipher, void *in, void *out,unsigned long len,void *IV);
00060 #endif
00061 };
00062