28 #include <openssl/dsa.h>    29 #include <openssl/rsa.h>    30 #include <openssl/sha.h>    31 #include <openssl/md5.h>    32 #include <openssl/hmac.h>    33 #ifdef HAVE_OPENSSL_ECC    34 #include <openssl/evp.h>    37 typedef SHA_CTX* SHACTX;
    38 typedef SHA256_CTX* SHA256CTX;
    39 typedef SHA512_CTX* SHA384CTX;
    40 typedef SHA512_CTX* SHA512CTX;
    41 typedef MD5_CTX*  MD5CTX;
    42 typedef HMAC_CTX* HMACCTX;
    44 typedef EVP_MD_CTX *EVPCTX;
    49 #define SHA_DIGEST_LEN SHA_DIGEST_LENGTH    50 #define SHA256_DIGEST_LEN SHA256_DIGEST_LENGTH    51 #define SHA384_DIGEST_LEN SHA384_DIGEST_LENGTH    52 #define SHA512_DIGEST_LEN SHA512_DIGEST_LENGTH    56 #define MD5_DIGEST_LEN MD5_DIGEST_LENGTH    58 #ifdef HAVE_OPENSSL_ECC    59 #define EVP_DIGEST_LEN EVP_MAX_MD_SIZE    62 #include <openssl/bn.h>    63 #include <openssl/opensslv.h>    64 #define OPENSSL_0_9_7b 0x0090702fL    65 #if (OPENSSL_VERSION_NUMBER <= OPENSSL_0_9_7b)    66 #define BROKEN_AES_CTR    68 typedef BIGNUM*  bignum;
    69 typedef BN_CTX* bignum_CTX;
    71 #define bignum_new() BN_new()    72 #define bignum_free(num) BN_clear_free(num)    73 #define bignum_set_word(bn,n) BN_set_word(bn,n)    74 #define bignum_bin2bn(bn,datalen,data) BN_bin2bn(bn,datalen,data)    75 #define bignum_bn2dec(num) BN_bn2dec(num)    76 #define bignum_dec2bn(bn,data) BN_dec2bn(data,bn)    77 #define bignum_bn2hex(num) BN_bn2hex(num)    78 #define bignum_rand(rnd, bits, top, bottom) BN_rand(rnd,bits,top,bottom)    79 #define bignum_ctx_new() BN_CTX_new()    80 #define bignum_ctx_free(num) BN_CTX_free(num)    81 #define bignum_mod_exp(dest,generator,exp,modulo,ctx) BN_mod_exp(dest,generator,exp,modulo,ctx)    82 #define bignum_num_bytes(num) BN_num_bytes(num)    83 #define bignum_num_bits(num) BN_num_bits(num)    84 #define bignum_is_bit_set(num,bit) BN_is_bit_set(num,bit)    85 #define bignum_bn2bin(num,ptr) BN_bn2bin(num,ptr)    86 #define bignum_cmp(num1,num2) BN_cmp(num1,num2)    88 SHA256CTX sha256_init(
void);
    89 void sha256_update(SHA256CTX c, 
const void *data, 
unsigned long len);
    90 void sha256_final(
unsigned char *md, SHA256CTX c);
    92 SHA384CTX sha384_init(
void);
    93 void sha384_update(SHA384CTX c, 
const void *data, 
unsigned long len);
    94 void sha384_final(
unsigned char *md, SHA384CTX c);
    96 SHA512CTX sha512_init(
void);
    97 void sha512_update(SHA512CTX c, 
const void *data, 
unsigned long len);
    98 void sha512_final(
unsigned char *md, SHA512CTX c);
   100 struct ssh_cipher_struct *ssh_get_ciphertab(
void);