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