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

lr_gpg_check_signature: Forward PGP error messages from RPM #282

Merged

Conversation

ppisar
Copy link
Contributor

@ppisar ppisar commented Sep 15, 2023

When debugging a test failure with RPM using internal OpenPGP+OpenSSL implementation (that's a bug in RPM, not in librepo), I discovered that librepo tests did not print error messages and that lr_gpg_check_signature() did not forwarded an error message from RPM.

RPM before rpm-4.19.0-alpha2 did not provided provided any error messages. That has changed with new functions pgpPrtParams2() and pgpVerifySignature2().

This patch enhances librepo code to use the new RPM functions if available and to propagate the RPM error messages via an already existing GError argument.

This patch also enhances librepo tests to actually print the unexpected error messages.

Both enhancements should help people to debug their failures.

Nonetheless, internal OpenPGP implementation in RPM does not set any error messages and that will probably not change because RPM is going to remove that implementation. On the other hand, Sequoia implementation in RPM forwards the messages from Sequoia library. Yet I was unbable to obtain any message. Sequoia promissed to improve their error messaging, especially with a demise of SHA-1. So I believe this librepo enhancement is useful.

Implementation details: I wrapped pgpPrtParams2() into a function because it's called at multiple places. Contrary I did not wrap pgpVerifySignature2() because it's called only at one place.

#281

When debugging a test failure with RPM using internal OpenPGP+OpenSSL
implementation (that's a bug in RPM, not in librepo), I discovered
that librepo tests did not print error messages and that
lr_gpg_check_signature() did not forwarded an error message from RPM.

RPM before rpm-4.19.0-alpha2 did not provided provided any error
messages. That has changed with new functions pgpPrtParams2() and
pgpVerifySignature2().

This patch enhances librepo code to use the new RPM functions if
available and to propagate the RPM error messages via an already
existing GError argument.

This patch also enhances librepo tests to actually print the
unexpected error messages.

Both enhancements should help people to debug their failures.

Nonetheless, internal OpenPGP implementation in RPM does not set any
error messages and that will probably not change because RPM is going
to remove that implementation. On the other hand, Sequoia
implementation in RPM forwards the messages from Sequoia library. Yet
I was unbable to obtain any message. Sequoia promissed to improve
their error messaging, especially with a demise of SHA-1. So I believe
this librepo enhancement is useful.

Implementation details: I wrapped pgpPrtParams2() into a function
because it's called at multiple places. Contrary I did not wrap
pgpVerifySignature2() because it's called only at one place.

rpm-software-management#281
@ppisar ppisar force-pushed the forward_rpm_pgp_error_messages branch from 4ca479f to c69793c Compare October 3, 2023 11:24
@jrohel jrohel self-assigned this Oct 4, 2023
@jrohel
Copy link
Contributor

jrohel commented Oct 4, 2023

Thank you. LGTM

@jrohel jrohel merged commit 363c7a5 into rpm-software-management:master Oct 4, 2023
6 checks passed
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

Successfully merging this pull request may close these issues.

2 participants