Hi Simone Zamboni,
Do you test the following function, and when you set message is not the multiple of 4 bytes, and you meet problems, is it right?
void TestCrc32(void)
{
status_t status;
size_t outLength;
unsigned int length;
unsigned char output[4];
static const uint8_t message[] = "abcdbcdecdefdefgefghfghighijhijk";
/* Expected CRC-32 for the message.
* CRC-32 params:
* width=32 poly=0x04c11db7 init=0xffffffff refin=false refout=false xorout=0x00000000
* http://reveng.sourceforge.net/crc-catalogue/
*/
static const unsigned char crc32[] = {0x7f, 0x04, 0x6a, 0xdd};
dcp_handle_t m_handle;
m_handle.channel = kDCP_Channel0;
m_handle.keySlot = kDCP_KeySlot0;
m_handle.swapConfig = kDCP_NoSwap;
length = sizeof(message) - 1;
outLength = sizeof(output);
memset(&output, 0, outLength);
/************************ CRC-32 **************************/
status = DCP_HASH(DCP, &m_handle, kDCP_Crc32, message, length, output, &outLength);
TEST_ASSERT(kStatus_Success == status);
TEST_ASSERT(outLength == 4u);
TEST_ASSERT(memcmp(output, crc32, outLength) == 0);
PRINTF("CRC-32 Test pass\r\n");
}
Have a great day,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------