Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkcs11/_pkcs11.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ cdef extern from '../extern/cryptoki.h':
CK_TRUE,
CK_FALSE,

cdef enum:
CK_UNAVAILABLE_INFORMATION,
CK_EFFECTIVELY_INFINITE,

cdef enum: # CK_FLAGS
CKF_DONT_BLOCK,
CKF_RW_SESSION,
Expand Down
4 changes: 4 additions & 0 deletions pkcs11/_pkcs11.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,8 @@ class Object(types.Object):
# Find out the attribute size
with nogil:
retval = _funclist.C_GetAttributeValue(handle, obj, &template, 1)
if retval == CK_UNAVAILABLE_INFORMATION:
return None
assertRV(retval)

if template.ulValueLen == 0:
Expand All @@ -927,6 +929,8 @@ class Object(types.Object):
# Request the value
with nogil:
retval = _funclist.C_GetAttributeValue(handle, obj, &template, 1)
if retval == CK_UNAVAILABLE_INFORMATION:
return None
assertRV(retval)

return _unpack_attributes(key, value)
Expand Down