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

@@ -21,11 +21,11 @@
 /*
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident   "@(#)mechstr.c  1.7     08/07/01 SMI"
+#pragma ident   "@(#)mechstr.c  1.8     08/07/07 SMI"
 
 /*
  * Convert Algorithm names as strings to PKCS#11 Mech numbers and vice versa.
  */
 

@@ -299,11 +299,11 @@
         { "CKM_AES_CBC_ENCRYPT_DATA", CKM_AES_CBC_ENCRYPT_DATA },
         { "CKM_DSA_PARAMETER_GEN", CKM_DSA_PARAMETER_GEN },
         { "CKM_DH_PKCS_PARAMETER_GEN", CKM_DH_PKCS_PARAMETER_GEN },
         { "CKM_X9_42_DH_PARAMETER_GEN", CKM_X9_42_DH_PARAMETER_GEN },
         /*
-         * Values above 0x8000000 (CKM_VENDOR_DEFINED) are represented
+         * Values >= 0x8000000 (CKM_VENDOR_DEFINED) are represented
          * as strings with hexadecimal numbers (e.g., "0x8123456").
          */
         { NULL, 0 }
 };
 

@@ -332,11 +332,11 @@
 *pkcs11_mech2str(CK_MECHANISM_TYPE mech)
 {
         pkcs11_mapping_t        target;
         pkcs11_mapping_t        *result = NULL;
 
-        if (mech > CKM_VENDOR_DEFINED) {
+        if (mech >= CKM_VENDOR_DEFINED) {
                 return (NULL);
         }
 
         /* Search for the mechanism number using bsearch(3C) */
         target.mech = mech;