include/libssh/crypto.h

00001 /*
00002 Copyright 2003 Aris Adamantiadis
00003 
00004 This file is part of the SSH Library
00005 
00006 The SSH Library is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU Lesser General Public License as published by
00008 the Free Software Foundation; either version 2.1 of the License, or (at your
00009 option) any later version.
00010 
00011 The SSH Library is distributed in the hope that it will be useful, but
00012 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00013 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00014 License for more details.
00015 
00016 You should have received a copy of the GNU Lesser General Public License
00017 along with the SSH Library; see the file COPYING.  If not, write to
00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00019 MA 02111-1307, USA. */
00020 
00021 /* Crypto.h is an include file for internal structures of libssh */
00022 /* It hasn't to be into the final development set of files (and btw the filename would cause problems on most systems) */
00023 /* Openssl has (really) stupid defines */
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; /* ssh name of the algorithm */
00042     unsigned int blocksize; /* blocksize of the algo */
00043     unsigned int keylen; /* length of the key structure */
00044 #ifdef HAVE_LIBGCRYPT
00045     gcry_cipher_hd_t *key;
00046 #elif defined HAVE_LIBCRYPTO
00047     void *key; /* a key buffer allocated for the algo */
00048 #endif
00049     unsigned int keysize; /* bytes of key used. != keylen */
00050 #ifdef HAVE_LIBGCRYPT
00051     void (*set_encrypt_key)(struct crypto_struct *cipher, void *key, void *IV); /* sets the new key for immediate use */
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); /* sets the new key for immediate use */
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 

Generated on Thu Aug 16 16:17:23 2007 for libssh by  doxygen 1.5.3