add CRC16-CCITT to libosmocore

Use the implementation from Linux lib/crc-ccitt.c (GPLv2)

Change-Id: I26bb54038f5ab36bbb34da7f5fb8ae6c0c0386a4
diff --git a/include/osmocom/core/crc16.h b/include/osmocom/core/crc16.h
index 83b2e5f..f1564bd 100644
--- a/include/osmocom/core/crc16.h
+++ b/include/osmocom/core/crc16.h
@@ -29,3 +29,15 @@
 {
 	return (crc >> 8) ^ osmo_crc16_table[(crc ^ data) & 0xff];
 }
+
+
+/* CCITT polynome 0x8408. This corresponds to x^0 + x^5 + x^12 */
+
+extern uint16_t const osmo_crc16_ccitt_table[256];
+
+extern uint16_t osmo_crc16_ccitt(uint16_t crc, const uint8_t *buffer, size_t len);
+
+static inline uint16_t osmo_crc16_ccitt_byte(uint16_t crc, const uint8_t data)
+{
+	return (crc >> 8) ^ osmo_crc16_ccitt_table[(crc ^ data) & 0xff];
+}