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