10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*3708Skrishna  * Common Development and Distribution License (the "License").
6*3708Skrishna  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*3708Skrishna  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
270Sstevel@tonic-gate 
280Sstevel@tonic-gate /*
290Sstevel@tonic-gate  * mdb dcmds for selected structures from
300Sstevel@tonic-gate  * usr/src/uts/common/sys/crypto/spi.h
310Sstevel@tonic-gate  *
320Sstevel@tonic-gate  * Also the mdb module housekeeping
330Sstevel@tonic-gate  */
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #include <sys/mdb_modapi.h>
360Sstevel@tonic-gate #include <sys/modctl.h>
370Sstevel@tonic-gate #include <sys/crypto/api.h>
380Sstevel@tonic-gate #include <sys/crypto/common.h>
390Sstevel@tonic-gate #include <sys/crypto/spi.h>
400Sstevel@tonic-gate #include <sys/crypto/impl.h>
410Sstevel@tonic-gate #include "crypto_cmds.h"
420Sstevel@tonic-gate 
430Sstevel@tonic-gate 
440Sstevel@tonic-gate const mdb_bitmask_t extf_flags[] = {
450Sstevel@tonic-gate 	{ "NIL", (ulong_t)-1, 0L },
460Sstevel@tonic-gate 	{ "CRYPTO_EXTF_RNG", CRYPTO_EXTF_RNG, CRYPTO_EXTF_RNG },
470Sstevel@tonic-gate 	{ "CRYPTO_EXTF_WRITE_PROTECTED", CRYPTO_EXTF_WRITE_PROTECTED,
480Sstevel@tonic-gate 		CRYPTO_EXTF_WRITE_PROTECTED },
490Sstevel@tonic-gate 	{ "CRYPTO_EXTF_LOGIN_REQUIRED", CRYPTO_EXTF_LOGIN_REQUIRED,
500Sstevel@tonic-gate 		CRYPTO_EXTF_LOGIN_REQUIRED },
510Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_INITIALIZED", CRYPTO_EXTF_USER_PIN_INITIALIZED,
520Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_INITIALIZED },
530Sstevel@tonic-gate 	{ "CRYPTO_EXTF_CLOCK_ON_TOKEN", CRYPTO_EXTF_CLOCK_ON_TOKEN,
540Sstevel@tonic-gate 		CRYPTO_EXTF_CLOCK_ON_TOKEN },
550Sstevel@tonic-gate 	{ "CRYPTO_EXTF_PROTECTED_AUTHENTICATION_PATH",
560Sstevel@tonic-gate 		CRYPTO_EXTF_PROTECTED_AUTHENTICATION_PATH,
570Sstevel@tonic-gate 		CRYPTO_EXTF_PROTECTED_AUTHENTICATION_PATH },
580Sstevel@tonic-gate 	{ "CRYPTO_EXTF_DUAL_CRYPTO_OPERATIONS",
590Sstevel@tonic-gate 		CRYPTO_EXTF_DUAL_CRYPTO_OPERATIONS,
600Sstevel@tonic-gate 		CRYPTO_EXTF_DUAL_CRYPTO_OPERATIONS },
610Sstevel@tonic-gate 	{ "CRYPTO_EXTF_TOKEN_INITIALIZED", CRYPTO_EXTF_TOKEN_INITIALIZED,
620Sstevel@tonic-gate 		CRYPTO_EXTF_TOKEN_INITIALIZED },
630Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_COUNT_LOW", CRYPTO_EXTF_USER_PIN_COUNT_LOW,
640Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_COUNT_LOW },
650Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_FINAL_TRY", CRYPTO_EXTF_USER_PIN_FINAL_TRY,
660Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_FINAL_TRY },
670Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_LOCKED", CRYPTO_EXTF_USER_PIN_LOCKED,
680Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_LOCKED },
690Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_TO_BE_CHANGED",
700Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_TO_BE_CHANGED,
710Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_TO_BE_CHANGED },
720Sstevel@tonic-gate 	{ "CRYPTO_EXTF_SO_PIN_COUNT_LOW", CRYPTO_EXTF_SO_PIN_COUNT_LOW,
730Sstevel@tonic-gate 		CRYPTO_EXTF_SO_PIN_COUNT_LOW },
740Sstevel@tonic-gate 	{ "CRYPTO_EXTF_SO_PIN_FINAL_TRY", CRYPTO_EXTF_SO_PIN_FINAL_TRY,
750Sstevel@tonic-gate 		CRYPTO_EXTF_SO_PIN_FINAL_TRY },
760Sstevel@tonic-gate 	{ "CRYPTO_EXTF_SO_PIN_LOCKED", CRYPTO_EXTF_SO_PIN_LOCKED,
770Sstevel@tonic-gate 		CRYPTO_EXTF_SO_PIN_LOCKED },
780Sstevel@tonic-gate 	{ "CRYPTO_EXTF_SO_PIN_TO_BE_CHANGED", CRYPTO_EXTF_SO_PIN_TO_BE_CHANGED,
790Sstevel@tonic-gate 		CRYPTO_EXTF_SO_PIN_TO_BE_CHANGED },
800Sstevel@tonic-gate 	{ NULL, 0, 0 }
810Sstevel@tonic-gate };
820Sstevel@tonic-gate 
830Sstevel@tonic-gate /*ARGSUSED*/
840Sstevel@tonic-gate int
850Sstevel@tonic-gate crypto_provider_ext_info(uintptr_t addr, uint_t flags, int argc,
860Sstevel@tonic-gate     const mdb_arg_t *argv)
870Sstevel@tonic-gate {
880Sstevel@tonic-gate 	crypto_provider_ext_info_t ext_prov;
890Sstevel@tonic-gate 	/*
900Sstevel@tonic-gate 	 * 33 is 1 + MAX(CRYPTO_EXT_SIZE_LABEL, CRYPTO_EXT_SIZE_MANUF,
910Sstevel@tonic-gate 	 *		 CRYPTO_EXT_SIZE_MODEL, CRYPTO_EXT_SIZE_SERIAL)
920Sstevel@tonic-gate 	 */
930Sstevel@tonic-gate 	char scratch[33];
940Sstevel@tonic-gate 
950Sstevel@tonic-gate 	if (!(flags && DCMD_ADDRSPEC))
960Sstevel@tonic-gate 		return (DCMD_USAGE);
970Sstevel@tonic-gate 
980Sstevel@tonic-gate 	if (mdb_vread(&ext_prov, sizeof (crypto_provider_ext_info_t), addr)
990Sstevel@tonic-gate 		== -1) {
1000Sstevel@tonic-gate 		mdb_warn("cannot read addr");
1010Sstevel@tonic-gate 		return (DCMD_ERR);
1020Sstevel@tonic-gate 	}
1030Sstevel@tonic-gate 	bcopy(ext_prov.ei_label, scratch, CRYPTO_EXT_SIZE_LABEL);
1040Sstevel@tonic-gate 	scratch[CRYPTO_EXT_SIZE_LABEL] = '\0';
1050Sstevel@tonic-gate 	mdb_printf("ei_label\t\t%s\n", scratch);
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate 	bcopy(ext_prov.ei_manufacturerID, scratch, CRYPTO_EXT_SIZE_MANUF);
1080Sstevel@tonic-gate 	scratch[CRYPTO_EXT_SIZE_MANUF] = '\0';
1090Sstevel@tonic-gate 	mdb_printf("ei_manufacturerID\t%s\n", scratch);
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate 	bcopy(ext_prov.ei_model, scratch, CRYPTO_EXT_SIZE_MODEL);
1120Sstevel@tonic-gate 	scratch[CRYPTO_EXT_SIZE_MODEL] = '\0';
1130Sstevel@tonic-gate 	mdb_printf("ei_model\t\t%s\n", scratch);
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate 	bcopy(ext_prov.ei_serial_number, scratch, CRYPTO_EXT_SIZE_SERIAL);
1160Sstevel@tonic-gate 	scratch[CRYPTO_EXT_SIZE_SERIAL] = '\0';
1170Sstevel@tonic-gate 	mdb_printf("ei_serial_number\t%s\n", scratch);
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate 	mdb_printf("ei_flags\t0x%x:\t<%lb>\n", ext_prov.ei_flags,
1200Sstevel@tonic-gate 	    ext_prov.ei_flags, extf_flags);
1210Sstevel@tonic-gate 	mdb_printf("ei_max_session_count\t%lu\n",
1220Sstevel@tonic-gate 	    ext_prov.ei_max_session_count);
1230Sstevel@tonic-gate 	mdb_printf("ei_max_pin_len\t\t%lu\n", ext_prov.ei_max_pin_len);
1240Sstevel@tonic-gate 	mdb_printf("ei_min_pin_len\t\t%lu\n", ext_prov.ei_min_pin_len);
1250Sstevel@tonic-gate 	mdb_printf("ei_total_public_memory\t%lu\n",
1260Sstevel@tonic-gate 	    ext_prov.ei_total_public_memory);
1270Sstevel@tonic-gate 	mdb_printf("ei_free_public_memory\t%lu\n",
1280Sstevel@tonic-gate 	    ext_prov.ei_free_public_memory);
1290Sstevel@tonic-gate 	mdb_printf("ei_total_private_memory\t%lu\n",
1300Sstevel@tonic-gate 	    ext_prov.ei_total_private_memory);
1310Sstevel@tonic-gate 	mdb_printf("ei_free_private_memory\t%lu\n",
1320Sstevel@tonic-gate 	    ext_prov.ei_free_private_memory);
1330Sstevel@tonic-gate 	mdb_printf("ei_hardware_version\tmajor %c minor %c\n",
1340Sstevel@tonic-gate 	    ext_prov.ei_hardware_version.cv_major,
1350Sstevel@tonic-gate 	    ext_prov.ei_hardware_version.cv_minor);
1360Sstevel@tonic-gate 	mdb_printf("ei_firmware_version\tmajor %c minor %c\n",
1370Sstevel@tonic-gate 	    ext_prov.ei_firmware_version.cv_major,
1380Sstevel@tonic-gate 	    ext_prov.ei_firmware_version.cv_minor);
1390Sstevel@tonic-gate 	mdb_printf("ei_time\t%s\n", ext_prov.ei_time);
1400Sstevel@tonic-gate 	return (DCMD_OK);
1410Sstevel@tonic-gate }
1420Sstevel@tonic-gate 
1430Sstevel@tonic-gate const mdb_bitmask_t mech_bits[] = {
1440Sstevel@tonic-gate 	{ "NIL", (uint32_t)-1, 0 },
1450Sstevel@tonic-gate 	{ "CRYPTO_FG_ENCRYPT", CRYPTO_FG_ENCRYPT, CRYPTO_FG_ENCRYPT },
1460Sstevel@tonic-gate 	{ "CRYPTO_FG_DECRYPT", CRYPTO_FG_DECRYPT, CRYPTO_FG_DECRYPT },
1470Sstevel@tonic-gate 	{ "CRYPTO_FG_DIGEST", CRYPTO_FG_DIGEST, CRYPTO_FG_DIGEST },
1480Sstevel@tonic-gate 	{ "CRYPTO_FG_SIGN", CRYPTO_FG_SIGN, CRYPTO_FG_SIGN },
1490Sstevel@tonic-gate 	{ "CRYPTO_FG_SIGN_RECOVER", CRYPTO_FG_SIGN_RECOVER,
1500Sstevel@tonic-gate 		CRYPTO_FG_SIGN_RECOVER },
1510Sstevel@tonic-gate 	{ "CRYPTO_FG_VERIFY", CRYPTO_FG_VERIFY, CRYPTO_FG_VERIFY },
1520Sstevel@tonic-gate 	{ "CRYPTO_FG_VERIFY_RECOVER", CRYPTO_FG_VERIFY_RECOVER,
1530Sstevel@tonic-gate 		CRYPTO_FG_VERIFY_RECOVER },
1540Sstevel@tonic-gate 	{ "CRYPTO_FG_GENERATE", CRYPTO_FG_GENERATE, CRYPTO_FG_GENERATE },
1550Sstevel@tonic-gate 	{ "CRYPTO_FG_GENERATE_KEY_PAIR", CRYPTO_FG_GENERATE_KEY_PAIR,
1560Sstevel@tonic-gate 		CRYPTO_FG_GENERATE_KEY_PAIR },
1570Sstevel@tonic-gate 	{ "CRYPTO_FG_WRAP", CRYPTO_FG_WRAP, CRYPTO_FG_WRAP },
1580Sstevel@tonic-gate 	{ "CRYPTO_FG_UNWRAP", CRYPTO_FG_UNWRAP, CRYPTO_FG_UNWRAP },
1590Sstevel@tonic-gate 	{ "CRYPTO_FG_DERIVE", CRYPTO_FG_DERIVE, CRYPTO_FG_DERIVE },
1600Sstevel@tonic-gate 	{ "CRYPTO_FG_MAC", CRYPTO_FG_MAC, CRYPTO_FG_MAC },
1610Sstevel@tonic-gate 	{ "CRYPTO_FG_ENCRYPT_MAC", CRYPTO_FG_ENCRYPT_MAC,
1620Sstevel@tonic-gate 		CRYPTO_FG_ENCRYPT_MAC },
1630Sstevel@tonic-gate 	{ "CRYPTO_FG_MAC_DECRYPT", CRYPTO_FG_MAC_DECRYPT,
1640Sstevel@tonic-gate 		CRYPTO_FG_MAC_DECRYPT },
1650Sstevel@tonic-gate 	{ "CRYPTO_FG_ENCRYPT_ATOMIC", CRYPTO_FG_ENCRYPT_ATOMIC,
1660Sstevel@tonic-gate 		CRYPTO_FG_ENCRYPT_ATOMIC },
1670Sstevel@tonic-gate 	{ "CRYPTO_FG_DECRYPT_ATOMIC", CRYPTO_FG_DECRYPT_ATOMIC,
1680Sstevel@tonic-gate 		CRYPTO_FG_DECRYPT_ATOMIC },
1690Sstevel@tonic-gate 	{ "CRYPTO_FG_MAC_ATOMIC", CRYPTO_FG_MAC_ATOMIC, CRYPTO_FG_MAC_ATOMIC },
1700Sstevel@tonic-gate 	{ "CRYPTO_FG_DIGEST_ATOMIC", CRYPTO_FG_DIGEST_ATOMIC,
1710Sstevel@tonic-gate 		CRYPTO_FG_DIGEST_ATOMIC },
1720Sstevel@tonic-gate 	{ "CRYPTO_FG_SIGN_ATOMIC", CRYPTO_FG_SIGN_ATOMIC,
1730Sstevel@tonic-gate 		CRYPTO_FG_SIGN_ATOMIC },
1740Sstevel@tonic-gate 	{ "CRYPTO_FG_SIGN_RECOVER_ATOMIC", CRYPTO_FG_SIGN_RECOVER_ATOMIC,
1750Sstevel@tonic-gate 		CRYPTO_FG_SIGN_RECOVER_ATOMIC },
1760Sstevel@tonic-gate 	{ "CRYPTO_FG_VERIFY_ATOMIC", CRYPTO_FG_VERIFY_ATOMIC,
1770Sstevel@tonic-gate 		CRYPTO_FG_VERIFY_ATOMIC },
1780Sstevel@tonic-gate 	{ "CRYPTO_FG_VERIFY_RECOVER_ATOMIC", CRYPTO_FG_VERIFY_RECOVER_ATOMIC,
1790Sstevel@tonic-gate 		CRYPTO_FG_VERIFY_RECOVER_ATOMIC },
1800Sstevel@tonic-gate 	{ "CRYPTO_FG_ENCRYPT_MAC_ATOMIC", CRYPTO_FG_ENCRYPT_MAC_ATOMIC,
1810Sstevel@tonic-gate 		CRYPTO_FG_ENCRYPT_MAC_ATOMIC },
1820Sstevel@tonic-gate 	{ "CRYPTO_FG_MAC_DECRYPT_ATOMIC", CRYPTO_FG_MAC_DECRYPT_ATOMIC,
1830Sstevel@tonic-gate 		CRYPTO_FG_MAC_DECRYPT_ATOMIC },
1840Sstevel@tonic-gate 	{ "CRYPTO_FG_RANDOM", CRYPTO_FG_RANDOM, CRYPTO_FG_RANDOM},
1850Sstevel@tonic-gate 	{ NULL, 0, 0 }
1860Sstevel@tonic-gate };
1870Sstevel@tonic-gate 
1880Sstevel@tonic-gate /*ARGSUSED*/
1890Sstevel@tonic-gate int
1900Sstevel@tonic-gate crypto_mech_info(uintptr_t addr, uint_t flags, int argc,
1910Sstevel@tonic-gate     const mdb_arg_t *argv)
1920Sstevel@tonic-gate {
1930Sstevel@tonic-gate 	crypto_mech_info_t minfo;
1940Sstevel@tonic-gate 	const char *unit = "bits";
1950Sstevel@tonic-gate 
1960Sstevel@tonic-gate 	if (! flags & DCMD_ADDRSPEC)
1970Sstevel@tonic-gate 		return (DCMD_USAGE);
1980Sstevel@tonic-gate 
1990Sstevel@tonic-gate 	if (mdb_vread(&minfo, sizeof (crypto_mech_info_t), addr)
2000Sstevel@tonic-gate 		== -1) {
2010Sstevel@tonic-gate 		mdb_warn("cannot read addr %p", addr);
2020Sstevel@tonic-gate 		return (DCMD_ERR);
2030Sstevel@tonic-gate 	}
2040Sstevel@tonic-gate 	mdb_printf("cm_mech_name_t\t%s\n", minfo.cm_mech_name);
2050Sstevel@tonic-gate 	mdb_printf("cm_mech_number\t%lld\n", minfo.cm_mech_number);
2060Sstevel@tonic-gate 	mdb_printf("cm_func_group_mask\t0x%x:\t<%b>\n",
2070Sstevel@tonic-gate 	    minfo.cm_func_group_mask, minfo.cm_func_group_mask, mech_bits);
208*3708Skrishna 	if (minfo.cm_keysize_unit & CRYPTO_KEYSIZE_UNIT_IN_BYTES)
2090Sstevel@tonic-gate 		unit = "bytes";
2100Sstevel@tonic-gate 	mdb_printf("cm_min_key_length\t%lu %s\n", minfo.cm_min_key_length,
2110Sstevel@tonic-gate 	    unit);
2120Sstevel@tonic-gate 	mdb_printf("cm_max_key_length\t%lu %s\n", minfo.cm_max_key_length,
2130Sstevel@tonic-gate 	    unit);
2140Sstevel@tonic-gate 
2150Sstevel@tonic-gate 	return (DCMD_OK);
2160Sstevel@tonic-gate }
2170Sstevel@tonic-gate 
2180Sstevel@tonic-gate /*
2190Sstevel@tonic-gate  * MDB module linkage information:
2200Sstevel@tonic-gate  *
2210Sstevel@tonic-gate  * We declare a list of structures describing our dcmds, and a function
2220Sstevel@tonic-gate  * named _mdb_init to return a pointer to our module information.
2230Sstevel@tonic-gate  */
2240Sstevel@tonic-gate 
2250Sstevel@tonic-gate static const mdb_dcmd_t dcmds[] = {
2260Sstevel@tonic-gate 
2270Sstevel@tonic-gate 	/* spi.c */
2280Sstevel@tonic-gate 	{ "crypto_provider_ext_info", ":",
2290Sstevel@tonic-gate 	    "module-private crypto provider info",
2300Sstevel@tonic-gate 	    crypto_provider_ext_info, NULL },
2310Sstevel@tonic-gate 	{ "crypto_mech_info", ":",
2320Sstevel@tonic-gate 	    "print as crypto_mech_info",
2330Sstevel@tonic-gate 	    crypto_mech_info, NULL },
2340Sstevel@tonic-gate 
2350Sstevel@tonic-gate 	/* common.c */
2360Sstevel@tonic-gate 	{ "crypto_mechanism", ":",
2370Sstevel@tonic-gate 	    "details about a crypto mechanism", crypto_mechanism, NULL },
2380Sstevel@tonic-gate 	{ "crypto_data", ":",
2390Sstevel@tonic-gate 	    "print as crypto_data",
2400Sstevel@tonic-gate 	    crypto_data, NULL },
2410Sstevel@tonic-gate 	{ "crypto_dual_data", ":",
2420Sstevel@tonic-gate 	    "print as crypto_dual_data",
2430Sstevel@tonic-gate 	    crypto_dual_data, NULL },
2440Sstevel@tonic-gate 	{ "crypto_key", ":",
2450Sstevel@tonic-gate 	    "print as crypto_key", crypto_key, NULL },
2460Sstevel@tonic-gate 
2470Sstevel@tonic-gate 
2480Sstevel@tonic-gate 	/* impl.c */
2490Sstevel@tonic-gate 	{ "kcf_sched_info", ":",
2500Sstevel@tonic-gate 	    "scheduling data for a crypto request", kcf_sched_info, NULL },
2510Sstevel@tonic-gate 
2520Sstevel@tonic-gate 	{ "kcf_provider_desc", ":",
2530Sstevel@tonic-gate 	    "crypto provider description struct", kcf_provider_desc, NULL },
2540Sstevel@tonic-gate 
2550Sstevel@tonic-gate 	{ "prov_tab", "",
2560Sstevel@tonic-gate 	    "global table of crypto providers ", prov_tab, NULL },
2570Sstevel@tonic-gate 
2580Sstevel@tonic-gate 	{ "policy_tab", "",
2590Sstevel@tonic-gate 	    "print global policy_tab", policy_tab, NULL },
2600Sstevel@tonic-gate 
2610Sstevel@tonic-gate 	/* sched_impl.c */
2620Sstevel@tonic-gate 	{ "kcf_areq_node", ":[-v]",
2630Sstevel@tonic-gate 	    "print asynchronous crypto request struct, [ verbose ]",
2640Sstevel@tonic-gate 		kcf_areq_node, NULL },
2650Sstevel@tonic-gate 
2660Sstevel@tonic-gate 	{ "kcf_global_swq", "?[-v]",
2670Sstevel@tonic-gate 	    "global or addr global crypto queue.  [ -v = verbose ]",
2680Sstevel@tonic-gate 		kcf_global_swq, NULL },
2690Sstevel@tonic-gate 	{ "crypto_find_reqid", "?[-v] reqid",
2700Sstevel@tonic-gate 	    "look for reqid, print if found [ -v = verbose ]",
2710Sstevel@tonic-gate 		crypto_find_reqid, NULL },
2720Sstevel@tonic-gate 
2730Sstevel@tonic-gate 	{ "kcf_reqid_table", ":[-v]",
2740Sstevel@tonic-gate 	    "print contents of a request ID hash table [ -v = verbose ]",
2750Sstevel@tonic-gate 		kcf_reqid_table_dcmd, NULL },
2760Sstevel@tonic-gate 
2770Sstevel@tonic-gate 	{ "kcf_soft_conf_entry", "?",
2780Sstevel@tonic-gate 	    "head or addr of configured software crypto providers",
2790Sstevel@tonic-gate 		kcf_soft_conf_entry, NULL },
2800Sstevel@tonic-gate 
2810Sstevel@tonic-gate 	{ "kcf_policy_desc", ":", "policy descriptors for crypto",
2820Sstevel@tonic-gate 		kcf_policy_desc, NULL },
2830Sstevel@tonic-gate 	{ NULL }
2840Sstevel@tonic-gate };
2850Sstevel@tonic-gate 
2860Sstevel@tonic-gate static const mdb_walker_t walkers[] = {
2870Sstevel@tonic-gate 	{ "an_next", "walk kcf_areq_node's by an_next",
2880Sstevel@tonic-gate 		areq_first_walk_init, an_next_walk_step, areq_walk_fini },
2890Sstevel@tonic-gate 	{ "an_prev", "walk kcf_areq_node's by an_prev",
2900Sstevel@tonic-gate 		areq_last_walk_init, an_prev_walk_step, areq_walk_fini },
2910Sstevel@tonic-gate 	{ "an_idnext", "walk kcf_areq_node's by an_idnext",
2920Sstevel@tonic-gate 		an_idnext_walk_init, an_idnext_walk_step, areq_walk_fini },
2930Sstevel@tonic-gate 	{ "an_idprev", "walk kcf_areq_node's by an_idprev",
2940Sstevel@tonic-gate 		an_idprev_walk_init, an_idprev_walk_step, areq_walk_fini },
2950Sstevel@tonic-gate 	{ "an_ctxchain_next",
2960Sstevel@tonic-gate 		"walk kcf_areq_node's by an_ctxchain_next",
2970Sstevel@tonic-gate 		an_ctxchain_walk_init, an_ctxchain_walk_step, areq_walk_fini },
2980Sstevel@tonic-gate 	{ "kcf_reqid_table", "table of asynchronous crypto requests",
2990Sstevel@tonic-gate 		reqid_table_walk_init, reqid_table_walk_step,
3000Sstevel@tonic-gate 		    reqid_table_walk_fini },
3010Sstevel@tonic-gate 	{ "soft_conf_entry", "table of software providers or addr",
3020Sstevel@tonic-gate 		soft_conf_walk_init, soft_conf_walk_step,
3030Sstevel@tonic-gate 		    soft_conf_walk_fini },
3040Sstevel@tonic-gate 	{ NULL }
3050Sstevel@tonic-gate };
3060Sstevel@tonic-gate 
3070Sstevel@tonic-gate 
3080Sstevel@tonic-gate static const mdb_modinfo_t modinfo = {
3090Sstevel@tonic-gate 	MDB_API_VERSION, dcmds, walkers
3100Sstevel@tonic-gate };
3110Sstevel@tonic-gate 
3120Sstevel@tonic-gate const mdb_modinfo_t *
3130Sstevel@tonic-gate _mdb_init(void)
3140Sstevel@tonic-gate {
3150Sstevel@tonic-gate 	return (&modinfo);
3160Sstevel@tonic-gate }
317