/[mcrypt]/libmcrypt/lib/mcrypt.h.in
ViewVC logotype

Contents of /libmcrypt/lib/mcrypt.h.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Thu May 17 20:54:31 2001 UTC (22 years, 11 months ago) by nmav
Branch: MAIN
CVS Tags: libmcrypt_2_4_15, mcrypt_2_4_12, mcrypt_2_4_13
Changes since 1.1: +7 -1 lines
minor updates

1 /*
2 * Copyright (C) 1998,1999 Nikos Mavroyanopoulos
3 *
4 * Encryption/decryption library. This library is free software;
5 * you can redistribute it and/or modify it under the terms of the
6 * GNU Library General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option) any
8 * later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
19 */
20
21
22 #define MCRYPT_API_VERSION 20010501
23 #define LIBMCRYPT_VERSION "@VERSION@"
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 /* Definitions
29 */
30 #define MCRYPT_FAILED 0x0
31
32 struct CRYPT_STREAM;
33 typedef struct CRYPT_STREAM *MCRYPT;
34
35 /* generic - high level functions.
36 */
37 MCRYPT mcrypt_module_open(char *algorithm,
38 char *a_directory, char *mode,
39 char *m_directory);
40 int mcrypt_module_close(MCRYPT td);
41
42
43 /* returns thread descriptor */
44
45 int mcrypt_generic_init(const MCRYPT td, void *key, int lenofkey,
46 void *IV);
47 int mcrypt_generic_deinit(const MCRYPT td);
48 int mcrypt_generic_end(const MCRYPT td);
49 int mdecrypt_generic(MCRYPT td, void *plaintext, int len);
50 int mcrypt_generic(MCRYPT td, void *plaintext, int len);
51
52 /* extra functions */
53
54 int mcrypt_enc_set_state(MCRYPT td, void *iv, int size); /* only for block algorithms */
55 int (mcrypt_enc_self_test) (MCRYPT);
56 int (mcrypt_enc_get_block_size) (MCRYPT);
57 int (mcrypt_enc_get_iv_size) (MCRYPT);
58 int (mcrypt_enc_get_key_size) (MCRYPT);
59
60 /* If this is a block algorithm returns 1
61 */
62 int (mcrypt_enc_is_block_algorithm) (MCRYPT);
63
64 /* If the mode operates in blocks returns 1
65 */
66 int (mcrypt_enc_is_block_mode) (MCRYPT);
67
68 /* If the mode is for block algorithms it returns 1
69 */
70 int (mcrypt_enc_is_block_algorithm_mode) (MCRYPT td);
71 int mcrypt_enc_mode_has_iv(MCRYPT td);
72
73 /* Return a string containing the name of the algorithm/mode
74 */
75 char *(mcrypt_enc_get_algorithms_name) (MCRYPT td);
76 char *(mcrypt_enc_get_modes_name) (MCRYPT td);
77
78 int *mcrypt_enc_get_supported_key_sizes(MCRYPT td, int *len);
79
80
81 char **mcrypt_list_algorithms(char *libdir, int *size);
82 char **mcrypt_list_modes(char *libdir, int *size);
83
84 /* Frees the memory allocated by the mcrypt_list_xxx() functions.
85 */
86 void mcrypt_free_p(char **p, int size);
87 void mcrypt_free(void *ptr);
88
89 /* If mcrypt_xxx functions return an error code, and you supply this
90 * to this function, it will print a human readable message
91 */
92 void mcrypt_perror(int err);
93 char* mcrypt_strerror(int err);
94
95 /* Self test for the specified algorithm
96 */
97 int mcrypt_module_self_test(char *algorithm, char *a_directory);
98
99 int mcrypt_module_is_block_algorithm(char *algorithm,
100 char *a_directory);
101 int mcrypt_module_is_block_algorithm_mode(char *mode,
102 char *m_directory);
103 int mcrypt_module_is_block_mode(char *mode, char *m_directory);
104
105 int mcrypt_module_get_algo_key_size(char *algorithm,
106 char *a_directory);
107 int mcrypt_module_get_algo_block_size(char *algorithm,
108 char *a_directory);
109
110 int *mcrypt_module_get_algo_supported_key_sizes(char *algorithm,
111 char *a_directory,
112 int *len);
113
114 /* Checks the version of the specified module
115 */
116 int mcrypt_module_algorithm_version(char *algorithm,
117 char *a_directory);
118 int mcrypt_module_mode_version(char *mode, char *a_directory);
119
120
121 /* for multithreaded applications:
122 */
123 int mcrypt_mutex_register ( void (*mutex_lock)(void) ,
124 void (*mutex_unlock)(void),
125 void (*set_error)(const char*),
126 const char* (*get_error)(void));
127
128 /* These definitions exist in order to ease the access to
129 * mcrypt_module_init().
130 */
131
132 /* Algorithms */
133 #define MCRYPT_BLOWFISH "blowfish"
134 #define MCRYPT_DES "des"
135 #define MCRYPT_3DES "tripledes"
136 #define MCRYPT_3WAY "threeway"
137 #define MCRYPT_GOST "gost"
138 #define MCRYPT_SAFER_SK64 "safer-sk64"
139 #define MCRYPT_SAFER_SK128 "safer-sk128"
140 #define MCRYPT_CAST_128 "cast-128"
141 #define MCRYPT_XTEA "xtea"
142 #define MCRYPT_RC2 "rc2"
143 #define MCRYPT_TWOFISH "twofish"
144 #define MCRYPT_CAST_256 "cast-256"
145 #define MCRYPT_SAFERPLUS "saferplus"
146 #define MCRYPT_LOKI97 "loki97"
147 #define MCRYPT_SERPENT "serpent"
148 #define MCRYPT_RIJNDAEL_128 "rijndael-128"
149 #define MCRYPT_RIJNDAEL_192 "rijndael-192"
150 #define MCRYPT_RIJNDAEL_256 "rijndael-256"
151 #define MCRYPT_ENIGMA "enigma"
152 #define MCRYPT_ARCFOUR "arcfour"
153 #define MCRYPT_WAKE "wake"
154
155 /* Modes */
156 #define MCRYPT_CBC "cbc"
157 #define MCRYPT_ECB "ecb"
158 #define MCRYPT_CFB "cfb"
159 #define MCRYPT_OFB "ofb"
160 #define MCRYPT_nOFB "nofb"
161 #define MCRYPT_STREAM "stream"
162
163 #ifdef __cplusplus
164 }
165 #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26