Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctypes.ArgumentError when calling c_initialize_ex function #37

Closed
manuelaguadomtz opened this issue Oct 14, 2022 · 2 comments
Closed

ctypes.ArgumentError when calling c_initialize_ex function #37

manuelaguadomtz opened this issue Oct 14, 2022 · 2 comments

Comments

@manuelaguadomtz
Copy link

Hi:

I am trying to call the c_initialize_ex function with the CKF_OS_LOCKING_OK flags but I am getting the following error

ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

`
from pycryptoki.defines import CKF_OS_LOCKING_OK
from pycryptoki.session_management import c_initialize_ex

c_initialize_ex(flags=CKF_OS_LOCKING_OK)
`

The code is running on Windows with LunaClient v2.2.3 installed.

I know this is an old version of LunaClient. Are there compatibility issues?

Thanks in advance!

@astraw38
Copy link
Contributor

Nope - just a common programming error!

Should be casting a pointer to the init struct to c_void_p, not the struct itself. I'll push up a fix shortly

@manuelaguadomtz
Copy link
Author

Thank you very much for the quick answer!

astraw38 pushed a commit that referenced this issue Oct 14, 2022
astraw38 pushed a commit that referenced this issue Oct 17, 2022
astraw38 pushed a commit that referenced this issue Oct 17, 2022
astraw38 pushed a commit that referenced this issue Oct 17, 2022
brice-fr added a commit to brice-fr/pycryptoki that referenced this issue Dec 7, 2022
Fix ThalesGroup#37 - bad arg for c_initialize with flags (ThalesGroup#38)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants