mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-09 18:17:54 +00:00

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.
35 lines
819 B
C
35 lines
819 B
C
/*
|
|
* Copyright (C) 2017 Richard Hughes <richard@hughsie.com>
|
|
*
|
|
* SPDX-License-Identifier: LGPL-2.1+
|
|
*/
|
|
|
|
#define G_LOG_DOMAIN "FuCommonCab"
|
|
|
|
#include "config.h"
|
|
|
|
#include "fu-cabinet.h"
|
|
#include "fu-common-cab.h"
|
|
|
|
/**
|
|
* fu_common_cab_build_silo: (skip):
|
|
* @blob: A readable blob
|
|
* @size_max: The maximum size of the archive
|
|
* @error: A #FuEndianType, e.g. %G_LITTLE_ENDIAN
|
|
*
|
|
* Create an AppStream silo from a cabinet archive.
|
|
*
|
|
* Returns: a #XbSilo, or %NULL on error
|
|
*
|
|
* Since: 1.2.0
|
|
**/
|
|
XbSilo *
|
|
fu_common_cab_build_silo (GBytes *blob, guint64 size_max, GError **error)
|
|
{
|
|
g_autoptr(FuCabinet) cabinet = fu_cabinet_new ();
|
|
fu_cabinet_set_size_max (cabinet, size_max);
|
|
if (!fu_cabinet_parse (cabinet, blob, FU_CABINET_PARSE_FLAG_NONE, error))
|
|
return NULL;
|
|
return fu_cabinet_get_silo (cabinet);
|
|
}
|