25
25
26
26
#include <uapi/linux/if_macsec.h>
27
27
28
- #define MACSEC_SCI_LEN 8
29
-
30
28
/* SecTAG length = macsec_eth_header without the optional SCI */
31
29
#define MACSEC_TAG_LEN 6
32
30
@@ -47,20 +45,10 @@ struct macsec_eth_header {
47
45
u8 secure_channel_id [8 ]; /* optional */
48
46
} __packed ;
49
47
50
- #define MACSEC_TCI_VERSION 0x80
51
- #define MACSEC_TCI_ES 0x40 /* end station */
52
- #define MACSEC_TCI_SC 0x20 /* SCI present */
53
- #define MACSEC_TCI_SCB 0x10 /* epon */
54
- #define MACSEC_TCI_E 0x08 /* encryption */
55
- #define MACSEC_TCI_C 0x04 /* changed text */
56
- #define MACSEC_AN_MASK 0x03 /* association number */
57
- #define MACSEC_TCI_CONFID (MACSEC_TCI_E | MACSEC_TCI_C)
58
-
59
48
/* minimum secure data length deemed "not short", see IEEE 802.1AE-2006 9.7 */
60
49
#define MIN_NON_SHORT_LEN 48
61
50
62
51
#define GCM_AES_IV_LEN 12
63
- #define DEFAULT_ICV_LEN 16
64
52
65
53
#define for_each_rxsc (secy , sc ) \
66
54
for (sc = rcu_dereference_bh(secy->rx_sc); \
@@ -244,7 +232,6 @@ static struct macsec_cb *macsec_skb_cb(struct sk_buff *skb)
244
232
return (struct macsec_cb * )skb -> cb ;
245
233
}
246
234
247
- #define MACSEC_PORT_ES (htons(0x0001))
248
235
#define MACSEC_PORT_SCB (0x0000)
249
236
#define MACSEC_UNDEF_SCI ((__force sci_t)0xffffffffffffffffULL)
250
237
#define MACSEC_UNDEF_SSCI ((__force ssci_t)0xffffffff)
@@ -259,14 +246,6 @@ static struct macsec_cb *macsec_skb_cb(struct sk_buff *skb)
259
246
#define DEFAULT_ENCODING_SA 0
260
247
#define MACSEC_XPN_MAX_REPLAY_WINDOW (((1 << 30) - 1))
261
248
262
- static bool send_sci (const struct macsec_secy * secy )
263
- {
264
- const struct macsec_tx_sc * tx_sc = & secy -> tx_sc ;
265
-
266
- return tx_sc -> send_sci ||
267
- (secy -> n_rx_sc > 1 && !tx_sc -> end_station && !tx_sc -> scb );
268
- }
269
-
270
249
static sci_t make_sci (const u8 * addr , __be16 port )
271
250
{
272
251
sci_t sci ;
@@ -331,7 +310,7 @@ static void macsec_fill_sectag(struct macsec_eth_header *h,
331
310
/* with GCM, C/E clear for !encrypt, both set for encrypt */
332
311
if (tx_sc -> encrypt )
333
312
h -> tci_an |= MACSEC_TCI_CONFID ;
334
- else if (secy -> icv_len != DEFAULT_ICV_LEN )
313
+ else if (secy -> icv_len != MACSEC_DEFAULT_ICV_LEN )
335
314
h -> tci_an |= MACSEC_TCI_C ;
336
315
337
316
h -> tci_an |= tx_sc -> encoding_sa ;
@@ -655,7 +634,7 @@ static struct sk_buff *macsec_encrypt(struct sk_buff *skb,
655
634
656
635
unprotected_len = skb -> len ;
657
636
eth = eth_hdr (skb );
658
- sci_present = send_sci (secy );
637
+ sci_present = macsec_send_sci (secy );
659
638
hh = skb_push (skb , macsec_extra_len (sci_present ));
660
639
memmove (hh , eth , 2 * ETH_ALEN );
661
640
@@ -1303,7 +1282,7 @@ static rx_handler_result_t macsec_handle_frame(struct sk_buff **pskb)
1303
1282
/* 10.6.1 if the SC is not found */
1304
1283
cbit = !!(hdr -> tci_an & MACSEC_TCI_C );
1305
1284
if (!cbit )
1306
- macsec_finalize_skb (skb , DEFAULT_ICV_LEN ,
1285
+ macsec_finalize_skb (skb , MACSEC_DEFAULT_ICV_LEN ,
1307
1286
macsec_extra_len (macsec_skb_cb (skb )-> has_sci ));
1308
1287
1309
1288
list_for_each_entry_rcu (macsec , & rxd -> secys , secys ) {
@@ -4067,7 +4046,7 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
4067
4046
{
4068
4047
struct macsec_dev * macsec = macsec_priv (dev );
4069
4048
rx_handler_func_t * rx_handler ;
4070
- u8 icv_len = DEFAULT_ICV_LEN ;
4049
+ u8 icv_len = MACSEC_DEFAULT_ICV_LEN ;
4071
4050
struct net_device * real_dev ;
4072
4051
int err , mtu ;
4073
4052
sci_t sci ;
@@ -4191,7 +4170,7 @@ static int macsec_validate_attr(struct nlattr *tb[], struct nlattr *data[],
4191
4170
struct netlink_ext_ack * extack )
4192
4171
{
4193
4172
u64 csid = MACSEC_DEFAULT_CIPHER_ID ;
4194
- u8 icv_len = DEFAULT_ICV_LEN ;
4173
+ u8 icv_len = MACSEC_DEFAULT_ICV_LEN ;
4195
4174
int flag ;
4196
4175
bool es , scb , sci ;
4197
4176
@@ -4203,7 +4182,7 @@ static int macsec_validate_attr(struct nlattr *tb[], struct nlattr *data[],
4203
4182
4204
4183
if (data [IFLA_MACSEC_ICV_LEN ]) {
4205
4184
icv_len = nla_get_u8 (data [IFLA_MACSEC_ICV_LEN ]);
4206
- if (icv_len != DEFAULT_ICV_LEN ) {
4185
+ if (icv_len != MACSEC_DEFAULT_ICV_LEN ) {
4207
4186
char dummy_key [DEFAULT_SAK_LEN ] = { 0 };
4208
4187
struct crypto_aead * dummy_tfm ;
4209
4188
0 commit comments