Commit Graph

23 Commits

Author SHA1 Message Date
Richard Hughes
e99dd242e9 Strip inner XML text when loading metainfo.xml files
This allows us to do the right thing if given an XML file with leading
or trailing space in the entry, e.g.

    <value key=LVFS::UpdateProtocol> org.uefi.capsule </value>
2021-10-18 14:43:57 +01:00
Richard Hughes
88b1b35a72 trivial: Use new libgcab API where possible
This is new in version 1.5, but may be backported.
2021-10-05 18:15:37 +01:00
Richard Hughes
d8af914072 trivial: Remove some unused variables 2021-08-28 10:17:56 +01:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Mario Limonciello
7ae233b7cf Forcefully set checksums found in cabinet files to lowercase
Archives uploaded to LVFS will have checksums written by hexdigest
and be set to lowercase, but hand generated archives this may not
be true.

For maximum compatibility with the most fwupd versions they should
be written in lowercase, but in case they aren't, convert to lowercase.

Reference https://github.com/fwupd/firmware-lenovo-thinkpad/issues/145
2021-08-18 14:18:28 -05:00
Richard Hughes
5f7e58b395 Revert "trivial: Ignore the NUL suffix to fix loading new firmware"
This reverts commit a8d73369f7.

“No matter how far you have gone on the wrong road, turn back.”
2021-07-30 13:42:41 +01:00
Richard Hughes
a8d73369f7 trivial: Ignore the NUL suffix to fix loading new firmware
The LVFS is now adding an artificial NUL to the metainfo data to work
around a possible buffer over-read on old fwupd versions. This breaks
new code that reads the XML buffer using xb_builder_source_load_bytes
as GLib then tries to parse the final NUL byte.

As `xmllint` actually ignores the trailing NUL, we should as well.
2021-07-29 20:07:22 +01:00
Richard Hughes
ae48e02ac2 Do not assume the metainfo file is NUL-terminated
This was only true by accident. We'll need another fix for the LVFS to
add the missing NUL to restore compatibility for older clients.

Fixes https://github.com/fwupd/fwupd/issues/3533
2021-07-23 11:58:56 +01:00
Mario Limonciello
1e17457b16 Allow building the documentation with gi-docgen and gtk-doc
Until gi-docgen is declared stable support either of them.
This effectively means that hand builds and CI builds will use
gi-docgen, but distro builds use gtk-doc-tools.
2021-06-09 22:21:53 +01:00
Richard Hughes
20ef071b3c trivial: Style fixes to lots of gtk-doc 2021-05-10 14:35:10 +01:00
Richard Hughes
89d45a0d91 trivial: Standardize on introspection for @error and @cancellable
Also standarize on `Returns:` for the result.
2021-04-28 16:19:50 +01:00
Richard Hughes
495302ca06 Support binary artifact resources in cabinet archives
Fixes the other half of https://github.com/fwupd/fwupd/issues/3193
2021-04-28 15:52:26 +01:00
Richard Hughes
c6bb21356f Support all hash types when loading cabinet archives
Fixes half of https://github.com/fwupd/fwupd/issues/3193
2021-04-27 15:41:44 +01:00
Richard Hughes
e65d28d817 Add a utility to resign firmware files
This can be used like this:

    fwupdtool firmware-sign firmware.cab rhughes_signed.pem rhughes.key

Test signing certificates can be generated using the example script here:
https://github.com/hughsie/libjcat/blob/master/contrib/build-certs.py although
these certificates should not be used for enterprise use.
2021-04-19 12:59:35 +01:00
Richard Hughes
5c9b1fcc81 Only include the start year in the copyright header
The end year is legally and functionally redundant, and more importantly causes
cherry-pick conflicts when trying to maintain old branches. Use git for history.
2021-01-07 14:48:16 +00:00
Richard Hughes
698099f643 trivial: Remove several unused variables 2020-12-08 20:06:46 +00:00
Richard Hughes
4cbe99c607 Restrict loading component types of firmware
This would allow us to add other component types in the future, for instance a
'generic' type that adds information to the composite device.

Any generic components would need to have a requirement of 1.5.2 to avoid
showing a runtime warning when trying to get the local file details.
2020-11-29 07:06:29 +00:00
Richard Hughes
33dcfb7219 trivial: Remove over-eager debugging output 2020-09-28 16:43:12 +01:00
Richard Hughes
c46aa815ea trivial: Do not show the libxmlb debugging by default 2020-09-28 16:43:12 +01:00
Richard Hughes
664b8aa9ad Add XB_QUERY_FLAG_FORCE_NODE_CACHE
Newer versions of libxmlb do not auto-cache XbNodes, and we have to opt-into
this beahviour for the _set_data() and _get_data() to work.

Although this is a behaviour change which also increases complexity, it lowers
our RSS usage by 200kB which is about a quarter of the total RSS used...
2020-06-23 16:30:38 +01:00
Richard Hughes
d5aab65f30 Use Jcat files in firmware archives and for metadata
A Jcat file can be used to store GPG, PKCS-7 and SHA-256 checksums for multiple
files. This allows us to sign a firmware or metadata multiple times (perhaps
by the OEM and also then the LVFS) which further decentralizes the trust model
of the LVFS.

The Jcat format was chosen as the Microsoft catalog format is nonfree and not
documented. We also don't want to modify an existing .cat file created from WU
as this may make it unsuitable to use on Windows.

More information can be found here: https://github.com/hughsie/libjcat
2020-03-23 19:55:12 +00:00
Mario Limonciello
96117d19df trivial: 1.3.9->1.4.0
We decided to branch at 1.3.8 and backport fix only things for 1_3_X.
So bump all the new stuff to 1.4.0 (which will be next release)
2020-02-28 10:17:56 -06:00
Richard Hughes
c6eb416fd5 Create FuCabinet and untangle a lot of legacy code
Replace fu_common_cab_build_silo() with an actual GObject that can hold parsing
state. This cleans up the code a lot, and means we can add additional
functionality in the future without breaking ABI or API.

The long term plan is to verify the metadata and payload signatures when
parsing FuCabinet, rather than much later in _check_requirements().
This of course requires passing in a keyring context (which we don't yet have)
and would mean we can stop setting the various confusing 'fwupd::ReleaseBlob'
XbNode extra data.

No logic changes for now, just a lot of moving things into sane places.
2020-02-27 18:06:26 +00:00