[Fedora-directory-commits] coolkey/src/coolkey object.cpp,1.1,1.2

Robert Relyea (rrelyea) fedora-directory-commits at redhat.com
Fri Feb 9 18:53:23 UTC 2007


Author: rrelyea

Update of /cvs/dirsec/coolkey/src/coolkey
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22388

Modified Files:
	object.cpp 
Log Message:


CK_ULONG is platform dependent, where the number of bytes used to store a 
CK_ULONG in the token is not. 



Index: object.cpp
===================================================================
RCS file: /cvs/dirsec/coolkey/src/coolkey/object.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- object.cpp	9 Jun 2006 18:39:11 -0000	1.1
+++ object.cpp	9 Feb 2007 18:53:21 -0000	1.2
@@ -105,7 +105,9 @@
 	if ((attrib.getType() == CKA_CLASS) || 
 	    (attrib.getType() == CKA_CERTIFICATE_TYPE) ||
 	    (attrib.getType() == CKA_KEY_TYPE)) {
-	    if (attrLen != sizeof (CK_ULONG)) {
+	    /* ulongs are 4 bytes on the token, even if they are 8 or
+	     * more in the pkcs11 module */
+	    if (attrLen != 4) {
                 throw PKCS11Exception(CKR_DEVICE_ERROR,
                 "Invalid attribute length %d\n", attrLen);
 	    }
@@ -183,7 +185,7 @@
     if (!attributeExists(CKA_CLASS)) {
 	PKCS11Attribute attrib;
 	attrib.setType(CKA_CLASS);
-	attrib.setValue((CKYByte *)&objectType, 4);
+	attrib.setValue((CKYByte *)&objectType, sizeof(CK_ULONG));
         attributes.push_back(attrib);
     }
 




More information about the Fedora-directory-commits mailing list