1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate /*
30*0Sstevel@tonic-gate  * mdb dcmds for selected structures from
31*0Sstevel@tonic-gate  * usr/src/uts/common/sys/crypto/spi.h
32*0Sstevel@tonic-gate  *
33*0Sstevel@tonic-gate  * Also the mdb module housekeeping
34*0Sstevel@tonic-gate  */
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #include <sys/mdb_modapi.h>
37*0Sstevel@tonic-gate #include <sys/modctl.h>
38*0Sstevel@tonic-gate #include <sys/crypto/api.h>
39*0Sstevel@tonic-gate #include <sys/crypto/common.h>
40*0Sstevel@tonic-gate #include <sys/crypto/spi.h>
41*0Sstevel@tonic-gate #include <sys/crypto/impl.h>
42*0Sstevel@tonic-gate #include "crypto_cmds.h"
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate const mdb_bitmask_t extf_flags[] = {
46*0Sstevel@tonic-gate 	{ "NIL", (ulong_t)-1, 0L },
47*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_RNG", CRYPTO_EXTF_RNG, CRYPTO_EXTF_RNG },
48*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_WRITE_PROTECTED", CRYPTO_EXTF_WRITE_PROTECTED,
49*0Sstevel@tonic-gate 		CRYPTO_EXTF_WRITE_PROTECTED },
50*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_LOGIN_REQUIRED", CRYPTO_EXTF_LOGIN_REQUIRED,
51*0Sstevel@tonic-gate 		CRYPTO_EXTF_LOGIN_REQUIRED },
52*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_INITIALIZED", CRYPTO_EXTF_USER_PIN_INITIALIZED,
53*0Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_INITIALIZED },
54*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_CLOCK_ON_TOKEN", CRYPTO_EXTF_CLOCK_ON_TOKEN,
55*0Sstevel@tonic-gate 		CRYPTO_EXTF_CLOCK_ON_TOKEN },
56*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_PROTECTED_AUTHENTICATION_PATH",
57*0Sstevel@tonic-gate 		CRYPTO_EXTF_PROTECTED_AUTHENTICATION_PATH,
58*0Sstevel@tonic-gate 		CRYPTO_EXTF_PROTECTED_AUTHENTICATION_PATH },
59*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_DUAL_CRYPTO_OPERATIONS",
60*0Sstevel@tonic-gate 		CRYPTO_EXTF_DUAL_CRYPTO_OPERATIONS,
61*0Sstevel@tonic-gate 		CRYPTO_EXTF_DUAL_CRYPTO_OPERATIONS },
62*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_TOKEN_INITIALIZED", CRYPTO_EXTF_TOKEN_INITIALIZED,
63*0Sstevel@tonic-gate 		CRYPTO_EXTF_TOKEN_INITIALIZED },
64*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_COUNT_LOW", CRYPTO_EXTF_USER_PIN_COUNT_LOW,
65*0Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_COUNT_LOW },
66*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_FINAL_TRY", CRYPTO_EXTF_USER_PIN_FINAL_TRY,
67*0Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_FINAL_TRY },
68*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_LOCKED", CRYPTO_EXTF_USER_PIN_LOCKED,
69*0Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_LOCKED },
70*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_TO_BE_CHANGED",
71*0Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_TO_BE_CHANGED,
72*0Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_TO_BE_CHANGED },
73*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_SO_PIN_COUNT_LOW", CRYPTO_EXTF_SO_PIN_COUNT_LOW,
74*0Sstevel@tonic-gate 		CRYPTO_EXTF_SO_PIN_COUNT_LOW },
75*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_SO_PIN_FINAL_TRY", CRYPTO_EXTF_SO_PIN_FINAL_TRY,
76*0Sstevel@tonic-gate 		CRYPTO_EXTF_SO_PIN_FINAL_TRY },
77*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_SO_PIN_LOCKED", CRYPTO_EXTF_SO_PIN_LOCKED,
78*0Sstevel@tonic-gate 		CRYPTO_EXTF_SO_PIN_LOCKED },
79*0Sstevel@tonic-gate 	{ "CRYPTO_EXTF_SO_PIN_TO_BE_CHANGED", CRYPTO_EXTF_SO_PIN_TO_BE_CHANGED,
80*0Sstevel@tonic-gate 		CRYPTO_EXTF_SO_PIN_TO_BE_CHANGED },
81*0Sstevel@tonic-gate 	{ NULL, 0, 0 }
82*0Sstevel@tonic-gate };
83*0Sstevel@tonic-gate 
84*0Sstevel@tonic-gate /*ARGSUSED*/
85*0Sstevel@tonic-gate int
86*0Sstevel@tonic-gate crypto_provider_ext_info(uintptr_t addr, uint_t flags, int argc,
87*0Sstevel@tonic-gate     const mdb_arg_t *argv)
88*0Sstevel@tonic-gate {
89*0Sstevel@tonic-gate 	crypto_provider_ext_info_t ext_prov;
90*0Sstevel@tonic-gate 	/*
91*0Sstevel@tonic-gate 	 * 33 is 1 + MAX(CRYPTO_EXT_SIZE_LABEL, CRYPTO_EXT_SIZE_MANUF,
92*0Sstevel@tonic-gate 	 *		 CRYPTO_EXT_SIZE_MODEL, CRYPTO_EXT_SIZE_SERIAL)
93*0Sstevel@tonic-gate 	 */
94*0Sstevel@tonic-gate 	char scratch[33];
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate 	if (!(flags && DCMD_ADDRSPEC))
97*0Sstevel@tonic-gate 		return (DCMD_USAGE);
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate 	if (mdb_vread(&ext_prov, sizeof (crypto_provider_ext_info_t), addr)
100*0Sstevel@tonic-gate 		== -1) {
101*0Sstevel@tonic-gate 		mdb_warn("cannot read addr");
102*0Sstevel@tonic-gate 		return (DCMD_ERR);
103*0Sstevel@tonic-gate 	}
104*0Sstevel@tonic-gate 	bcopy(ext_prov.ei_label, scratch, CRYPTO_EXT_SIZE_LABEL);
105*0Sstevel@tonic-gate 	scratch[CRYPTO_EXT_SIZE_LABEL] = '\0';
106*0Sstevel@tonic-gate 	mdb_printf("ei_label\t\t%s\n", scratch);
107*0Sstevel@tonic-gate 
108*0Sstevel@tonic-gate 	bcopy(ext_prov.ei_manufacturerID, scratch, CRYPTO_EXT_SIZE_MANUF);
109*0Sstevel@tonic-gate 	scratch[CRYPTO_EXT_SIZE_MANUF] = '\0';
110*0Sstevel@tonic-gate 	mdb_printf("ei_manufacturerID\t%s\n", scratch);
111*0Sstevel@tonic-gate 
112*0Sstevel@tonic-gate 	bcopy(ext_prov.ei_model, scratch, CRYPTO_EXT_SIZE_MODEL);
113*0Sstevel@tonic-gate 	scratch[CRYPTO_EXT_SIZE_MODEL] = '\0';
114*0Sstevel@tonic-gate 	mdb_printf("ei_model\t\t%s\n", scratch);
115*0Sstevel@tonic-gate 
116*0Sstevel@tonic-gate 	bcopy(ext_prov.ei_serial_number, scratch, CRYPTO_EXT_SIZE_SERIAL);
117*0Sstevel@tonic-gate 	scratch[CRYPTO_EXT_SIZE_SERIAL] = '\0';
118*0Sstevel@tonic-gate 	mdb_printf("ei_serial_number\t%s\n", scratch);
119*0Sstevel@tonic-gate 
120*0Sstevel@tonic-gate 	mdb_printf("ei_flags\t0x%x:\t<%lb>\n", ext_prov.ei_flags,
121*0Sstevel@tonic-gate 	    ext_prov.ei_flags, extf_flags);
122*0Sstevel@tonic-gate 	mdb_printf("ei_max_session_count\t%lu\n",
123*0Sstevel@tonic-gate 	    ext_prov.ei_max_session_count);
124*0Sstevel@tonic-gate 	mdb_printf("ei_max_pin_len\t\t%lu\n", ext_prov.ei_max_pin_len);
125*0Sstevel@tonic-gate 	mdb_printf("ei_min_pin_len\t\t%lu\n", ext_prov.ei_min_pin_len);
126*0Sstevel@tonic-gate 	mdb_printf("ei_total_public_memory\t%lu\n",
127*0Sstevel@tonic-gate 	    ext_prov.ei_total_public_memory);
128*0Sstevel@tonic-gate 	mdb_printf("ei_free_public_memory\t%lu\n",
129*0Sstevel@tonic-gate 	    ext_prov.ei_free_public_memory);
130*0Sstevel@tonic-gate 	mdb_printf("ei_total_private_memory\t%lu\n",
131*0Sstevel@tonic-gate 	    ext_prov.ei_total_private_memory);
132*0Sstevel@tonic-gate 	mdb_printf("ei_free_private_memory\t%lu\n",
133*0Sstevel@tonic-gate 	    ext_prov.ei_free_private_memory);
134*0Sstevel@tonic-gate 	mdb_printf("ei_hardware_version\tmajor %c minor %c\n",
135*0Sstevel@tonic-gate 	    ext_prov.ei_hardware_version.cv_major,
136*0Sstevel@tonic-gate 	    ext_prov.ei_hardware_version.cv_minor);
137*0Sstevel@tonic-gate 	mdb_printf("ei_firmware_version\tmajor %c minor %c\n",
138*0Sstevel@tonic-gate 	    ext_prov.ei_firmware_version.cv_major,
139*0Sstevel@tonic-gate 	    ext_prov.ei_firmware_version.cv_minor);
140*0Sstevel@tonic-gate 	mdb_printf("ei_time\t%s\n", ext_prov.ei_time);
141*0Sstevel@tonic-gate 	return (DCMD_OK);
142*0Sstevel@tonic-gate }
143*0Sstevel@tonic-gate 
144*0Sstevel@tonic-gate const mdb_bitmask_t mech_bits[] = {
145*0Sstevel@tonic-gate 	{ "NIL", (uint32_t)-1, 0 },
146*0Sstevel@tonic-gate 	{ "CRYPTO_FG_ENCRYPT", CRYPTO_FG_ENCRYPT, CRYPTO_FG_ENCRYPT },
147*0Sstevel@tonic-gate 	{ "CRYPTO_FG_DECRYPT", CRYPTO_FG_DECRYPT, CRYPTO_FG_DECRYPT },
148*0Sstevel@tonic-gate 	{ "CRYPTO_FG_DIGEST", CRYPTO_FG_DIGEST, CRYPTO_FG_DIGEST },
149*0Sstevel@tonic-gate 	{ "CRYPTO_FG_SIGN", CRYPTO_FG_SIGN, CRYPTO_FG_SIGN },
150*0Sstevel@tonic-gate 	{ "CRYPTO_FG_SIGN_RECOVER", CRYPTO_FG_SIGN_RECOVER,
151*0Sstevel@tonic-gate 		CRYPTO_FG_SIGN_RECOVER },
152*0Sstevel@tonic-gate 	{ "CRYPTO_FG_VERIFY", CRYPTO_FG_VERIFY, CRYPTO_FG_VERIFY },
153*0Sstevel@tonic-gate 	{ "CRYPTO_FG_VERIFY_RECOVER", CRYPTO_FG_VERIFY_RECOVER,
154*0Sstevel@tonic-gate 		CRYPTO_FG_VERIFY_RECOVER },
155*0Sstevel@tonic-gate 	{ "CRYPTO_FG_GENERATE", CRYPTO_FG_GENERATE, CRYPTO_FG_GENERATE },
156*0Sstevel@tonic-gate 	{ "CRYPTO_FG_GENERATE_KEY_PAIR", CRYPTO_FG_GENERATE_KEY_PAIR,
157*0Sstevel@tonic-gate 		CRYPTO_FG_GENERATE_KEY_PAIR },
158*0Sstevel@tonic-gate 	{ "CRYPTO_FG_WRAP", CRYPTO_FG_WRAP, CRYPTO_FG_WRAP },
159*0Sstevel@tonic-gate 	{ "CRYPTO_FG_UNWRAP", CRYPTO_FG_UNWRAP, CRYPTO_FG_UNWRAP },
160*0Sstevel@tonic-gate 	{ "CRYPTO_FG_DERIVE", CRYPTO_FG_DERIVE, CRYPTO_FG_DERIVE },
161*0Sstevel@tonic-gate 	{ "CRYPTO_FG_MAC", CRYPTO_FG_MAC, CRYPTO_FG_MAC },
162*0Sstevel@tonic-gate 	{ "CRYPTO_FG_ENCRYPT_MAC", CRYPTO_FG_ENCRYPT_MAC,
163*0Sstevel@tonic-gate 		CRYPTO_FG_ENCRYPT_MAC },
164*0Sstevel@tonic-gate 	{ "CRYPTO_FG_MAC_DECRYPT", CRYPTO_FG_MAC_DECRYPT,
165*0Sstevel@tonic-gate 		CRYPTO_FG_MAC_DECRYPT },
166*0Sstevel@tonic-gate 	{ "CRYPTO_FG_ENCRYPT_ATOMIC", CRYPTO_FG_ENCRYPT_ATOMIC,
167*0Sstevel@tonic-gate 		CRYPTO_FG_ENCRYPT_ATOMIC },
168*0Sstevel@tonic-gate 	{ "CRYPTO_FG_DECRYPT_ATOMIC", CRYPTO_FG_DECRYPT_ATOMIC,
169*0Sstevel@tonic-gate 		CRYPTO_FG_DECRYPT_ATOMIC },
170*0Sstevel@tonic-gate 	{ "CRYPTO_FG_MAC_ATOMIC", CRYPTO_FG_MAC_ATOMIC, CRYPTO_FG_MAC_ATOMIC },
171*0Sstevel@tonic-gate 	{ "CRYPTO_FG_DIGEST_ATOMIC", CRYPTO_FG_DIGEST_ATOMIC,
172*0Sstevel@tonic-gate 		CRYPTO_FG_DIGEST_ATOMIC },
173*0Sstevel@tonic-gate 	{ "CRYPTO_FG_SIGN_ATOMIC", CRYPTO_FG_SIGN_ATOMIC,
174*0Sstevel@tonic-gate 		CRYPTO_FG_SIGN_ATOMIC },
175*0Sstevel@tonic-gate 	{ "CRYPTO_FG_SIGN_RECOVER_ATOMIC", CRYPTO_FG_SIGN_RECOVER_ATOMIC,
176*0Sstevel@tonic-gate 		CRYPTO_FG_SIGN_RECOVER_ATOMIC },
177*0Sstevel@tonic-gate 	{ "CRYPTO_FG_VERIFY_ATOMIC", CRYPTO_FG_VERIFY_ATOMIC,
178*0Sstevel@tonic-gate 		CRYPTO_FG_VERIFY_ATOMIC },
179*0Sstevel@tonic-gate 	{ "CRYPTO_FG_VERIFY_RECOVER_ATOMIC", CRYPTO_FG_VERIFY_RECOVER_ATOMIC,
180*0Sstevel@tonic-gate 		CRYPTO_FG_VERIFY_RECOVER_ATOMIC },
181*0Sstevel@tonic-gate 	{ "CRYPTO_FG_ENCRYPT_MAC_ATOMIC", CRYPTO_FG_ENCRYPT_MAC_ATOMIC,
182*0Sstevel@tonic-gate 		CRYPTO_FG_ENCRYPT_MAC_ATOMIC },
183*0Sstevel@tonic-gate 	{ "CRYPTO_FG_MAC_DECRYPT_ATOMIC", CRYPTO_FG_MAC_DECRYPT_ATOMIC,
184*0Sstevel@tonic-gate 		CRYPTO_FG_MAC_DECRYPT_ATOMIC },
185*0Sstevel@tonic-gate 	{ "CRYPTO_FG_RANDOM", CRYPTO_FG_RANDOM, CRYPTO_FG_RANDOM},
186*0Sstevel@tonic-gate 	{ NULL, 0, 0 }
187*0Sstevel@tonic-gate };
188*0Sstevel@tonic-gate 
189*0Sstevel@tonic-gate /*ARGSUSED*/
190*0Sstevel@tonic-gate int
191*0Sstevel@tonic-gate crypto_mech_info(uintptr_t addr, uint_t flags, int argc,
192*0Sstevel@tonic-gate     const mdb_arg_t *argv)
193*0Sstevel@tonic-gate {
194*0Sstevel@tonic-gate 	crypto_mech_info_t minfo;
195*0Sstevel@tonic-gate 	const char *unit = "bits";
196*0Sstevel@tonic-gate 
197*0Sstevel@tonic-gate 	if (! flags & DCMD_ADDRSPEC)
198*0Sstevel@tonic-gate 		return (DCMD_USAGE);
199*0Sstevel@tonic-gate 
200*0Sstevel@tonic-gate 	if (mdb_vread(&minfo, sizeof (crypto_mech_info_t), addr)
201*0Sstevel@tonic-gate 		== -1) {
202*0Sstevel@tonic-gate 		mdb_warn("cannot read addr %p", addr);
203*0Sstevel@tonic-gate 		return (DCMD_ERR);
204*0Sstevel@tonic-gate 	}
205*0Sstevel@tonic-gate 	mdb_printf("cm_mech_name_t\t%s\n", minfo.cm_mech_name);
206*0Sstevel@tonic-gate 	mdb_printf("cm_mech_number\t%lld\n", minfo.cm_mech_number);
207*0Sstevel@tonic-gate 	mdb_printf("cm_func_group_mask\t0x%x:\t<%b>\n",
208*0Sstevel@tonic-gate 	    minfo.cm_func_group_mask, minfo.cm_func_group_mask, mech_bits);
209*0Sstevel@tonic-gate 	if (minfo.cm_keysize_unit != CRYPTO_KEYSIZE_UNIT_IN_BITS)
210*0Sstevel@tonic-gate 		unit = "bytes";
211*0Sstevel@tonic-gate 	mdb_printf("cm_min_key_length\t%lu %s\n", minfo.cm_min_key_length,
212*0Sstevel@tonic-gate 	    unit);
213*0Sstevel@tonic-gate 	mdb_printf("cm_max_key_length\t%lu %s\n", minfo.cm_max_key_length,
214*0Sstevel@tonic-gate 	    unit);
215*0Sstevel@tonic-gate 
216*0Sstevel@tonic-gate 	return (DCMD_OK);
217*0Sstevel@tonic-gate }
218*0Sstevel@tonic-gate 
219*0Sstevel@tonic-gate /*
220*0Sstevel@tonic-gate  * MDB module linkage information:
221*0Sstevel@tonic-gate  *
222*0Sstevel@tonic-gate  * We declare a list of structures describing our dcmds, and a function
223*0Sstevel@tonic-gate  * named _mdb_init to return a pointer to our module information.
224*0Sstevel@tonic-gate  */
225*0Sstevel@tonic-gate 
226*0Sstevel@tonic-gate static const mdb_dcmd_t dcmds[] = {
227*0Sstevel@tonic-gate 
228*0Sstevel@tonic-gate 	/* spi.c */
229*0Sstevel@tonic-gate 	{ "crypto_provider_ext_info", ":",
230*0Sstevel@tonic-gate 	    "module-private crypto provider info",
231*0Sstevel@tonic-gate 	    crypto_provider_ext_info, NULL },
232*0Sstevel@tonic-gate 	{ "crypto_mech_info", ":",
233*0Sstevel@tonic-gate 	    "print as crypto_mech_info",
234*0Sstevel@tonic-gate 	    crypto_mech_info, NULL },
235*0Sstevel@tonic-gate 
236*0Sstevel@tonic-gate 	/* common.c */
237*0Sstevel@tonic-gate 	{ "crypto_mechanism", ":",
238*0Sstevel@tonic-gate 	    "details about a crypto mechanism", crypto_mechanism, NULL },
239*0Sstevel@tonic-gate 	{ "crypto_data", ":",
240*0Sstevel@tonic-gate 	    "print as crypto_data",
241*0Sstevel@tonic-gate 	    crypto_data, NULL },
242*0Sstevel@tonic-gate 	{ "crypto_dual_data", ":",
243*0Sstevel@tonic-gate 	    "print as crypto_dual_data",
244*0Sstevel@tonic-gate 	    crypto_dual_data, NULL },
245*0Sstevel@tonic-gate 	{ "crypto_key", ":",
246*0Sstevel@tonic-gate 	    "print as crypto_key", crypto_key, NULL },
247*0Sstevel@tonic-gate 
248*0Sstevel@tonic-gate 
249*0Sstevel@tonic-gate 	/* impl.c */
250*0Sstevel@tonic-gate 	{ "kcf_sched_info", ":",
251*0Sstevel@tonic-gate 	    "scheduling data for a crypto request", kcf_sched_info, NULL },
252*0Sstevel@tonic-gate 
253*0Sstevel@tonic-gate 	{ "kcf_provider_desc", ":",
254*0Sstevel@tonic-gate 	    "crypto provider description struct", kcf_provider_desc, NULL },
255*0Sstevel@tonic-gate 
256*0Sstevel@tonic-gate 	{ "prov_tab", "",
257*0Sstevel@tonic-gate 	    "global table of crypto providers ", prov_tab, NULL },
258*0Sstevel@tonic-gate 
259*0Sstevel@tonic-gate 	{ "policy_tab", "",
260*0Sstevel@tonic-gate 	    "print global policy_tab", policy_tab, NULL },
261*0Sstevel@tonic-gate 
262*0Sstevel@tonic-gate 	/* sched_impl.c */
263*0Sstevel@tonic-gate 	{ "kcf_areq_node", ":[-v]",
264*0Sstevel@tonic-gate 	    "print asynchronous crypto request struct, [ verbose ]",
265*0Sstevel@tonic-gate 		kcf_areq_node, NULL },
266*0Sstevel@tonic-gate 
267*0Sstevel@tonic-gate 	{ "kcf_global_swq", "?[-v]",
268*0Sstevel@tonic-gate 	    "global or addr global crypto queue.  [ -v = verbose ]",
269*0Sstevel@tonic-gate 		kcf_global_swq, NULL },
270*0Sstevel@tonic-gate 	{ "crypto_find_reqid", "?[-v] reqid",
271*0Sstevel@tonic-gate 	    "look for reqid, print if found [ -v = verbose ]",
272*0Sstevel@tonic-gate 		crypto_find_reqid, NULL },
273*0Sstevel@tonic-gate 
274*0Sstevel@tonic-gate 	{ "kcf_reqid_table", ":[-v]",
275*0Sstevel@tonic-gate 	    "print contents of a request ID hash table [ -v = verbose ]",
276*0Sstevel@tonic-gate 		kcf_reqid_table_dcmd, NULL },
277*0Sstevel@tonic-gate 
278*0Sstevel@tonic-gate 	{ "kcf_soft_conf_entry", "?",
279*0Sstevel@tonic-gate 	    "head or addr of configured software crypto providers",
280*0Sstevel@tonic-gate 		kcf_soft_conf_entry, NULL },
281*0Sstevel@tonic-gate 
282*0Sstevel@tonic-gate 	{ "kcf_policy_desc", ":", "policy descriptors for crypto",
283*0Sstevel@tonic-gate 		kcf_policy_desc, NULL },
284*0Sstevel@tonic-gate 	{ NULL }
285*0Sstevel@tonic-gate };
286*0Sstevel@tonic-gate 
287*0Sstevel@tonic-gate static const mdb_walker_t walkers[] = {
288*0Sstevel@tonic-gate 	{ "an_next", "walk kcf_areq_node's by an_next",
289*0Sstevel@tonic-gate 		areq_first_walk_init, an_next_walk_step, areq_walk_fini },
290*0Sstevel@tonic-gate 	{ "an_prev", "walk kcf_areq_node's by an_prev",
291*0Sstevel@tonic-gate 		areq_last_walk_init, an_prev_walk_step, areq_walk_fini },
292*0Sstevel@tonic-gate 	{ "an_idnext", "walk kcf_areq_node's by an_idnext",
293*0Sstevel@tonic-gate 		an_idnext_walk_init, an_idnext_walk_step, areq_walk_fini },
294*0Sstevel@tonic-gate 	{ "an_idprev", "walk kcf_areq_node's by an_idprev",
295*0Sstevel@tonic-gate 		an_idprev_walk_init, an_idprev_walk_step, areq_walk_fini },
296*0Sstevel@tonic-gate 	{ "an_ctxchain_next",
297*0Sstevel@tonic-gate 		"walk kcf_areq_node's by an_ctxchain_next",
298*0Sstevel@tonic-gate 		an_ctxchain_walk_init, an_ctxchain_walk_step, areq_walk_fini },
299*0Sstevel@tonic-gate 	{ "kcf_reqid_table", "table of asynchronous crypto requests",
300*0Sstevel@tonic-gate 		reqid_table_walk_init, reqid_table_walk_step,
301*0Sstevel@tonic-gate 		    reqid_table_walk_fini },
302*0Sstevel@tonic-gate 	{ "soft_conf_entry", "table of software providers or addr",
303*0Sstevel@tonic-gate 		soft_conf_walk_init, soft_conf_walk_step,
304*0Sstevel@tonic-gate 		    soft_conf_walk_fini },
305*0Sstevel@tonic-gate 	{ NULL }
306*0Sstevel@tonic-gate };
307*0Sstevel@tonic-gate 
308*0Sstevel@tonic-gate 
309*0Sstevel@tonic-gate static const mdb_modinfo_t modinfo = {
310*0Sstevel@tonic-gate 	MDB_API_VERSION, dcmds, walkers
311*0Sstevel@tonic-gate };
312*0Sstevel@tonic-gate 
313*0Sstevel@tonic-gate const mdb_modinfo_t *
314*0Sstevel@tonic-gate _mdb_init(void)
315*0Sstevel@tonic-gate {
316*0Sstevel@tonic-gate 	return (&modinfo);
317*0Sstevel@tonic-gate }
318