• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

include/libssh/libcrypto.h

00001 /*
00002  * This file is part of the SSH Library
00003  *
00004  * Copyright (c) 2009 by Aris Adamantiadis
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 
00022 #ifndef LIBCRYPTO_H_
00023 #define LIBCRYPTO_H_
00024 
00025 #include "config.h"
00026 
00027 #ifdef HAVE_LIBCRYPTO
00028 
00029 #include <openssl/dsa.h>
00030 #include <openssl/rsa.h>
00031 #include <openssl/sha.h>
00032 #include <openssl/md5.h>
00033 #include <openssl/hmac.h>
00034 typedef SHA_CTX* SHACTX;
00035 typedef MD5_CTX*  MD5CTX;
00036 typedef HMAC_CTX* HMACCTX;
00037 
00038 #define SHA_DIGEST_LEN SHA_DIGEST_LENGTH
00039 #ifdef MD5_DIGEST_LEN
00040     #undef MD5_DIGEST_LEN
00041 #endif
00042 #define MD5_DIGEST_LEN MD5_DIGEST_LENGTH
00043 
00044 #include <openssl/bn.h>
00045 #include <openssl/opensslv.h>
00046 #define OPENSSL_0_9_7b 0x0090702fL
00047 #if (OPENSSL_VERSION_NUMBER <= OPENSSL_0_9_7b)
00048 #define BROKEN_AES_CTR
00049 #endif
00050 typedef BIGNUM*  bignum;
00051 typedef BN_CTX* bignum_CTX;
00052 
00053 #define bignum_new() BN_new()
00054 #define bignum_free(num) BN_clear_free(num)
00055 #define bignum_set_word(bn,n) BN_set_word(bn,n)
00056 #define bignum_bin2bn(bn,datalen,data) BN_bin2bn(bn,datalen,data)
00057 #define bignum_bn2dec(num) BN_bn2dec(num)
00058 #define bignum_dec2bn(bn,data) BN_dec2bn(data,bn)
00059 #define bignum_bn2hex(num) BN_bn2hex(num)
00060 #define bignum_rand(rnd, bits, top, bottom) BN_rand(rnd,bits,top,bottom)
00061 #define bignum_ctx_new() BN_CTX_new()
00062 #define bignum_ctx_free(num) BN_CTX_free(num)
00063 #define bignum_mod_exp(dest,generator,exp,modulo,ctx) BN_mod_exp(dest,generator,exp,modulo,ctx)
00064 #define bignum_num_bytes(num) BN_num_bytes(num)
00065 #define bignum_num_bits(num) BN_num_bits(num)
00066 #define bignum_is_bit_set(num,bit) BN_is_bit_set(num,bit)
00067 #define bignum_bn2bin(num,ptr) BN_bn2bin(num,ptr)
00068 #define bignum_cmp(num1,num2) BN_cmp(num1,num2)
00069 
00070 struct crypto_struct *ssh_get_ciphertab(void);
00071 
00072 #endif /* HAVE_LIBCRYPTO */
00073 
00074 #endif /* LIBCRYPTO_H_ */

Generated by  doxygen 1.7.1