libssh
0.5.4
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
include
libssh
libgcrypt.h
1
/*
2
* This file is part of the SSH Library
3
*
4
* Copyright (c) 2009 by Aris Adamantiadis
5
*
6
* The SSH Library is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation; either version 2.1 of the License, or (at your
9
* option) any later version.
10
*
11
* The SSH Library is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14
* License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with the SSH Library; see the file COPYING. If not, write to
18
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19
* MA 02111-1307, USA.
20
*/
21
22
#ifndef LIBGCRYPT_H_
23
#define LIBGCRYPT_H_
24
25
#include "config.h"
26
27
#ifdef HAVE_LIBGCRYPT
28
29
#include <gcrypt.h>
30
typedef
gcry_md_hd_t SHACTX;
31
typedef
gcry_md_hd_t MD5CTX;
32
typedef
gcry_md_hd_t HMACCTX;
33
#define SHA_DIGEST_LEN 20
34
#define MD5_DIGEST_LEN 16
35
#define EVP_MAX_MD_SIZE 36
36
37
typedef
gcry_mpi_t bignum;
38
39
#define bignum_new() gcry_mpi_new(0)
40
#define bignum_free(num) gcry_mpi_release(num)
41
#define bignum_set_word(bn,n) gcry_mpi_set_ui(bn,n)
42
#define bignum_bin2bn(bn,datalen,data) gcry_mpi_scan(data,GCRYMPI_FMT_USG,bn,datalen,NULL)
43
#define bignum_bn2dec(num) my_gcry_bn2dec(num)
44
#define bignum_dec2bn(num, data) my_gcry_dec2bn(data, num)
45
#define bignum_bn2hex(num,data) gcry_mpi_aprint(GCRYMPI_FMT_HEX,data,NULL,num)
46
#define bignum_hex2bn(num,datalen,data) gcry_mpi_scan(num,GCRYMPI_FMT_HEX,data,datalen,NULL)
47
#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)
48
#define bignum_mod_exp(dest,generator,exp,modulo) gcry_mpi_powm(dest,generator,exp,modulo)
49
#define bignum_num_bits(num) gcry_mpi_get_nbits(num)
50
#define bignum_num_bytes(num) ((gcry_mpi_get_nbits(num)+7)/8)
51
#define bignum_is_bit_set(num,bit) gcry_mpi_test_bit(num,bit)
52
#define bignum_bn2bin(num,datalen,data) gcry_mpi_print(GCRYMPI_FMT_USG,data,datalen,NULL,num)
53
#define bignum_cmp(num1,num2) gcry_mpi_cmp(num1,num2)
54
55
56
#endif
/* HAVE_LIBGCRYPT */
57
58
struct
crypto_struct *ssh_get_ciphertab(
void
);
59
60
#endif
/* LIBGCRYPT_H_ */
Generated by
1.8.3.1