-
Notifications
You must be signed in to change notification settings - Fork 711
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
OpenPGP card v3.4 pkcs15-init reports not supported private key #3094
Comments
Can you run the code under valgrind to get a backtrace of the double-free? |
Do you need any special parameters for valgrind? |
No, the default memcheck should catch double free and print backtraces. |
@Jakuje here it is: |
errors reported by I think your code is en par with 0.25.0. Here, card-openpgp.c:2551 calls pgp_put_data with diff --git a/src/libopensc/card-openpgp.c b/src/libopensc/card-openpgp.c
index 0e8015053..c7b067bdf 100644
--- a/src/libopensc/card-openpgp.c
+++ b/src/libopensc/card-openpgp.c
@@ -2547,8 +2547,8 @@ pgp_update_new_algo_attr(sc_card_t *card, sc_cardctl_openpgp_keygen_info_t *key_
}
pgp_set_blob(algo_blob, data, data_len);
+ r = pgp_put_data(card, tag, data, data_len);
free(data);
- r = pgp_put_data(card, tag, algo_blob->data, data_len);
/* Note: Don't use pgp_set_blob to set data, because it won't touch the real DO */
LOG_TEST_RET(card->ctx, r, "Cannot set new algorithm attributes");
} else { However, I'm not too deep into that code to check whether there is some logical problem that should be fixed first. |
@msetina did you try with the changed code proposed by Frank? |
By the words around I did not bite, but now I tried it and there is no change from user side. It still says unsupported, but I think now it does not write certificate. |
I've reverted and I can confirm that after the mentioned change certificate is not written. Reverting I get Private key and certificate on the card. |
thanks for the feedback. I created a pull request with the fix. |
@frankmorgner I am sorry for the confusion, but the proposed change did not fix the issue. It added a problem of not writing a certificate. |
I've made a test case that prepares as private key and a certificate and tries to write it to the card. In one case it core dumped, when running in a separate process it said it has a corrupted double-linked list in another malloc_consolidate(): unaligned fastbin chunk detected. |
I would suggest that you build OpenSC and add to CPPFLAGS and LDGLAGS -g |
I would do that if I was not running in python over PyKCS11. It would be easy for me to help you if I was capable of CPP or C. |
While running:
I got:
When ran with -vvvv it reports:
pkcs11-tool reports private key, public key and cert written on the card.
opensc-tool info is:
The text was updated successfully, but these errors were encountered: