fwupd/libfwupdplugin/fu-common-guid.c
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

36 lines
640 B
C

/*
* Copyright (C) 2017 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#define G_LOG_DOMAIN "FuCommon"
#include <config.h>
#include "fu-common-guid.h"
/**
* fu_common_guid_is_plausible:
* @buf: a buffer of data
*
* Checks whether a chunk of memory looks like it could be a GUID.
*
* Returns: TRUE if it looks like a GUID, FALSE if not
*
* Since: 1.2.5
**/
gboolean
fu_common_guid_is_plausible (const guint8 *buf)
{
guint guint_sum = 0;
for (guint i = 0; i < 16; i++)
guint_sum += buf[i];
if (guint_sum == 0x00)
return FALSE;
if (guint_sum < 0xff)
return FALSE;
return TRUE;
}