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   "@(#)kernelUtil.c       1.17    08/06/30 SMI"
+#pragma ident   "@(#)kernelUtil.c       1.18    08/07/07 SMI"
 
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
 #include <stdio.h>

@@ -210,11 +210,11 @@
                         *k_number = elem->kmech;
                         return (CKR_OK);
                 }
         }
 
-        if (type > CKM_VENDOR_DEFINED) {
+        if (type >= CKM_VENDOR_DEFINED) {
                 (void) snprintf(buf, sizeof (buf), "%#lx", type);
                 string = buf;
         } else {
                 string = pkcs11_mech2str(type);
         }

@@ -1232,11 +1232,11 @@
         CK_FLAGS flags, mi_flags;
         CK_RV rv;
         int r;
         char buf[11];   /* Num chars for representing ulong in ASCII */
 
-        if (type > CKM_VENDOR_DEFINED) {
+        if (type >= CKM_VENDOR_DEFINED) {
                 /* allocate/build a string containing the mechanism number */
                 (void) snprintf(buf, sizeof (buf), "%#lx", type);
                 string = buf;
         } else {
                 string = pkcs11_mech2str(type);