Security routines implementation.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "sysConfig.h"
#include "sysEncrypt.h"
#include "nwk.h"
#include "nwkTx.h"
#include "nwkFrame.h"
#include "nwkSecurity.h"
Enumerations | |
enum | { NWK_SECURITY_STATE_ENCRYPT_PENDING = 0x30, NWK_SECURITY_STATE_DECRYPT_PENDING = 0x31, NWK_SECURITY_STATE_PROCESS = 0x32, NWK_SECURITY_STATE_WAIT = 0x33, NWK_SECURITY_STATE_CONFIRM = 0x34 } |
Functions | |
void | NWK_SetSecurityKey (uint8_t *key) |
void | nwkSecurityInit (void) |
Initializes the Security module. More... | |
void | nwkSecurityProcess (NwkFrame_t *frame, bool encrypt) |
static bool | nwkSecurityProcessMic (void) |
static void | nwkSecurityStart (void) |
void | nwkSecurityTaskHandler (void) |
Security Module task handler. More... | |
void | SYS_EncryptConf (void) |
Variables | |
static NwkFrame_t * | nwkSecurityActiveFrame |
static uint8_t | nwkSecurityActiveFrames |
static bool | nwkSecurityEncrypt |
static uint8_t | nwkSecurityOffset |
static uint8_t | nwkSecuritySize |
static uint32_t | nwkSecurityVector [4] |
anonymous enum |
void NWK_SetSecurityKey | ( | uint8_t * | key | ) |
References NwkIb_t::key, NWK_SECURITY_KEY_SIZE, and nwkIb.
Referenced by appInit().
void nwkSecurityInit | ( | void | ) |
void nwkSecurityProcess | ( | NwkFrame_t * | frame, |
bool | encrypt | ||
) |
References NWK_SECURITY_STATE_DECRYPT_PENDING, NWK_SECURITY_STATE_ENCRYPT_PENDING, nwkSecurityActiveFrames, and NwkFrame_t::state.
Referenced by nwkRxTaskHandler(), and nwkTxTaskHandler().
|
static |
References NWK_SECURITY_MIC_SIZE, nwkSecurityEncrypt, nwkSecurityOffset, nwkSecurityVector, NwkFrame_t::payload, and NwkFrame_t::size.
Referenced by nwkSecurityTaskHandler().
|
static |
References NwkFrame_t::header, if(), NwkFrameHeader_t::macDstPanId, NWK_SECURITY_MIC_SIZE, NWK_SECURITY_STATE_DECRYPT_PENDING, NWK_SECURITY_STATE_ENCRYPT_PENDING, NWK_SECURITY_STATE_PROCESS, NwkFrameHeader_t::nwkDstAddr, NwkFrameHeader_t::nwkDstEndpoint, NwkFrameHeader_t::nwkFcf, nwkFramePayloadSize(), nwkSecurityEncrypt, nwkSecurityOffset, nwkSecuritySize, nwkSecurityVector, NwkFrameHeader_t::nwkSeq, NwkFrameHeader_t::nwkSrcAddr, NwkFrameHeader_t::nwkSrcEndpoint, NwkFrame_t::size, and NwkFrame_t::state.
Referenced by nwkSecurityTaskHandler().
void nwkSecurityTaskHandler | ( | void | ) |
Security Module task handler.
References NwkIb_t::key, NWK_SECURITY_STATE_CONFIRM, NWK_SECURITY_STATE_DECRYPT_PENDING, NWK_SECURITY_STATE_ENCRYPT_PENDING, NWK_SECURITY_STATE_PROCESS, NWK_SECURITY_STATE_WAIT, nwkFrameNext(), nwkIb, nwkRxDecryptConf(), nwkSecurityActiveFrames, nwkSecurityEncrypt, nwkSecurityProcessMic(), nwkSecurityStart(), nwkSecurityVector, nwkTxEncryptConf(), NwkFrame_t::state, and SYS_EncryptReq().
Referenced by NWK_TaskHandler().
|
static |
|
static |
Referenced by nwkSecurityInit(), nwkSecurityProcess(), and nwkSecurityTaskHandler().
|
static |
Referenced by nwkSecurityProcessMic(), nwkSecurityStart(), nwkSecurityTaskHandler(), and SYS_EncryptConf().
|
static |
Referenced by nwkSecurityProcessMic(), nwkSecurityStart(), and SYS_EncryptConf().
|
static |
Referenced by nwkSecurityStart(), and SYS_EncryptConf().
|
static |
Referenced by nwkSecurityProcessMic(), nwkSecurityStart(), nwkSecurityTaskHandler(), and SYS_EncryptConf().