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