xref: /minix3/crypto/external/bsd/heimdal/dist/lib/hcrypto/evp.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: evp.h,v 1.1.1.3 2014/04/24 12:45:30 pettai Exp $	*/
2ebfedea0SLionel Sambuc 
3ebfedea0SLionel Sambuc /*
4ebfedea0SLionel Sambuc  * Copyright (c) 2005 - 2008 Kungliga Tekniska Högskolan
5ebfedea0SLionel Sambuc  * (Royal Institute of Technology, Stockholm, Sweden).
6ebfedea0SLionel Sambuc  * All rights reserved.
7ebfedea0SLionel Sambuc  *
8ebfedea0SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
9ebfedea0SLionel Sambuc  * modification, are permitted provided that the following conditions
10ebfedea0SLionel Sambuc  * are met:
11ebfedea0SLionel Sambuc  *
12ebfedea0SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
13ebfedea0SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
14ebfedea0SLionel Sambuc  *
15ebfedea0SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
16ebfedea0SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
17ebfedea0SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
18ebfedea0SLionel Sambuc  *
19ebfedea0SLionel Sambuc  * 3. Neither the name of the Institute nor the names of its contributors
20ebfedea0SLionel Sambuc  *    may be used to endorse or promote products derived from this software
21ebfedea0SLionel Sambuc  *    without specific prior written permission.
22ebfedea0SLionel Sambuc  *
23ebfedea0SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24ebfedea0SLionel Sambuc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25ebfedea0SLionel Sambuc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ebfedea0SLionel Sambuc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27ebfedea0SLionel Sambuc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28ebfedea0SLionel Sambuc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29ebfedea0SLionel Sambuc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30ebfedea0SLionel Sambuc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31ebfedea0SLionel Sambuc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32ebfedea0SLionel Sambuc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33ebfedea0SLionel Sambuc  * SUCH DAMAGE.
34ebfedea0SLionel Sambuc  */
35ebfedea0SLionel Sambuc 
36ebfedea0SLionel Sambuc /* Id */
37ebfedea0SLionel Sambuc 
38ebfedea0SLionel Sambuc #ifndef HEIM_EVP_H
39ebfedea0SLionel Sambuc #define HEIM_EVP_H 1
40ebfedea0SLionel Sambuc 
41ebfedea0SLionel Sambuc #include <hcrypto/engine.h>
42ebfedea0SLionel Sambuc 
43ebfedea0SLionel Sambuc /* symbol renaming */
44ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_block_size hc_EVP_CIPHER_CTX_block_size
45ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_cipher hc_EVP_CIPHER_CTX_cipher
46ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_cleanup hc_EVP_CIPHER_CTX_cleanup
47ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_flags hc_EVP_CIPHER_CTX_flags
48ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_get_app_data hc_EVP_CIPHER_CTX_get_app_data
49ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_init hc_EVP_CIPHER_CTX_init
50ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_iv_length hc_EVP_CIPHER_CTX_iv_length
51ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_key_length hc_EVP_CIPHER_CTX_key_length
52ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_mode hc_EVP_CIPHER_CTX_mode
53ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_set_app_data hc_EVP_CIPHER_CTX_set_app_data
54ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_set_key_length hc_EVP_CIPHER_CTX_set_key_length
55ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_set_padding hc_EVP_CIPHER_CTX_set_padding
56ebfedea0SLionel Sambuc #define EVP_CIPHER_block_size hc_EVP_CIPHER_block_size
57ebfedea0SLionel Sambuc #define EVP_CIPHER_iv_length hc_EVP_CIPHER_iv_length
58ebfedea0SLionel Sambuc #define EVP_CIPHER_key_length hc_EVP_CIPHER_key_length
59ebfedea0SLionel Sambuc #define EVP_Cipher hc_EVP_Cipher
60ebfedea0SLionel Sambuc #define EVP_CipherInit_ex hc_EVP_CipherInit_ex
61ebfedea0SLionel Sambuc #define EVP_CipherUpdate hc_EVP_CipherUpdate
62ebfedea0SLionel Sambuc #define EVP_CipherFinal_ex hc_EVP_CipherFinal_ex
63ebfedea0SLionel Sambuc #define EVP_Digest hc_EVP_Digest
64ebfedea0SLionel Sambuc #define EVP_DigestFinal_ex hc_EVP_DigestFinal_ex
65ebfedea0SLionel Sambuc #define EVP_DigestInit_ex hc_EVP_DigestInit_ex
66ebfedea0SLionel Sambuc #define EVP_DigestUpdate hc_EVP_DigestUpdate
67ebfedea0SLionel Sambuc #define EVP_MD_CTX_block_size hc_EVP_MD_CTX_block_size
68ebfedea0SLionel Sambuc #define EVP_MD_CTX_cleanup hc_EVP_MD_CTX_cleanup
69ebfedea0SLionel Sambuc #define EVP_MD_CTX_create hc_EVP_MD_CTX_create
70ebfedea0SLionel Sambuc #define EVP_MD_CTX_init hc_EVP_MD_CTX_init
71ebfedea0SLionel Sambuc #define EVP_MD_CTX_destroy hc_EVP_MD_CTX_destroy
72ebfedea0SLionel Sambuc #define EVP_MD_CTX_md hc_EVP_MD_CTX_md
73ebfedea0SLionel Sambuc #define EVP_MD_CTX_size hc_EVP_MD_CTX_size
74ebfedea0SLionel Sambuc #define EVP_MD_block_size hc_EVP_MD_block_size
75ebfedea0SLionel Sambuc #define EVP_MD_size hc_EVP_MD_size
76ebfedea0SLionel Sambuc #define EVP_aes_128_cbc hc_EVP_aes_128_cbc
77ebfedea0SLionel Sambuc #define EVP_aes_192_cbc hc_EVP_aes_192_cbc
78ebfedea0SLionel Sambuc #define EVP_aes_256_cbc hc_EVP_aes_256_cbc
79ebfedea0SLionel Sambuc #define EVP_aes_128_cfb8 hc_EVP_aes_128_cfb8
80ebfedea0SLionel Sambuc #define EVP_aes_192_cfb8 hc_EVP_aes_192_cfb8
81ebfedea0SLionel Sambuc #define EVP_aes_256_cfb8 hc_EVP_aes_256_cfb8
82ebfedea0SLionel Sambuc 
83ebfedea0SLionel Sambuc #define EVP_des_cbc hc_EVP_des_cbc
84ebfedea0SLionel Sambuc #define EVP_des_ede3_cbc hc_EVP_des_ede3_cbc
85ebfedea0SLionel Sambuc #define EVP_enc_null hc_EVP_enc_null
86ebfedea0SLionel Sambuc #define EVP_md2 hc_EVP_md2
87ebfedea0SLionel Sambuc #define EVP_md4 hc_EVP_md4
88ebfedea0SLionel Sambuc #define EVP_md5 hc_EVP_md5
89ebfedea0SLionel Sambuc #define EVP_md_null hc_EVP_md_null
90ebfedea0SLionel Sambuc #define EVP_rc2_40_cbc hc_EVP_rc2_40_cbc
91ebfedea0SLionel Sambuc #define EVP_rc2_64_cbc hc_EVP_rc2_64_cbc
92ebfedea0SLionel Sambuc #define EVP_rc2_cbc hc_EVP_rc2_cbc
93ebfedea0SLionel Sambuc #define EVP_rc4 hc_EVP_rc4
94ebfedea0SLionel Sambuc #define EVP_rc4_40 hc_EVP_rc4_40
95ebfedea0SLionel Sambuc #define EVP_camellia_128_cbc hc_EVP_camellia_128_cbc
96ebfedea0SLionel Sambuc #define EVP_camellia_192_cbc hc_EVP_camellia_192_cbc
97ebfedea0SLionel Sambuc #define EVP_camellia_256_cbc hc_EVP_camellia_256_cbc
98ebfedea0SLionel Sambuc #define EVP_sha hc_EVP_sha
99ebfedea0SLionel Sambuc #define EVP_sha1 hc_EVP_sha1
100ebfedea0SLionel Sambuc #define EVP_sha256 hc_EVP_sha256
101ebfedea0SLionel Sambuc #define EVP_sha384 hc_EVP_sha384
102ebfedea0SLionel Sambuc #define EVP_sha512 hc_EVP_sha512
103ebfedea0SLionel Sambuc #define PKCS5_PBKDF2_HMAC_SHA1 hc_PKCS5_PBKDF2_HMAC_SHA1
104ebfedea0SLionel Sambuc #define EVP_BytesToKey hc_EVP_BytesToKey
105ebfedea0SLionel Sambuc #define EVP_get_cipherbyname hc_EVP_get_cipherbyname
106ebfedea0SLionel Sambuc #define	OpenSSL_add_all_algorithms hc_OpenSSL_add_all_algorithms
107ebfedea0SLionel Sambuc #define	OpenSSL_add_all_algorithms_conf hc_OpenSSL_add_all_algorithms_conf
108ebfedea0SLionel Sambuc #define	OpenSSL_add_all_algorithms_noconf hc_OpenSSL_add_all_algorithms_noconf
109ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_ctrl hc_EVP_CIPHER_CTX_ctrl
110ebfedea0SLionel Sambuc #define EVP_CIPHER_CTX_rand_key hc_EVP_CIPHER_CTX_rand_key
111ebfedea0SLionel Sambuc #define hcrypto_validate hc_hcrypto_validate
112ebfedea0SLionel Sambuc 
113ebfedea0SLionel Sambuc /*
114ebfedea0SLionel Sambuc  *
115ebfedea0SLionel Sambuc  */
116ebfedea0SLionel Sambuc 
117ebfedea0SLionel Sambuc typedef struct hc_EVP_MD_CTX EVP_MD_CTX;
118ebfedea0SLionel Sambuc typedef struct hc_evp_pkey EVP_PKEY;
119ebfedea0SLionel Sambuc typedef struct hc_evp_md EVP_MD;
120ebfedea0SLionel Sambuc typedef struct hc_CIPHER EVP_CIPHER;
121ebfedea0SLionel Sambuc typedef struct hc_CIPHER_CTX EVP_CIPHER_CTX;
122ebfedea0SLionel Sambuc 
123ebfedea0SLionel Sambuc #define EVP_MAX_IV_LENGTH	16
124ebfedea0SLionel Sambuc #define EVP_MAX_BLOCK_LENGTH	32
125ebfedea0SLionel Sambuc 
126ebfedea0SLionel Sambuc #define EVP_MAX_MD_SIZE		64
127ebfedea0SLionel Sambuc 
128ebfedea0SLionel Sambuc struct hc_CIPHER {
129ebfedea0SLionel Sambuc     int nid;
130ebfedea0SLionel Sambuc     int block_size;
131ebfedea0SLionel Sambuc     int key_len;
132ebfedea0SLionel Sambuc     int iv_len;
133ebfedea0SLionel Sambuc     unsigned long flags;
134ebfedea0SLionel Sambuc     /* The lowest 3 bits is used as integer field for the mode the
135ebfedea0SLionel Sambuc      * cipher is used in (use EVP_CIPHER.._mode() to extract the
136ebfedea0SLionel Sambuc      * mode). The rest of the flag field is a bitfield.
137ebfedea0SLionel Sambuc      */
138ebfedea0SLionel Sambuc #define EVP_CIPH_STREAM_CIPHER		0
139ebfedea0SLionel Sambuc #define EVP_CIPH_CBC_MODE		2
140ebfedea0SLionel Sambuc #define EVP_CIPH_CFB8_MODE              4
141ebfedea0SLionel Sambuc #define EVP_CIPH_MODE			0x7
142ebfedea0SLionel Sambuc 
143ebfedea0SLionel Sambuc #define EVP_CIPH_VARIABLE_LENGTH	0x008 /* variable key length */
144ebfedea0SLionel Sambuc #define EVP_CIPH_ALWAYS_CALL_INIT	0x020
145ebfedea0SLionel Sambuc #define EVP_CIPH_RAND_KEY		0x200
146ebfedea0SLionel Sambuc 
147ebfedea0SLionel Sambuc     int (*init)(EVP_CIPHER_CTX*,const unsigned char*,const unsigned char*,int);
148ebfedea0SLionel Sambuc     int (*do_cipher)(EVP_CIPHER_CTX *, unsigned char *,
149ebfedea0SLionel Sambuc 		     const unsigned char *, unsigned int);
150ebfedea0SLionel Sambuc     int (*cleanup)(EVP_CIPHER_CTX *);
151ebfedea0SLionel Sambuc     int ctx_size;
152ebfedea0SLionel Sambuc     void *set_asn1_parameters;
153ebfedea0SLionel Sambuc     void *get_asn1_parameters;
154ebfedea0SLionel Sambuc     int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr);
155ebfedea0SLionel Sambuc #define EVP_CTRL_RAND_KEY		0x6
156ebfedea0SLionel Sambuc 
157ebfedea0SLionel Sambuc     void *app_data;
158ebfedea0SLionel Sambuc };
159ebfedea0SLionel Sambuc 
160ebfedea0SLionel Sambuc struct hc_CIPHER_CTX {
161ebfedea0SLionel Sambuc     const EVP_CIPHER *cipher;
162ebfedea0SLionel Sambuc     ENGINE *engine;
163ebfedea0SLionel Sambuc     int encrypt;
164ebfedea0SLionel Sambuc     int buf_len; /* bytes stored in buf for EVP_CipherUpdate */
165ebfedea0SLionel Sambuc     unsigned char oiv[EVP_MAX_IV_LENGTH];
166ebfedea0SLionel Sambuc     unsigned char iv[EVP_MAX_IV_LENGTH];
167ebfedea0SLionel Sambuc     unsigned char buf[EVP_MAX_BLOCK_LENGTH];
168ebfedea0SLionel Sambuc     int num;
169ebfedea0SLionel Sambuc     void *app_data;
170ebfedea0SLionel Sambuc     int key_len;
171ebfedea0SLionel Sambuc     unsigned long flags;
172ebfedea0SLionel Sambuc     void *cipher_data;
173ebfedea0SLionel Sambuc     int final_used;
174ebfedea0SLionel Sambuc     int block_mask;
175ebfedea0SLionel Sambuc     unsigned char final[EVP_MAX_BLOCK_LENGTH];
176ebfedea0SLionel Sambuc };
177ebfedea0SLionel Sambuc 
178ebfedea0SLionel Sambuc typedef int (*hc_evp_md_init)(EVP_MD_CTX *);
179ebfedea0SLionel Sambuc typedef int (*hc_evp_md_update)(EVP_MD_CTX *,const void *, size_t);
180ebfedea0SLionel Sambuc typedef int (*hc_evp_md_final)(void *, EVP_MD_CTX *);
181ebfedea0SLionel Sambuc typedef int (*hc_evp_md_cleanup)(EVP_MD_CTX *);
182ebfedea0SLionel Sambuc 
183ebfedea0SLionel Sambuc struct hc_evp_md {
184ebfedea0SLionel Sambuc     int hash_size;
185ebfedea0SLionel Sambuc     int block_size;
186ebfedea0SLionel Sambuc     int ctx_size;
187ebfedea0SLionel Sambuc     hc_evp_md_init init;
188ebfedea0SLionel Sambuc     hc_evp_md_update update;
189ebfedea0SLionel Sambuc     hc_evp_md_final final;
190ebfedea0SLionel Sambuc     hc_evp_md_cleanup cleanup;
191ebfedea0SLionel Sambuc };
192ebfedea0SLionel Sambuc 
193ebfedea0SLionel Sambuc #if !defined(__GNUC__) && !defined(__attribute__)
194ebfedea0SLionel Sambuc #define __attribute__(x)
195ebfedea0SLionel Sambuc #endif
196ebfedea0SLionel Sambuc 
197ebfedea0SLionel Sambuc #ifndef HC_DEPRECATED
198ebfedea0SLionel Sambuc #if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1 )))
199ebfedea0SLionel Sambuc #define HC_DEPRECATED __attribute__((deprecated))
200ebfedea0SLionel Sambuc #elif defined(_MSC_VER) && (_MSC_VER>1200)
201ebfedea0SLionel Sambuc #define HC_DEPRECATED __declspec(deprecated)
202ebfedea0SLionel Sambuc #else
203ebfedea0SLionel Sambuc #define HC_DEPRECATED
204ebfedea0SLionel Sambuc #endif
205ebfedea0SLionel Sambuc #endif
206ebfedea0SLionel Sambuc 
207ebfedea0SLionel Sambuc #ifndef HC_DEPRECATED_CRYPTO
208ebfedea0SLionel Sambuc #define HC_DEPRECATED_CRYPTO HC_DEPRECATED
209ebfedea0SLionel Sambuc #endif
210ebfedea0SLionel Sambuc 
211ebfedea0SLionel Sambuc #ifdef __cplusplus
212ebfedea0SLionel Sambuc #define HC_CPP_BEGIN extern "C" {
213ebfedea0SLionel Sambuc #define HC_CPP_END }
214ebfedea0SLionel Sambuc #else
215ebfedea0SLionel Sambuc #define HC_CPP_BEGIN
216ebfedea0SLionel Sambuc #define HC_CPP_END
217ebfedea0SLionel Sambuc #endif
218ebfedea0SLionel Sambuc 
219ebfedea0SLionel Sambuc HC_CPP_BEGIN
220ebfedea0SLionel Sambuc 
221ebfedea0SLionel Sambuc /*
222ebfedea0SLionel Sambuc  * Avaible crypto algs
223ebfedea0SLionel Sambuc  */
224ebfedea0SLionel Sambuc 
225ebfedea0SLionel Sambuc const EVP_MD *EVP_md_null(void);
226ebfedea0SLionel Sambuc HC_DEPRECATED_CRYPTO const EVP_MD *EVP_md2(void);
227ebfedea0SLionel Sambuc HC_DEPRECATED_CRYPTO const EVP_MD *EVP_md4(void);
228ebfedea0SLionel Sambuc HC_DEPRECATED_CRYPTO const EVP_MD *EVP_md5(void);
229ebfedea0SLionel Sambuc const EVP_MD *EVP_sha(void);
230ebfedea0SLionel Sambuc const EVP_MD *EVP_sha1(void);
231ebfedea0SLionel Sambuc const EVP_MD *EVP_sha256(void);
232ebfedea0SLionel Sambuc const EVP_MD *EVP_sha384(void);
233ebfedea0SLionel Sambuc const EVP_MD *EVP_sha512(void);
234ebfedea0SLionel Sambuc 
235ebfedea0SLionel Sambuc const EVP_CIPHER * EVP_aes_128_cbc(void);
236ebfedea0SLionel Sambuc const EVP_CIPHER * EVP_aes_192_cbc(void);
237ebfedea0SLionel Sambuc const EVP_CIPHER * EVP_aes_256_cbc(void);
238ebfedea0SLionel Sambuc const EVP_CIPHER * EVP_aes_128_cfb8(void);
239ebfedea0SLionel Sambuc const EVP_CIPHER * EVP_aes_192_cfb8(void);
240ebfedea0SLionel Sambuc const EVP_CIPHER * EVP_aes_256_cfb8(void);
241ebfedea0SLionel Sambuc HC_DEPRECATED_CRYPTO const EVP_CIPHER * EVP_des_cbc(void);
242ebfedea0SLionel Sambuc const EVP_CIPHER * EVP_des_ede3_cbc(void);
243ebfedea0SLionel Sambuc const EVP_CIPHER * EVP_enc_null(void);
244ebfedea0SLionel Sambuc HC_DEPRECATED_CRYPTO const EVP_CIPHER * EVP_rc2_40_cbc(void);
245ebfedea0SLionel Sambuc HC_DEPRECATED_CRYPTO const EVP_CIPHER * EVP_rc2_64_cbc(void);
246ebfedea0SLionel Sambuc HC_DEPRECATED_CRYPTO const EVP_CIPHER * EVP_rc2_cbc(void);
247ebfedea0SLionel Sambuc const EVP_CIPHER * EVP_rc4(void);
248ebfedea0SLionel Sambuc HC_DEPRECATED_CRYPTO const EVP_CIPHER * EVP_rc4_40(void);
249ebfedea0SLionel Sambuc const EVP_CIPHER * EVP_camellia_128_cbc(void);
250ebfedea0SLionel Sambuc const EVP_CIPHER * EVP_camellia_192_cbc(void);
251ebfedea0SLionel Sambuc const EVP_CIPHER * EVP_camellia_256_cbc(void);
252ebfedea0SLionel Sambuc 
253ebfedea0SLionel Sambuc size_t	EVP_MD_size(const EVP_MD *);
254ebfedea0SLionel Sambuc size_t	EVP_MD_block_size(const EVP_MD *);
255ebfedea0SLionel Sambuc 
256ebfedea0SLionel Sambuc const EVP_MD *
257ebfedea0SLionel Sambuc 	EVP_MD_CTX_md(EVP_MD_CTX *);
258ebfedea0SLionel Sambuc size_t	EVP_MD_CTX_size(EVP_MD_CTX *);
259ebfedea0SLionel Sambuc size_t	EVP_MD_CTX_block_size(EVP_MD_CTX *);
260ebfedea0SLionel Sambuc 
261ebfedea0SLionel Sambuc EVP_MD_CTX *
262ebfedea0SLionel Sambuc 	EVP_MD_CTX_create(void);
263ebfedea0SLionel Sambuc void	HC_DEPRECATED EVP_MD_CTX_init(EVP_MD_CTX *);
264ebfedea0SLionel Sambuc void	EVP_MD_CTX_destroy(EVP_MD_CTX *);
265ebfedea0SLionel Sambuc int	HC_DEPRECATED EVP_MD_CTX_cleanup(EVP_MD_CTX *);
266ebfedea0SLionel Sambuc 
267ebfedea0SLionel Sambuc int	EVP_DigestInit_ex(EVP_MD_CTX *, const EVP_MD *, ENGINE *);
268ebfedea0SLionel Sambuc int	EVP_DigestUpdate(EVP_MD_CTX *,const void *, size_t);
269ebfedea0SLionel Sambuc int	EVP_DigestFinal_ex(EVP_MD_CTX *, void *, unsigned int *);
270ebfedea0SLionel Sambuc int	EVP_Digest(const void *, size_t, void *, unsigned int *,
271ebfedea0SLionel Sambuc 		   const EVP_MD *, ENGINE *);
272ebfedea0SLionel Sambuc /*
273ebfedea0SLionel Sambuc  *
274ebfedea0SLionel Sambuc  */
275ebfedea0SLionel Sambuc 
276ebfedea0SLionel Sambuc const EVP_CIPHER *
277ebfedea0SLionel Sambuc 	EVP_get_cipherbyname(const char *);
278ebfedea0SLionel Sambuc 
279ebfedea0SLionel Sambuc size_t	EVP_CIPHER_block_size(const EVP_CIPHER *);
280ebfedea0SLionel Sambuc size_t	EVP_CIPHER_key_length(const EVP_CIPHER *);
281ebfedea0SLionel Sambuc size_t	EVP_CIPHER_iv_length(const EVP_CIPHER *);
282ebfedea0SLionel Sambuc 
283ebfedea0SLionel Sambuc void	EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *);
284ebfedea0SLionel Sambuc int	EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *);
285ebfedea0SLionel Sambuc int	EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *, int);
286ebfedea0SLionel Sambuc int	EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *, int);
287ebfedea0SLionel Sambuc unsigned long
288ebfedea0SLionel Sambuc 	EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *);
289ebfedea0SLionel Sambuc int	EVP_CIPHER_CTX_mode(const EVP_CIPHER_CTX *);
290ebfedea0SLionel Sambuc 
291ebfedea0SLionel Sambuc const EVP_CIPHER *
292ebfedea0SLionel Sambuc 	EVP_CIPHER_CTX_cipher(EVP_CIPHER_CTX *);
293ebfedea0SLionel Sambuc size_t	EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *);
294ebfedea0SLionel Sambuc size_t	EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *);
295ebfedea0SLionel Sambuc size_t	EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *);
296ebfedea0SLionel Sambuc void *	EVP_CIPHER_CTX_get_app_data(EVP_CIPHER_CTX *);
297ebfedea0SLionel Sambuc void	EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *, void *);
298ebfedea0SLionel Sambuc 
299ebfedea0SLionel Sambuc int	EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *, int, int, void *);
300ebfedea0SLionel Sambuc int	EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *, void *);
301ebfedea0SLionel Sambuc 
302ebfedea0SLionel Sambuc 
303ebfedea0SLionel Sambuc int	EVP_CipherInit_ex(EVP_CIPHER_CTX *,const EVP_CIPHER *, ENGINE *,
304ebfedea0SLionel Sambuc 			  const void *, const void *, int);
305ebfedea0SLionel Sambuc int	EVP_CipherUpdate(EVP_CIPHER_CTX *, void *, int *, void *, size_t);
306ebfedea0SLionel Sambuc int	EVP_CipherFinal_ex(EVP_CIPHER_CTX *, void *, int *);
307ebfedea0SLionel Sambuc 
308ebfedea0SLionel Sambuc int	EVP_Cipher(EVP_CIPHER_CTX *,void *,const void *,size_t);
309ebfedea0SLionel Sambuc 
310ebfedea0SLionel Sambuc int	PKCS5_PBKDF2_HMAC_SHA1(const void *, size_t, const void *, size_t,
311ebfedea0SLionel Sambuc 			       unsigned long, size_t, void *);
312ebfedea0SLionel Sambuc 
313ebfedea0SLionel Sambuc int	EVP_BytesToKey(const EVP_CIPHER *, const EVP_MD *,
314ebfedea0SLionel Sambuc 		       const void *, const void *, size_t,
315ebfedea0SLionel Sambuc 		       unsigned int, void *, void *);
316ebfedea0SLionel Sambuc 
317ebfedea0SLionel Sambuc 
318ebfedea0SLionel Sambuc /*
319ebfedea0SLionel Sambuc  *
320ebfedea0SLionel Sambuc  */
321ebfedea0SLionel Sambuc 
322ebfedea0SLionel Sambuc void	OpenSSL_add_all_algorithms(void);
323ebfedea0SLionel Sambuc void	OpenSSL_add_all_algorithms_conf(void);
324ebfedea0SLionel Sambuc void	OpenSSL_add_all_algorithms_noconf(void);
325ebfedea0SLionel Sambuc 
326ebfedea0SLionel Sambuc void
327ebfedea0SLionel Sambuc hcrypto_validate(void);
328ebfedea0SLionel Sambuc 
329ebfedea0SLionel Sambuc HC_CPP_END
330ebfedea0SLionel Sambuc 
331ebfedea0SLionel Sambuc #endif /* HEIM_EVP_H */
332