Other Parts Discussed in Thread: TIMAC
Hi,
I would like to use the encryption feature () in the TIMAC for my application but I encounter some issue.
Using the MSA example, I manage to make the output data encrypted and this encrypted data can be communicated with other device with FEATURE_MAC_SECURITY enabled.
So I proceed to implement encryption for command frame type (Association Request & Association Response).
However, when these frame are encrypted, the other device seems unable to receive.
When I run in debug mode and put a breakpoint in MAC_MLME_ASSOCIATE_IND, it doesn't get there although from sniffer I saw that the other devices had sent an encrypted CMD type frame.
Anyone can guide me on how to implement encryption on Association Request frame and Association Response frame so that only devices with the encryption key able to join the network.
What currently I have done are added the new entries for CMD type frame to keyUsageDescriptor_t and securityLevelDescriptor_t as follow:
const keyUsageDescriptor_t app_keyUsageList[] = {
{MAC_FRAME_TYPE_COMMAND, MAC_ASSOC_REQ_FRAME},
{MAC_FRAME_TYPE_COMMAND, MAC_ASSOC_RSP_FRAME},
{MAC_FRAME_TYPE_DATA, MAC_DATA_REQ_FRAME}
};
const securityLevelDescriptor_t app_securityLevelTable[] = {
{MAC_FRAME_TYPE_COMMAND, MAC_ASSOC_REQ_FRAME, MAC_SEC_LEVEL_NONE, FALSE},
{MAC_FRAME_TYPE_COMMAND, MAC_ASSOC_RSP_FRAME, MAC_SEC_LEVEL_NONE, FALSE},
{MAC_FRAME_TYPE_DATA, MAC_DATA_REQ_FRAME, MAC_SEC_LEVEL_NONE, FALSE}
};
change the value KEY_USAGE_TABLE_ENTRIES and SECURITY_LEVEL_ENTRIES to 3;
and add the security parameters to the Association Request Package and Association Response Package:
osal_memcpy(AssociateRspPkg.sec.keySource, keySource, MAC_KEY_SOURCE_MAX_LEN);
AssociateRspPkg.sec.securityLevel = securityLevel;
AssociateRspPkg.sec.keyIdMode = keyIdMode;
AssociateRspPkg.sec.keyIndex = keyIndex;
osal_memcpy(AssociateReqPkg.sec.keySource, keySource, MAC_KEY_SOURCE_MAX_LEN);
AssociateReqPkg.sec.securityLevel = securityLevel;
AssociateReqPkg.sec.keyIdMode = keyIdMode;
AssociateReqPkg.sec.keyIndex = keyIndex;
Any help/guide would be much appreciate.
Thank you.
regards,
Jackson