Hello,
I am looking for some code that will show how to use the i.MX6 Data Co Processor to calculate a SHA256.
I tried the following:
CCM->CCGR0|= CCM_CCGR0_CG5(3); // turn on GPIO4
L1C_CleanInvalidateDataCacheRange((void*)data, len);
L1C_CleanInvalidateDataCacheRange((void*)hash, 256/8);
memset(&dcp1, 0, sizeof(dcp1));
// set up control packet
dcp1.next = 0; // single packet in chain
dcp1.ctrl0.HASH_INIT = 1; // initialize hash with this block
dcp1.ctrl0.HASH_TERM = 1; // terminate hash with this block
dcp1.ctrl0.ENABLE_HASH = 1; // enable hash
dcp1.ctrl0.DECR_SEMAPHORE = 1; // decrement semaphore
dcp1.ctrl1.HASH_SELECT= 2; // sha256.
dcp1.src = data; // source buffer
dcp1.buf_size = len; // 512 bytes
dcp1.payload = hash; // holds expected hash value
// Enable channel 0
DCP->CHANNELCTRL= 0x101; // enable channel 0
DCP->CH0CMDPTR= (u32)&dcp1;
DCP->CH0SEMA= 1;
mydcpcp= DCP;
// now wait for interrupt or poll
while ( (DCP->CH0SEMA & 0xff0000) != 0x00 );
But, Althrough it does calculate something, it does not seem to match other sha256 calcuators.
Anything that I am imssing?
cyrille