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_uef.c  1.13    08/06/27 SMI"
  27 
  28 #include <cryptoutil.h>
  29 #include <fcntl.h>
  30 #include <libintl.h>
  31 #include <stdio.h>
  32 #include <stdlib.h>
  33 #include <strings.h>
  34 #include <unistd.h>
  35 #include <errno.h>
  36 #include <dlfcn.h>
  37 #include <link.h>
  38 #include <sys/types.h>
  39 #include <sys/stat.h>
  40 #include <security/cryptoki.h>
  41 #include "cryptoadm.h"
  42 
  43 #define HDR1 "                                     P\n"
  44 #define HDR2 "                         S     V  K  a     U  D\n"
  45 #define HDR3 "                         i     e  e  i     n  e\n"
  46 #define HDR4 "                      S  g  V  r  y  r  W  w  r\n"


 431                 } else  {
 432                         /* use the mechanism list passed in */
 433                         rc = convert_mechlist(&pmech_list, &mech_count, mlist);
 434                         if (rc != SUCCESS) {
 435                                 goto clean_exit;
 436                         }
 437                 }
 438                 if (show_mechs)
 439                         (void) printf(gettext("Mechanisms:\n"));
 440 
 441                 if (verbose && show_mechs) {
 442                         display_verbose_mech_header();
 443                 }
 444                 /*
 445                  * Merge the current mechanism list into the returning
 446                  * mechanism list.
 447                  */
 448                 for (j = 0; show_mechs && j < mech_count; j++) {
 449                         CK_MECHANISM_TYPE       mech = pmech_list[j];
 450 
 451                         if (mech > CKM_VENDOR_DEFINED) {
 452                                 (void) printf("%#lx", mech);
 453                         } else {
 454                                 mech_name = pkcs11_mech2str(mech);
 455                                 (void) printf("%-29s", mech_name);
 456                         }
 457 
 458                         if (verbose) {
 459                                 CK_MECHANISM_INFO mech_info;
 460                                 rv = prov_funcs->C_GetMechanismInfo(
 461                                     prov_slots[i], mech, &mech_info);
 462                                 if (rv != CKR_OK) {
 463                                         cryptodebug(
 464                                             "failed to call "
 465                                             "C_GetMechanismInfo() from %s.",
 466                                             libname);
 467                                         (void) free(pmech_list);
 468                                         rc = FAILURE;
 469                                         break;
 470                                 }
 471                                 display_mech_info(&mech_info);


1126         umechlist_t             *ptr;
1127 
1128         if (puent == NULL) {
1129                 return (SUCCESS);
1130         }
1131 
1132         if (puent->flag_enabledlist == B_FALSE) {
1133                 (void) printf(gettext("%s: all mechanisms are enabled"),
1134                     puent->name);
1135                 ptr = puent->policylist;
1136                 if (ptr == NULL) {
1137                         (void) printf(".");
1138                 } else {
1139                         (void) printf(gettext(", except "));
1140                         while (ptr != NULL) {
1141                                 mech_id = strtoul(ptr->name, NULL, 0);
1142                                 if (mech_id & CKO_VENDOR_DEFINED) {
1143                                         /* vendor defined mechanism */
1144                                         (void) printf("%s", ptr->name);
1145                                 } else {
1146                                         if (mech_id > CKM_VENDOR_DEFINED) {
1147                                                 (void) printf("%#lx", mech_id);
1148                                         } else {
1149                                                 mech_name = pkcs11_mech2str(
1150                                                     mech_id);
1151                                                 if (mech_name == NULL) {
1152                                                         return (FAILURE);
1153                                                 }
1154                                                 (void) printf("%s", mech_name);
1155                                         }
1156                                 }
1157 
1158                                 ptr = ptr->next;
1159                                 if (ptr == NULL) {
1160                                         (void) printf(".");
1161                                 } else {
1162                                         (void) printf(",");
1163                                 }
1164                         }
1165                 }
1166         } else { /* puent->flag_enabledlist == B_TRUE */




   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_uef.c  1.14    08/07/07 SMI"
  27 
  28 #include <cryptoutil.h>
  29 #include <fcntl.h>
  30 #include <libintl.h>
  31 #include <stdio.h>
  32 #include <stdlib.h>
  33 #include <strings.h>
  34 #include <unistd.h>
  35 #include <errno.h>
  36 #include <dlfcn.h>
  37 #include <link.h>
  38 #include <sys/types.h>
  39 #include <sys/stat.h>
  40 #include <security/cryptoki.h>
  41 #include "cryptoadm.h"
  42 
  43 #define HDR1 "                                     P\n"
  44 #define HDR2 "                         S     V  K  a     U  D\n"
  45 #define HDR3 "                         i     e  e  i     n  e\n"
  46 #define HDR4 "                      S  g  V  r  y  r  W  w  r\n"


 431                 } else  {
 432                         /* use the mechanism list passed in */
 433                         rc = convert_mechlist(&pmech_list, &mech_count, mlist);
 434                         if (rc != SUCCESS) {
 435                                 goto clean_exit;
 436                         }
 437                 }
 438                 if (show_mechs)
 439                         (void) printf(gettext("Mechanisms:\n"));
 440 
 441                 if (verbose && show_mechs) {
 442                         display_verbose_mech_header();
 443                 }
 444                 /*
 445                  * Merge the current mechanism list into the returning
 446                  * mechanism list.
 447                  */
 448                 for (j = 0; show_mechs && j < mech_count; j++) {
 449                         CK_MECHANISM_TYPE       mech = pmech_list[j];
 450 
 451                         if (mech >= CKM_VENDOR_DEFINED) {
 452                                 (void) printf("%#lx", mech);
 453                         } else {
 454                                 mech_name = pkcs11_mech2str(mech);
 455                                 (void) printf("%-29s", mech_name);
 456                         }
 457 
 458                         if (verbose) {
 459                                 CK_MECHANISM_INFO mech_info;
 460                                 rv = prov_funcs->C_GetMechanismInfo(
 461                                     prov_slots[i], mech, &mech_info);
 462                                 if (rv != CKR_OK) {
 463                                         cryptodebug(
 464                                             "failed to call "
 465                                             "C_GetMechanismInfo() from %s.",
 466                                             libname);
 467                                         (void) free(pmech_list);
 468                                         rc = FAILURE;
 469                                         break;
 470                                 }
 471                                 display_mech_info(&mech_info);


1126         umechlist_t             *ptr;
1127 
1128         if (puent == NULL) {
1129                 return (SUCCESS);
1130         }
1131 
1132         if (puent->flag_enabledlist == B_FALSE) {
1133                 (void) printf(gettext("%s: all mechanisms are enabled"),
1134                     puent->name);
1135                 ptr = puent->policylist;
1136                 if (ptr == NULL) {
1137                         (void) printf(".");
1138                 } else {
1139                         (void) printf(gettext(", except "));
1140                         while (ptr != NULL) {
1141                                 mech_id = strtoul(ptr->name, NULL, 0);
1142                                 if (mech_id & CKO_VENDOR_DEFINED) {
1143                                         /* vendor defined mechanism */
1144                                         (void) printf("%s", ptr->name);
1145                                 } else {
1146                                         if (mech_id >= CKM_VENDOR_DEFINED) {
1147                                                 (void) printf("%#lx", mech_id);
1148                                         } else {
1149                                                 mech_name = pkcs11_mech2str(
1150                                                     mech_id);
1151                                                 if (mech_name == NULL) {
1152                                                         return (FAILURE);
1153                                                 }
1154                                                 (void) printf("%s", mech_name);
1155                                         }
1156                                 }
1157 
1158                                 ptr = ptr->next;
1159                                 if (ptr == NULL) {
1160                                         (void) printf(".");
1161                                 } else {
1162                                         (void) printf(",");
1163                                 }
1164                         }
1165                 }
1166         } else { /* puent->flag_enabledlist == B_TRUE */