summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrrelyea <rrelyea@fba4d07e-fe0f-4d7f-8147-e0026e666dc0>2007-02-09 18:53:21 +0000
committerrrelyea <rrelyea@fba4d07e-fe0f-4d7f-8147-e0026e666dc0>2007-02-09 18:53:21 +0000
commit2305de44e3adcb931be2d4f0125859fe6f7d9d58 (patch)
treee4f4ab6d78f03af957dc1abe9124481ca138f875 /src
parentd8d0dc7388f45bf4b09986b69da151c3adb4e4ff (diff)
CK_ULONG is platform dependent, where the number of bytes used to store a
CK_ULONG in the token is not. git-svn-id: http://svn.fedorahosted.org/svn/coolkey/trunk@48 fba4d07e-fe0f-4d7f-8147-e0026e666dc0
Diffstat (limited to 'src')
-rw-r--r--src/coolkey/object.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/coolkey/object.cpp b/src/coolkey/object.cpp
index d471c6e..bcf44c6 100644
--- a/src/coolkey/object.cpp
+++ b/src/coolkey/object.cpp
@@ -105,7 +105,9 @@ PKCS11Object::parseOldObject(const CKYBuffer *data)
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 @@ PKCS11Object::expandAttributes(unsigned long fixedAttrs)
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);
}