diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-14 01:22:22 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-14 01:22:22 +0200 |
commit | 2234c115f25ccf606d28981711bc75871fbd2505 (patch) | |
tree | f8ecf0d195070ebe06f2b5a553941230c65cfdcb /include/libssh/wrapper.h | |
parent | b23b3f1d9951df3ea7cc074de40db04bdf0d3a1c (diff) | |
download | libssh-2234c115f25ccf606d28981711bc75871fbd2505.tar.gz libssh-2234c115f25ccf606d28981711bc75871fbd2505.tar.xz libssh-2234c115f25ccf606d28981711bc75871fbd2505.zip |
Separation work between openssl and libgcrypt
Diffstat (limited to 'include/libssh/wrapper.h')
-rw-r--r-- | include/libssh/wrapper.h | 75 |
1 files changed, 2 insertions, 73 deletions
diff --git a/include/libssh/wrapper.h b/include/libssh/wrapper.h index 71ed81f4..8c034970 100644 --- a/include/libssh/wrapper.h +++ b/include/libssh/wrapper.h @@ -23,79 +23,8 @@ #define WRAPPER_H_ #include "config.h" - -#ifdef MD5_DIGEST_LEN - #undef MD5_DIGEST_LEN -#endif -/* wrapper things */ -#ifdef HAVE_LIBGCRYPT -#include <gcrypt.h> -typedef gcry_md_hd_t SHACTX; -typedef gcry_md_hd_t MD5CTX; -typedef gcry_md_hd_t HMACCTX; -#define SHA_DIGEST_LEN 20 -#define MD5_DIGEST_LEN 16 -#define EVP_MAX_MD_SIZE 36 - -typedef gcry_mpi_t bignum; - -#define bignum_new() gcry_mpi_new(0) -#define bignum_free(num) gcry_mpi_release(num) -#define bignum_set_word(bn,n) gcry_mpi_set_ui(bn,n) -#define bignum_bin2bn(bn,datalen,data) gcry_mpi_scan(data,GCRYMPI_FMT_USG,bn,datalen,NULL) -#define bignum_bn2dec(num) my_gcry_bn2dec(num) -#define bignum_dec2bn(num, data) my_gcry_dec2bn(data, num) -#define bignum_bn2hex(num,data) gcry_mpi_aprint(GCRYMPI_FMT_HEX,data,NULL,num) -#define bignum_hex2bn(num,datalen,data) gcry_mpi_scan(num,GCRYMPI_FMT_HEX,data,datalen,NULL) -#define bignum_rand(num,bits) gcry_mpi_randomize(num,bits,GCRY_STRONG_RANDOM),gcry_mpi_set_bit(num,bits-1),gcry_mpi_set_bit(num,0) -#define bignum_mod_exp(dest,generator,exp,modulo) gcry_mpi_powm(dest,generator,exp,modulo) -#define bignum_num_bits(num) gcry_mpi_get_nbits(num) -#define bignum_num_bytes(num) ((gcry_mpi_get_nbits(num)+7)/8) -#define bignum_is_bit_set(num,bit) gcry_mpi_test_bit(num,bit) -#define bignum_bn2bin(num,datalen,data) gcry_mpi_print(GCRYMPI_FMT_USG,data,datalen,NULL,num) -#define bignum_cmp(num1,num2) gcry_mpi_cmp(num1,num2) - -#elif defined HAVE_LIBCRYPTO - -#include <openssl/dsa.h> -#include <openssl/rsa.h> -#include <openssl/sha.h> -#include <openssl/md5.h> -#include <openssl/hmac.h> -typedef SHA_CTX* SHACTX; -typedef MD5_CTX* MD5CTX; -typedef HMAC_CTX* HMACCTX; - -#define SHA_DIGEST_LEN SHA_DIGEST_LENGTH -#define MD5_DIGEST_LEN MD5_DIGEST_LENGTH - -#include <openssl/bn.h> -#include <openssl/opensslv.h> -#define OPENSSL_0_9_7b 0x0090702fL -#if (OPENSSL_VERSION_NUMBER <= OPENSSL_0_9_7b) -#define BROKEN_AES_CTR -#endif -typedef BIGNUM* bignum; -typedef BN_CTX* bignum_CTX; - -#define bignum_new() BN_new() -#define bignum_free(num) BN_clear_free(num) -#define bignum_set_word(bn,n) BN_set_word(bn,n) -#define bignum_bin2bn(bn,datalen,data) BN_bin2bn(bn,datalen,data) -#define bignum_bn2dec(num) BN_bn2dec(num) -#define bignum_dec2bn(bn,data) BN_dec2bn(data,bn) -#define bignum_bn2hex(num) BN_bn2hex(num) -#define bignum_rand(rnd, bits, top, bottom) BN_rand(rnd,bits,top,bottom) -#define bignum_ctx_new() BN_CTX_new() -#define bignum_ctx_free(num) BN_CTX_free(num) -#define bignum_mod_exp(dest,generator,exp,modulo,ctx) BN_mod_exp(dest,generator,exp,modulo,ctx) -#define bignum_num_bytes(num) BN_num_bytes(num) -#define bignum_num_bits(num) BN_num_bits(num) -#define bignum_is_bit_set(num,bit) BN_is_bit_set(num,bit) -#define bignum_bn2bin(num,ptr) BN_bn2bin(num,ptr) -#define bignum_cmp(num1,num2) BN_cmp(num1,num2) - -#endif /* OPENSSL_CRYPTO */ +#include "libssh/libcrypto.h" +#include "libssh/libgcrypt.h" MD5CTX md5_init(void); void md5_update(MD5CTX c, const void *data, unsigned long len); |