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