[gnutls-devel] GnuTLS | x509: pin/password callback support for openssl encrypted private keys (!1459)
Read-only notification of GnuTLS library development activities
gnutls-devel at lists.gnutls.org
Thu Aug 12 16:33:43 CEST 2021
Craig commented on a discussion on lib/x509/privkey.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1459#note_649760962
> password == NULL && (!(flags & GNUTLS_PKCS_PLAIN))) {
> /* use the callback if any */
> ret = _gnutls_retrieve_pin(&key->pin, "key:", "", 0, pin, sizeof(pin));
> if (ret == 0) {
If by 'error out' you mean `goto cleanup`, I don't think that is safe. That would break the fallthrough behavior to process openssl encrypted private keys if pkcs8 processing fails. However, your point about an unnecessary call to `gnutls_x509_privkey_import_pkcs8` when the pin callback fails is valid. Further, this pattern of overwriting `password` with `pin` when processing a pin is also probably wrong. If the pin obtain when processing a pkcs8 payload fails to decrypt the payload, the original password supplied will never be used in the openssl fallthrough section.
I've re-worked the pkcs8 section and the new openssl section I added to remove the unnecessary call when the pin callback fails and to also use the pin obtained directly (instead of overwriting the `password` variable).
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1459#note_649760962
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20210812/b73ae8eb/attachment.html>
More information about the Gnutls-devel
mailing list