File: mcrypt_internal.h

package info (click to toggle)
libmcrypt 2.5.8-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,060 kB
  • sloc: ansic: 15,868; sh: 8,579; makefile: 196
file content (89 lines) | stat: -rw-r--r-- 2,495 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef LIBDEFS_H
#define LIBDEFS_H
#include <libdefs.h>
#endif

/* Local Defines */

#ifndef lt_ptr
/* older version of libltdl */
# define lt_ptr lt_ptr_t
#endif

typedef struct {
	char* name;
	lt_ptr address;
} mcrypt_preloaded;

typedef struct {
		lt_dlhandle handle;
		char name[64];
} mcrypt_dlhandle;

#define MCRYPT_INTERNAL_HANDLER (void*)-1

typedef struct {
	mcrypt_dlhandle algorithm_handle;
	mcrypt_dlhandle mode_handle;

	/* Holds the algorithm's internal key */
	byte *akey;

	byte *abuf; /* holds the mode's internal buffers */

	/* holds the key */
	byte *keyword_given;

/* These were included to speed up encryption/decryption proccess, so
 * there is not need for resolving symbols every time.
 */
	lt_ptr m_encrypt;
	lt_ptr m_decrypt;
	lt_ptr a_encrypt;
	lt_ptr a_decrypt;
	lt_ptr a_block_size;
} CRYPT_STREAM;

typedef CRYPT_STREAM* MCRYPT;

#define MCRYPT_FAILED 0x0

int mcrypt_module_close(MCRYPT td);

/* frontends */

int end_mcrypt( MCRYPT td, void *buf);
int mcrypt_enc_get_size(MCRYPT td);
int mcrypt_mode_get_size(MCRYPT td);
int mcrypt_set_key(MCRYPT td, void *a, const void *, int c, const void *, int e);
int mcrypt_enc_get_block_size(MCRYPT td);
int __mcrypt_get_block_size(MCRYPT td);
int mcrypt_enc_get_algo_iv_size(MCRYPT td);
int mcrypt_enc_get_iv_size(MCRYPT td);
int mcrypt_enc_get_key_size(MCRYPT td);
int* mcrypt_enc_get_supported_key_sizes(MCRYPT td, int* out_size);
int mcrypt_enc_is_block_algorithm(MCRYPT td);
char *mcrypt_enc_get_algorithms_name(MCRYPT td);
int init_mcrypt(MCRYPT td, void*buf, const void *, int, const void *);
int mcrypt(MCRYPT td, void* buf, void *a, int b);
int mdecrypt(MCRYPT td, void* buf, void *a, int b);
char *mcrypt_enc_get_modes_name(MCRYPT td);
int mcrypt_enc_is_block_mode(MCRYPT td);
int mcrypt_enc_mode_has_iv(MCRYPT td);
int mcrypt_enc_is_block_algorithm_mode(MCRYPT td);
int mcrypt_module_algorithm_version(const char *algorithm, const char *a_directory);
int mcrypt_module_mode_version(const char *mode, const char *m_directory);
int mcrypt_get_size(MCRYPT td);


#define MCRYPT_UNKNOWN_ERROR -1
#define MCRYPT_ALGORITHM_MODE_INCOMPATIBILITY -2
#define MCRYPT_KEY_LEN_ERROR -3
#define MCRYPT_MEMORY_ALLOCATION_ERROR -4
#define MCRYPT_UNKNOWN_MODE -5
#define MCRYPT_UNKNOWN_ALGORITHM -6

lt_ptr mcrypt_dlsym( mcrypt_dlhandle, char* str);
void mcrypt_dlclose( mcrypt_dlhandle mod);
lt_ptr _mcrypt_search_symlist_lib(const char* name);
lt_ptr _mcrypt_search_symlist_sym(mcrypt_dlhandle handle, const char* _name);