-
Notifications
You must be signed in to change notification settings - Fork 13
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
Decryption using symmetric key in another function gives CKR_GENERAL_ERROR #53
Comments
Are you able to submit a script that actually triggers the error ? When trying it myself, I get a SegFault that seems related to issue #51 |
Sure, it took a while before getting it figured out, but here it is. HTH FYI: While creating this script I have also come across malloc() crashes like so (unable to reproduce now):
NB: If you replace the
Output:
|
Hi @gamringer, any news on this? I've just received my Nitrokey HSM 2 and would like to start using it. 😀 |
Hi @Magentron, I am still working on #51, fixing a bad design decision that I made early on. Since you now mention the Nitrokey HSM 2, that should make debugging this easier. I did also just received one myself a 2 weeks ago and saw some very interesting things with respect to the returned size for some operations, which is why I added some checks on buffer creations like in a85bd3f. In that case, attempting to wrap something on a Nitrokey HSM 2 returns a ridiculous ciphertextLen (I didn't check if it could just be a signed vs unsigned issue, since it's not supposed to be). But I did not add that check everywhere yet. |
Not related to #51. I tried a few modifications to your test script. Somehow, merely calling base64_encode() on the encrypted data prevents it from decrypting the data, even when using the variable directly, not going through base64. I'm getting very confused. |
So it looks like it is in fact related to #51 after all. I will be putting up a pull request for you to try soon. |
@Magentron Here you go. Try PR #57 |
@gamringer It's probably going to be Monday or Tuesday, so far it looks good with the latest changes. |
NP The PR is already merged. |
The test I wrote for my application now works in PHP 7.3 and PHP 8.0. In order to make the extension compile for 7.3 I had to add a define for ZEND_THIS since this appeared in 8.0, do you @gamringer want me to create an issue/PR for it? |
I was not planning on adding support for 7.3. If it's a relatively small change, sure, make a PR and we'll discuss further on it. |
+1 small patches that can extend the scope of supported versions are welcomed as long as they remain maintainable. The more people/PHP versions will be using this extension, the better. |
Unfortunately, I got it running with PHP 7.3 with no compiler errors, but with warnings, so I've been checking the warnings and there are some warnings that should be resolved properly (like |
It already documented on the pecl page, but I'll put it up on the README as well. |
On current master 941f846 using the following logic (pseduo code):
Results in:
PS: I'm using SoftHSMv2
The text was updated successfully, but these errors were encountered: