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