Add a CRC module to mbedtls and baremetal config
Add a new CRC module along with some tests for it.
The table and the CRC function body is generated using pycrc v0.9.2.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
diff --git a/tests/suites/test_suite_crc.function b/tests/suites/test_suite_crc.function
new file mode 100644
index 0000000..8d09958
--- /dev/null
+++ b/tests/suites/test_suite_crc.function
@@ -0,0 +1,26 @@
+/* BEGIN_HEADER */
+#include "mbedtls/crc.h"
+/* END_HEADER */
+
+/* BEGIN_DEPENDENCIES
+ * depends_on:MBEDTLS_CRC_C
+ * END_DEPENDENCIES
+ */
+
+/* BEGIN_CASE */
+void compute_crc( data_t *input, unsigned int crc )
+{
+ uint16_t result = mbedtls_crc_update( 0, input->x, input->len );
+ uint32_t len = input->len;
+ TEST_ASSERT( crc == result );
+
+ result = 0;
+ while( len > 0 )
+ {
+ uint8_t cur_len = ( len > 8 ? 8 : len );
+ result = mbedtls_crc_update( result, &input->x[ input->len - len ], cur_len );
+ len -= cur_len;
+ }
+ TEST_ASSERT( crc == result );
+}
+/* END_CASE */