1 |
|
2 |
/* Local Defines */ |
3 |
|
4 |
#ifndef lt_ptr |
5 |
/* older version of libltdl */ |
6 |
# define lt_ptr lt_ptr_t |
7 |
#endif |
8 |
|
9 |
typedef struct { |
10 |
lt_dlhandle handle; |
11 |
char name[64]; |
12 |
} mcrypt_dlhandle; |
13 |
|
14 |
#define MCRYPT_INTERNAL_HANDLER (void*)-1 |
15 |
|
16 |
typedef struct { |
17 |
mcrypt_dlhandle algorithm_handle; |
18 |
mcrypt_dlhandle mode_handle; |
19 |
|
20 |
/* Holds the algorithm's internal key */ |
21 |
byte *akey; |
22 |
|
23 |
byte *abuf; /* holds the mode's internal buffers */ |
24 |
|
25 |
/* holds the key */ |
26 |
byte *keyword_given; |
27 |
|
28 |
/* These were included to speed up encryption/decryption proccess, so |
29 |
* there is not need for resolving symbols every time. |
30 |
*/ |
31 |
lt_ptr m_encrypt; |
32 |
lt_ptr m_decrypt; |
33 |
lt_ptr a_encrypt; |
34 |
lt_ptr a_decrypt; |
35 |
lt_ptr a_block_size; |
36 |
} CRYPT_STREAM; |
37 |
|
38 |
typedef CRYPT_STREAM* MCRYPT; |
39 |
|
40 |
#define MCRYPT_FAILED 0x0 |
41 |
|
42 |
int mcrypt_module_close(MCRYPT td); |
43 |
|
44 |
/* frontends */ |
45 |
|
46 |
int end_mcrypt( MCRYPT td, void *buf); |
47 |
int mcrypt_enc_get_size(MCRYPT td); |
48 |
int mcrypt_mode_get_size(MCRYPT td); |
49 |
int mcrypt_set_key(MCRYPT td, void *a, void *b, int c, void *d, int e); |
50 |
int mcrypt_enc_get_block_size(MCRYPT td); |
51 |
int __mcrypt_get_block_size(MCRYPT td); |
52 |
int mcrypt_enc_get_algo_iv_size(MCRYPT td); |
53 |
int mcrypt_enc_get_iv_size(MCRYPT td); |
54 |
int mcrypt_enc_get_key_size(MCRYPT td); |
55 |
int* mcrypt_enc_get_supported_key_sizes(MCRYPT td, int* out_size); |
56 |
int mcrypt_enc_is_block_algorithm(MCRYPT td); |
57 |
char *mcrypt_enc_get_algorithms_name(MCRYPT td); |
58 |
int init_mcrypt(MCRYPT td, void*buf, void *a, int b, void *c); |
59 |
int mcrypt(MCRYPT td, void* buf, void *a, int b); |
60 |
int mdecrypt(MCRYPT td, void* buf, void *a, int b); |
61 |
char *mcrypt_enc_get_modes_name(MCRYPT td); |
62 |
int mcrypt_enc_is_block_mode(MCRYPT td); |
63 |
int mcrypt_enc_mode_has_iv(MCRYPT td); |
64 |
int mcrypt_enc_is_block_algorithm_mode(MCRYPT td); |
65 |
int mcrypt_module_algorithm_version(char *algorithm, char *a_directory); |
66 |
int mcrypt_module_mode_version(char *mode, char *m_directory); |
67 |
int mcrypt_get_size(MCRYPT td); |
68 |
int *mcrypt_enc_get_supported_key_sizes(MCRYPT td, int *len); |
69 |
|
70 |
|
71 |
#define MCRYPT_UNKNOWN_ERROR -1 |
72 |
#define MCRYPT_ALGORITHM_MODE_INCOMPATIBILITY -2 |
73 |
#define MCRYPT_KEY_LEN_ERROR -3 |
74 |
#define MCRYPT_MEMORY_ALLOCATION_ERROR -4 |
75 |
#define MCRYPT_UNKNOWN_MODE -5 |
76 |
#define MCRYPT_UNKNOWN_ALGORITHM -6 |
77 |
|
78 |
lt_ptr mcrypt_dlsym( mcrypt_dlhandle, char* str); |
79 |
void mcrypt_dlclose( mcrypt_dlhandle mod); |