impl.c revision fe2f74680a9b0a4c22a80f5da91700cd48e715fe
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* mdb dcmds for selected structures from
*/
#include <stdio.h>
#include <sys/mdb_modapi.h>
#include "crypto_cmds.h"
int
{
if (!(flags & DCMD_ADDRSPEC)) {
else
return (DCMD_USAGE);
return (DCMD_USAGE);
else {
return (DCMD_ERR);
}
}
return (DCMD_OK);
}
static const char *prov_states[] = {
"none",
"KCF_PROV_ALLOCATED",
"KCF_PROV_UNVERIFIED",
"KCF_PROV_VERIFICATION_FAILED",
"KCF_PROV_READY",
"KCF_PROV_BUSY",
"KCF_PROV_FAILED",
"KCF_PROV_DISABLED",
"KCF_PROV_REMOVED",
"KCF_PROV_FREED"
};
static void
{
mdb_inc_indent(4);
mdb_printf("value = ");
/*
* The only data type used for the provider kstats is uint64.
*/
case KSTAT_DATA_UINT64:
#if defined(_LP64) || defined(_LONGLONG_TYPE)
#endif
break;
default:
mdb_warn("Incorrect data type for kstat.\n");
}
mdb_dec_indent(4);
}
/*ARGSUSED*/
int
{
int i, j;
return (DCMD_USAGE);
#ifdef DEBUG
#endif
== -1) {
return (DCMD_ERR);
}
switch (desc.pd_prov_type) {
case CRYPTO_HW_PROVIDER:
mdb_printf("pd_prov_type:\t\tCRYPTO_HW_PROVIDER\n");
break;
case CRYPTO_SW_PROVIDER:
mdb_printf("pd_prov_type:\t\tCRYPTO_SW_PROVIDER\n");
break;
case CRYPTO_LOGICAL_PROVIDER:
mdb_printf("pd_prov_type:\t\tCRYPTO_LOGICAL_PROVIDER\n");
break;
default:
}
mdb_printf("pd_description:\t\tNULL\n");
} else
/* mechanisms */
mdb_inc_indent(4);
for (i = 0; i < desc.pd_mech_list_count; i++) {
mdb_call_dcmd("crypto_mech_info",
}
mdb_dec_indent(4);
mdb_printf("pd_mech_indx:\n");
mdb_inc_indent(8);
for (i = 0; i < KCF_OPS_CLASSSIZE; i++) {
for (j = 0; j < KCF_MAXMECHTAB; j++) {
mdb_printf("N ");
else
}
mdb_printf("\n");
}
mdb_dec_indent(8);
mdb_printf("pd_ks_data.ps_ops_passed:\n",
mdb_printf("pd_ks_data.ps_ops_failed:\n",
mdb_printf("pd_ks_data.ps_ops_busy_rval:\n",
mdb_printf("kcf_sched_info:\n");
/* print pd_sched_info via existing function */
mdb_inc_indent(8);
mdb_dec_indent(8);
mdb_printf("pd_name:\t\t NULL\n");
== -1)
else
else
mdb_printf("pd_flags:\t\t%s %s %s %s\n",
"CRYPTO_HIDE_PROVIDER" : " ",
"CRYPTO_HASH_NO_UPDATE" : " ",
"KCF_LPROV_MEMBER" : " ",
"KCF_PROV_RESTRICTED" : " ");
return (DCMD_OK);
}
#define GOT_NONE (-2)
/*ARGSUSED*/
int
{
int i;
return (DCMD_USAGE);
== -1) {
mdb_warn("cannot read prov_tab");
return (DCMD_ERR);
mdb_warn("cannot read prov_tab_max");
return (DCMD_ERR);
}
#ifdef DEBUG
#endif
mdb_warn("cannot read prov_tab");
return (DCMD_ERR);
}
#ifdef DEBUG
mdb_printf("DEBUG: got past mdb_vread of tab\n");
#endif
for (i = 0; i < prov_tab_max; i++) {
/* save space, only print range for long list of nulls */
mdb_printf("prov_tab[%d", i);
gotzero = i;
}
} else {
/* first non-null in awhile, print index of prev null */
if (gotzero == (i - 1))
else
}
/* interesting value, print it */
mdb_warn("cannot read at address %p",
return (DCMD_ERR);
}
}
}
/* if we've printed the first of many nulls but left the brace open */
mdb_printf("] = NULL\n");
else
}
return (DCMD_OK);
}
/*ARGSUSED*/
int
{
int num, i;
return (DCMD_USAGE);
== -1) {
mdb_warn("cannot read policy_tab");
return (DCMD_ERR);
mdb_warn("cannot read policy_tab_max");
return (DCMD_ERR);
}
/* get the current number of descriptors in the table */
mdb_warn("cannot read policy_tab_num");
return (DCMD_ERR);
}
mdb_printf("%<b>policy_tab = %p%</b> \tpolicy_tab_num = %d\n",
mdb_warn("cannot read policy_tab");
return (DCMD_ERR);
}
#ifdef DEBUG
mdb_printf("DEBUG: got past mdb_vread of tab\n");
#endif
for (i = 0; i < policy_tab_max; i++) {
/* save space, only print range for long list of nulls */
mdb_printf("policy_tab[%d", i);
gotzero = i;
}
} else {
/* first non-null in awhile, print index of prev null */
if (gotzero == (i - 1))
else
}
/* interesting value, print it */
}
}
/* if we've printed the first of many nulls but left the brace open */
mdb_printf("] = NULL\n");
else
}
return (DCMD_OK);
}
static void
{
int i;
for (i = 0; i < count; i++) {
continue;
/* put in quotes */
/* yes, length is 32, but then it will wrap */
/* this shorter size formats nicely for most cases */
mechs++;
}
}
/* ARGSUSED2 */
static int
void *cbdata)
{
mdb_printf("\tce_name: NULL\n");
== -1)
mdb_printf("could not read ce_name from %p\n",
else
return (WALK_NEXT);
}
int
{
"soft_config_list") == -1) {
mdb_warn("failed to find 'soft_config_list'");
return (WALK_ERR);
}
return (WALK_NEXT);
}
/*
* At each step, read a kcf_soft_conf_entry_t into our private storage, then
* invoke the callback function. We terminate when we reach a NULL ce_next
* pointer.
*/
int
{
int status;
return (WALK_DONE);
#ifdef DEBUG
else
#endif
mdb_warn("failed to read kcf_soft_conf_entry at %p",
return (WALK_DONE);
}
wsp->walk_cbdata);
return (status);
}
/*
* The walker's fini function is invoked at the end of each walk. Since we
* dynamically allocated a kcf_soft_conf_entry_t in soft_conf_walk_init,
* we must free it now.
*/
void
{
#ifdef DEBUG
mdb_printf("...end of kcf_soft_conf_entry walk\n");
#endif
}
/* ARGSUSED2 */
int
{
return (DCMD_USAGE);
else
== -1) {
mdb_warn("cannot read soft_config_list");
return (DCMD_ERR);
} else
return (DCMD_OK);
== -1) {
return (DCMD_ERR);
}
/* this could change in the future to have more than one ret val */
return (DCMD_OK);
return (DCMD_ERR);
}
/* ARGSUSED1 */
int
{
return (DCMD_USAGE);
== -1) {
return (DCMD_ERR);
}
mdb_printf("pd_prov_type: %s",
: "CRYPTO_SW_PROVIDER");
mdb_printf("\tpd_name: NULL\n");
== -1)
mdb_printf("could not read pd_name from %p\n",
else
mdb_printf("\npd_disabled_mechs:\n");
mdb_inc_indent(4);
mdb_dec_indent(4);
return (DCMD_OK);
}