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