1 /* crypto.h --- Crypto prototypes.
2 * Copyright (C) 2002, 2003, 2004, 2007 Simon Josefsson
4 * This file is part of Shishi.
6 * Shishi is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * Shishi is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with Shishi; if not, see http://www.gnu.org/licenses or write
18 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
19 * Floor, Boston, MA 02110-1301, USA
26 #define SHISHI_DK_CONSTANT "\x6b\x65\x72\x62\x65\x72\x6f\x73"
28 extern int _shishi_crypto_init (Shishi
* handle
);
31 _shishi_simplified_derivekey (Shishi
* handle
,
34 int derivekeymode
, Shishi_key
** outkey
);
36 _shishi_simplified_checksum (Shishi
* handle
,
40 const char *in
, size_t inlen
,
41 char **out
, size_t * outlen
);
43 _shishi_simplified_dencrypt (Shishi
* handle
,
45 const char *iv
, size_t ivlen
,
46 char **ivout
, size_t * ivoutlen
,
47 const char *in
, size_t inlen
,
48 char **out
, size_t * outlen
, int decryptp
);
50 _shishi_simplified_encrypt (Shishi
* handle
,
53 const char *iv
, size_t ivlen
,
54 char **ivout
, size_t * ivoutlen
,
55 const char *in
, size_t inlen
,
56 char **out
, size_t * outlen
);
58 _shishi_simplified_decrypt (Shishi
* handle
,
61 const char *iv
, size_t ivlen
,
62 char **ivout
, size_t * ivoutlen
,
63 const char *in
, size_t inlen
,
64 char **out
, size_t * outlen
);
68 SHISHI_DERIVEKEYMODE_CHECKSUM
,
69 SHISHI_DERIVEKEYMODE_PRIVACY
,
70 SHISHI_DERIVEKEYMODE_INTEGRITY
74 typedef int (*Shishi_random_to_key_function
) (Shishi
* handle
,
79 typedef int (*Shishi_string_to_key_function
) (Shishi
* handle
,
84 const char *parameter
,
87 typedef int (*Shishi_encrypt_function
) (Shishi
* handle
,
90 const char *iv
, size_t ivlen
,
91 char **ivout
, size_t * ivoutlen
,
92 const char *in
, size_t inlen
,
93 char **out
, size_t * outlen
);
95 typedef int (*Shishi_decrypt_function
) (Shishi
* handle
,
98 const char *iv
, size_t ivlen
,
99 char **ivout
, size_t * ivoutlen
,
100 const char *in
, size_t inlen
,
101 char **out
, size_t * outlen
);
103 typedef int (*Shishi_checksum_function
) (Shishi
* handle
,
107 const char *in
, size_t inlen
,
108 char **out
, size_t * outlen
);
110 typedef int (*Shishi_verify_function
) (Shishi
* handle
,
114 const char *in
, size_t inlen
,
115 const char *cksum
, size_t cksumlen
);
125 int defaultcksumtype
;
126 Shishi_random_to_key_function random2key
;
127 Shishi_string_to_key_function string2key
;
128 Shishi_encrypt_function encrypt
;
129 Shishi_decrypt_function decrypt
;
131 typedef struct cipherinfo cipherinfo
;
138 Shishi_checksum_function checksum
;
139 Shishi_verify_function verify
;
141 typedef struct checksuminfo checksuminfo
;
143 extern cipherinfo null_info
;
145 extern checksuminfo crc32_info
;
146 extern checksuminfo md4_info
;
147 extern checksuminfo md5_info
;
149 extern cipherinfo des_cbc_crc_info
;
150 extern cipherinfo des_cbc_md4_info
;
151 extern cipherinfo des_cbc_md5_info
;
152 extern cipherinfo des_cbc_none_info
;
153 extern checksuminfo md4_des_info
;
154 extern checksuminfo md5_des_info
;
155 extern checksuminfo md5_gss_info
;
157 extern cipherinfo des3_cbc_none_info
;
158 extern cipherinfo des3_cbc_sha1_kd_info
;
159 extern checksuminfo hmac_sha1_des3_kd_info
;
161 extern cipherinfo aes128_cts_hmac_sha1_96_info
;
162 extern cipherinfo aes256_cts_hmac_sha1_96_info
;
163 extern checksuminfo hmac_sha1_96_aes128_info
;
164 extern checksuminfo hmac_sha1_96_aes256_info
;
166 extern cipherinfo arcfour_hmac_info
;
167 extern cipherinfo arcfour_hmac_exp_info
;
168 extern checksuminfo arcfour_hmac_md5_info
;