Path: blob/main/sys/contrib/ncsw/Peripherals/FM/MACSEC/fm_macsec_secy.h
48420 views
/*1* Copyright 2008-2015 Freescale Semiconductor Inc.2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions are met:5* * Redistributions of source code must retain the above copyright6* notice, this list of conditions and the following disclaimer.7* * Redistributions in binary form must reproduce the above copyright8* notice, this list of conditions and the following disclaimer in the9* documentation and/or other materials provided with the distribution.10* * Neither the name of Freescale Semiconductor nor the11* names of its contributors may be used to endorse or promote products12* derived from this software without specific prior written permission.13*14*15* ALTERNATIVELY, this software may be distributed under the terms of the16* GNU General Public License ("GPL") as published by the Free Software17* Foundation, either version 2 of that License or (at your option) any18* later version.19*20* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY21* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED22* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE23* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY24* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES25* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;26* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND27* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT28* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS29* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.30*/3132/******************************************************************************33@File fm_macsec_secy.h3435@Description FM MACSEC SecY internal structures and definitions.36*//***************************************************************************/37#ifndef __FM_MACSEC_SECY_H38#define __FM_MACSEC_SECY_H3940#include "error_ext.h"41#include "std_ext.h"4243#include "fm_macsec.h"444546/**************************************************************************//**47@Description Exceptions48*//***************************************************************************/4950#define FM_MACSEC_SECY_EX_FRAME_DISCARDED 0x800000005152#define GET_EXCEPTION_FLAG(bitMask, exception) switch (exception){ \53case e_FM_MACSEC_SECY_EX_FRAME_DISCARDED: \54bitMask = FM_MACSEC_SECY_EX_FRAME_DISCARDED; break; \55default: bitMask = 0;break;}5657/**************************************************************************//**58@Description Events59*//***************************************************************************/6061#define FM_MACSEC_SECY_EV_NEXT_PN 0x800000006263#define GET_EVENT_FLAG(bitMask, event) switch (event){ \64case e_FM_MACSEC_SECY_EV_NEXT_PN: \65bitMask = FM_MACSEC_SECY_EV_NEXT_PN; break; \66default: bitMask = 0;break;}6768/**************************************************************************//**69@Description Defaults70*//***************************************************************************/7172#define DEFAULT_exceptions (FM_MACSEC_SECY_EX_FRAME_DISCARDED)73#define DEFAULT_events (FM_MACSEC_SECY_EV_NEXT_PN)74#define DEFAULT_numOfTxSc 175#define DEFAULT_confidentialityEnable FALSE76#define DEFAULT_confidentialityOffset 077#define DEFAULT_sciInsertionMode e_FM_MACSEC_SCI_INSERTION_MODE_EXPLICIT_SECTAG78#define DEFAULT_validateFrames e_FM_MACSEC_VALID_FRAME_BEHAVIOR_STRICT79#define DEFAULT_replayEnable FALSE80#define DEFAULT_replayWindow 081#define DEFAULT_protectFrames TRUE82#define DEFAULT_ptp FALSE8384/**************************************************************************//**85@Description General defines86*//***************************************************************************/8788#define SECY_AN_FREE_VALUE MAX_NUM_OF_SA_PER_SC899091typedef struct {92e_ScSaId saId;93bool active;94union {95t_FmMacsecSecYRxSaStatistics rxSaStatistics;96t_FmMacsecSecYTxSaStatistics txSaStatistics;97};98} t_SecYSa;99100typedef struct {101bool inUse;102uint32_t scId;103e_ScType type;104uint8_t numOfSa;105t_SecYSa sa[MAX_NUM_OF_SA_PER_SC];106union {107t_FmMacsecSecYRxScStatistics rxScStatistics;108t_FmMacsecSecYTxScStatistics txScStatistics;109};110} t_SecYSc;111112typedef struct {113t_FmMacsecSecYSCParams txScParams; /**< Tx SC Params */114} t_FmMacsecSecYDriverParam;115116typedef struct {117t_Handle h_FmMacsec;118bool confidentialityEnable; /**< TRUE - confidentiality protection and integrity protection119FALSE - no confidentiality protection, only integrity protection*/120uint16_t confidentialityOffset; /**< The number of initial octets of each MSDU without confidentiality protection121common values are 0, 30, and 50 */122bool replayProtect; /**< replay protection function mode */123uint32_t replayWindow; /**< the size of the replay window */124e_FmMacsecValidFrameBehavior validateFrames; /**< validation function mode */125e_FmMacsecSciInsertionMode sciInsertionMode;126bool protectFrames;127bool isPointToPoint;128e_FmMacsecSecYCipherSuite cipherSuite; /**< Cipher suite to be used for this SecY */129uint32_t numOfRxSc; /**< Number of receive channels */130uint32_t numOfTxSc; /**< Number of transmit channels */131t_SecYSc *p_RxSc;132t_SecYSc *p_TxSc;133uint32_t events;134uint32_t exceptions;135t_FmMacsecSecYExceptionsCallback *f_Exception; /**< TODO */136t_FmMacsecSecYEventsCallback *f_Event; /**< TODO */137t_Handle h_App;138t_FmMacsecSecYStatistics statistics;139t_FmMacsecSecYDriverParam *p_FmMacsecSecYDriverParam;140} t_FmMacsecSecY;141142143#endif /* __FM_MACSEC_SECY_H */144145146