rpm/sign
Panu Matilainen a79d7ae0f0 Fix IMA signature lengths assumed constant (#1833, RhBug:2018937)
At least ECDSA and RSA signatures can vary in length, but the IMA code
assumes constant lengths and thus may either place invalid signatures on
disk from either truncating or overshooting, and segfault if the stars are
just so.

Luckily the signatures are stored as strings so we can calculate the
actual lengths at runtime and ignore the stored constant length info.
Extend hex2bin() to optionally calculate the lengths and maximum,
and use these for returning IMA data from the rpmfi(les) API.

Additionally update the signing code to store the largest IMA signature
length rather than what happened to be last to be on the safe side.
We can't rely on this value due to invalid packages being out there,
but then we need to calculate the lengths on rpmfiles populate so there's
not a lot to gain anyhow.

Fixes: #1833
2021-12-13 10:38:36 +02:00
..
Makefile.am Add basic autoconf and framework for fsverity support 2020-09-04 13:22:38 +03:00
rpmgensig.c rpmsign: support EdDSA signatures 2021-03-15 13:58:54 +02:00
rpmsign.h Add --delfilesign flag to delete IMA and fsverity file signatures 2020-09-04 13:22:38 +03:00
rpmsignfiles.c Fix IMA signature lengths assumed constant (#1833, RhBug:2018937) 2021-12-13 10:38:36 +02:00
rpmsignfiles.h Place file signatures into the signature header where they belong 2017-10-10 12:18:36 +03:00
rpmsignverity.c rpmsign: Add argument to specify algorithm for fsverity signatures 2020-09-04 13:22:38 +03:00
rpmsignverity.h rpmsign: Add argument to specify algorithm for fsverity signatures 2020-09-04 13:22:38 +03:00