Skip to content

Conversation

@pmatilai
Copy link
Member

@pmatilai pmatilai commented Mar 19, 2024

For bootstrapping purposes, having rpm depend on Rust is painful, but directing people to unmaintained crypto code as an alternative is hair-raising. As a middle ground, let rpm be built without OpenPGP support at all, which at least gives you a functional rpm and rpm-build even if you can't sign or verify signatures.

Achieving this is a moderately complex dance which can't meaningfully be split into multiple commits because everything is interconnected:

Add a new WITH_SEQUOIA option to control use of Sequoia, on by default. When Sequoia is disabled, default to a newly added dummy PGP implementation instead which just returns error on everything. And finally, if the older WITH_INTERNAL_OPENPGP is enabled, use the old PGP implementation.

As the intent is to cut out rpmpgp_legacy to a separate repository, sanity requires that we also split the openssl/libgcrypt code at the digest/signature fault line. It's not ideal, but the alternative of having unused crypto code on which an external component depends on is just not sustainable. This way, the signature side of things is quite neatly cut off with the PGP stuff. The diff looks big but there are no code/functional changes in the libgcrypt/openssl split.

@pmatilai pmatilai added the crypto Signatures, keys, hashes and their verification label Mar 19, 2024
@pmatilai
Copy link
Member Author

pmatilai commented Mar 19, 2024

As per the commit message, the intent is to follow-up this with a patch to split the rpmpgp_legacy directory off the rpm main repo entirely, at which point #2414 is achieved while letting others to maintain the code if they so wish.

That split is not done here because it'd make any tweaks to the first patch horribly painful.

Copy link
Collaborator

@nwalfield nwalfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

INSTALL Outdated
The source for the file utility + library is available from
ftp://ftp.astron.com/pub/file/

You will need a cryptographic library to support digests and
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps: s/cryptographic library/OpenPGP implementation/

Copy link
Member Author

@pmatilai pmatilai Mar 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gets tricky here because now those two are separated in some of the options. What a crazy tangle 😄 But yeah the language here needs some more love. I also realized the "Use of rpm-sequoia..." paragraph looks odd where it is now - I just moved it a bit earlier without other changes but that doesn't quite cut it.

It's also surprisingly hard to write meaningful docs for the internal parser part when you know it'll be shortly removed.

@pmatilai
Copy link
Member Author

pmatilai commented Mar 19, 2024

All good points, thanks for the review!

As for pgpVerifySignature[2](), I considered returning NOKEY for a softer impact, but the gotcha is that the sanity check in rpmsinfoInit() causes things to fail long before you get to call verify. So while adding a "not at home" lint will of course not hurt anything, chances are nobody actually gets to see it.

@pmatilai
Copy link
Member Author

This will also need some further tweaks to skip the relevant tests.

For bootstrapping purposes, having rpm depend on Rust is painful, but
directing people to unmaintained crypto code as an alternative is
hair-raising. As a middle ground, let rpm be built without OpenPGP
support at all, which at least gives you a functional rpm and rpm-build
even if you can't sign or verify signatures.

Achieving this is a moderately complex dance which can't meaningfully
be split into multiple commits because everything is interconnected:

Add a new WITH_SEQUOIA option to control use of Sequoia, on by default.
When Sequoia is disabled, default to a newly added dummy PGP implementation
instead which just returns error on everything. And finally, if the
older WITH_INTERNAL_OPENPGP is enabled, use the old PGP implementation.

As the intent is to cut out rpmpgp_legacy to a separate repository,
sanity requires that we also split the openssl/libgcrypt code at the
digest/signature fault line. It's not ideal, but the alternative of
having unused crypto code on which an external component depends on
is just not sustainable. This way, the signature side of things is
quite neatly cut off with the PGP stuff. The diff looks big but there
are no code/functional changes in the libgcrypt/openssl split.
@pmatilai
Copy link
Member Author

pmatilai commented Mar 19, 2024

Lints added, a couple of simple tests added, a whole lot tests skipped when dummy pgp used.
The INSTALL docs hopefully a little saner now 😆

@pmatilai
Copy link
Member Author

Okay, best to just get this out of the way...

@pmatilai pmatilai merged commit 725ca51 into rpm-software-management:master Mar 20, 2024
@pmatilai pmatilai deleted the nopgp branch March 20, 2024 10:42
@dmnks dmnks added build Build-system related RFE labels Mar 22, 2024
@mlschroe
Copy link
Collaborator

mlschroe commented Apr 3, 2024

You really should use Sequoia for digesting. It makes no sense to use openssl/libgcrypt in rpm and something else in sequoia. If it's not already exposed, can you please add expose digesting functionality in Sequoia?

@pmatilai
Copy link
Member Author

pmatilai commented Apr 3, 2024

The sole reason for this exercise is to be able to build rpm without rpm-sequoia.
rpm-sequoia doesn't support external digest, and wouldn't make much sense for it to do so.

@mlschroe
Copy link
Collaborator

mlschroe commented Apr 3, 2024

Why wouldn't it make sense? Sequoia needs to do digesting anyway to verify the signatures, it might as well expose the functionality. Securitywise it is bad design if two implementations are used.

@pmatilai
Copy link
Member Author

pmatilai commented Apr 3, 2024

Oh, I guess I wasn't clear: sure rpm-sequoia supports and exports all the digest functionality rpm needs. What I mean is that it does NOT support using libgcrypt/openssl from rpm side to do that.

libgcrypt/openssl digest support in rpm is only for the case where rpm-sequoia is not available.

@mlschroe
Copy link
Collaborator

mlschroe commented Apr 3, 2024

Ah, I missed that. Then please ignore me ;-)

@pmatilai
Copy link
Member Author

pmatilai commented Apr 3, 2024

I know the split is somewhat painful this way, but it was the least painful (or only) way I could see to accomplish this within reasonable time/effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Build-system related crypto Signatures, keys, hashes and their verification RFE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants