summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2009-11-13 04:27:40 +0000
committerStef Walter <stef@memberwebs.com>2009-11-13 04:27:40 +0000
commit68bc026d96ee568bf47745ee59035c8f9200179e (patch)
tree15313d4ecdf658943363366615af3a689f8a0eac
parentafbffb00ac2622bcacbd17598eddf7442abc379d (diff)
Fix semantics when attribute retrieved with too small buffer.
-rw-r--r--src/object.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/object.c b/src/object.c
index 9b36b93..cb4b59c 100644
--- a/src/object.c
+++ b/src/object.c
@@ -5,7 +5,7 @@
#include <string.h>
/* An very likey to be invalid attribute */
-#define CKA_INVALID (CKA_VENDOR_DEFINED | 0x00FFFFFF)
+#define CKA_INVALID 0x80FFFFFFUL
/* ----------------------------------------------------------------------------------
* TESTS
@@ -212,7 +212,7 @@ test_get_attribute_value(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE object)
attrs[0].ulValueLen = 2;
rv = (p11t_module_funcs->C_GetAttributeValue)(session, object, attrs, 1);
P11T_CHECK_RV("Buffer too small", rv, CKR_BUFFER_TOO_SMALL);
- P11T_CHECK_ULONG("Buffer too small should return size", attrs[0].ulValueLen, sizeof(CK_OBJECT_CLASS));
+ P11T_CHECK_ULONG("Buffer too small should return -1", attrs[0].ulValueLen, (CK_ULONG)-1);
}
attrs[0].pValue = NULL;
@@ -305,7 +305,7 @@ test_get_attribute_value(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE object)
rv = (p11t_module_funcs->C_GetAttributeValue)(session, object, attrs, 5);
P11T_CHECK_RV("Multiple attributes, one small buffer", rv, CKR_BUFFER_TOO_SMALL);
- P11T_CHECK_ULONG("Size of CKA_CLASS", attrs[0].ulValueLen, sizeof(CK_OBJECT_CLASS));
+ P11T_CHECK_ULONG("Invalid attribute size", attrs[0].ulValueLen, (CK_ULONG)-1);
P11T_CHECK_BOOL("CKA_TOKEN boolean value", *((CK_BBOOL*)attrs[1].pValue));
P11T_CHECK_BOOL("CKA_PRIVATE boolean value", *((CK_BBOOL*)attrs[2].pValue));
P11T_CHECK_BOOL("CKA_MODIFIABLE boolean value", *((CK_BBOOL*)attrs[3].pValue));