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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations)
Sat Mar 9 21:48:51 2002 UTC (22 years, 1 month ago) by nmav
Branch: MAIN
CVS Tags: libmcrypt_2_5_3, libmcrypt_2_5_2, libmcrypt_2_5_0
Changes since 1.6: +7 -3 lines
Added mcrypt_enc_get_state()

1 nmav 1.1 /*
2 nmav 1.7 * Copyright (C) 1998,1999,2002 Nikos Mavroyanopoulos
3 nmav 1.1 *
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 nmav 1.7 #define MCRYPT_API_VERSION 20020309
23 nmav 1.1 #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 nmav 1.7 int mcrypt_enc_set_state(MCRYPT td, void *st, int size);
55     int mcrypt_enc_get_state(MCRYPT td, void *st, int *size); /* only
56     * for block algorithms and certain modes like cbc
57     * ncfb etc.
58     */
59 nmav 1.1 int (mcrypt_enc_self_test) (MCRYPT);
60     int (mcrypt_enc_get_block_size) (MCRYPT);
61     int (mcrypt_enc_get_iv_size) (MCRYPT);
62     int (mcrypt_enc_get_key_size) (MCRYPT);
63    
64     /* If this is a block algorithm returns 1
65     */
66     int (mcrypt_enc_is_block_algorithm) (MCRYPT);
67    
68     /* If the mode operates in blocks returns 1
69     */
70     int (mcrypt_enc_is_block_mode) (MCRYPT);
71    
72     /* If the mode is for block algorithms it returns 1
73     */
74     int (mcrypt_enc_is_block_algorithm_mode) (MCRYPT td);
75     int mcrypt_enc_mode_has_iv(MCRYPT td);
76    
77 nmav 1.3 /* Return a const string containing the name of the algorithm/mode
78 nmav 1.1 */
79 nmav 1.5 char *(mcrypt_enc_get_algorithms_name) (MCRYPT td);
80     char *(mcrypt_enc_get_modes_name) (MCRYPT td);
81 nmav 1.1
82 nmav 1.5 int *mcrypt_enc_get_supported_key_sizes(MCRYPT td, int *len);
83 nmav 1.1
84    
85     char **mcrypt_list_algorithms(char *libdir, int *size);
86     char **mcrypt_list_modes(char *libdir, int *size);
87    
88     /* Frees the memory allocated by the mcrypt_list_xxx() functions.
89     */
90     void mcrypt_free_p(char **p, int size);
91     void mcrypt_free(void *ptr);
92    
93     /* If mcrypt_xxx functions return an error code, and you supply this
94     * to this function, it will print a human readable message
95     */
96     void mcrypt_perror(int err);
97 nmav 1.4 const char* mcrypt_strerror(int err);
98 nmav 1.1
99     /* Self test for the specified algorithm
100     */
101     int mcrypt_module_self_test(char *algorithm, char *a_directory);
102    
103     int mcrypt_module_is_block_algorithm(char *algorithm,
104     char *a_directory);
105     int mcrypt_module_is_block_algorithm_mode(char *mode,
106     char *m_directory);
107     int mcrypt_module_is_block_mode(char *mode, char *m_directory);
108    
109     int mcrypt_module_get_algo_key_size(char *algorithm,
110     char *a_directory);
111     int mcrypt_module_get_algo_block_size(char *algorithm,
112     char *a_directory);
113    
114     int *mcrypt_module_get_algo_supported_key_sizes(char *algorithm,
115     char *a_directory,
116     int *len);
117    
118     /* Checks the version of the specified module
119     */
120     int mcrypt_module_algorithm_version(char *algorithm,
121     char *a_directory);
122     int mcrypt_module_mode_version(char *mode, char *a_directory);
123    
124    
125 nmav 1.2 /* for multithreaded applications:
126     */
127     int mcrypt_mutex_register ( void (*mutex_lock)(void) ,
128     void (*mutex_unlock)(void),
129     void (*set_error)(const char*),
130     const char* (*get_error)(void));
131 nmav 1.1
132 nmav 1.6 const char *
133     mcrypt_check_version( const char *);
134    
135 nmav 1.1 /* These definitions exist in order to ease the access to
136     * mcrypt_module_init().
137     */
138    
139     /* Algorithms */
140     #define MCRYPT_BLOWFISH "blowfish"
141     #define MCRYPT_DES "des"
142     #define MCRYPT_3DES "tripledes"
143     #define MCRYPT_3WAY "threeway"
144     #define MCRYPT_GOST "gost"
145     #define MCRYPT_SAFER_SK64 "safer-sk64"
146     #define MCRYPT_SAFER_SK128 "safer-sk128"
147     #define MCRYPT_CAST_128 "cast-128"
148     #define MCRYPT_XTEA "xtea"
149     #define MCRYPT_RC2 "rc2"
150     #define MCRYPT_TWOFISH "twofish"
151     #define MCRYPT_CAST_256 "cast-256"
152     #define MCRYPT_SAFERPLUS "saferplus"
153     #define MCRYPT_LOKI97 "loki97"
154     #define MCRYPT_SERPENT "serpent"
155     #define MCRYPT_RIJNDAEL_128 "rijndael-128"
156     #define MCRYPT_RIJNDAEL_192 "rijndael-192"
157     #define MCRYPT_RIJNDAEL_256 "rijndael-256"
158     #define MCRYPT_ENIGMA "enigma"
159     #define MCRYPT_ARCFOUR "arcfour"
160     #define MCRYPT_WAKE "wake"
161    
162     /* Modes */
163     #define MCRYPT_CBC "cbc"
164     #define MCRYPT_ECB "ecb"
165     #define MCRYPT_CFB "cfb"
166     #define MCRYPT_OFB "ofb"
167     #define MCRYPT_nOFB "nofb"
168     #define MCRYPT_STREAM "stream"
169    
170     #ifdef __cplusplus
171     }
172     #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26