1*852ba100SJustin Hibbits /* 2*852ba100SJustin Hibbits * Copyright 2008-2015 Freescale Semiconductor Inc. 3*852ba100SJustin Hibbits * 4*852ba100SJustin Hibbits * Redistribution and use in source and binary forms, with or without 5*852ba100SJustin Hibbits * modification, are permitted provided that the following conditions are met: 6*852ba100SJustin Hibbits * * Redistributions of source code must retain the above copyright 7*852ba100SJustin Hibbits * notice, this list of conditions and the following disclaimer. 8*852ba100SJustin Hibbits * * Redistributions in binary form must reproduce the above copyright 9*852ba100SJustin Hibbits * notice, this list of conditions and the following disclaimer in the 10*852ba100SJustin Hibbits * documentation and/or other materials provided with the distribution. 11*852ba100SJustin Hibbits * * Neither the name of Freescale Semiconductor nor the 12*852ba100SJustin Hibbits * names of its contributors may be used to endorse or promote products 13*852ba100SJustin Hibbits * derived from this software without specific prior written permission. 14*852ba100SJustin Hibbits * 15*852ba100SJustin Hibbits * 16*852ba100SJustin Hibbits * ALTERNATIVELY, this software may be distributed under the terms of the 17*852ba100SJustin Hibbits * GNU General Public License ("GPL") as published by the Free Software 18*852ba100SJustin Hibbits * Foundation, either version 2 of that License or (at your option) any 19*852ba100SJustin Hibbits * later version. 20*852ba100SJustin Hibbits * 21*852ba100SJustin Hibbits * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY 22*852ba100SJustin Hibbits * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23*852ba100SJustin Hibbits * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24*852ba100SJustin Hibbits * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY 25*852ba100SJustin Hibbits * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26*852ba100SJustin Hibbits * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27*852ba100SJustin Hibbits * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 28*852ba100SJustin Hibbits * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29*852ba100SJustin Hibbits * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30*852ba100SJustin Hibbits * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31*852ba100SJustin Hibbits */ 32*852ba100SJustin Hibbits 33*852ba100SJustin Hibbits /****************************************************************************** 34*852ba100SJustin Hibbits @File fm_macsec_secy.h 35*852ba100SJustin Hibbits 36*852ba100SJustin Hibbits @Description FM MACSEC SecY internal structures and definitions. 37*852ba100SJustin Hibbits *//***************************************************************************/ 38*852ba100SJustin Hibbits #ifndef __FM_MACSEC_SECY_H 39*852ba100SJustin Hibbits #define __FM_MACSEC_SECY_H 40*852ba100SJustin Hibbits 41*852ba100SJustin Hibbits #include "error_ext.h" 42*852ba100SJustin Hibbits #include "std_ext.h" 43*852ba100SJustin Hibbits 44*852ba100SJustin Hibbits #include "fm_macsec.h" 45*852ba100SJustin Hibbits 46*852ba100SJustin Hibbits 47*852ba100SJustin Hibbits /**************************************************************************//** 48*852ba100SJustin Hibbits @Description Exceptions 49*852ba100SJustin Hibbits *//***************************************************************************/ 50*852ba100SJustin Hibbits 51*852ba100SJustin Hibbits #define FM_MACSEC_SECY_EX_FRAME_DISCARDED 0x80000000 52*852ba100SJustin Hibbits 53*852ba100SJustin Hibbits #define GET_EXCEPTION_FLAG(bitMask, exception) switch (exception){ \ 54*852ba100SJustin Hibbits case e_FM_MACSEC_SECY_EX_FRAME_DISCARDED: \ 55*852ba100SJustin Hibbits bitMask = FM_MACSEC_SECY_EX_FRAME_DISCARDED; break; \ 56*852ba100SJustin Hibbits default: bitMask = 0;break;} 57*852ba100SJustin Hibbits 58*852ba100SJustin Hibbits /**************************************************************************//** 59*852ba100SJustin Hibbits @Description Events 60*852ba100SJustin Hibbits *//***************************************************************************/ 61*852ba100SJustin Hibbits 62*852ba100SJustin Hibbits #define FM_MACSEC_SECY_EV_NEXT_PN 0x80000000 63*852ba100SJustin Hibbits 64*852ba100SJustin Hibbits #define GET_EVENT_FLAG(bitMask, event) switch (event){ \ 65*852ba100SJustin Hibbits case e_FM_MACSEC_SECY_EV_NEXT_PN: \ 66*852ba100SJustin Hibbits bitMask = FM_MACSEC_SECY_EV_NEXT_PN; break; \ 67*852ba100SJustin Hibbits default: bitMask = 0;break;} 68*852ba100SJustin Hibbits 69*852ba100SJustin Hibbits /**************************************************************************//** 70*852ba100SJustin Hibbits @Description Defaults 71*852ba100SJustin Hibbits *//***************************************************************************/ 72*852ba100SJustin Hibbits 73*852ba100SJustin Hibbits #define DEFAULT_exceptions (FM_MACSEC_SECY_EX_FRAME_DISCARDED) 74*852ba100SJustin Hibbits #define DEFAULT_events (FM_MACSEC_SECY_EV_NEXT_PN) 75*852ba100SJustin Hibbits #define DEFAULT_numOfTxSc 1 76*852ba100SJustin Hibbits #define DEFAULT_confidentialityEnable FALSE 77*852ba100SJustin Hibbits #define DEFAULT_confidentialityOffset 0 78*852ba100SJustin Hibbits #define DEFAULT_sciInsertionMode e_FM_MACSEC_SCI_INSERTION_MODE_EXPLICIT_SECTAG 79*852ba100SJustin Hibbits #define DEFAULT_validateFrames e_FM_MACSEC_VALID_FRAME_BEHAVIOR_STRICT 80*852ba100SJustin Hibbits #define DEFAULT_replayEnable FALSE 81*852ba100SJustin Hibbits #define DEFAULT_replayWindow 0 82*852ba100SJustin Hibbits #define DEFAULT_protectFrames TRUE 83*852ba100SJustin Hibbits #define DEFAULT_ptp FALSE 84*852ba100SJustin Hibbits 85*852ba100SJustin Hibbits /**************************************************************************//** 86*852ba100SJustin Hibbits @Description General defines 87*852ba100SJustin Hibbits *//***************************************************************************/ 88*852ba100SJustin Hibbits 89*852ba100SJustin Hibbits #define SECY_AN_FREE_VALUE MAX_NUM_OF_SA_PER_SC 90*852ba100SJustin Hibbits 91*852ba100SJustin Hibbits 92*852ba100SJustin Hibbits typedef struct { 93*852ba100SJustin Hibbits e_ScSaId saId; 94*852ba100SJustin Hibbits bool active; 95*852ba100SJustin Hibbits union { 96*852ba100SJustin Hibbits t_FmMacsecSecYRxSaStatistics rxSaStatistics; 97*852ba100SJustin Hibbits t_FmMacsecSecYTxSaStatistics txSaStatistics; 98*852ba100SJustin Hibbits }; 99*852ba100SJustin Hibbits } t_SecYSa; 100*852ba100SJustin Hibbits 101*852ba100SJustin Hibbits typedef struct { 102*852ba100SJustin Hibbits bool inUse; 103*852ba100SJustin Hibbits uint32_t scId; 104*852ba100SJustin Hibbits e_ScType type; 105*852ba100SJustin Hibbits uint8_t numOfSa; 106*852ba100SJustin Hibbits t_SecYSa sa[MAX_NUM_OF_SA_PER_SC]; 107*852ba100SJustin Hibbits union { 108*852ba100SJustin Hibbits t_FmMacsecSecYRxScStatistics rxScStatistics; 109*852ba100SJustin Hibbits t_FmMacsecSecYTxScStatistics txScStatistics; 110*852ba100SJustin Hibbits }; 111*852ba100SJustin Hibbits } t_SecYSc; 112*852ba100SJustin Hibbits 113*852ba100SJustin Hibbits typedef struct { 114*852ba100SJustin Hibbits t_FmMacsecSecYSCParams txScParams; /**< Tx SC Params */ 115*852ba100SJustin Hibbits } t_FmMacsecSecYDriverParam; 116*852ba100SJustin Hibbits 117*852ba100SJustin Hibbits typedef struct { 118*852ba100SJustin Hibbits t_Handle h_FmMacsec; 119*852ba100SJustin Hibbits bool confidentialityEnable; /**< TRUE - confidentiality protection and integrity protection 120*852ba100SJustin Hibbits FALSE - no confidentiality protection, only integrity protection*/ 121*852ba100SJustin Hibbits uint16_t confidentialityOffset; /**< The number of initial octets of each MSDU without confidentiality protection 122*852ba100SJustin Hibbits common values are 0, 30, and 50 */ 123*852ba100SJustin Hibbits bool replayProtect; /**< replay protection function mode */ 124*852ba100SJustin Hibbits uint32_t replayWindow; /**< the size of the replay window */ 125*852ba100SJustin Hibbits e_FmMacsecValidFrameBehavior validateFrames; /**< validation function mode */ 126*852ba100SJustin Hibbits e_FmMacsecSciInsertionMode sciInsertionMode; 127*852ba100SJustin Hibbits bool protectFrames; 128*852ba100SJustin Hibbits bool isPointToPoint; 129*852ba100SJustin Hibbits e_FmMacsecSecYCipherSuite cipherSuite; /**< Cipher suite to be used for this SecY */ 130*852ba100SJustin Hibbits uint32_t numOfRxSc; /**< Number of receive channels */ 131*852ba100SJustin Hibbits uint32_t numOfTxSc; /**< Number of transmit channels */ 132*852ba100SJustin Hibbits t_SecYSc *p_RxSc; 133*852ba100SJustin Hibbits t_SecYSc *p_TxSc; 134*852ba100SJustin Hibbits uint32_t events; 135*852ba100SJustin Hibbits uint32_t exceptions; 136*852ba100SJustin Hibbits t_FmMacsecSecYExceptionsCallback *f_Exception; /**< TODO */ 137*852ba100SJustin Hibbits t_FmMacsecSecYEventsCallback *f_Event; /**< TODO */ 138*852ba100SJustin Hibbits t_Handle h_App; 139*852ba100SJustin Hibbits t_FmMacsecSecYStatistics statistics; 140*852ba100SJustin Hibbits t_FmMacsecSecYDriverParam *p_FmMacsecSecYDriverParam; 141*852ba100SJustin Hibbits } t_FmMacsecSecY; 142*852ba100SJustin Hibbits 143*852ba100SJustin Hibbits 144*852ba100SJustin Hibbits #endif /* __FM_MACSEC_SECY_H */ 145