SEC 2.0 Reference Device Driver User’s Guide, Rev. 0
38
PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE
Freescale Semiconductor
Sample Code
ipsecReq.hashKeyBytes = 16; /* key length for HMAC SHA-1 */
ipsecReq.hashKeyData = authKey; /* pointer to HMAC Key */
ipsecReq.cryptCtxInBytes = 8; /* length of input iv */
ipsecReq.cryptCtxInData = in_iv; /* pointer to input iv */
ipsecReq.cryptKeyBytes = 24; /* DES key length */
ipsecReq.cryptKeyData = EncKey; /* pointer to DES key */
ipsecReq.hashInDataBytes = 8; /* length of data to be hashed only */
ipsecReq.hashInData = PlainText; /* pointer to data to be
hashed only */
ipsecReq.inDataBytes = packet_length-8; /* length of data to be
hashed and encrypted */
ipsecReq.inData = &PlainText[8]; /* pointer to data to be
hashed and encrypted */
ipsecReq.cryptDataOut = Result; /* pointer to encrypted results */
ipsecReq.hashDataOutBytes = 20; /* length of output digest */
ipsecReq.hashDataOut = digest; /* pointer to output digest */
ipsecReq.nextReq = 0; /* no chained requests */
/* call the driver */
status = Ioctl(device, IOCTL_PROC_REQ, &ipsecReq);
/* First Level Error Checking */
if (status != 0) {
...
}
...
void notifyFunc (void)
{
/* Second Level Error Checking */
if (ipsecReq.status != 0) {
...
}
..)