Print this page
5031131 perf: pkcs11_kernel can benefit from a more efficient pkcs11_mech2str()
*** 1,12 ****
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
! * Common Development and Distribution License, Version 1.0 only
! * (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
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
--- 1,11 ----
/*
* 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
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*** 18,32 ****
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
! * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
! #pragma ident "@(#)adm_metaslot.c 1.3 05/06/08 SMI"
/*
* Administration for metaslot
*
* All the "list" operations will call functions in libpkcs11.so
--- 17,31 ----
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
! * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
! #pragma ident "@(#)adm_metaslot.c 1.4 08/06/27 SMI"
/*
* Administration for metaslot
*
* All the "list" operations will call functions in libpkcs11.so
*** 167,177 ****
}
/*
* We know for sure that metaslot is slot 0 in the framework,
* so, we will do a C_GetSlotInfo() trying to see if it works.
! * If it failes with CKR_SLOT_ID_INVALID, we know that metaslot
* is not really enabled.
*/
rv = funcs->C_GetSlotInfo(METASLOT_ID, &slot_info);
if (rv == CKR_SLOT_ID_INVALID) {
(void) printf(gettext("actual status: disabled.\n"));
--- 166,176 ----
}
/*
* We know for sure that metaslot is slot 0 in the framework,
* so, we will do a C_GetSlotInfo() trying to see if it works.
! * If it fails with CKR_SLOT_ID_INVALID, we know that metaslot
* is not really enabled.
*/
rv = funcs->C_GetSlotInfo(METASLOT_ID, &slot_info);
if (rv == CKR_SLOT_ID_INVALID) {
(void) printf(gettext("actual status: disabled.\n"));
*** 282,296 ****
if (verbose) {
display_verbose_mech_header();
}
for (i = 0; i < mech_count; i++) {
! (void) printf("%-29s", pkcs11_mech2str(pmech_list[i]));
if (verbose) {
CK_MECHANISM_INFO mech_info;
rv = funcs->C_GetMechanismInfo(METASLOT_ID,
! pmech_list[i], &mech_info);
if (rv != CKR_OK) {
cryptodebug("C_GetMechanismInfo failed with "
"error code 0x%x\n", rv);
rc = FAILURE;
goto finish;
--- 281,302 ----
if (verbose) {
display_verbose_mech_header();
}
for (i = 0; i < mech_count; i++) {
! CK_MECHANISM_TYPE mech = pmech_list[i];
!
! if (mech > CKM_VENDOR_DEFINED) {
! (void) printf("%#lx", mech);
! } else {
! (void) printf("%-29s", pkcs11_mech2str(mech));
! }
!
if (verbose) {
CK_MECHANISM_INFO mech_info;
rv = funcs->C_GetMechanismInfo(METASLOT_ID,
! mech, &mech_info);
if (rv != CKR_OK) {
cryptodebug("C_GetMechanismInfo failed with "
"error code 0x%x\n", rv);
rc = FAILURE;
goto finish;