I'm developing in CodeWarrior 6.4, using mcf548x_sec.h, on a board based on the MCF5485EVB.
First off is there an application note or some sample code that would illustrate how to use the SEC to calculate an MD5 check sum on a file?
Right now I'm using a software algorithm to calculate an MD5 check sum on some files. But I'd really like to use the Security Encryption Controller (SEC) to do the job.
I've statically assigned crypto channels 0 and 1 to the MDEU. I think I have initialized the SEC correctly with this init function. For my sanity and yours I've added the section numbers form the MCF5485 Reference manual Rev.4 into the comments.
/* set the Interrupt mask in the SIMRH 22.214.171.124*/
MCF_SEC_SIMRH = (0); /* don't mask any errors for now */
/* Software Reset the MDEU 22.10.2*/
MCF_SEC_MDRCR |= MCF_SEC_MDRCR_SR;
/* Static assign channels 0 and 1 to the MDEU 22.6.1*/
MCF_SEC_EUACRH |= (0
| MCF_SEC_EUACRH_MDEU_CHA1 );
/* Set up crypto channel 0. 22.7.1
* Burst size 2 //j increase size later
* Write back enabled
* Fetch next descriptor
* Not setting MCF_SEC_CCCRn_NT will send the notification at the end last descriptor
* Channel done interrupt enabled
* reset the crypto channel
MCF_SEC_CCCR0 |= (0
I built a Descriptor structure based on figure 22-40 in the manual
/* SEC Data packet Discriptor */
typedef struct SECdataPacketDiscriptorTag
vuint32 Header; //4
vuint32 LEN_1; //8
vuint32 PTR_1; //12
vuint32 LEN_2; //16
vuint32 PTR_2; //20
vuint32 LEN_3; //24
vuint32 PTR_3; //28
vuint32 LEN_4; //32
vuint32 PTR_4; //36
vuint32 LEN_5; //40
vuint32 PTR_5; //44
vuint32 LEN_6; //48
vuint32 PTR_6; //52
vuint32 LEN_7; //56
vuint32 PTR_7; //60
vuint32 PTR_Next; //64
I can load the descriptor with the Statically Assigned MDEU specific stuff from 126.96.36.199 for the first, middle and last descriptor.
But I have no Idea how to get this thing going. It looks like I have to chain the descriptors so I think I need to grab the start address and the size of my file. Build the first descriptor, run through a for loop (file size /512 bit times???) to build the middle descriptors then build the last descriptor all in RAM. Then feed the address of the first descriptor to???? No idea, I'm lost here.
Sure could use a push in the right direction. Or help getting back on track
Any advice would be greatly appreciated.