1 /* crypto.h --- Crypto prototypes.
2 * Copyright (C) 2002, 2003, 2004 Simon Josefsson
4 * This file is part of Shishi.
6 * Shishi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * Shishi is distributed in the hope that it will be useful,
12 * but 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, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 #define SHISHI_DK_CONSTANT "\x6b\x65\x72\x62\x65\x72\x6f\x73"
27 extern int _shishi_crypto_init (Shishi
* handle
);
30 _shishi_simplified_derivekey (Shishi
* handle
,
33 int derivekeymode
, Shishi_key
** outkey
);
35 _shishi_simplified_checksum (Shishi
* handle
,
39 const char *in
, size_t inlen
,
40 char **out
, size_t * outlen
);
42 _shishi_simplified_dencrypt (Shishi
* handle
,
44 const char *iv
, size_t ivlen
,
45 char **ivout
, size_t * ivoutlen
,
46 const char *in
, size_t inlen
,
47 char **out
, size_t * outlen
, int decryptp
);
49 _shishi_simplified_encrypt (Shishi
* handle
,
52 const char *iv
, size_t ivlen
,
53 char **ivout
, size_t * ivoutlen
,
54 const char *in
, size_t inlen
,
55 char **out
, size_t * outlen
);
57 _shishi_simplified_decrypt (Shishi
* handle
,
60 const char *iv
, size_t ivlen
,
61 char **ivout
, size_t * ivoutlen
,
62 const char *in
, size_t inlen
,
63 char **out
, size_t * outlen
);
67 SHISHI_DERIVEKEYMODE_CHECKSUM
,
68 SHISHI_DERIVEKEYMODE_PRIVACY
,
69 SHISHI_DERIVEKEYMODE_INTEGRITY
73 typedef int (*Shishi_random_to_key_function
) (Shishi
* handle
,
78 typedef int (*Shishi_string_to_key_function
) (Shishi
* handle
,
83 const char *parameter
,
86 typedef int (*Shishi_encrypt_function
) (Shishi
* handle
,
89 const char *iv
, size_t ivlen
,
90 char **ivout
, size_t * ivoutlen
,
91 const char *in
, size_t inlen
,
92 char **out
, size_t * outlen
);
94 typedef int (*Shishi_decrypt_function
) (Shishi
* handle
,
97 const char *iv
, size_t ivlen
,
98 char **ivout
, size_t * ivoutlen
,
99 const char *in
, size_t inlen
,
100 char **out
, size_t * outlen
);
102 typedef int (*Shishi_checksum_function
) (Shishi
* handle
,
106 const char *in
, size_t inlen
,
107 char **out
, size_t * outlen
);
109 typedef int (*Shishi_verify_function
) (Shishi
* handle
,
113 const char *in
, size_t inlen
,
114 const char *cksum
, size_t cksumlen
);
124 int defaultcksumtype
;
125 Shishi_random_to_key_function random2key
;
126 Shishi_string_to_key_function string2key
;
127 Shishi_encrypt_function encrypt
;
128 Shishi_decrypt_function decrypt
;
130 typedef struct cipherinfo cipherinfo
;
137 Shishi_checksum_function checksum
;
138 Shishi_verify_function verify
;
140 typedef struct checksuminfo checksuminfo
;
142 extern cipherinfo null_info
;
144 extern checksuminfo crc32_info
;
145 extern checksuminfo md4_info
;
146 extern checksuminfo md5_info
;
148 extern cipherinfo des_cbc_crc_info
;
149 extern cipherinfo des_cbc_md4_info
;
150 extern cipherinfo des_cbc_md5_info
;
151 extern cipherinfo des_cbc_none_info
;
152 extern checksuminfo md4_des_info
;
153 extern checksuminfo md5_des_info
;
154 extern checksuminfo md5_gss_info
;
156 extern cipherinfo des3_cbc_none_info
;
157 extern cipherinfo des3_cbc_sha1_kd_info
;
158 extern checksuminfo hmac_sha1_des3_kd_info
;
160 extern cipherinfo aes128_cts_hmac_sha1_96_info
;
161 extern cipherinfo aes256_cts_hmac_sha1_96_info
;
162 extern checksuminfo hmac_sha1_96_aes128_info
;
163 extern checksuminfo hmac_sha1_96_aes256_info
;
165 extern cipherinfo arcfour_hmac_info
;
166 extern cipherinfo arcfour_hmac_exp_info
;
167 extern checksuminfo arcfour_hmac_md5_info
;