17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
56a1073f8Skrishna  * Common Development and Distribution License (the "License").
66a1073f8Skrishna  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22ef56a3c5SKrishna Yenduri  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
26*d75f3745SJohn Levon /*
27*d75f3745SJohn Levon  * Copyright (c) 2018, Joyent, Inc.
28*d75f3745SJohn Levon  */
29*d75f3745SJohn Levon 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  * mdb dcmds for selected structures from
327c478bd9Sstevel@tonic-gate  * usr/src/uts/common/sys/crypto/spi.h
337c478bd9Sstevel@tonic-gate  *
347c478bd9Sstevel@tonic-gate  * Also the mdb module housekeeping
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #include <sys/mdb_modapi.h>
387c478bd9Sstevel@tonic-gate #include <sys/modctl.h>
397c478bd9Sstevel@tonic-gate #include <sys/crypto/api.h>
407c478bd9Sstevel@tonic-gate #include <sys/crypto/common.h>
417c478bd9Sstevel@tonic-gate #include <sys/crypto/spi.h>
427c478bd9Sstevel@tonic-gate #include <sys/crypto/impl.h>
437c478bd9Sstevel@tonic-gate #include "crypto_cmds.h"
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate const mdb_bitmask_t extf_flags[] = {
477c478bd9Sstevel@tonic-gate 	{ "NIL", (ulong_t)-1, 0L },
487c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_RNG", CRYPTO_EXTF_RNG, CRYPTO_EXTF_RNG },
497c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_WRITE_PROTECTED", CRYPTO_EXTF_WRITE_PROTECTED,
507c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_WRITE_PROTECTED },
517c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_LOGIN_REQUIRED", CRYPTO_EXTF_LOGIN_REQUIRED,
527c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_LOGIN_REQUIRED },
537c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_INITIALIZED", CRYPTO_EXTF_USER_PIN_INITIALIZED,
547c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_INITIALIZED },
557c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_CLOCK_ON_TOKEN", CRYPTO_EXTF_CLOCK_ON_TOKEN,
567c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_CLOCK_ON_TOKEN },
577c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_PROTECTED_AUTHENTICATION_PATH",
587c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_PROTECTED_AUTHENTICATION_PATH,
597c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_PROTECTED_AUTHENTICATION_PATH },
607c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_DUAL_CRYPTO_OPERATIONS",
617c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_DUAL_CRYPTO_OPERATIONS,
627c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_DUAL_CRYPTO_OPERATIONS },
637c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_TOKEN_INITIALIZED", CRYPTO_EXTF_TOKEN_INITIALIZED,
647c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_TOKEN_INITIALIZED },
657c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_COUNT_LOW", CRYPTO_EXTF_USER_PIN_COUNT_LOW,
667c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_COUNT_LOW },
677c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_FINAL_TRY", CRYPTO_EXTF_USER_PIN_FINAL_TRY,
687c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_FINAL_TRY },
697c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_LOCKED", CRYPTO_EXTF_USER_PIN_LOCKED,
707c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_LOCKED },
717c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_USER_PIN_TO_BE_CHANGED",
727c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_TO_BE_CHANGED,
737c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_USER_PIN_TO_BE_CHANGED },
747c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_SO_PIN_COUNT_LOW", CRYPTO_EXTF_SO_PIN_COUNT_LOW,
757c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_SO_PIN_COUNT_LOW },
767c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_SO_PIN_FINAL_TRY", CRYPTO_EXTF_SO_PIN_FINAL_TRY,
777c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_SO_PIN_FINAL_TRY },
787c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_SO_PIN_LOCKED", CRYPTO_EXTF_SO_PIN_LOCKED,
797c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_SO_PIN_LOCKED },
807c478bd9Sstevel@tonic-gate 	{ "CRYPTO_EXTF_SO_PIN_TO_BE_CHANGED", CRYPTO_EXTF_SO_PIN_TO_BE_CHANGED,
817c478bd9Sstevel@tonic-gate 		CRYPTO_EXTF_SO_PIN_TO_BE_CHANGED },
827c478bd9Sstevel@tonic-gate 	{ NULL, 0, 0 }
837c478bd9Sstevel@tonic-gate };
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate /*ARGSUSED*/
867c478bd9Sstevel@tonic-gate int
crypto_provider_ext_info(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)877c478bd9Sstevel@tonic-gate crypto_provider_ext_info(uintptr_t addr, uint_t flags, int argc,
887c478bd9Sstevel@tonic-gate     const mdb_arg_t *argv)
897c478bd9Sstevel@tonic-gate {
907c478bd9Sstevel@tonic-gate 	crypto_provider_ext_info_t ext_prov;
917c478bd9Sstevel@tonic-gate 	/*
927c478bd9Sstevel@tonic-gate 	 * 33 is 1 + MAX(CRYPTO_EXT_SIZE_LABEL, CRYPTO_EXT_SIZE_MANUF,
937c478bd9Sstevel@tonic-gate 	 *		 CRYPTO_EXT_SIZE_MODEL, CRYPTO_EXT_SIZE_SERIAL)
947c478bd9Sstevel@tonic-gate 	 */
957c478bd9Sstevel@tonic-gate 	char scratch[33];
967c478bd9Sstevel@tonic-gate 
97fc10aa48SRichard Lowe 	if (!(flags & DCMD_ADDRSPEC))
987c478bd9Sstevel@tonic-gate 		return (DCMD_USAGE);
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate 	if (mdb_vread(&ext_prov, sizeof (crypto_provider_ext_info_t), addr)
101ef56a3c5SKrishna Yenduri 	    == -1) {
1027c478bd9Sstevel@tonic-gate 		mdb_warn("cannot read addr");
1037c478bd9Sstevel@tonic-gate 		return (DCMD_ERR);
1047c478bd9Sstevel@tonic-gate 	}
1057c478bd9Sstevel@tonic-gate 	bcopy(ext_prov.ei_label, scratch, CRYPTO_EXT_SIZE_LABEL);
1067c478bd9Sstevel@tonic-gate 	scratch[CRYPTO_EXT_SIZE_LABEL] = '\0';
1077c478bd9Sstevel@tonic-gate 	mdb_printf("ei_label\t\t%s\n", scratch);
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate 	bcopy(ext_prov.ei_manufacturerID, scratch, CRYPTO_EXT_SIZE_MANUF);
1107c478bd9Sstevel@tonic-gate 	scratch[CRYPTO_EXT_SIZE_MANUF] = '\0';
1117c478bd9Sstevel@tonic-gate 	mdb_printf("ei_manufacturerID\t%s\n", scratch);
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate 	bcopy(ext_prov.ei_model, scratch, CRYPTO_EXT_SIZE_MODEL);
1147c478bd9Sstevel@tonic-gate 	scratch[CRYPTO_EXT_SIZE_MODEL] = '\0';
1157c478bd9Sstevel@tonic-gate 	mdb_printf("ei_model\t\t%s\n", scratch);
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate 	bcopy(ext_prov.ei_serial_number, scratch, CRYPTO_EXT_SIZE_SERIAL);
1187c478bd9Sstevel@tonic-gate 	scratch[CRYPTO_EXT_SIZE_SERIAL] = '\0';
1197c478bd9Sstevel@tonic-gate 	mdb_printf("ei_serial_number\t%s\n", scratch);
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate 	mdb_printf("ei_flags\t0x%x:\t<%lb>\n", ext_prov.ei_flags,
1227c478bd9Sstevel@tonic-gate 	    ext_prov.ei_flags, extf_flags);
1237c478bd9Sstevel@tonic-gate 	mdb_printf("ei_max_session_count\t%lu\n",
1247c478bd9Sstevel@tonic-gate 	    ext_prov.ei_max_session_count);
1257c478bd9Sstevel@tonic-gate 	mdb_printf("ei_max_pin_len\t\t%lu\n", ext_prov.ei_max_pin_len);
1267c478bd9Sstevel@tonic-gate 	mdb_printf("ei_min_pin_len\t\t%lu\n", ext_prov.ei_min_pin_len);
1277c478bd9Sstevel@tonic-gate 	mdb_printf("ei_total_public_memory\t%lu\n",
1287c478bd9Sstevel@tonic-gate 	    ext_prov.ei_total_public_memory);
1297c478bd9Sstevel@tonic-gate 	mdb_printf("ei_free_public_memory\t%lu\n",
1307c478bd9Sstevel@tonic-gate 	    ext_prov.ei_free_public_memory);
1317c478bd9Sstevel@tonic-gate 	mdb_printf("ei_total_private_memory\t%lu\n",
1327c478bd9Sstevel@tonic-gate 	    ext_prov.ei_total_private_memory);
1337c478bd9Sstevel@tonic-gate 	mdb_printf("ei_free_private_memory\t%lu\n",
1347c478bd9Sstevel@tonic-gate 	    ext_prov.ei_free_private_memory);
1357c478bd9Sstevel@tonic-gate 	mdb_printf("ei_hardware_version\tmajor %c minor %c\n",
1367c478bd9Sstevel@tonic-gate 	    ext_prov.ei_hardware_version.cv_major,
1377c478bd9Sstevel@tonic-gate 	    ext_prov.ei_hardware_version.cv_minor);
1387c478bd9Sstevel@tonic-gate 	mdb_printf("ei_firmware_version\tmajor %c minor %c\n",
1397c478bd9Sstevel@tonic-gate 	    ext_prov.ei_firmware_version.cv_major,
1407c478bd9Sstevel@tonic-gate 	    ext_prov.ei_firmware_version.cv_minor);
1417c478bd9Sstevel@tonic-gate 	mdb_printf("ei_time\t%s\n", ext_prov.ei_time);
1427c478bd9Sstevel@tonic-gate 	return (DCMD_OK);
1437c478bd9Sstevel@tonic-gate }
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate const mdb_bitmask_t mech_bits[] = {
1467c478bd9Sstevel@tonic-gate 	{ "NIL", (uint32_t)-1, 0 },
1477c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_ENCRYPT", CRYPTO_FG_ENCRYPT, CRYPTO_FG_ENCRYPT },
1487c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_DECRYPT", CRYPTO_FG_DECRYPT, CRYPTO_FG_DECRYPT },
1497c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_DIGEST", CRYPTO_FG_DIGEST, CRYPTO_FG_DIGEST },
1507c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_SIGN", CRYPTO_FG_SIGN, CRYPTO_FG_SIGN },
1517c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_SIGN_RECOVER", CRYPTO_FG_SIGN_RECOVER,
1527c478bd9Sstevel@tonic-gate 		CRYPTO_FG_SIGN_RECOVER },
1537c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_VERIFY", CRYPTO_FG_VERIFY, CRYPTO_FG_VERIFY },
1547c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_VERIFY_RECOVER", CRYPTO_FG_VERIFY_RECOVER,
1557c478bd9Sstevel@tonic-gate 		CRYPTO_FG_VERIFY_RECOVER },
1567c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_GENERATE", CRYPTO_FG_GENERATE, CRYPTO_FG_GENERATE },
1577c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_GENERATE_KEY_PAIR", CRYPTO_FG_GENERATE_KEY_PAIR,
1587c478bd9Sstevel@tonic-gate 		CRYPTO_FG_GENERATE_KEY_PAIR },
1597c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_WRAP", CRYPTO_FG_WRAP, CRYPTO_FG_WRAP },
1607c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_UNWRAP", CRYPTO_FG_UNWRAP, CRYPTO_FG_UNWRAP },
1617c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_DERIVE", CRYPTO_FG_DERIVE, CRYPTO_FG_DERIVE },
1627c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_MAC", CRYPTO_FG_MAC, CRYPTO_FG_MAC },
1637c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_ENCRYPT_MAC", CRYPTO_FG_ENCRYPT_MAC,
1647c478bd9Sstevel@tonic-gate 		CRYPTO_FG_ENCRYPT_MAC },
1657c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_MAC_DECRYPT", CRYPTO_FG_MAC_DECRYPT,
1667c478bd9Sstevel@tonic-gate 		CRYPTO_FG_MAC_DECRYPT },
1677c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_ENCRYPT_ATOMIC", CRYPTO_FG_ENCRYPT_ATOMIC,
1687c478bd9Sstevel@tonic-gate 		CRYPTO_FG_ENCRYPT_ATOMIC },
1697c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_DECRYPT_ATOMIC", CRYPTO_FG_DECRYPT_ATOMIC,
1707c478bd9Sstevel@tonic-gate 		CRYPTO_FG_DECRYPT_ATOMIC },
1717c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_MAC_ATOMIC", CRYPTO_FG_MAC_ATOMIC, CRYPTO_FG_MAC_ATOMIC },
1727c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_DIGEST_ATOMIC", CRYPTO_FG_DIGEST_ATOMIC,
1737c478bd9Sstevel@tonic-gate 		CRYPTO_FG_DIGEST_ATOMIC },
1747c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_SIGN_ATOMIC", CRYPTO_FG_SIGN_ATOMIC,
1757c478bd9Sstevel@tonic-gate 		CRYPTO_FG_SIGN_ATOMIC },
1767c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_SIGN_RECOVER_ATOMIC", CRYPTO_FG_SIGN_RECOVER_ATOMIC,
1777c478bd9Sstevel@tonic-gate 		CRYPTO_FG_SIGN_RECOVER_ATOMIC },
1787c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_VERIFY_ATOMIC", CRYPTO_FG_VERIFY_ATOMIC,
1797c478bd9Sstevel@tonic-gate 		CRYPTO_FG_VERIFY_ATOMIC },
1807c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_VERIFY_RECOVER_ATOMIC", CRYPTO_FG_VERIFY_RECOVER_ATOMIC,
1817c478bd9Sstevel@tonic-gate 		CRYPTO_FG_VERIFY_RECOVER_ATOMIC },
1827c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_ENCRYPT_MAC_ATOMIC", CRYPTO_FG_ENCRYPT_MAC_ATOMIC,
1837c478bd9Sstevel@tonic-gate 		CRYPTO_FG_ENCRYPT_MAC_ATOMIC },
1847c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_MAC_DECRYPT_ATOMIC", CRYPTO_FG_MAC_DECRYPT_ATOMIC,
1857c478bd9Sstevel@tonic-gate 		CRYPTO_FG_MAC_DECRYPT_ATOMIC },
1867c478bd9Sstevel@tonic-gate 	{ "CRYPTO_FG_RANDOM", CRYPTO_FG_RANDOM, CRYPTO_FG_RANDOM},
1877c478bd9Sstevel@tonic-gate 	{ NULL, 0, 0 }
1887c478bd9Sstevel@tonic-gate };
1897c478bd9Sstevel@tonic-gate 
1907c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1917c478bd9Sstevel@tonic-gate int
crypto_mech_info(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)1927c478bd9Sstevel@tonic-gate crypto_mech_info(uintptr_t addr, uint_t flags, int argc,
1937c478bd9Sstevel@tonic-gate     const mdb_arg_t *argv)
1947c478bd9Sstevel@tonic-gate {
1957c478bd9Sstevel@tonic-gate 	crypto_mech_info_t minfo;
1967c478bd9Sstevel@tonic-gate 	const char *unit = "bits";
1977c478bd9Sstevel@tonic-gate 
198*d75f3745SJohn Levon 	if (!(flags & DCMD_ADDRSPEC))
1997c478bd9Sstevel@tonic-gate 		return (DCMD_USAGE);
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate 	if (mdb_vread(&minfo, sizeof (crypto_mech_info_t), addr)
202ef56a3c5SKrishna Yenduri 	    == -1) {
2037c478bd9Sstevel@tonic-gate 		mdb_warn("cannot read addr %p", addr);
2047c478bd9Sstevel@tonic-gate 		return (DCMD_ERR);
2057c478bd9Sstevel@tonic-gate 	}
2067c478bd9Sstevel@tonic-gate 	mdb_printf("cm_mech_name_t\t%s\n", minfo.cm_mech_name);
2077c478bd9Sstevel@tonic-gate 	mdb_printf("cm_mech_number\t%lld\n", minfo.cm_mech_number);
2087c478bd9Sstevel@tonic-gate 	mdb_printf("cm_func_group_mask\t0x%x:\t<%b>\n",
2097c478bd9Sstevel@tonic-gate 	    minfo.cm_func_group_mask, minfo.cm_func_group_mask, mech_bits);
2106a1073f8Skrishna 	if (minfo.cm_keysize_unit & CRYPTO_KEYSIZE_UNIT_IN_BYTES)
2117c478bd9Sstevel@tonic-gate 		unit = "bytes";
2127c478bd9Sstevel@tonic-gate 	mdb_printf("cm_min_key_length\t%lu %s\n", minfo.cm_min_key_length,
2137c478bd9Sstevel@tonic-gate 	    unit);
2147c478bd9Sstevel@tonic-gate 	mdb_printf("cm_max_key_length\t%lu %s\n", minfo.cm_max_key_length,
2157c478bd9Sstevel@tonic-gate 	    unit);
2167c478bd9Sstevel@tonic-gate 
2177c478bd9Sstevel@tonic-gate 	return (DCMD_OK);
2187c478bd9Sstevel@tonic-gate }
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate /*
2217c478bd9Sstevel@tonic-gate  * MDB module linkage information:
2227c478bd9Sstevel@tonic-gate  *
2237c478bd9Sstevel@tonic-gate  * We declare a list of structures describing our dcmds, and a function
2247c478bd9Sstevel@tonic-gate  * named _mdb_init to return a pointer to our module information.
2257c478bd9Sstevel@tonic-gate  */
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate static const mdb_dcmd_t dcmds[] = {
2287c478bd9Sstevel@tonic-gate 
2297c478bd9Sstevel@tonic-gate 	/* spi.c */
2307c478bd9Sstevel@tonic-gate 	{ "crypto_provider_ext_info", ":",
2317c478bd9Sstevel@tonic-gate 	    "module-private crypto provider info",
2327c478bd9Sstevel@tonic-gate 	    crypto_provider_ext_info, NULL },
2337c478bd9Sstevel@tonic-gate 	{ "crypto_mech_info", ":",
2347c478bd9Sstevel@tonic-gate 	    "print as crypto_mech_info",
2357c478bd9Sstevel@tonic-gate 	    crypto_mech_info, NULL },
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate 	/* common.c */
2387c478bd9Sstevel@tonic-gate 	{ "crypto_mechanism", ":",
2397c478bd9Sstevel@tonic-gate 	    "details about a crypto mechanism", crypto_mechanism, NULL },
2407c478bd9Sstevel@tonic-gate 	{ "crypto_data", ":",
2417c478bd9Sstevel@tonic-gate 	    "print as crypto_data",
2427c478bd9Sstevel@tonic-gate 	    crypto_data, NULL },
2437c478bd9Sstevel@tonic-gate 	{ "crypto_dual_data", ":",
2447c478bd9Sstevel@tonic-gate 	    "print as crypto_dual_data",
2457c478bd9Sstevel@tonic-gate 	    crypto_dual_data, NULL },
2467c478bd9Sstevel@tonic-gate 	{ "crypto_key", ":",
2477c478bd9Sstevel@tonic-gate 	    "print as crypto_key", crypto_key, NULL },
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate 	/* impl.c */
2517c478bd9Sstevel@tonic-gate 	{ "kcf_provider_desc", ":",
2527c478bd9Sstevel@tonic-gate 	    "crypto provider description struct", kcf_provider_desc, NULL },
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate 	{ "prov_tab", "",
2557c478bd9Sstevel@tonic-gate 	    "global table of crypto providers ", prov_tab, NULL },
2567c478bd9Sstevel@tonic-gate 
2577c478bd9Sstevel@tonic-gate 	{ "policy_tab", "",
2587c478bd9Sstevel@tonic-gate 	    "print global policy_tab", policy_tab, NULL },
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate 	/* sched_impl.c */
2617c478bd9Sstevel@tonic-gate 	{ "kcf_areq_node", ":[-v]",
2627c478bd9Sstevel@tonic-gate 	    "print asynchronous crypto request struct, [ verbose ]",
2637c478bd9Sstevel@tonic-gate 		kcf_areq_node, NULL },
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate 	{ "kcf_global_swq", "?[-v]",
2667c478bd9Sstevel@tonic-gate 	    "global or addr global crypto queue.  [ -v = verbose ]",
2677c478bd9Sstevel@tonic-gate 		kcf_global_swq, NULL },
2687c478bd9Sstevel@tonic-gate 	{ "crypto_find_reqid", "?[-v] reqid",
2697c478bd9Sstevel@tonic-gate 	    "look for reqid, print if found [ -v = verbose ]",
2707c478bd9Sstevel@tonic-gate 		crypto_find_reqid, NULL },
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate 	{ "kcf_reqid_table", ":[-v]",
2737c478bd9Sstevel@tonic-gate 	    "print contents of a request ID hash table [ -v = verbose ]",
2747c478bd9Sstevel@tonic-gate 		kcf_reqid_table_dcmd, NULL },
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate 	{ "kcf_soft_conf_entry", "?",
2777c478bd9Sstevel@tonic-gate 	    "head or addr of configured software crypto providers",
2787c478bd9Sstevel@tonic-gate 		kcf_soft_conf_entry, NULL },
2797c478bd9Sstevel@tonic-gate 
2807c478bd9Sstevel@tonic-gate 	{ "kcf_policy_desc", ":", "policy descriptors for crypto",
2817c478bd9Sstevel@tonic-gate 		kcf_policy_desc, NULL },
2827c478bd9Sstevel@tonic-gate 	{ NULL }
2837c478bd9Sstevel@tonic-gate };
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate static const mdb_walker_t walkers[] = {
2867c478bd9Sstevel@tonic-gate 	{ "an_next", "walk kcf_areq_node's by an_next",
2877c478bd9Sstevel@tonic-gate 		areq_first_walk_init, an_next_walk_step, areq_walk_fini },
2887c478bd9Sstevel@tonic-gate 	{ "an_prev", "walk kcf_areq_node's by an_prev",
2897c478bd9Sstevel@tonic-gate 		areq_last_walk_init, an_prev_walk_step, areq_walk_fini },
2907c478bd9Sstevel@tonic-gate 	{ "an_idnext", "walk kcf_areq_node's by an_idnext",
2917c478bd9Sstevel@tonic-gate 		an_idnext_walk_init, an_idnext_walk_step, areq_walk_fini },
2927c478bd9Sstevel@tonic-gate 	{ "an_idprev", "walk kcf_areq_node's by an_idprev",
2937c478bd9Sstevel@tonic-gate 		an_idprev_walk_init, an_idprev_walk_step, areq_walk_fini },
2947c478bd9Sstevel@tonic-gate 	{ "an_ctxchain_next",
2957c478bd9Sstevel@tonic-gate 		"walk kcf_areq_node's by an_ctxchain_next",
2967c478bd9Sstevel@tonic-gate 		an_ctxchain_walk_init, an_ctxchain_walk_step, areq_walk_fini },
2977c478bd9Sstevel@tonic-gate 	{ "kcf_reqid_table", "table of asynchronous crypto requests",
2987c478bd9Sstevel@tonic-gate 		reqid_table_walk_init, reqid_table_walk_step,
2997c478bd9Sstevel@tonic-gate 		    reqid_table_walk_fini },
3007c478bd9Sstevel@tonic-gate 	{ "soft_conf_entry", "table of software providers or addr",
3017c478bd9Sstevel@tonic-gate 		soft_conf_walk_init, soft_conf_walk_step,
3027c478bd9Sstevel@tonic-gate 		    soft_conf_walk_fini },
3037c478bd9Sstevel@tonic-gate 	{ NULL }
3047c478bd9Sstevel@tonic-gate };
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate 
3077c478bd9Sstevel@tonic-gate static const mdb_modinfo_t modinfo = {
3087c478bd9Sstevel@tonic-gate 	MDB_API_VERSION, dcmds, walkers
3097c478bd9Sstevel@tonic-gate };
3107c478bd9Sstevel@tonic-gate 
3117c478bd9Sstevel@tonic-gate const mdb_modinfo_t *
_mdb_init(void)3127c478bd9Sstevel@tonic-gate _mdb_init(void)
3137c478bd9Sstevel@tonic-gate {
3147c478bd9Sstevel@tonic-gate 	return (&modinfo);
3157c478bd9Sstevel@tonic-gate }
316