Data Structures | |
struct | secAes_t |
AES Security callback parameters structure. More... | |
struct | secCmacMsg_t |
CMAC Security callback parameters structure. More... | |
struct | secCcmEncMsg_t |
CCM-Mode encrypt callback parameters structure. More... | |
struct | secCcmDecMsg_t |
CCM-Mode decrypt and authenticate callback parameters structure. More... | |
union | secMsg_t |
Generic security callback parameters structure. More... | |
struct | secEccKey_t |
ECC Security public/private key pair. More... | |
struct | secEccSharedSec_t |
ECC security DH Key shared secret. More... | |
struct | secEccMsg_t |
ECC Security callback parameters structure. More... | |
Macros | |
#define | SEC_CMAC_KEY_LEN 16 |
CMAC algorithm key length. More... | |
#define | SEC_AES_BLK_LEN 16 |
CMAC algorithm key length. More... | |
#define | SEC_CMAC_HASH_LEN 16 |
CMAC algorithm result length. More... | |
#define | SEC_ECC_KEY_LEN 32 |
ECC algorithm key length. More... | |
#define | SEC_TOKEN_INVALID 0xFF |
Invalid AES Token. More... | |
Typedefs | |
typedef void(* | SecBlkEncFunc_t) (uint8_t *pKey, uint8_t *pMessage, void *pParam) |
Block encryption function. More... | |
CCM-Mode algorithm lengths | |
#define | SEC_CCM_KEY_LEN 16 |
#define | SEC_CCM_MAX_ADDITIONAL_LEN ((1<<16) - (1<<8)) |
#define | SEC_CCM_L 2 |
#define | SEC_CCM_NONCE_LEN (15-SEC_CCM_L) |
Security Initialization Functions | |
void | SecInit (void) |
Initialize the security service. This function should only be called once upon system initialization. More... | |
void | SecRandInit (void) |
Initialize the random number service. This function should only be called once upon system initialization. More... | |
void | SecAesInit (void) |
Initialize the AES service. This function should only be called once upon system initialization. More... | |
void | SecAesRevInit (void) |
Initialize the AES (reverse) service. This function should only be called once upon system initialization. More... | |
void | SecCmacInit (void) |
Called to initialize CMAC security. This function should only be called once upon system initialization. More... | |
void | SecCcmInit (void) |
Called to initialize CCM security. More... | |
void | SecEccInit (void) |
Called to initialize ECC security. This function should only be called once upon system initialization. More... | |
Security AES, CMAC and CCM Functions | |
uint8_t | SecAes (uint8_t *pKey, uint8_t *pPlaintext, wsfHandlerId_t handlerId, uint16_t param, uint8_t event) |
Execute an AES calculation. When the calculation completes, a WSF message will be sent to the specified handler. This function returns a token value that the client can use to match calls to this function with messages. More... | |
uint8_t | SecAesRev (uint8_t *pKey, uint8_t *pPlaintext, wsfHandlerId_t handlerId, uint16_t param, uint8_t event) |
Execute an AES calculation. When the calculation completes, a WSF message will be sent to the specified handler. This function returns a token value that the client can use to match calls to this function with messages. Note this version reverses the key and plaintext bytes. More... | |
bool_t | SecCmac (const uint8_t *pKey, uint8_t *pPlaintext, uint16_t textLen, wsfHandlerId_t handlerId, uint16_t param, uint8_t event) |
Execute the CMAC algorithm. More... | |
bool_t | SecCcmEnc (const uint8_t *pKey, uint8_t *pNonce, uint8_t *pPlainText, uint16_t textLen, uint8_t *pClear, uint16_t clearLen, uint8_t micLen, uint8_t *pResult, wsfHandlerId_t handlerId, uint16_t param, uint8_t event) |
Execute the CCM-Mode encryption algorithm. More... | |
bool_t | SecCcmDec (const uint8_t *pKey, uint8_t *pNonce, uint8_t *pCypherText, uint16_t textLen, uint8_t *pClear, uint16_t clearLen, uint8_t *pMic, uint8_t micLen, uint8_t *pResult, wsfHandlerId_t handlerId, uint16_t param, uint8_t event) |
Execute the CCM-Mode verify and decrypt algorithm. More... | |
Security ECC Functions | |
bool_t | SecEccGenKey (wsfHandlerId_t handlerId, uint16_t param, uint8_t event) |
Generate an ECC key. More... | |
bool_t | SecEccGenSharedSecret (secEccKey_t *pKey, wsfHandlerId_t handlerId, uint16_t param, uint8_t event) |
Generate an ECC key. More... | |
Security Random Number Generator Functions | |
void | SecRand (uint8_t *pRand, uint8_t randLen) |
This function returns up to 16 bytes of random data to a buffer provided by the client. More... | |
typedef void(* SecBlkEncFunc_t) (uint8_t *pKey, uint8_t *pMessage, void *pParam) |
uint8_t SecAes | ( | uint8_t * | pKey, |
uint8_t * | pPlaintext, | ||
wsfHandlerId_t | handlerId, | ||
uint16_t | param, | ||
uint8_t | event | ||
) |
Execute an AES calculation. When the calculation completes, a WSF message will be sent to the specified handler. This function returns a token value that the client can use to match calls to this function with messages.
pKey | Pointer to 16 byte key. |
pPlaintext | Pointer to 16 byte plaintext. |
handlerId | WSF handler ID. |
param | Client-defined parameter returned in message. |
event | Event for client's WSF handler. |
void SecAesInit | ( | void | ) |
Initialize the AES service. This function should only be called once upon system initialization.
uint8_t SecAesRev | ( | uint8_t * | pKey, |
uint8_t * | pPlaintext, | ||
wsfHandlerId_t | handlerId, | ||
uint16_t | param, | ||
uint8_t | event | ||
) |
Execute an AES calculation. When the calculation completes, a WSF message will be sent to the specified handler. This function returns a token value that the client can use to match calls to this function with messages. Note this version reverses the key and plaintext bytes.
pKey | Pointer to 16 byte key. |
pPlaintext | Pointer to 16 byte plaintext. |
handlerId | WSF handler ID. |
param | Client-defined parameter returned in message. |
event | Event for client's WSF handler. |
void SecAesRevInit | ( | void | ) |
Initialize the AES (reverse) service. This function should only be called once upon system initialization.
bool_t SecCcmDec | ( | const uint8_t * | pKey, |
uint8_t * | pNonce, | ||
uint8_t * | pCypherText, | ||
uint16_t | textLen, | ||
uint8_t * | pClear, | ||
uint16_t | clearLen, | ||
uint8_t * | pMic, | ||
uint8_t | micLen, | ||
uint8_t * | pResult, | ||
wsfHandlerId_t | handlerId, | ||
uint16_t | param, | ||
uint8_t | event | ||
) |
Execute the CCM-Mode verify and decrypt algorithm.
pKey | Pointer to encryption key (SEC_CCM_KEY_LEN bytes). |
pNonce | Pointer to nonce (SEC_CCM_NONCE_LEN bytes). |
pCypherText | Pointer to text to decrypt. |
textLen | Length of pCypherText in bytes. |
pClear | Pointer to additional, unencrypted authentication text. |
clearLen | Length of pClear in bytes. |
pMic | Pointer to authentication digest. |
micLen | Size of MIC in bytes (4, 8 or 16). |
pResult | Buffer to hold result (returned in complete event). |
handlerId | Task handler ID to receive complete event. |
param | Optional parameter passed in complete event. |
event | Event ID of complete event. |
bool_t SecCcmEnc | ( | const uint8_t * | pKey, |
uint8_t * | pNonce, | ||
uint8_t * | pPlainText, | ||
uint16_t | textLen, | ||
uint8_t * | pClear, | ||
uint16_t | clearLen, | ||
uint8_t | micLen, | ||
uint8_t * | pResult, | ||
wsfHandlerId_t | handlerId, | ||
uint16_t | param, | ||
uint8_t | event | ||
) |
Execute the CCM-Mode encryption algorithm.
pKey | Pointer to encryption key (SEC_CCM_KEY_LEN bytes). |
pNonce | Pointer to nonce (SEC_CCM_NONCE_LEN bytes). |
pPlainText | Pointer to text to encrypt. |
textLen | Length of pPlainText in bytes. |
pClear | Pointer to additional, unencrypted authentication text. |
clearLen | Length of pClear in bytes. |
micLen | Size of MIC in bytes (4, 8 or 16). |
pResult | Buffer to hold result (returned in complete event). |
handlerId | Task handler ID to receive complete event. |
param | Optional parameter passed in complete event. |
event | Event ID of complete event. |
void SecCcmInit | ( | void | ) |
Called to initialize CCM security.
bool_t SecCmac | ( | const uint8_t * | pKey, |
uint8_t * | pPlaintext, | ||
uint16_t | textLen, | ||
wsfHandlerId_t | handlerId, | ||
uint16_t | param, | ||
uint8_t | event | ||
) |
Execute the CMAC algorithm.
pKey | Key used in CMAC operation. |
pPlaintext | Plain text buffer - buffer must persist until secCmacMsg_t callback. |
textLen | Size of pPlaintext in bytes. |
handlerId | WSF handler ID for client. |
param | Optional parameter sent to client's WSF handler. |
event | Event for client's WSF handler. |
void SecCmacInit | ( | void | ) |
Called to initialize CMAC security. This function should only be called once upon system initialization.
bool_t SecEccGenKey | ( | wsfHandlerId_t | handlerId, |
uint16_t | param, | ||
uint8_t | event | ||
) |
Generate an ECC key.
handlerId | WSF handler ID for client. |
param | Optional parameter sent to client's WSF handler. |
event | Event for client's WSF handler. |
bool_t SecEccGenSharedSecret | ( | secEccKey_t * | pKey, |
wsfHandlerId_t | handlerId, | ||
uint16_t | param, | ||
uint8_t | event | ||
) |
Generate an ECC key.
pKey | ECC Key structure. |
handlerId | WSF handler ID for client. |
param | Optional parameter sent to client's WSF handler. |
event | Event for client's WSF handler. |
void SecEccInit | ( | void | ) |
Called to initialize ECC security. This function should only be called once upon system initialization.
void SecInit | ( | void | ) |
Initialize the security service. This function should only be called once upon system initialization.
void SecRand | ( | uint8_t * | pRand, |
uint8_t | randLen | ||
) |
This function returns up to 16 bytes of random data to a buffer provided by the client.
pRand | Pointer to returned random data. |
randLen | Length of random data. |
void SecRandInit | ( | void | ) |
Initialize the random number service. This function should only be called once upon system initialization.