xref: /netbsd-src/external/mpl/bind/dist/lib/dns/dst_openssl.h (revision f3cfa6f6ce31685c6c4a758bc430e69eb99f50a4)
1 /*	$NetBSD: dst_openssl.h,v 1.2 2018/08/12 13:02:35 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9  *
10  * See the COPYRIGHT file distributed with this work for additional
11  * information regarding copyright ownership.
12  */
13 
14 #ifndef DST_OPENSSL_H
15 #define DST_OPENSSL_H 1
16 
17 #include <isc/lang.h>
18 #include <isc/log.h>
19 #include <isc/result.h>
20 
21 #include <openssl/err.h>
22 #include <openssl/rand.h>
23 #include <openssl/evp.h>
24 #include <openssl/conf.h>
25 #include <openssl/crypto.h>
26 #include <openssl/bn.h>
27 
28 #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
29 /*
30  * These are new in OpenSSL 1.1.0.  BN_GENCB _cb needs to be declared in
31  * the function like this before the BN_GENCB_new call:
32  *
33  * #if OPENSSL_VERSION_NUMBER < 0x10100000L
34  *     	 _cb;
35  * #endif
36  */
37 #define BN_GENCB_free(x) ((void)0)
38 #define BN_GENCB_new() (&_cb)
39 #define BN_GENCB_get_arg(x) ((x)->arg)
40 #endif
41 
42 #if OPENSSL_VERSION_NUMBER >= 0x10100000L
43 /*
44  * EVP_dss1() is a version of EVP_sha1() that was needed prior to
45  * 1.1.0 because there was a link between digests and signing algorithms;
46  * the link has been eliminated and EVP_sha1() can be used now instead.
47  */
48 #define EVP_dss1 EVP_sha1
49 #endif
50 
51 ISC_LANG_BEGINDECLS
52 
53 isc_result_t
54 dst__openssl_toresult(isc_result_t fallback);
55 
56 isc_result_t
57 dst__openssl_toresult2(const char *funcname, isc_result_t fallback);
58 
59 isc_result_t
60 dst__openssl_toresult3(isc_logcategory_t *category,
61 		       const char *funcname, isc_result_t fallback);
62 
63 #if !defined(OPENSSL_NO_ENGINE)
64 ENGINE *
65 dst__openssl_getengine(const char *engine);
66 #else
67 #define dst__openssl_getengine(x) NULL
68 #endif
69 
70 ISC_LANG_ENDDECLS
71 
72 #endif /* DST_OPENSSL_H */
73 /*! \file */
74