]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/evp/evp.h
Import of old SSLeay release: SSLeay 0.8.1b
[thirdparty/openssl.git] / crypto / evp / evp.h
CommitLineData
d02b48c6
RE
1/* crypto/evp/evp.h */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#ifndef HEADER_ENVELOPE_H
60#define HEADER_ENVELOPE_H
61
62#ifdef __cplusplus
63extern "C" {
64#endif
65
66#ifndef NO_MD2
67#include "md2.h"
68#endif
69#ifndef NO_MD5
70#include "md5.h"
71#endif
72#if !defined(NO_SHA) || !defined(NO_SHA1)
73#include "sha.h"
74#endif
75#ifndef NO_DES
76#include "des.h"
77#endif
78#ifndef NO_RC4
79#include "rc4.h"
80#endif
81#ifndef NO_RC2
82#include "rc2.h"
83#endif
84#ifndef NO_BLOWFISH
85#include "blowfish.h"
86#endif
87#ifndef NO_IDEA
88#include "idea.h"
89#endif
90#ifndef NO_MDC2
91#include "mdc2.h"
92#endif
93
94#define EVP_RC2_KEY_SIZE 16
95#define EVP_RC4_KEY_SIZE 16
96#define EVP_BLOWFISH_KEY_SIZE 16
97#define EVP_MAX_MD_SIZE 20
98#define EVP_MAX_KEY_LENGTH 24
99#define EVP_MAX_IV_LENGTH 8
100
101#ifndef NO_RSA
102#include "rsa.h"
103#else
104#define RSA long
105#endif
106
107#ifndef NO_DSA
108#include "dsa.h"
109#else
110#define DSA long
111#endif
112
113#ifndef NO_DH
114#include "dh.h"
115#else
116#define DH long
117#endif
118
119#include "objects.h"
120
121#define EVP_PK_RSA 0x0001
122#define EVP_PK_DSA 0x0002
123#define EVP_PK_DH 0x0004
124#define EVP_PKT_SIGN 0x0010
125#define EVP_PKT_ENC 0x0020
126#define EVP_PKT_EXCH 0x0040
127#define EVP_PKS_RSA 0x0100
128#define EVP_PKS_DSA 0x0200
129#define EVP_PKT_EXP 0x1000 /* <= 512 bit key */
130
131#define EVP_PKEY_NONE NID_undef
132#define EVP_PKEY_RSA NID_rsaEncryption
133#define EVP_PKEY_RSA2 NID_rsa
134#define EVP_PKEY_DSA NID_dsa
135#define EVP_PKEY_DSA2 NID_dsaWithSHA
136#define EVP_PKEY_DSA3 NID_dsaWithSHA1
137#define EVP_PKEY_DH NID_dhKeyAgreement
138
139typedef struct evp_pkey_st
140 {
141 int type;
142 int save_type;
143 int references;
144 union {
145 char *ptr;
146 struct rsa_st *rsa; /* RSA */
147 struct dsa_st *dsa; /* DSA */
148 struct dh_st *dh; /* DH */
149 } pkey;
150 int save_parameters;
151#ifdef HEADER_STACK_H
152 STACK /* X509_ATTRIBUTE */ *attributes; /* [ 0 ] */
153#else
154 char /* X509_ATTRIBUTE */ *attributes; /* [ 0 ] */
155#endif
156 } EVP_PKEY;
157
158#ifndef EVP_MD
159typedef struct env_md_st
160 {
161 int type;
162 int pkey_type;
163 int md_size;
164 void (*init)();
165 void (*update)();
166 void (*final)();
167
168 int (*sign)();
169 int (*verify)();
170 int required_pkey_type[4]; /*EVP_PKEY_xxx */
171 } EVP_MD;
172
173#define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0}
174
175#ifndef NO_DSA
176#define EVP_PKEY_DSA_method DSA_sign,DSA_verify, \
177 {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3,0}
178#else
179#define EVP_PKEY_DSA_method EVP_PKEY_NULL_method
180#endif
181
182#ifndef NO_RSA
183#define EVP_PKEY_RSA_method RSA_sign,RSA_verify, \
184 {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
185#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \
186 RSA_sign_ASN1_OCTET_STRING, \
187 RSA_verify_ASN1_OCTET_STRING, \
188 {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
189#else
190#define EVP_PKEY_RSA_method EVP_PKEY_NULL_method
191#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method EVP_PKEY_NULL_method
192#endif
193
194#endif /* !EVP_MD */
195
196typedef struct env_md_ctx_st
197 {
198 EVP_MD *digest;
199 union {
200 unsigned char base[4];
201#ifndef NO_MD2
202 MD2_CTX md2;
203#endif
204#ifndef NO_MD5
205 MD5_CTX md5;
206#endif
207#if !defined(NO_SHA) || !defined(NO_SHA1)
208 SHA_CTX sha;
209#endif
210#ifndef NO_MDC2
211 MDC2_CTX mdc2;
212#endif
213 } md;
214 } EVP_MD_CTX;
215
216typedef struct evp_cipher_st
217 {
218 int nid;
219 int block_size;
220 int key_len;
221 int iv_len;
222 void (*init)(); /* init for encryption */
223 void (*do_cipher)(); /* encrypt data */
224 void (*cleanup)(); /* used by cipher method */
225 } EVP_CIPHER;
226
227typedef struct evp_cipher_info_st
228 {
229 EVP_CIPHER *cipher;
230 unsigned char iv[EVP_MAX_IV_LENGTH];
231 } EVP_CIPHER_INFO;
232
233typedef struct evp_cipher_ctx_st
234 {
235 EVP_CIPHER *cipher;
236 int encrypt; /* encrypt or decrypt */
237 int buf_len; /* number we have left */
238 unsigned char buf[8];
239 char *app_data; /* aplication stuff */
240 union {
241#ifndef NO_RC4
242 struct
243 {
244 unsigned char key[EVP_RC4_KEY_SIZE];
245 RC4_KEY ks; /* working key */
246 } rc4;
247#endif
248#ifndef NO_DES
249 struct
250 {
251 des_key_schedule ks;/* key schedule */
252 } des_ecb;
253
254 struct
255 {
256 C_Block oiv; /* original iv */
257 C_Block iv; /* working iv */
258 des_key_schedule ks;/* key schedule */
259 } des_cbc;
260
261 struct
262 {
263 C_Block oiv; /* original iv */
264 C_Block iv; /* working iv */
265 C_Block inw;
266 C_Block outw;
267 des_key_schedule ks;/* key schedule */
268 } desx_cbc;
269
270 struct
271 {
272 C_Block oiv; /* original iv */
273 C_Block iv; /* working iv */
274 des_key_schedule ks;/* key schedule */
275 des_key_schedule ks2;/* key schedule (for ede) */
276 des_key_schedule ks3;/* key schedule (for ede3) */
277 int num; /* used by cfb mode */
278 } des_cfb;
279
280 struct
281 {
282 C_Block oiv; /* original iv */
283 C_Block iv; /* working iv */
284 des_key_schedule ks1;/* ksched 1 */
285 des_key_schedule ks2;/* ksched 2 */
286 des_key_schedule ks3;/* ksched 3 */
287 } des_ede;
288#endif
289#ifndef NO_IDEA
290 struct
291 {
292 IDEA_KEY_SCHEDULE ks;/* key schedule */
293 } idea_ecb;
294 struct
295 {
296 unsigned char oiv[8];/* original iv */
297 unsigned char iv[8]; /* working iv */
298 IDEA_KEY_SCHEDULE ks;/* key schedule */
299 } idea_cbc;
300 struct
301 {
302 unsigned char oiv[8];/* original iv */
303 unsigned char iv[8]; /* working iv */
304 IDEA_KEY_SCHEDULE ks;/* key schedule */
305 int num; /* used by cfb mode */
306 } idea_cfb;
307#endif
308#ifndef NO_RC2
309 struct
310 {
311 RC2_KEY ks;/* key schedule */
312 } rc2_ecb;
313 struct
314 {
315 unsigned char oiv[8];/* original iv */
316 unsigned char iv[8]; /* working iv */
317 RC2_KEY ks;/* key schedule */
318 } rc2_cbc;
319 struct
320 {
321 unsigned char oiv[8];/* original iv */
322 unsigned char iv[8]; /* working iv */
323 RC2_KEY ks;/* key schedule */
324 int num; /* used by cfb mode */
325 } rc2_cfb;
326#endif
327#ifndef NO_BLOWFISH
328 struct
329 {
330 BF_KEY ks;/* key schedule */
331 } bf_ecb;
332 struct
333 {
334 unsigned char oiv[8];/* original iv */
335 unsigned char iv[8]; /* working iv */
336 BF_KEY ks;/* key schedule */
337 } bf_cbc;
338 struct
339 {
340 unsigned char oiv[8];/* original iv */
341 unsigned char iv[8]; /* working iv */
342 BF_KEY ks;/* key schedule */
343 int num; /* used by cfb mode */
344 } bf_cfb;
345#endif
346 } c;
347 } EVP_CIPHER_CTX;
348
349typedef struct evp_Encode_Ctx_st
350 {
351 int num; /* number saved in a partial encode/decode */
352 int length; /* The length is either the output line length
353 * (in input bytes) or the shortest input line
354 * length that is ok. Once decoding begins,
355 * the length is adjusted up each time a longer
356 * line is decoded */
357 unsigned char enc_data[80]; /* data to encode */
358 int line_num; /* number read on current line */
359 } EVP_ENCODE_CTX;
360
361#define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\
362 (char *)(rsa))
363#define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\
364 (char *)(dsa))
365#define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\
366 (char *)(dh))
367
368/* Add some extra combinations */
369#define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))
370#define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))
371#define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a))
372#define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a))
373
374#define EVP_MD_type(e) ((e)->type)
375#define EVP_MD_pkey_type(e) ((e)->pkey_type)
376#define EVP_MD_size(e) ((e)->md_size)
377#define EVP_MD_CTX_size(e) ((e)->digest->md_size)
378#define EVP_MD_CTX_type(e) ((e)->digest)
379
380#define EVP_CIPHER_nid(e) ((e)->nid)
381#define EVP_CIPHER_block_size(e) ((e)->block_size)
382#define EVP_CIPHER_key_length(e) ((e)->key_len)
383#define EVP_CIPHER_iv_length(e) ((e)->iv_len)
384
385#define EVP_CIPHER_CTX_cipher(e) ((e)->cipher)
386#define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid)
387#define EVP_CIPHER_CTX_block_size(e) ((e)->cipher->block_size)
388#define EVP_CIPHER_CTX_key_length(e) ((e)->cipher->key_len)
389#define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len)
390#define EVP_CIPHER_CTX_get_app_data(e) ((e)->app_data)
391#define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d))
392
393#define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80)
394#define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80)
395
396#define EVP_SignInit(a,b) EVP_DigestInit(a,b)
397#define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c)
398#define EVP_VerifyInit(a,b) EVP_DigestInit(a,b)
399#define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c)
400#define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e)
401#define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e)
402
403#define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md)
404#define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp)
405#define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp)
406#define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL)
407
408#define EVP_Cipher(c,o,i,l) (c)->cipher->do_cipher((c),(o),(i),(l))
409
410#ifndef NOPROTO
411
412void EVP_DigestInit(EVP_MD_CTX *ctx, EVP_MD *type);
413void EVP_DigestUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt);
414void EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
415
416int EVP_read_pw_string(char *buf,int length,char *prompt,int verify);
417void EVP_set_pw_prompt(char *prompt);
418char * EVP_get_pw_prompt(void);
419
420int EVP_BytesToKey(EVP_CIPHER *type,EVP_MD *md,unsigned char *salt,
421 unsigned char *data, int datal, int count,
422 unsigned char *key,unsigned char *iv);
423
424EVP_CIPHER *EVP_get_cipherbyname(char *name);
425
426void EVP_EncryptInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,
427 unsigned char *key, unsigned char *iv);
428void EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
429 int *outl, unsigned char *in, int inl);
430void EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
431
432void EVP_DecryptInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,
433 unsigned char *key, unsigned char *iv);
434void EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
435 int *outl, unsigned char *in, int inl);
436int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
437
438void EVP_CipherInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type, unsigned char *key,
439 unsigned char *iv,int enc);
440void EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
441 int *outl, unsigned char *in, int inl);
442int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
443
444int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s,
445 EVP_PKEY *pkey);
446
447int EVP_VerifyFinal(EVP_MD_CTX *ctx,unsigned char *sigbuf,
448 unsigned int siglen,EVP_PKEY *pkey);
449
450int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek,
451 int ekl,unsigned char *iv,EVP_PKEY *priv);
452int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
453
454int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek,
455 int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk);
456void EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl);
457
458void EVP_EncodeInit(EVP_ENCODE_CTX *ctx);
459void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,
460 int *outl,unsigned char *in,int inl);
461void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl);
462int EVP_EncodeBlock(unsigned char *t, unsigned char *f, int n);
463
464void EVP_DecodeInit(EVP_ENCODE_CTX *ctx);
465int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
466 unsigned char *in, int inl);
467int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned
468 char *out, int *outl);
469int EVP_DecodeBlock(unsigned char *t, unsigned
470 char *f, int n);
471
472void ERR_load_EVP_strings(void );
473
474void EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a);
475
476#ifdef HEADER_BIO_H
477BIO_METHOD *BIO_f_md(void);
478BIO_METHOD *BIO_f_base64(void);
479BIO_METHOD *BIO_f_cipher(void);
480void BIO_set_cipher(BIO *b,EVP_CIPHER *c,unsigned char *k,
481 unsigned char *i, int enc);
482#endif
483
484EVP_MD *EVP_md_null(void);
485EVP_MD *EVP_md2(void);
486EVP_MD *EVP_md5(void);
487EVP_MD *EVP_sha(void);
488EVP_MD *EVP_sha1(void);
489EVP_MD *EVP_dss(void);
490EVP_MD *EVP_dss1(void);
491EVP_MD *EVP_mdc2(void);
492
493EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */
494EVP_CIPHER *EVP_des_ecb(void);
495EVP_CIPHER *EVP_des_ede(void);
496EVP_CIPHER *EVP_des_ede3(void);
497EVP_CIPHER *EVP_des_cfb(void);
498EVP_CIPHER *EVP_des_ede_cfb(void);
499EVP_CIPHER *EVP_des_ede3_cfb(void);
500EVP_CIPHER *EVP_des_ofb(void);
501EVP_CIPHER *EVP_des_ede_ofb(void);
502EVP_CIPHER *EVP_des_ede3_ofb(void);
503EVP_CIPHER *EVP_des_cbc(void);
504EVP_CIPHER *EVP_des_ede_cbc(void);
505EVP_CIPHER *EVP_des_ede3_cbc(void);
506EVP_CIPHER *EVP_desx_cbc(void);
507EVP_CIPHER *EVP_rc4(void);
508EVP_CIPHER *EVP_idea_ecb(void);
509EVP_CIPHER *EVP_idea_cfb(void);
510EVP_CIPHER *EVP_idea_ofb(void);
511EVP_CIPHER *EVP_idea_cbc(void);
512EVP_CIPHER *EVP_rc2_ecb(void);
513EVP_CIPHER *EVP_rc2_cbc(void);
514EVP_CIPHER *EVP_rc2_cfb(void);
515EVP_CIPHER *EVP_rc2_ofb(void);
516EVP_CIPHER *EVP_bf_ecb(void);
517EVP_CIPHER *EVP_bf_cbc(void);
518EVP_CIPHER *EVP_bf_cfb(void);
519EVP_CIPHER *EVP_bf_ofb(void);
520
521void SSLeay_add_all_algorithms(void);
522void SSLeay_add_all_ciphers(void);
523void SSLeay_add_all_digests(void);
524
525int EVP_add_cipher(EVP_CIPHER *cipher);
526int EVP_add_digest(EVP_MD *digest);
527int EVP_add_alias(char *name,char *alias);
528int EVP_delete_alias(char *name);
529
530EVP_CIPHER *EVP_get_cipherbyname(char *name);
531EVP_MD *EVP_get_digestbyname(char *name);
532void EVP_cleanup(void);
533
534int EVP_PKEY_type(int type);
535int EVP_PKEY_size(EVP_PKEY *pkey);
536int EVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key);
537EVP_PKEY * EVP_PKEY_new(void);
538void EVP_PKEY_free(EVP_PKEY *pkey);
539EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, unsigned char **pp,
540 long length);
541int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);
542
543EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, unsigned char **pp,
544 long length);
545int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);
546
547int EVP_PKEY_copy_parameters(EVP_PKEY *to,EVP_PKEY *from);
548int EVP_PKEY_missing_parameters(EVP_PKEY *pkey);
549int EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode);
550
551#else
552
553void EVP_DigestInit();
554void EVP_DigestUpdate();
555void EVP_DigestFinal();
556
557int EVP_read_pw_string();
558void EVP_set_pw_prompt();
559char * EVP_get_pw_prompt();
560
561int EVP_BytesToKey();
562
563EVP_CIPHER *EVP_get_cipherbyname();
564
565void EVP_EncryptInit();
566void EVP_EncryptUpdate();
567void EVP_EncryptFinal();
568
569void EVP_DecryptInit();
570void EVP_DecryptUpdate();
571int EVP_DecryptFinal();
572
573void EVP_CipherInit();
574void EVP_CipherUpdate();
575int EVP_CipherFinal();
576
577int EVP_SignFinal();
578
579int EVP_VerifyFinal();
580
581int EVP_OpenInit();
582int EVP_OpenFinal();
583
584int EVP_SealInit();
585void EVP_SealFinal();
586
587void EVP_EncodeInit();
588void EVP_EncodeUpdate();
589void EVP_EncodeFinal();
590int EVP_EncodeBlock();
591
592void EVP_DecodeInit();
593int EVP_DecodeUpdate();
594int EVP_DecodeFinal();
595int EVP_DecodeBlock();
596
597void ERR_load_EVP_strings();
598
599void EVP_CIPHER_CTX_cleanup();
600
601#ifdef HEADER_BIO_H
602BIO_METHOD *BIO_f_md();
603BIO_METHOD *BIO_f_base64();
604BIO_METHOD *BIO_f_cipher();
605void BIO_set_cipher();
606#endif
607
608EVP_MD *EVP_md_null();
609EVP_MD *EVP_md2();
610EVP_MD *EVP_md5();
611EVP_MD *EVP_sha();
612EVP_MD *EVP_sha1();
613EVP_MD *EVP_dss();
614EVP_MD *EVP_dss1();
615EVP_MD *EVP_mdc2();
616
617EVP_CIPHER *EVP_enc_null();
618EVP_CIPHER *EVP_des_ecb();
619EVP_CIPHER *EVP_des_ede();
620EVP_CIPHER *EVP_des_ede3();
621EVP_CIPHER *EVP_des_cfb();
622EVP_CIPHER *EVP_des_ede_cfb();
623EVP_CIPHER *EVP_des_ede3_cfb();
624EVP_CIPHER *EVP_des_ofb();
625EVP_CIPHER *EVP_des_ede_ofb();
626EVP_CIPHER *EVP_des_ede3_ofb();
627EVP_CIPHER *EVP_des_cbc();
628EVP_CIPHER *EVP_des_ede_cbc();
629EVP_CIPHER *EVP_des_ede3_cbc();
630EVP_CIPHER *EVP_desx_cbc();
631EVP_CIPHER *EVP_rc4();
632EVP_CIPHER *EVP_idea_ecb();
633EVP_CIPHER *EVP_idea_cfb();
634EVP_CIPHER *EVP_idea_ofb();
635EVP_CIPHER *EVP_idea_cbc();
636EVP_CIPHER *EVP_rc2_ecb();
637EVP_CIPHER *EVP_rc2_cbc();
638EVP_CIPHER *EVP_rc2_cfb();
639EVP_CIPHER *EVP_rc2_ofb();
640EVP_CIPHER *EVP_bf_ecb();
641EVP_CIPHER *EVP_bf_cbc();
642EVP_CIPHER *EVP_bf_cfb();
643EVP_CIPHER *EVP_bf_ofb();
644
645void SSLeay_add_all_algorithms();
646void SSLeay_add_all_ciphers();
647void SSLeay_add_all_digests();
648
649int EVP_add_cipher();
650int EVP_add_digest();
651int EVP_add_alias();
652int EVP_delete_alias();
653
654EVP_CIPHER *EVP_get_cipherbyname();
655EVP_MD *EVP_get_digestbyname();
656void EVP_cleanup();
657
658int EVP_PKEY_type();
659int EVP_PKEY_size();
660int EVP_PKEY_assign();
661EVP_PKEY * EVP_PKEY_new();
662void EVP_PKEY_free();
663EVP_PKEY * d2i_PublicKey();
664int i2d_PublicKey();
665
666EVP_PKEY * d2i_PrivateKey();
667int i2d_PrivateKey();
668
669int EVP_PKEY_copy_parameters();
670int EVP_PKEY_missing_parameters();
671int EVP_PKEY_save_parameters();
672
673#endif
674
675/* BEGIN ERROR CODES */
676/* Error codes for the EVP functions. */
677
678/* Function codes. */
679#define EVP_F_D2I_PKEY 100
680#define EVP_F_EVP_DECRYPTFINAL 101
681#define EVP_F_EVP_OPENINIT 102
682#define EVP_F_EVP_PKEY_COPY_PARAMETERS 103
683#define EVP_F_EVP_PKEY_NEW 104
684#define EVP_F_EVP_SEALINIT 105
685#define EVP_F_EVP_SIGNFINAL 106
686#define EVP_F_EVP_VERIFYFINAL 107
687
688/* Reason codes. */
689#define EVP_R_BAD_DECRYPT 100
690#define EVP_R_DIFFERENT_KEY_TYPES 101
691#define EVP_R_IV_TOO_LARGE 102
692#define EVP_R_MISSING_PARMATERS 103
693#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104
694#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105
695#define EVP_R_PUBLIC_KEY_NOT_RSA 106
696#define EVP_R_UNSUPPORTED_CIPHER 107
697#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 108
698#define EVP_R_WRONG_PUBLIC_KEY_TYPE 109
699
700#ifdef __cplusplus
701}
702#endif
703#endif
704