heimdal: import heimdal's trunk svn rev 23697 + lorikeet-heimdal patches
[amitay/samba.git] / source4 / heimdal / lib / hcrypto / engine.h
1 /*
2  * Copyright (c) 2006 Kungliga Tekniska Högskolan
3  * (Royal Institute of Technology, Stockholm, Sweden). 
4  * All rights reserved. 
5  *
6  * Redistribution and use in source and binary forms, with or without 
7  * modification, are permitted provided that the following conditions 
8  * are met: 
9  *
10  * 1. Redistributions of source code must retain the above copyright 
11  *    notice, this list of conditions and the following disclaimer. 
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright 
14  *    notice, this list of conditions and the following disclaimer in the 
15  *    documentation and/or other materials provided with the distribution. 
16  *
17  * 3. Neither the name of the Institute nor the names of its contributors 
18  *    may be used to endorse or promote products derived from this software 
19  *    without specific prior written permission. 
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
31  * SUCH DAMAGE. 
32  */
33
34 /*
35  * $Id$
36  */
37
38 #ifndef _HEIM_ENGINE_H
39 #define _HEIM_ENGINE_H 1
40
41 /* symbol renaming */
42 #define ENGINE_add_conf_module hc_ENGINE_add_conf_module
43 #define ENGINE_by_dso hc_ENGINE_by_dso
44 #define ENGINE_by_id hc_ENGINE_by_id
45 #define ENGINE_finish hc_ENGINE_finish
46 #define ENGINE_get_DH hc_ENGINE_get_DH
47 #define ENGINE_get_RSA hc_ENGINE_get_RSA
48 #define ENGINE_get_RAND hc_ENGINE_get_RAND
49 #define ENGINE_get_id hc_ENGINE_get_id
50 #define ENGINE_get_name hc_ENGINE_get_name
51 #define ENGINE_load_builtin_engines hc_ENGINE_load_builtin_engines
52 #define ENGINE_set_DH hc_ENGINE_set_DH
53 #define ENGINE_set_RSA hc_ENGINE_set_RSA
54 #define ENGINE_set_id hc_ENGINE_set_id
55 #define ENGINE_set_name hc_ENGINE_set_name
56 #define ENGINE_set_destroy_function hc_ENGINE_set_destroy_function
57 #define ENGINE_up_ref hc_ENGINE_up_ref
58 #define ENGINE_get_default_DH hc_ENGINE_get_default_DH
59 #define ENGINE_get_default_RSA hc_ENGINE_get_default_RSA
60 #define ENGINE_set_default_DH hc_ENGINE_set_default_DH
61 #define ENGINE_set_default_RSA hc_ENGINE_set_default_RSA
62
63 /*
64  *
65  */
66
67 typedef struct hc_engine ENGINE;
68
69 #include <hcrypto/rsa.h>
70 #include <hcrypto/dsa.h>
71 #include <hcrypto/dh.h>
72 #include <hcrypto/rand.h>
73
74 #define OPENSSL_DYNAMIC_VERSION         (unsigned long)0x00020000
75
76 typedef int (*openssl_bind_engine)(ENGINE *, const char *, const void *);
77 typedef unsigned long (*openssl_v_check)(unsigned long);
78
79 void    ENGINE_add_conf_module(void);
80 void    ENGINE_load_builtin_engines(void);
81 ENGINE *ENGINE_by_id(const char *);
82 ENGINE *ENGINE_by_dso(const char *, const char *);
83 int     ENGINE_finish(ENGINE *);
84 int     ENGINE_up_ref(ENGINE *);
85 int     ENGINE_set_id(ENGINE *, const char *);
86 int     ENGINE_set_name(ENGINE *, const char *);
87 int     ENGINE_set_RSA(ENGINE *, const RSA_METHOD *);
88 int     ENGINE_set_DH(ENGINE *, const DH_METHOD *);
89 int     ENGINE_set_destroy_function(ENGINE *, void (*)(ENGINE *));
90
91 const char *            ENGINE_get_id(const ENGINE *);
92 const char *            ENGINE_get_name(const ENGINE *);
93 const RSA_METHOD *      ENGINE_get_RSA(const ENGINE *);
94 const DH_METHOD *       ENGINE_get_DH(const ENGINE *);
95 const RAND_METHOD *     ENGINE_get_RAND(const ENGINE *);
96
97 int             ENGINE_set_default_RSA(ENGINE *);
98 ENGINE *        ENGINE_get_default_RSA(void);
99 int             ENGINE_set_default_DH(ENGINE *);
100 ENGINE *        ENGINE_get_default_DH(void);
101
102
103 #endif /* _HEIM_ENGINE_H */