diff --git a/lib_cxng/include/lcx_crc.h b/lib_cxng/include/lcx_crc.h index 98fb545f..b68d5a68 100644 --- a/lib_cxng/include/lcx_crc.h +++ b/lib_cxng/include/lcx_crc.h @@ -60,6 +60,35 @@ uint16_t cx_crc16(const void *buffer, size_t len); */ uint16_t cx_crc16_update(uint16_t crc, const void *buffer, size_t len); +/** CRC32 initial value */ +#define CX_CRC32_INIT 0xFFFFFFFF + +/** + * @brief Computes a 32-bit checksum value. + * + * @details The 32-bit value is computed according to the CRC32 CCITT definition. + * + * @param[in] buffer The buffer to compute the CRC over. + * + * @param[in] len Bytes length of the buffer. + * + * @return Current CRC value. + */ +uint32_t cx_crc32(const void *buf, size_t len); + +/** + * @brief Accumulates more data to CRC. + * + * @param[in] crc CRC value to be updated. + * + * @param[in] buffer The buffer to compute the CRC over. + * + * @param[in] len Bytes length of the buffer. + * + * @return Updated CRC value. + */ +uint32_t cx_crc32_update(uint32_t crc_state, const void *buf, size_t len); + #endif // HAVE_CRC #endif // LCX_CRC_H diff --git a/lib_cxng/src/cx_crc.h b/lib_cxng/src/cx_crc.h index 0698874c..bc7a811f 100644 --- a/lib_cxng/src/cx_crc.h +++ b/lib_cxng/src/cx_crc.h @@ -21,10 +21,7 @@ #ifdef HAVE_CRC -#include -#include - -uint32_t cx_crc32(const void *buf, size_t len); +#include "lcx_crc.h" #endif // HAVE_CRC diff --git a/lib_stusb_impl/u2f_impl.c b/lib_stusb_impl/u2f_impl.c index a77b15f8..70a2db18 100644 --- a/lib_stusb_impl/u2f_impl.c +++ b/lib_stusb_impl/u2f_impl.c @@ -332,7 +332,7 @@ void u2f_handle_cmd_msg(u2f_service_t *service, uint8_t *buffer, uint16_t length uint8_t p2 = buffer[OFFSET_P2]; #endif // U2F_PROXY_MAGIC - uint32_t dataLength = u2f_get_cmd_msg_data_length(buffer, length); + int dataLength = u2f_get_cmd_msg_data_length(buffer, length); if (dataLength < 0) { // invalid size u2f_message_reply(