/[mcrypt]/libmcrypt-nm/lib/mcrypt_int.h
ViewVC logotype

Contents of /libmcrypt-nm/lib/mcrypt_int.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Mon May 22 13:09:15 2000 UTC (23 years, 10 months ago) by nmav
Branch: MAIN, mcrypt
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain

1 /* Copyright (C) 1998,1999 Nikos Mavroyanopoulos
2 * Encryption/decryption library. This library is free software;
3 * you can redistribute it and/or modify it under the terms of the
4 * GNU Library General Public License as published by the Free Software
5 * Foundation; either version 2 of the License, or (at your option) any
6 * later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
12 *
13 * You should have received a copy of the GNU Library General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 02111-1307, USA.
17 */
18
19 /* $Id: mcrypt.h,v 1.8 1999/11/06 00:29:21 nmav Exp $ */
20
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 #define MCRYPT_FAILED 0x0
27
28 #define MCRYPT_BLOWFISH 0
29 #define MCRYPT_DES 1
30 #define MCRYPT_TRIPLEDES 2
31 #define MCRYPT_THREEWAY 3
32 #define MCRYPT_GOST 4
33 #define MCRYPT_SAFER_SK64 6
34 #define MCRYPT_SAFER_SK128 7
35 #define MCRYPT_CAST_128 8
36 #define MCRYPT_XTEA 9
37 #define MCRYPT_RC2 11
38 #define MCRYPT_TWOFISH 13
39 #define MCRYPT_CAST_256 17
40 #define MCRYPT_SAFERPLUS 18
41 #define MCRYPT_LOKI97 19
42 #define MCRYPT_SERPENT 22
43 #define MCRYPT_RIJNDAEL_128 25
44 #define MCRYPT_RC4 MCRYPT_ARCFOUR
45 #define MCRYPT_ARCFOUR 104
46 #define MCRYPT_ENIGMA 107
47
48 #define MCRYPT_CBC 0
49 #define MCRYPT_ECB 1
50 #define MCRYPT_CFB 2
51 #define MCRYPT_OFB 3
52 #define MCRYPT_nOFB 4
53 #define MCRYPT_STREAM 5
54
55 struct MCRYPT_INT {
56 word8 *akey;
57
58 /* For CBC mode */
59 word32 *previous_ciphertext;
60 word32 *previous_plaintext;
61 word32 *previous_cipher;
62
63 /* For CFB mode */
64 word8 *sd_register;
65 word8 *s_register;
66 word8 *enc_s_register;
67 word8 *enc_sd_register;
68
69
70 /* hold the key and the algorithm */
71 word8 *keyword_given;
72 int algorithm_given;
73 int mode_given;
74 };
75 typedef struct MCRYPT_INT* MCRYPT;
76
77 typedef struct mcrypt_algorithm_entry mcrypt_algorithm_entry;
78 typedef struct mcrypt_mode_entry mcrypt_mode_entry;
79
80 #define end_mcrypt_ecb end_mcrypt
81 #define end_mcrypt_stream end_mcrypt
82
83 /* generic - high level functions. These are a bit slower because
84 * they perform a switch before each call but they have the advantage
85 * of being able to check at run-time which modes are in the library
86 * and use them
87 */
88
89 MCRYPT mcrypt_generic_init(const int mode,
90 const int algorithm, void *key, int lenofkey, void *IV);
91 int mcrypt_generic_end(const MCRYPT td);
92 int mdecrypt_generic(MCRYPT td, void *plaintext, int len);
93 int mcrypt_generic(MCRYPT td, void *plaintext, int len);
94 void mcrypt_generic_term();
95
96 /* extra functions */
97
98 int mcrypt_get_block_size(int algorithm);
99 int mcrypt_get_key_size(int algorithm);
100
101 int mcrypt_is_ok_algorithm(int algorithm); /* if this algorithm exists returns 0 */
102 int mcrypt_is_ok_mode(int mode); /* if this mode exists returns 0 */
103 int mcrypt_is_block_algorithm(int algorithm); /* If this is a block algorithm returns 1 */
104 int mcrypt_is_block_algorithm_mode(int mode);
105 int mcrypt_mode_has_iv(int mode);
106
107 char* mcrypt_get_algorithms_name(int algorithm);
108 char *mcrypt_get_modes_name(int mode);
109
110
111 /* Functions used internally and in mcrypt (the program) */
112 MCRYPT init_mcrypt ( const int mode, const int algorithm, void * key, int lenofkey);
113 int mcrypt(MCRYPT td, void *plaintext);
114 int mdecrypt(MCRYPT td, void *plaintext);
115 int end_mcrypt(MCRYPT td);
116
117 /* ECB */
118 MCRYPT init_mcrypt_ecb( const int algorithm, void * key, int lenofkey);
119 int mcrypt_ecb(MCRYPT td, void *plaintext,int len);
120 int mdecrypt_ecb(MCRYPT td, void *plaintext, int);
121
122 /* CBC */
123 int end_mcrypt_cbc(MCRYPT td);
124 int mcrypt_cbc(MCRYPT td, void *plaintext, int);
125 int mdecrypt_cbc(MCRYPT td, void *ciphertext, int);
126 MCRYPT init_mcrypt_cbc( const int algorithm, void * key, int lenofkey);
127 MCRYPT init_mcrypt_cbc_iv( const int algorithm, void * key, int lenofkey, void *IV);
128
129 /* CFB */
130 int end_mcrypt_cfb(MCRYPT td);
131 int mcrypt_cfb(MCRYPT td, void *plaintext,int len);
132 int mdecrypt_cfb(MCRYPT td, void *ciphertext, int len);
133 MCRYPT init_mcrypt_cfb( const int algorithm, void * key, int lenofkey, void *IV);
134
135 /* OFB */
136 int end_mcrypt_ofb(MCRYPT td);
137 int mcrypt_ofb(MCRYPT td, void *plaintext,int len);
138 int mdecrypt_ofb(MCRYPT td, void *ciphertext, int len);
139 MCRYPT init_mcrypt_ofb( const int algorithm, void * key, int lenofkey, void *IV);
140
141 /* nbit OFB */
142 MCRYPT init_mcrypt_nofb(const int algorithm, void *key, int lenofkey, void *IV);
143 int mcrypt_nofb(MCRYPT td, void *plaintext, int len);
144 int mdecrypt_nofb(MCRYPT td, void *plaintext, int len);
145 int end_mcrypt_nofb(MCRYPT td);
146
147 /* STREAM */
148 MCRYPT init_mcrypt_stream(const int algorithm, void *key, int lenofkey);
149 int mcrypt_stream(MCRYPT td, void *plaintext, int len);
150 int mdecrypt_stream(MCRYPT td, void *ciphertext, int len);
151
152 #ifdef __cplusplus
153 }
154 #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26