xref: /netbsd-src/external/mpl/bind/dist/lib/dns/dst_openssl.h (revision bcda20f65a8566e103791ec395f7f499ef322704)
1 /*	$NetBSD: dst_openssl.h,v 1.7 2025/01/26 16:25:22 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 #pragma once
17 
18 #include <openssl/bn.h>
19 #include <openssl/conf.h>
20 #include <openssl/crypto.h>
21 #include <openssl/err.h>
22 #include <openssl/evp.h>
23 #include <openssl/rand.h>
24 
25 #include <isc/lang.h>
26 #include <isc/log.h>
27 #include <isc/result.h>
28 
29 ISC_LANG_BEGINDECLS
30 
31 isc_result_t
32 dst__openssl_toresult(isc_result_t fallback);
33 
34 #define dst__openssl_toresult2(A, B) \
35 	dst___openssl_toresult2(A, B, __FILE__, __LINE__)
36 isc_result_t
37 dst___openssl_toresult2(const char *funcname, isc_result_t fallback,
38 			const char *file, int line);
39 
40 #define dst__openssl_toresult3(A, B, C) \
41 	dst___openssl_toresult3(A, B, C, __FILE__, __LINE__)
42 isc_result_t
43 dst___openssl_toresult3(isc_logcategory_t *category, const char *funcname,
44 			isc_result_t fallback, const char *file, int line);
45 
46 #if !defined(OPENSSL_NO_ENGINE) && OPENSSL_API_LEVEL < 30000
47 ENGINE *
48 dst__openssl_getengine(const char *engine);
49 #endif /* if !defined(OPENSSL_NO_ENGINE) && OPENSSL_API_LEVEL < 30000 */
50 
51 isc_result_t
52 dst__openssl_fromlabel(int key_base_id, const char *engine, const char *label,
53 		       const char *pin, EVP_PKEY **ppub, EVP_PKEY **ppriv);
54 
55 bool
56 dst__openssl_keypair_compare(const dst_key_t *key1, const dst_key_t *key2);
57 
58 bool
59 dst__openssl_keypair_isprivate(const dst_key_t *key);
60 
61 void
62 dst__openssl_keypair_destroy(dst_key_t *key);
63 
64 ISC_LANG_ENDDECLS
65