xref: /openbsd/usr.bin/dig/lib/dns/dst_result.c (revision 73471bf0)
1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14  * PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /*%
18  * Principal Author: Brian Wellington
19  * $Id: dst_result.c,v 1.3 2020/09/14 08:40:43 florian Exp $
20  */
21 
22 #include <isc/util.h>
23 #include <dst/result.h>
24 
25 static const char *text[DST_R_NRESULTS] = {
26 	"algorithm is unsupported",		/*%< 0 */
27 	"crypto failure",			/*%< 1 */
28 	"built with no crypto support",		/*%< 2 */
29 	"illegal operation for a null key",	/*%< 3 */
30 	"public key is invalid",		/*%< 4 */
31 	"private key is invalid",		/*%< 5 */
32 	"external key",				/*%< 6 */
33 	"error occurred writing key to disk",	/*%< 7 */
34 	"invalid algorithm specific parameter",	/*%< 8 */
35 	"UNUSED9",				/*%< 9 */
36 	"UNUSED10",				/*%< 10 */
37 	"sign failure",				/*%< 11 */
38 	"UNUSED12",				/*%< 12 */
39 	"UNUSED13",				/*%< 13 */
40 	"verify failure",			/*%< 14 */
41 	"not a public key",			/*%< 15 */
42 	"not a private key",			/*%< 16 */
43 	"not a key that can compute a secret",	/*%< 17 */
44 	"failure computing a shared secret",	/*%< 18 */
45 	"no randomness available",		/*%< 19 */
46 	"bad key type",				/*%< 20 */
47 	"no engine",				/*%< 21 */
48 	"illegal operation for an external key",/*%< 22 */
49 };
50 
51 #define DST_RESULT_RESULTSET			2
52 
53 static int		once = 0;
54 
55 static void
56 initialize_action(void) {
57 	isc_result_t result;
58 
59 	result = isc_result_register(ISC_RESULTCLASS_DST, DST_R_NRESULTS,
60 				     text, DST_RESULT_RESULTSET);
61 	if (result != ISC_R_SUCCESS)
62 		UNEXPECTED_ERROR(__FILE__, __LINE__,
63 				 "isc_result_register() failed: %u", result);
64 }
65 
66 static void
67 initialize(void) {
68 	if (!once) {
69 		once = 1;
70 		initialize_action();
71 	}
72 }
73 
74 void
75 dst_result_register(void) {
76 	initialize();
77 }
78 
79 /*! \file */
80