fix crc16 prototypes
authorChristian Grothoff <christian@grothoff.org>
Thu, 5 Jan 2012 20:18:50 +0000 (20:18 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 5 Jan 2012 20:18:50 +0000 (20:18 +0000)
src/include/gnunet_crypto_lib.h
src/util/crypto_crc.c

index 0be9611baed6170f83871aa33cdd79a04148fda2..75aabe75f1b4eeb01e4b67e7d061c9988502454d 100644 (file)
@@ -238,12 +238,12 @@ GNUNET_CRYPTO_seed_weak_random (int32_t seed);
  * Perform an incremental step in a CRC16 (for TCP/IP) calculation.
  *
  * @param sum current sum, initially 0
- * @param hdr buffer to calculate CRC over (must be 16-bit aligned)
+ * @param buf buffer to calculate CRC over (must be 16-bit aligned)
  * @param len number of bytes in hdr, must be multiple of 2
  * @return updated crc sum (must be subjected to GNUNET_CRYPTO_crc16_finish to get actual crc16)
  */
 uint32_t
-GNUNET_CRYPTO_crc16_step (uint32_t sum, uint16_t * hdr, size_t len);
+GNUNET_CRYPTO_crc16_step (uint32_t sum, const void *buf, size_t len);
 
 
 /**
@@ -259,12 +259,12 @@ GNUNET_CRYPTO_crc16_finish (uint32_t sum);
 /**
  * Calculate the checksum of a buffer in one step.
  *
- * @param hdr buffer to  calculate CRC over (must be 16-bit aligned)
+ * @param buf buffer to  calculate CRC over (must be 16-bit aligned)
  * @param len number of bytes in hdr, must be multiple of 2
  * @return crc16 value
  */
 uint16_t
-GNUNET_CRYPTO_crc16_n (uint16_t *hdr, size_t len);
+GNUNET_CRYPTO_crc16_n (const void *buf, size_t len);
 
 
 /**
index c6cd83a7494d65d363045758e6c6fcb56e8e8eb8..bf8e058ad864b8ba242e19acacbcea4316464d9f 100644 (file)
@@ -118,13 +118,14 @@ GNUNET_CRYPTO_crc32_n (const void *buf, size_t len)
  * Perform an incremental step in a CRC16 (for TCP/IP) calculation.
  *
  * @param sum current sum, initially 0
- * @param hdr buffer to calculate CRC over (must be 16-bit aligned)
+ * @param buf buffer to calculate CRC over (must be 16-bit aligned)
  * @param len number of bytes in hdr, must be multiple of 2
  * @return updated crc sum (must be subjected to GNUNET_CRYPTO_crc16_finish to get actual crc16)
  */
 uint32_t
-GNUNET_CRYPTO_crc16_step (uint32_t sum, uint16_t * hdr, size_t len)
+GNUNET_CRYPTO_crc16_step (uint32_t sum, const void *buf, size_t len)
 {
+  uint16_t *hdr = buf;
   for (; len >= 2; len -= 2)
     sum += *(hdr++);
   if (len == 1)
@@ -151,13 +152,14 @@ GNUNET_CRYPTO_crc16_finish (uint32_t sum)
 /**
  * Calculate the checksum of a buffer in one step.
  *
- * @param hdr buffer to  calculate CRC over (must be 16-bit aligned)
+ * @param buf buffer to  calculate CRC over (must be 16-bit aligned)
  * @param len number of bytes in hdr, must be multiple of 2
  * @return crc16 value
  */
 uint16_t
-GNUNET_CRYPTO_crc16_n (uint16_t *hdr, size_t len)
+GNUNET_CRYPTO_crc16_n (const void *buf, size_t len)
 {
+  uint16_t *hdr = buf;
   uint32_t sum = GNUNET_CRYPTO_crc16_step (0, hdr, len);
 
   return GNUNET_CRYPTO_crc16_finish (sum);