-
Notifications
You must be signed in to change notification settings - Fork 23
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
segmentation fault retrieving unwrap template #52
Comments
There's a few things going on here: Don't specify key types in the unwrap template. You can apply other attributes, like modifiable, but the key types, sizes, etc all would be determined by the attr template provided to the What was the log entry for generating the key complete w/ attrs? It might be helpful.
The password is encrypted at the boundaries of C_Login. As in, it will be encrypted during that call. Management of the password outside of that scope is left to user. Python in particular is rather difficult to force string vals to be cleared from memory. If you're concerned about that, use
What was the exception? IIRC, that's the preferred way. It's been some years since I've worked on this (almost 10 years!), so I'm a little hazy on the details. |
I provide a reproducer if you wish to dig deeper. |
I get that. The segfault appears to be due to memory management when getting attrs. The P11 calling convention means we need to fully create the target data structure(s), of all the appropriate sizes, before calling C_GetAttributeValue. If I had to guess... perhaps it's because it's a nested template that there's something incorrect about the data struct sizing. Whether it's a problem in pycryptoki, libCryptoki, or both remains to be seen. That it's returned empty for ckdemo makes me think it might be a libCryptoki problem, but I'm not sure without digging deeper. |
Question for you -- did you try keygen w/ an unwrap template in ckdemo and verified it works too? That'll really help me narrow it down. |
I did not try generating a key with a template through ckdemo, I don't know if the feature is present. |
BTW, what was the exception you got when using |
|
I am trying to set up a private RSA key with an unwrap template. This works but I could not find a way to retrieve the unwrap template from the key. In some instances python cores with segmentation fault:
Reproducer using DPOD and pycryptoki 2.6.6, on Centos Stream 9
on my system this cores with segmentation fault:
(and the pin token is leaked in the core file)
ckdemo also fails to list the content of the unwrap template btw (attributes are there but value is 0 for all)
I also tried with template={CKA_UNWRAP_TEMPLATE: None} which fails with an exception.
The text was updated successfully, but these errors were encountered: