diff --git a/src/checksum.c b/src/checksum.c index 76f184e..b271d04 100644 --- a/src/checksum.c +++ b/src/checksum.c @@ -161,7 +161,7 @@ checksum_crc16r_ccitt (const unsigned char data[], unsigned int size, unsigned s unsigned int -checksum_crc32 (const unsigned char data[], unsigned int size) +checksum_crc32r (const unsigned char data[], unsigned int size) { static const unsigned int crc_table[] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, @@ -206,7 +206,7 @@ checksum_crc32 (const unsigned char data[], unsigned int size) } unsigned int -checksum_crc32b (const unsigned char data[], unsigned int size) +checksum_crc32 (const unsigned char data[], unsigned int size) { static const unsigned int crc_table[] = { 0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005, diff --git a/src/checksum.h b/src/checksum.h index c88db86..5c91d0a 100644 --- a/src/checksum.h +++ b/src/checksum.h @@ -45,10 +45,10 @@ unsigned short checksum_crc16r_ccitt (const unsigned char data[], unsigned int size, unsigned short init, unsigned short xorout); unsigned int -checksum_crc32 (const unsigned char data[], unsigned int size); +checksum_crc32r (const unsigned char data[], unsigned int size); unsigned int -checksum_crc32b (const unsigned char data[], unsigned int size); +checksum_crc32 (const unsigned char data[], unsigned int size); #ifdef __cplusplus } diff --git a/src/liquivision_lynx.c b/src/liquivision_lynx.c index e7ad5a4..b755955 100644 --- a/src/liquivision_lynx.c +++ b/src/liquivision_lynx.c @@ -528,7 +528,7 @@ liquivision_lynx_device_foreach (dc_device_t *abstract, dc_dive_callback_t callb memcpy (header + 0, device->info + 2, 4); memcpy (header + 4, logbook + offset + 4, headersize - 4); unsigned int crc = array_uint32_le (logbook + offset + 0); - unsigned int ccrc = checksum_crc32b (header, headersize - unused); + unsigned int ccrc = checksum_crc32 (header, headersize - unused); if (crc != ccrc) { WARNING (abstract->context, "Invalid dive checksum (%08x %08x)", crc, ccrc); status = DC_STATUS_DATAFORMAT; diff --git a/src/suunto_eonsteel.c b/src/suunto_eonsteel.c index 6ffc7bc..c82db4d 100644 --- a/src/suunto_eonsteel.c +++ b/src/suunto_eonsteel.c @@ -352,7 +352,7 @@ suunto_eonsteel_receive_ble(suunto_eonsteel_device_t *device, unsigned char data unsigned int nbytes = transferred - CRC_SIZE; unsigned int crc = array_uint32_le(buffer + nbytes); - unsigned int ccrc = checksum_crc32(buffer, nbytes); + unsigned int ccrc = checksum_crc32r(buffer, nbytes); if (crc != ccrc) { ERROR(device->base.context, "Invalid checksum (expected %08x, received %08x).", ccrc, crc); return DC_STATUS_PROTOCOL; @@ -411,7 +411,7 @@ suunto_eonsteel_send(suunto_eonsteel_device_t *device, } // 4 byte LE checksum - unsigned int crc = checksum_crc32(buf + 2, size + HEADER_SIZE); + unsigned int crc = checksum_crc32r(buf + 2, size + HEADER_SIZE); put_le32(crc, buf + 14 + size); if (dc_iostream_get_transport(device->iostream) == DC_TRANSPORT_BLE) {