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