From b24866225a6301d3a663f874725e83c012dc25d3 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Wed, 26 Dec 2012 17:36:00 +0100 Subject: digital/beacon: add bitcloud stack into common directory digital/zigbit --- .../include/private/sspSfpHandler.h | 134 +++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 digital/zigbit/bitcloud/stack/Components/Security/ServiceProvider/include/private/sspSfpHandler.h (limited to 'digital/zigbit/bitcloud/stack/Components/Security/ServiceProvider/include/private/sspSfpHandler.h') diff --git a/digital/zigbit/bitcloud/stack/Components/Security/ServiceProvider/include/private/sspSfpHandler.h b/digital/zigbit/bitcloud/stack/Components/Security/ServiceProvider/include/private/sspSfpHandler.h new file mode 100644 index 00000000..3cc50904 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/Security/ServiceProvider/include/private/sspSfpHandler.h @@ -0,0 +1,134 @@ +/**************************************************************************//** + \file sspSfpHandler.h + + \brief SFP routine header file. + + \author + Atmel Corporation: http://www.atmel.com \n + Support email: avr@atmel.com + + Copyright (c) 2008-2011, Atmel Corporation. All rights reserved. + Licensed under Atmel's Limited License Agreement (BitCloudTM). + + \internal + History: + 2006 - VGribanovsky created. + 29/11/2007 - ALuzhetsky API corrected. +******************************************************************************/ + +#ifndef _SSPSFPHANDLER_H +#define _SSPSFPHANDLER_H + +/****************************************************************************** + Includes section. +******************************************************************************/ +#include +#include +#include +#include +#include + +/****************************************************************************** + Types definition section. +******************************************************************************/ +/**************************************************************************//** + \brief TBD +******************************************************************************/ +typedef enum +{ + SFP_STATE_IDLE, + SFP_STATE_ENCRYPTION_KEY_TRANSFORMING, + SFP_STATE_ENCRYPTION_AUTHENTIC, + SFP_STATE_ENCRYPTION_ENCRYPT, + SFP_STATE_DECRYPTION_KEY_TRANSFORMING, + SFP_STATE_DECRYPTION_AUTHENTIC, + SFP_STATE_DECRYPTION_ENCRYPT, + SFP_STATE_DECRYPTION_MIC_CHECK +} SspSfpHandlerState_t; + +/**************************************************************************//** + \brief TBD +******************************************************************************/ +typedef struct +{ + SspSfpHandlerState_t sfpState; + uint8_t nonce[CCM_NONCE_SIZE]; + uint8_t transformedKey[SECURITY_KEY_SIZE]; + uint8_t mic[CCM_MIC_MAX_SIZE]; + uint8_t auxiliaryHeaderLength; + union + { + CcmReq_t ccmReq; +#ifdef _LINK_SECURITY_ + SspKeyedHashMacReq_t hashMacReq; +#endif // _LINK_SECURITY_ + }; + BEGIN_PACK + struct PACK + { + volatile uint8_t keyExpander[16]; + uint8_t text; + volatile uint8_t bitsExpander[16]; + }; // For hash function + END_PACK +} SspSfpHandlerMem_t; + +/**************************************************************************//** + \brief Security Control field format. +******************************************************************************/ +BEGIN_PACK +typedef struct PACK +{ + LITTLE_ENDIAN_OCTET(4,( + uint8_t securityLevel : 3, + uint8_t keyIdentifier : 2, + uint8_t extendedNonce : 1, + uint8_t reserved : 2 + )) +} SecurityCtrlField_t; +END_PACK + +/****************************************************************************** + Prototypes section. +******************************************************************************/ +/****************************************************************************** + Encrypts frame. Encoding is based on incoming param which are extracted from + SSP_EncryptFrameReq param. + Parameters: + none. + Return: + none. +******************************************************************************/ +void sspEncryptFrameReqHandler(void); + +/****************************************************************************** + Decrypts frame. Decrypting is based on incoming param which are extracted from + SSP_DecryptFrameReq param. + Parameters: + none. + Return: + none. +******************************************************************************/ +void sspDecryptFrameReqHandler(void); + +/****************************************************************************** + Parses auxiliary frame header. + Parameters: + param - contains pointer to the frame and parameters to be initialized. + Return: + Auxiliary header length. +******************************************************************************/ +uint8_t sspParseAuxiliaryHeaderHandler(SSP_ParseAuxiliaryHeader_t *param); + +/****************************************************************************** + Security Frame Processor Handler's task. + Parameters: + none + Return: + none. +******************************************************************************/ +void sspSfpTaskHandler(void); + +#endif //_SSPSFPHANDLER_H + +// eof sspSfpHandler.h -- cgit v1.2.3