diff --git a/pkcs11/_pkcs11.pyx b/pkcs11/_pkcs11.pyx index 955c592..9384eb6 100644 --- a/pkcs11/_pkcs11.pyx +++ b/pkcs11/_pkcs11.pyx @@ -188,6 +188,9 @@ class Slot(types.Slot): assertRV(C_GetMechanismList(self.slot_id, NULL, &count)) + if count == 0: + return set() + cdef CK_MECHANISM_TYPE [:] mechanisms = CK_ULONG_buffer(count) assertRV(C_GetMechanismList(self.slot_id, &mechanisms[0], &count))