Linux Audio

Check our new training course

Loading...
v3.1
 
 1#ifndef _NET_ESP_H
 2#define _NET_ESP_H
 3
 4#include <linux/skbuff.h>
 5
 6struct crypto_aead;
 7
 8struct esp_data {
 9	/* 0..255 */
10	int padlen;
11
12	/* Confidentiality & Integrity */
13	struct crypto_aead *aead;
14};
15
16extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
17
18struct ip_esp_hdr;
19
20static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
21{
22	return (struct ip_esp_hdr *)skb_transport_header(skb);
23}
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25#endif
v5.14.15
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef _NET_ESP_H
 3#define _NET_ESP_H
 4
 5#include <linux/skbuff.h>
 6
 
 
 
 
 
 
 
 
 
 
 
 
 7struct ip_esp_hdr;
 8
 9static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
10{
11	return (struct ip_esp_hdr *)skb_transport_header(skb);
12}
13
14static inline void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
15{
16	/* Fill padding... */
17	if (tfclen) {
18		memset(tail, 0, tfclen);
19		tail += tfclen;
20	}
21	do {
22		int i;
23		for (i = 0; i < plen - 2; i++)
24			tail[i] = i + 1;
25	} while (0);
26	tail[plen - 2] = plen - 2;
27	tail[plen - 1] = proto;
28}
29
30struct esp_info {
31	struct	ip_esp_hdr *esph;
32	__be64	seqno;
33	int	tfclen;
34	int	tailen;
35	int	plen;
36	int	clen;
37	int 	len;
38	int 	nfrags;
39	__u8	proto;
40	bool	inplace;
41};
42
43int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
44int esp_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
45int esp_input_done2(struct sk_buff *skb, int err);
46int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
47int esp6_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
48int esp6_input_done2(struct sk_buff *skb, int err);
49#endif