mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-09-10 13:00:08 +00:00
goodixmoc: Fix handling of CRC32 in big endian archs
This commit is contained in:
@@ -177,7 +177,7 @@ fp_cmd_receive_cb (FpiUsbTransfer *transfer,
|
|||||||
gx_proto_crc32_calc (transfer->buffer, PACKAGE_HEADER_SIZE + header.len, (uint8_t *) &crc32_calc);
|
gx_proto_crc32_calc (transfer->buffer, PACKAGE_HEADER_SIZE + header.len, (uint8_t *) &crc32_calc);
|
||||||
|
|
||||||
if (!fpi_byte_reader_get_uint32_le (&reader, &crc32) ||
|
if (!fpi_byte_reader_get_uint32_le (&reader, &crc32) ||
|
||||||
crc32_calc != crc32)
|
GUINT32_FROM_LE (crc32_calc) != crc32)
|
||||||
{
|
{
|
||||||
fpi_ssm_mark_failed (transfer->ssm,
|
fpi_ssm_mark_failed (transfer->ssm,
|
||||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||||
@@ -1618,7 +1618,7 @@ gx_fp_template_delete (FpDevice *device)
|
|||||||
gsize user_id_len = 0;
|
gsize user_id_len = 0;
|
||||||
const guint8 *tid;
|
const guint8 *tid;
|
||||||
gsize tid_len = 0;
|
gsize tid_len = 0;
|
||||||
gsize payload_len = 0;
|
guint16 payload_len = 0;
|
||||||
g_autofree guint8 *payload = NULL;
|
g_autofree guint8 *payload = NULL;
|
||||||
|
|
||||||
fpi_device_get_delete_data (device, &print);
|
fpi_device_get_delete_data (device, &print);
|
||||||
@@ -1631,7 +1631,8 @@ gx_fp_template_delete (FpDevice *device)
|
|||||||
fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID));
|
fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!encode_finger_id (tid, tid_len, user_id, user_id_len, &payload, (guint16 *) &payload_len))
|
|
||||||
|
if (!encode_finger_id (tid, tid_len, user_id, user_id_len, &payload, &payload_len))
|
||||||
{
|
{
|
||||||
fpi_device_delete_complete (device,
|
fpi_device_delete_complete (device,
|
||||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||||
|
|||||||
@@ -493,8 +493,6 @@ static uint8_t sensor_config[26] = {
|
|||||||
int
|
int
|
||||||
gx_proto_init_sensor_config (pgxfp_sensor_cfg_t pconfig)
|
gx_proto_init_sensor_config (pgxfp_sensor_cfg_t pconfig)
|
||||||
{
|
{
|
||||||
uint32_t crc32_calc = 0;
|
|
||||||
|
|
||||||
if (!pconfig)
|
if (!pconfig)
|
||||||
return -1;
|
return -1;
|
||||||
memset (pconfig, 0, sizeof (*pconfig));
|
memset (pconfig, 0, sizeof (*pconfig));
|
||||||
@@ -503,9 +501,7 @@ gx_proto_init_sensor_config (pgxfp_sensor_cfg_t pconfig)
|
|||||||
memcpy (&pconfig->config, sensor_config, G_N_ELEMENTS (sensor_config));
|
memcpy (&pconfig->config, sensor_config, G_N_ELEMENTS (sensor_config));
|
||||||
pconfig->reserved[0] = 1;
|
pconfig->reserved[0] = 1;
|
||||||
|
|
||||||
gx_proto_crc32_calc ((uint8_t *) pconfig, sizeof (*pconfig) - PACKAGE_CRC_SIZE, (uint8_t *) &crc32_calc);
|
gx_proto_crc32_calc ((uint8_t *) pconfig, sizeof (*pconfig) - PACKAGE_CRC_SIZE, pconfig->crc_value);
|
||||||
|
|
||||||
memcpy (pconfig->crc_value, &crc32_calc, PACKAGE_CRC_SIZE);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -136,7 +136,7 @@ drivers_info = {
|
|||||||
'upektc': {},
|
'upektc': {},
|
||||||
'upeksonly': {},
|
'upeksonly': {},
|
||||||
'upekts': {},
|
'upekts': {},
|
||||||
'goodixmoc': { 'endian_dependent': true },
|
'goodixmoc': {},
|
||||||
'nb1010': {},
|
'nb1010': {},
|
||||||
'fpcmoc': {},
|
'fpcmoc': {},
|
||||||
'realtek': {},
|
'realtek': {},
|
||||||
|
|||||||
Reference in New Issue
Block a user