Print this page
6723237 libcryptoutil should allow mechanism number "0x80000000" (the value of marker CKM_VENDOR_DEFINED)


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "@(#)adm_metaslot.c     1.4     08/06/27 SMI"
  27 
  28 /*
  29  * Administration for metaslot
  30  *
  31  * All the "list" operations will call functions in libpkcs11.so
  32  * Normally, it doesn't make sense to call functions in libpkcs11.so directly
  33  * because libpkcs11.so depends on the configuration file (pkcs11.conf) the
  34  * cryptoadm command is trying to administer.  However, since metaslot
  35  * is part of the framework, it is not possible to get information about
  36  * it without actually calling functions in libpkcs11.so.
  37  *
  38  * So, for the listing operation, which won't modify the value of pkcs11.conf
  39  * it is safe to call libpkcs11.so.
  40  *
  41  * For other operations that modifies the pkcs11.conf file, libpkcs11.so
  42  * will not be called.
  43  *
  44  */
  45 
  46 #include <cryptoutil.h>


 268         } else {
 269                 rc = convert_mechlist(&pmech_list, &mech_count, mechlist);
 270                 if (rc != SUCCESS) {
 271                         goto finish;
 272                 }
 273         }
 274 
 275         (void) printf(gettext("Mechanisms:\n"));
 276         if (mech_count == 0) {
 277                 /* should never be this case */
 278                 (void) printf(gettext("No mechanisms\n"));
 279                 goto finish;
 280         }
 281         if (verbose) {
 282                 display_verbose_mech_header();
 283         }
 284 
 285         for (i = 0; i < mech_count; i++) {
 286                 CK_MECHANISM_TYPE       mech = pmech_list[i];
 287 
 288                 if (mech > CKM_VENDOR_DEFINED) {
 289                         (void) printf("%#lx", mech);
 290                 } else {
 291                         (void) printf("%-29s", pkcs11_mech2str(mech));
 292                 }
 293 
 294                 if (verbose) {
 295                         CK_MECHANISM_INFO mech_info;
 296                         rv = funcs->C_GetMechanismInfo(METASLOT_ID,
 297                             mech, &mech_info);
 298                         if (rv != CKR_OK) {
 299                                 cryptodebug("C_GetMechanismInfo failed with "
 300                                     "error code 0x%x\n", rv);
 301                                 rc = FAILURE;
 302                                 goto finish;
 303                         }
 304                         display_mech_info(&mech_info);
 305                 }
 306                 (void) printf("\n");
 307         }
 308 




   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "@(#)adm_metaslot.c     1.5     08/07/07 SMI"
  27 
  28 /*
  29  * Administration for metaslot
  30  *
  31  * All the "list" operations will call functions in libpkcs11.so
  32  * Normally, it doesn't make sense to call functions in libpkcs11.so directly
  33  * because libpkcs11.so depends on the configuration file (pkcs11.conf) the
  34  * cryptoadm command is trying to administer.  However, since metaslot
  35  * is part of the framework, it is not possible to get information about
  36  * it without actually calling functions in libpkcs11.so.
  37  *
  38  * So, for the listing operation, which won't modify the value of pkcs11.conf
  39  * it is safe to call libpkcs11.so.
  40  *
  41  * For other operations that modifies the pkcs11.conf file, libpkcs11.so
  42  * will not be called.
  43  *
  44  */
  45 
  46 #include <cryptoutil.h>


 268         } else {
 269                 rc = convert_mechlist(&pmech_list, &mech_count, mechlist);
 270                 if (rc != SUCCESS) {
 271                         goto finish;
 272                 }
 273         }
 274 
 275         (void) printf(gettext("Mechanisms:\n"));
 276         if (mech_count == 0) {
 277                 /* should never be this case */
 278                 (void) printf(gettext("No mechanisms\n"));
 279                 goto finish;
 280         }
 281         if (verbose) {
 282                 display_verbose_mech_header();
 283         }
 284 
 285         for (i = 0; i < mech_count; i++) {
 286                 CK_MECHANISM_TYPE       mech = pmech_list[i];
 287 
 288                 if (mech >= CKM_VENDOR_DEFINED) {
 289                         (void) printf("%#lx", mech);
 290                 } else {
 291                         (void) printf("%-29s", pkcs11_mech2str(mech));
 292                 }
 293 
 294                 if (verbose) {
 295                         CK_MECHANISM_INFO mech_info;
 296                         rv = funcs->C_GetMechanismInfo(METASLOT_ID,
 297                             mech, &mech_info);
 298                         if (rv != CKR_OK) {
 299                                 cryptodebug("C_GetMechanismInfo failed with "
 300                                     "error code 0x%x\n", rv);
 301                                 rc = FAILURE;
 302                                 goto finish;
 303                         }
 304                         display_mech_info(&mech_info);
 305                 }
 306                 (void) printf("\n");
 307         }
 308