Freescale Semiconductor SEC2SWUG Network Card User Manual


 
SEC 2.0 Reference Device Driver User’s Guide, Rev. 0
36 PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Freescale Semiconductor
Sample Code
unsigned long ivBytes;
unsigned char *ivData;
unsigned long HeaderBytes;
unsigned long inBytes;
unsigned char *inData;
unsigned long ROCBytes;
unsigned long cryptDataBytes;
unsigned char *cryptDataOut;
unsigned long digestBytes;
unsigned char *digestData;
unsigned long outIvBytes;
unsigned char *outIvData;
NUM_SRTP_DESC defines the number of descriptors within the DPD_SRTP_GROUP that use this request.
DPD_SRTP_GROUP (0x8500) defines the group for all descriptors within this request.
5 Sample Code
The following sections provide sample codes for DES and IPSec.
5.1 DES Sample
/* define the User Structure */
DES_LOADCTX_CRYPT_REQ desencReq;
...
/* fill the User Request structure with appropriate pointers */
desencReq.opId = DPD_TDES_CBC_ENCRYPT_SA_LDCTX_CRYPT ;
desencReq.channel = 0; /* dynamic channel */
desencReq.notify = (void*) notifyDes; /* callback function */
desencReq.notify_on_error = (void*) notifyDes; /* callback in case of
errors only */
Table 30. SRTP_REQ Valid Descriptors (opId)
Descriptors Value Function Description
DPD_SRTP_OUTBOUND 0x8500 Process an outbound SRTP packet
DPD_SRTP_INBOUND 0x8501 Process an inbound SRTP packet