Commit | Line | Data |
---|---|---|
afd46503 JP |
1 | #define pr_fmt(fmt) "IPsec: " fmt |
2 | ||
38320c70 HX |
3 | #include <crypto/aead.h> |
4 | #include <crypto/authenc.h> | |
6b7326c8 | 5 | #include <linux/err.h> |
1da177e4 LT |
6 | #include <linux/module.h> |
7 | #include <net/ip.h> | |
8 | #include <net/xfrm.h> | |
9 | #include <net/esp.h> | |
72998d8c | 10 | #include <linux/scatterlist.h> |
a02a6422 | 11 | #include <linux/kernel.h> |
1da177e4 | 12 | #include <linux/pfkeyv2.h> |
38320c70 HX |
13 | #include <linux/rtnetlink.h> |
14 | #include <linux/slab.h> | |
b7c6538c | 15 | #include <linux/spinlock.h> |
2017a72c | 16 | #include <linux/in6.h> |
1da177e4 | 17 | #include <net/icmp.h> |
14c85021 | 18 | #include <net/protocol.h> |
1da177e4 LT |
19 | #include <net/udp.h> |
20 | ||
cac2661c SK |
21 | #include <linux/highmem.h> |
22 | ||
38320c70 HX |
23 | struct esp_skb_cb { |
24 | struct xfrm_skb_cb xfrm; | |
25 | void *tmp; | |
26 | }; | |
27 | ||
962fcef3 HX |
28 | struct esp_output_extra { |
29 | __be32 seqhi; | |
30 | u32 esphoff; | |
31 | }; | |
32 | ||
38320c70 HX |
33 | #define ESP_SKB_CB(__skb) ((struct esp_skb_cb *)&((__skb)->cb[0])) |
34 | ||
d979e20f MW |
35 | static u32 esp4_get_mtu(struct xfrm_state *x, int mtu); |
36 | ||
38320c70 HX |
37 | /* |
38 | * Allocate an AEAD request structure with extra space for SG and IV. | |
39 | * | |
40 | * For alignment considerations the IV is placed at the front, followed | |
41 | * by the request and finally the SG list. | |
42 | * | |
43 | * TODO: Use spare space in skb for this where possible. | |
44 | */ | |
962fcef3 | 45 | static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags, int extralen) |
38320c70 HX |
46 | { |
47 | unsigned int len; | |
48 | ||
962fcef3 | 49 | len = extralen; |
0dc49e9b SK |
50 | |
51 | len += crypto_aead_ivsize(aead); | |
52 | ||
38320c70 HX |
53 | if (len) { |
54 | len += crypto_aead_alignmask(aead) & | |
55 | ~(crypto_tfm_ctx_alignment() - 1); | |
56 | len = ALIGN(len, crypto_tfm_ctx_alignment()); | |
57 | } | |
58 | ||
7021b2e1 | 59 | len += sizeof(struct aead_request) + crypto_aead_reqsize(aead); |
38320c70 HX |
60 | len = ALIGN(len, __alignof__(struct scatterlist)); |
61 | ||
62 | len += sizeof(struct scatterlist) * nfrags; | |
63 | ||
64 | return kmalloc(len, GFP_ATOMIC); | |
65 | } | |
66 | ||
962fcef3 | 67 | static inline void *esp_tmp_extra(void *tmp) |
0dc49e9b | 68 | { |
962fcef3 | 69 | return PTR_ALIGN(tmp, __alignof__(struct esp_output_extra)); |
0dc49e9b | 70 | } |
962fcef3 HX |
71 | |
72 | static inline u8 *esp_tmp_iv(struct crypto_aead *aead, void *tmp, int extralen) | |
38320c70 HX |
73 | { |
74 | return crypto_aead_ivsize(aead) ? | |
962fcef3 HX |
75 | PTR_ALIGN((u8 *)tmp + extralen, |
76 | crypto_aead_alignmask(aead) + 1) : tmp + extralen; | |
38320c70 HX |
77 | } |
78 | ||
38320c70 HX |
79 | static inline struct aead_request *esp_tmp_req(struct crypto_aead *aead, u8 *iv) |
80 | { | |
81 | struct aead_request *req; | |
82 | ||
83 | req = (void *)PTR_ALIGN(iv + crypto_aead_ivsize(aead), | |
84 | crypto_tfm_ctx_alignment()); | |
85 | aead_request_set_tfm(req, aead); | |
86 | return req; | |
87 | } | |
88 | ||
89 | static inline struct scatterlist *esp_req_sg(struct crypto_aead *aead, | |
90 | struct aead_request *req) | |
91 | { | |
92 | return (void *)ALIGN((unsigned long)(req + 1) + | |
93 | crypto_aead_reqsize(aead), | |
94 | __alignof__(struct scatterlist)); | |
95 | } | |
96 | ||
cac2661c SK |
97 | static void esp_ssg_unref(struct xfrm_state *x, void *tmp) |
98 | { | |
99 | struct esp_output_extra *extra = esp_tmp_extra(tmp); | |
100 | struct crypto_aead *aead = x->data; | |
101 | int extralen = 0; | |
102 | u8 *iv; | |
103 | struct aead_request *req; | |
104 | struct scatterlist *sg; | |
105 | ||
106 | if (x->props.flags & XFRM_STATE_ESN) | |
107 | extralen += sizeof(*extra); | |
108 | ||
109 | extra = esp_tmp_extra(tmp); | |
110 | iv = esp_tmp_iv(aead, tmp, extralen); | |
111 | req = esp_tmp_req(aead, iv); | |
112 | ||
113 | /* Unref skb_frag_pages in the src scatterlist if necessary. | |
114 | * Skip the first sg which comes from skb->data. | |
115 | */ | |
116 | if (req->src != req->dst) | |
117 | for (sg = sg_next(req->src); sg; sg = sg_next(sg)) | |
118 | put_page(sg_page(sg)); | |
119 | } | |
120 | ||
38320c70 HX |
121 | static void esp_output_done(struct crypto_async_request *base, int err) |
122 | { | |
123 | struct sk_buff *skb = base->data; | |
cac2661c SK |
124 | void *tmp; |
125 | struct dst_entry *dst = skb_dst(skb); | |
126 | struct xfrm_state *x = dst->xfrm; | |
38320c70 | 127 | |
cac2661c SK |
128 | tmp = ESP_SKB_CB(skb)->tmp; |
129 | esp_ssg_unref(x, tmp); | |
130 | kfree(tmp); | |
38320c70 HX |
131 | xfrm_output_resume(skb, err); |
132 | } | |
133 | ||
7021b2e1 HX |
134 | /* Move ESP header back into place. */ |
135 | static void esp_restore_header(struct sk_buff *skb, unsigned int offset) | |
136 | { | |
137 | struct ip_esp_hdr *esph = (void *)(skb->data + offset); | |
138 | void *tmp = ESP_SKB_CB(skb)->tmp; | |
962fcef3 | 139 | __be32 *seqhi = esp_tmp_extra(tmp); |
7021b2e1 HX |
140 | |
141 | esph->seq_no = esph->spi; | |
142 | esph->spi = *seqhi; | |
143 | } | |
144 | ||
145 | static void esp_output_restore_header(struct sk_buff *skb) | |
146 | { | |
962fcef3 HX |
147 | void *tmp = ESP_SKB_CB(skb)->tmp; |
148 | struct esp_output_extra *extra = esp_tmp_extra(tmp); | |
149 | ||
150 | esp_restore_header(skb, skb_transport_offset(skb) + extra->esphoff - | |
151 | sizeof(__be32)); | |
7021b2e1 HX |
152 | } |
153 | ||
cac2661c | 154 | static struct ip_esp_hdr *esp_output_set_extra(struct sk_buff *skb, |
fca11ebd | 155 | struct xfrm_state *x, |
cac2661c SK |
156 | struct ip_esp_hdr *esph, |
157 | struct esp_output_extra *extra) | |
158 | { | |
cac2661c SK |
159 | /* For ESN we move the header forward by 4 bytes to |
160 | * accomodate the high bits. We will move it back after | |
161 | * encryption. | |
162 | */ | |
163 | if ((x->props.flags & XFRM_STATE_ESN)) { | |
7862b405 SK |
164 | __u32 seqhi; |
165 | struct xfrm_offload *xo = xfrm_offload(skb); | |
166 | ||
167 | if (xo) | |
168 | seqhi = xo->seq.hi; | |
169 | else | |
170 | seqhi = XFRM_SKB_CB(skb)->seq.output.hi; | |
171 | ||
cac2661c SK |
172 | extra->esphoff = (unsigned char *)esph - |
173 | skb_transport_header(skb); | |
174 | esph = (struct ip_esp_hdr *)((unsigned char *)esph - 4); | |
175 | extra->seqhi = esph->spi; | |
7862b405 | 176 | esph->seq_no = htonl(seqhi); |
cac2661c SK |
177 | } |
178 | ||
179 | esph->spi = x->id.spi; | |
180 | ||
181 | return esph; | |
182 | } | |
183 | ||
7021b2e1 HX |
184 | static void esp_output_done_esn(struct crypto_async_request *base, int err) |
185 | { | |
186 | struct sk_buff *skb = base->data; | |
187 | ||
188 | esp_output_restore_header(skb); | |
189 | esp_output_done(base, err); | |
190 | } | |
191 | ||
eb758c88 SK |
192 | static void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto) |
193 | { | |
194 | /* Fill padding... */ | |
195 | if (tfclen) { | |
196 | memset(tail, 0, tfclen); | |
197 | tail += tfclen; | |
198 | } | |
199 | do { | |
200 | int i; | |
201 | for (i = 0; i < plen - 2; i++) | |
202 | tail[i] = i + 1; | |
203 | } while (0); | |
204 | tail[plen - 2] = plen - 2; | |
205 | tail[plen - 1] = proto; | |
206 | } | |
207 | ||
fca11ebd | 208 | static void esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp) |
1da177e4 | 209 | { |
fca11ebd SK |
210 | int encap_type; |
211 | struct udphdr *uh; | |
212 | __be32 *udpdata32; | |
213 | __be16 sport, dport; | |
214 | struct xfrm_encap_tmpl *encap = x->encap; | |
215 | struct ip_esp_hdr *esph = esp->esph; | |
216 | ||
217 | spin_lock_bh(&x->lock); | |
218 | sport = encap->encap_sport; | |
219 | dport = encap->encap_dport; | |
220 | encap_type = encap->encap_type; | |
221 | spin_unlock_bh(&x->lock); | |
222 | ||
223 | uh = (struct udphdr *)esph; | |
224 | uh->source = sport; | |
225 | uh->dest = dport; | |
226 | uh->len = htons(skb->len + esp->tailen | |
227 | - skb_transport_offset(skb)); | |
228 | uh->check = 0; | |
229 | ||
230 | switch (encap_type) { | |
231 | default: | |
232 | case UDP_ENCAP_ESPINUDP: | |
233 | esph = (struct ip_esp_hdr *)(uh + 1); | |
234 | break; | |
235 | case UDP_ENCAP_ESPINUDP_NON_IKE: | |
236 | udpdata32 = (__be32 *)(uh + 1); | |
237 | udpdata32[0] = udpdata32[1] = 0; | |
238 | esph = (struct ip_esp_hdr *)(udpdata32 + 2); | |
239 | break; | |
d979e20f | 240 | } |
0dc49e9b | 241 | |
fca11ebd SK |
242 | *skb_mac_header(skb) = IPPROTO_UDP; |
243 | esp->esph = esph; | |
244 | } | |
0dc49e9b | 245 | |
fca11ebd SK |
246 | int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp) |
247 | { | |
248 | u8 *tail; | |
249 | u8 *vaddr; | |
250 | int nfrags; | |
0e78a873 | 251 | int esph_offset; |
fca11ebd SK |
252 | struct page *page; |
253 | struct sk_buff *trailer; | |
254 | int tailen = esp->tailen; | |
1da177e4 LT |
255 | |
256 | /* this is non-NULL only with UDP Encapsulation */ | |
fca11ebd SK |
257 | if (x->encap) |
258 | esp_output_udp_encap(x, skb, esp); | |
1da177e4 | 259 | |
cac2661c SK |
260 | if (!skb_cloned(skb)) { |
261 | if (tailen <= skb_availroom(skb)) { | |
262 | nfrags = 1; | |
263 | trailer = skb; | |
264 | tail = skb_tail_pointer(trailer); | |
1da177e4 | 265 | |
cac2661c SK |
266 | goto skip_cow; |
267 | } else if ((skb_shinfo(skb)->nr_frags < MAX_SKB_FRAGS) | |
268 | && !skb_has_frag_list(skb)) { | |
269 | int allocsize; | |
270 | struct sock *sk = skb->sk; | |
271 | struct page_frag *pfrag = &x->xfrag; | |
7021b2e1 | 272 | |
fca11ebd SK |
273 | esp->inplace = false; |
274 | ||
cac2661c SK |
275 | allocsize = ALIGN(tailen, L1_CACHE_BYTES); |
276 | ||
277 | spin_lock_bh(&x->lock); | |
278 | ||
279 | if (unlikely(!skb_page_frag_refill(allocsize, pfrag, GFP_ATOMIC))) { | |
280 | spin_unlock_bh(&x->lock); | |
281 | goto cow; | |
282 | } | |
283 | ||
284 | page = pfrag->page; | |
285 | get_page(page); | |
286 | ||
287 | vaddr = kmap_atomic(page); | |
288 | ||
289 | tail = vaddr + pfrag->offset; | |
290 | ||
fca11ebd | 291 | esp_output_fill_trailer(tail, esp->tfclen, esp->plen, esp->proto); |
cac2661c SK |
292 | |
293 | kunmap_atomic(vaddr); | |
294 | ||
fca11ebd SK |
295 | spin_unlock_bh(&x->lock); |
296 | ||
cac2661c SK |
297 | nfrags = skb_shinfo(skb)->nr_frags; |
298 | ||
299 | __skb_fill_page_desc(skb, nfrags, page, pfrag->offset, | |
300 | tailen); | |
301 | skb_shinfo(skb)->nr_frags = ++nfrags; | |
302 | ||
303 | pfrag->offset = pfrag->offset + allocsize; | |
304 | nfrags++; | |
305 | ||
306 | skb->len += tailen; | |
307 | skb->data_len += tailen; | |
308 | skb->truesize += tailen; | |
309 | if (sk) | |
14afee4b | 310 | refcount_add(tailen, &sk->sk_wmem_alloc); |
cac2661c | 311 | |
fca11ebd | 312 | goto out; |
cac2661c | 313 | } |
7021b2e1 HX |
314 | } |
315 | ||
cac2661c | 316 | cow: |
0e78a873 SK |
317 | esph_offset = (unsigned char *)esp->esph - skb_transport_header(skb); |
318 | ||
fca11ebd SK |
319 | nfrags = skb_cow_data(skb, tailen, &trailer); |
320 | if (nfrags < 0) | |
321 | goto out; | |
cac2661c | 322 | tail = skb_tail_pointer(trailer); |
0e78a873 | 323 | esp->esph = (struct ip_esp_hdr *)(skb_transport_header(skb) + esph_offset); |
cac2661c SK |
324 | |
325 | skip_cow: | |
fca11ebd SK |
326 | esp_output_fill_trailer(tail, esp->tfclen, esp->plen, esp->proto); |
327 | pskb_put(skb, trailer, tailen); | |
cac2661c | 328 | |
fca11ebd SK |
329 | out: |
330 | return nfrags; | |
331 | } | |
332 | EXPORT_SYMBOL_GPL(esp_output_head); | |
333 | ||
334 | int esp_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp) | |
335 | { | |
336 | u8 *iv; | |
337 | int alen; | |
338 | void *tmp; | |
339 | int ivlen; | |
340 | int assoclen; | |
341 | int extralen; | |
342 | struct page *page; | |
343 | struct ip_esp_hdr *esph; | |
344 | struct crypto_aead *aead; | |
345 | struct aead_request *req; | |
346 | struct scatterlist *sg, *dsg; | |
347 | struct esp_output_extra *extra; | |
348 | int err = -ENOMEM; | |
349 | ||
350 | assoclen = sizeof(struct ip_esp_hdr); | |
351 | extralen = 0; | |
352 | ||
353 | if (x->props.flags & XFRM_STATE_ESN) { | |
354 | extralen += sizeof(*extra); | |
355 | assoclen += sizeof(__be32); | |
356 | } | |
7021b2e1 | 357 | |
fca11ebd SK |
358 | aead = x->data; |
359 | alen = crypto_aead_authsize(aead); | |
360 | ivlen = crypto_aead_ivsize(aead); | |
361 | ||
362 | tmp = esp_alloc_tmp(aead, esp->nfrags + 2, extralen); | |
e892d2d4 | 363 | if (!tmp) |
cac2661c | 364 | goto error; |
cac2661c SK |
365 | |
366 | extra = esp_tmp_extra(tmp); | |
367 | iv = esp_tmp_iv(aead, tmp, extralen); | |
368 | req = esp_tmp_req(aead, iv); | |
369 | sg = esp_req_sg(aead, req); | |
cac2661c | 370 | |
fca11ebd SK |
371 | if (esp->inplace) |
372 | dsg = sg; | |
373 | else | |
374 | dsg = &sg[esp->nfrags]; | |
cac2661c | 375 | |
fca11ebd SK |
376 | esph = esp_output_set_extra(skb, x, esp->esph, extra); |
377 | esp->esph = esph; | |
378 | ||
379 | sg_init_table(sg, esp->nfrags); | |
3f297707 JD |
380 | err = skb_to_sgvec(skb, sg, |
381 | (unsigned char *)esph - skb->data, | |
382 | assoclen + ivlen + esp->clen + alen); | |
383 | if (unlikely(err < 0)) | |
384 | goto error; | |
fca11ebd SK |
385 | |
386 | if (!esp->inplace) { | |
387 | int allocsize; | |
388 | struct page_frag *pfrag = &x->xfrag; | |
389 | ||
390 | allocsize = ALIGN(skb->data_len, L1_CACHE_BYTES); | |
391 | ||
392 | spin_lock_bh(&x->lock); | |
393 | if (unlikely(!skb_page_frag_refill(allocsize, pfrag, GFP_ATOMIC))) { | |
394 | spin_unlock_bh(&x->lock); | |
fca11ebd SK |
395 | goto error; |
396 | } | |
397 | ||
398 | skb_shinfo(skb)->nr_frags = 1; | |
399 | ||
400 | page = pfrag->page; | |
401 | get_page(page); | |
402 | /* replace page frags in skb with new page */ | |
403 | __skb_fill_page_desc(skb, 0, page, pfrag->offset, skb->data_len); | |
404 | pfrag->offset = pfrag->offset + allocsize; | |
405 | spin_unlock_bh(&x->lock); | |
406 | ||
407 | sg_init_table(dsg, skb_shinfo(skb)->nr_frags + 1); | |
3f297707 JD |
408 | err = skb_to_sgvec(skb, dsg, |
409 | (unsigned char *)esph - skb->data, | |
410 | assoclen + ivlen + esp->clen + alen); | |
411 | if (unlikely(err < 0)) | |
412 | goto error; | |
fca11ebd | 413 | } |
0dc49e9b | 414 | |
cac2661c SK |
415 | if ((x->props.flags & XFRM_STATE_ESN)) |
416 | aead_request_set_callback(req, 0, esp_output_done_esn, skb); | |
417 | else | |
418 | aead_request_set_callback(req, 0, esp_output_done, skb); | |
419 | ||
fca11ebd | 420 | aead_request_set_crypt(req, sg, dsg, ivlen + esp->clen, iv); |
7021b2e1 HX |
421 | aead_request_set_ad(req, assoclen); |
422 | ||
7021b2e1 | 423 | memset(iv, 0, ivlen); |
fca11ebd | 424 | memcpy(iv + ivlen - min(ivlen, 8), (u8 *)&esp->seqno + 8 - min(ivlen, 8), |
7021b2e1 | 425 | min(ivlen, 8)); |
38320c70 HX |
426 | |
427 | ESP_SKB_CB(skb)->tmp = tmp; | |
7021b2e1 HX |
428 | err = crypto_aead_encrypt(req); |
429 | ||
430 | switch (err) { | |
431 | case -EINPROGRESS: | |
38320c70 | 432 | goto error; |
1da177e4 | 433 | |
7021b2e1 | 434 | case -EBUSY: |
38320c70 | 435 | err = NET_XMIT_DROP; |
7021b2e1 HX |
436 | break; |
437 | ||
438 | case 0: | |
439 | if ((x->props.flags & XFRM_STATE_ESN)) | |
440 | esp_output_restore_header(skb); | |
441 | } | |
1da177e4 | 442 | |
cac2661c SK |
443 | if (sg != dsg) |
444 | esp_ssg_unref(x, tmp); | |
38320c70 | 445 | kfree(tmp); |
b7c6538c | 446 | |
1da177e4 LT |
447 | error: |
448 | return err; | |
449 | } | |
fca11ebd SK |
450 | EXPORT_SYMBOL_GPL(esp_output_tail); |
451 | ||
452 | static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | |
453 | { | |
454 | int alen; | |
455 | int blksize; | |
456 | struct ip_esp_hdr *esph; | |
457 | struct crypto_aead *aead; | |
458 | struct esp_info esp; | |
459 | ||
460 | esp.inplace = true; | |
461 | ||
462 | esp.proto = *skb_mac_header(skb); | |
463 | *skb_mac_header(skb) = IPPROTO_ESP; | |
464 | ||
465 | /* skb is pure payload to encrypt */ | |
466 | ||
467 | aead = x->data; | |
468 | alen = crypto_aead_authsize(aead); | |
469 | ||
470 | esp.tfclen = 0; | |
471 | if (x->tfcpad) { | |
472 | struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb); | |
473 | u32 padto; | |
474 | ||
475 | padto = min(x->tfcpad, esp4_get_mtu(x, dst->child_mtu_cached)); | |
476 | if (skb->len < padto) | |
477 | esp.tfclen = padto - skb->len; | |
478 | } | |
479 | blksize = ALIGN(crypto_aead_blocksize(aead), 4); | |
480 | esp.clen = ALIGN(skb->len + 2 + esp.tfclen, blksize); | |
481 | esp.plen = esp.clen - skb->len - esp.tfclen; | |
482 | esp.tailen = esp.tfclen + esp.plen + alen; | |
483 | ||
484 | esp.esph = ip_esp_hdr(skb); | |
485 | ||
486 | esp.nfrags = esp_output_head(x, skb, &esp); | |
487 | if (esp.nfrags < 0) | |
488 | return esp.nfrags; | |
489 | ||
490 | esph = esp.esph; | |
491 | esph->spi = x->id.spi; | |
492 | ||
493 | esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output.low); | |
494 | esp.seqno = cpu_to_be64(XFRM_SKB_CB(skb)->seq.output.low + | |
495 | ((u64)XFRM_SKB_CB(skb)->seq.output.hi << 32)); | |
496 | ||
497 | skb_push(skb, -skb_network_offset(skb)); | |
498 | ||
499 | return esp_output_tail(x, skb, &esp); | |
500 | } | |
1da177e4 | 501 | |
fca11ebd | 502 | int esp_input_done2(struct sk_buff *skb, int err) |
1da177e4 | 503 | { |
b71d1d42 | 504 | const struct iphdr *iph; |
38320c70 | 505 | struct xfrm_state *x = xfrm_input_state(skb); |
d77e38e6 | 506 | struct xfrm_offload *xo = xfrm_offload(skb); |
1c5ad13f | 507 | struct crypto_aead *aead = x->data; |
38320c70 HX |
508 | int alen = crypto_aead_authsize(aead); |
509 | int hlen = sizeof(struct ip_esp_hdr) + crypto_aead_ivsize(aead); | |
510 | int elen = skb->len - hlen; | |
31a4ab93 | 511 | int ihl; |
4bf05ece | 512 | u8 nexthdr[2]; |
ec9567a9 IT |
513 | int padlen, trimlen; |
514 | __wsum csumdiff; | |
1da177e4 | 515 | |
d77e38e6 SK |
516 | if (!xo || (xo && !(xo->flags & CRYPTO_DONE))) |
517 | kfree(ESP_SKB_CB(skb)->tmp); | |
0ebea8ef | 518 | |
6b7326c8 | 519 | if (unlikely(err)) |
668dc8af | 520 | goto out; |
1da177e4 | 521 | |
4bf05ece HX |
522 | if (skb_copy_bits(skb, skb->len-alen-2, nexthdr, 2)) |
523 | BUG(); | |
1da177e4 | 524 | |
668dc8af | 525 | err = -EINVAL; |
4bf05ece | 526 | padlen = nexthdr[0]; |
38320c70 | 527 | if (padlen + 2 + alen >= elen) |
4bf05ece | 528 | goto out; |
1da177e4 | 529 | |
e905a9ed | 530 | /* ... check padding bits here. Silly. :-) */ |
1da177e4 | 531 | |
eddc9ec5 | 532 | iph = ip_hdr(skb); |
31a4ab93 HX |
533 | ihl = iph->ihl * 4; |
534 | ||
752c1f4c HX |
535 | if (x->encap) { |
536 | struct xfrm_encap_tmpl *encap = x->encap; | |
d56f90a7 | 537 | struct udphdr *uh = (void *)(skb_network_header(skb) + ihl); |
752c1f4c HX |
538 | |
539 | /* | |
540 | * 1) if the NAT-T peer's IP or port changed then | |
541 | * advertize the change to the keying daemon. | |
542 | * This is an inbound SA, so just compare | |
543 | * SRC ports. | |
544 | */ | |
545 | if (iph->saddr != x->props.saddr.a4 || | |
546 | uh->source != encap->encap_sport) { | |
547 | xfrm_address_t ipaddr; | |
548 | ||
549 | ipaddr.a4 = iph->saddr; | |
550 | km_new_mapping(x, &ipaddr, uh->source); | |
e905a9ed | 551 | |
752c1f4c HX |
552 | /* XXX: perhaps add an extra |
553 | * policy check here, to see | |
554 | * if we should allow or | |
555 | * reject a packet from a | |
556 | * different source | |
557 | * address/port. | |
558 | */ | |
1da177e4 | 559 | } |
e905a9ed | 560 | |
752c1f4c HX |
561 | /* |
562 | * 2) ignore UDP/TCP checksums in case | |
563 | * of NAT-T in Transport Mode, or | |
564 | * perform other post-processing fixes | |
565 | * as per draft-ietf-ipsec-udp-encaps-06, | |
566 | * section 3.1.2 | |
567 | */ | |
8bd17075 | 568 | if (x->props.mode == XFRM_MODE_TRANSPORT) |
752c1f4c | 569 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1da177e4 LT |
570 | } |
571 | ||
ec9567a9 IT |
572 | trimlen = alen + padlen + 2; |
573 | if (skb->ip_summed == CHECKSUM_COMPLETE) { | |
574 | csumdiff = skb_checksum(skb, skb->len - trimlen, trimlen, 0); | |
575 | skb->csum = csum_block_sub(skb->csum, csumdiff, | |
576 | skb->len - trimlen); | |
577 | } | |
578 | pskb_trim(skb, skb->len - trimlen); | |
579 | ||
580 | skb_pull_rcsum(skb, hlen); | |
7143dfac LR |
581 | if (x->props.mode == XFRM_MODE_TUNNEL) |
582 | skb_reset_transport_header(skb); | |
583 | else | |
584 | skb_set_transport_header(skb, -ihl); | |
4bf05ece | 585 | |
38320c70 HX |
586 | err = nexthdr[1]; |
587 | ||
588 | /* RFC4303: Drop dummy packets without any error */ | |
589 | if (err == IPPROTO_NONE) | |
590 | err = -EINVAL; | |
591 | ||
592 | out: | |
593 | return err; | |
594 | } | |
fca11ebd | 595 | EXPORT_SYMBOL_GPL(esp_input_done2); |
38320c70 HX |
596 | |
597 | static void esp_input_done(struct crypto_async_request *base, int err) | |
598 | { | |
599 | struct sk_buff *skb = base->data; | |
600 | ||
601 | xfrm_input_resume(skb, esp_input_done2(skb, err)); | |
602 | } | |
603 | ||
7021b2e1 HX |
604 | static void esp_input_restore_header(struct sk_buff *skb) |
605 | { | |
606 | esp_restore_header(skb, 0); | |
607 | __skb_pull(skb, 4); | |
608 | } | |
609 | ||
cac2661c SK |
610 | static void esp_input_set_header(struct sk_buff *skb, __be32 *seqhi) |
611 | { | |
612 | struct xfrm_state *x = xfrm_input_state(skb); | |
613 | struct ip_esp_hdr *esph = (struct ip_esp_hdr *)skb->data; | |
614 | ||
615 | /* For ESN we move the header forward by 4 bytes to | |
616 | * accomodate the high bits. We will move it back after | |
617 | * decryption. | |
618 | */ | |
619 | if ((x->props.flags & XFRM_STATE_ESN)) { | |
d58ff351 | 620 | esph = skb_push(skb, 4); |
cac2661c SK |
621 | *seqhi = esph->spi; |
622 | esph->spi = esph->seq_no; | |
623 | esph->seq_no = XFRM_SKB_CB(skb)->seq.input.hi; | |
624 | } | |
625 | } | |
626 | ||
7021b2e1 HX |
627 | static void esp_input_done_esn(struct crypto_async_request *base, int err) |
628 | { | |
629 | struct sk_buff *skb = base->data; | |
630 | ||
631 | esp_input_restore_header(skb); | |
632 | esp_input_done(base, err); | |
633 | } | |
634 | ||
38320c70 HX |
635 | /* |
636 | * Note: detecting truncated vs. non-truncated authentication data is very | |
637 | * expensive, so we only support truncated data, which is the recommended | |
638 | * and common case. | |
639 | */ | |
640 | static int esp_input(struct xfrm_state *x, struct sk_buff *skb) | |
641 | { | |
642 | struct ip_esp_hdr *esph; | |
1c5ad13f | 643 | struct crypto_aead *aead = x->data; |
38320c70 HX |
644 | struct aead_request *req; |
645 | struct sk_buff *trailer; | |
7021b2e1 HX |
646 | int ivlen = crypto_aead_ivsize(aead); |
647 | int elen = skb->len - sizeof(*esph) - ivlen; | |
38320c70 | 648 | int nfrags; |
0dc49e9b | 649 | int assoclen; |
0dc49e9b SK |
650 | int seqhilen; |
651 | __be32 *seqhi; | |
38320c70 HX |
652 | void *tmp; |
653 | u8 *iv; | |
654 | struct scatterlist *sg; | |
38320c70 HX |
655 | int err = -EINVAL; |
656 | ||
7021b2e1 | 657 | if (!pskb_may_pull(skb, sizeof(*esph) + ivlen)) |
38320c70 HX |
658 | goto out; |
659 | ||
660 | if (elen <= 0) | |
661 | goto out; | |
662 | ||
0dc49e9b | 663 | assoclen = sizeof(*esph); |
0dc49e9b SK |
664 | seqhilen = 0; |
665 | ||
666 | if (x->props.flags & XFRM_STATE_ESN) { | |
0dc49e9b SK |
667 | seqhilen += sizeof(__be32); |
668 | assoclen += seqhilen; | |
669 | } | |
670 | ||
cac2661c SK |
671 | if (!skb_cloned(skb)) { |
672 | if (!skb_is_nonlinear(skb)) { | |
673 | nfrags = 1; | |
674 | ||
675 | goto skip_cow; | |
676 | } else if (!skb_has_frag_list(skb)) { | |
677 | nfrags = skb_shinfo(skb)->nr_frags; | |
678 | nfrags++; | |
679 | ||
680 | goto skip_cow; | |
681 | } | |
682 | } | |
683 | ||
684 | err = skb_cow_data(skb, 0, &trailer); | |
685 | if (err < 0) | |
686 | goto out; | |
687 | ||
688 | nfrags = err; | |
689 | ||
690 | skip_cow: | |
38320c70 | 691 | err = -ENOMEM; |
7021b2e1 | 692 | tmp = esp_alloc_tmp(aead, nfrags, seqhilen); |
38320c70 HX |
693 | if (!tmp) |
694 | goto out; | |
695 | ||
696 | ESP_SKB_CB(skb)->tmp = tmp; | |
962fcef3 | 697 | seqhi = esp_tmp_extra(tmp); |
0dc49e9b | 698 | iv = esp_tmp_iv(aead, tmp, seqhilen); |
38320c70 | 699 | req = esp_tmp_req(aead, iv); |
7021b2e1 | 700 | sg = esp_req_sg(aead, req); |
38320c70 | 701 | |
cac2661c | 702 | esp_input_set_header(skb, seqhi); |
38320c70 | 703 | |
cac2661c | 704 | sg_init_table(sg, nfrags); |
3f297707 JD |
705 | err = skb_to_sgvec(skb, sg, 0, skb->len); |
706 | if (unlikely(err < 0)) | |
707 | goto out; | |
38320c70 | 708 | |
cac2661c | 709 | skb->ip_summed = CHECKSUM_NONE; |
0dc49e9b | 710 | |
cac2661c | 711 | if ((x->props.flags & XFRM_STATE_ESN)) |
7021b2e1 | 712 | aead_request_set_callback(req, 0, esp_input_done_esn, skb); |
cac2661c SK |
713 | else |
714 | aead_request_set_callback(req, 0, esp_input_done, skb); | |
7021b2e1 HX |
715 | |
716 | aead_request_set_crypt(req, sg, sg, elen + ivlen, iv); | |
717 | aead_request_set_ad(req, assoclen); | |
38320c70 HX |
718 | |
719 | err = crypto_aead_decrypt(req); | |
720 | if (err == -EINPROGRESS) | |
721 | goto out; | |
722 | ||
7021b2e1 HX |
723 | if ((x->props.flags & XFRM_STATE_ESN)) |
724 | esp_input_restore_header(skb); | |
725 | ||
38320c70 | 726 | err = esp_input_done2(skb, err); |
1da177e4 LT |
727 | |
728 | out: | |
668dc8af | 729 | return err; |
1da177e4 LT |
730 | } |
731 | ||
c5c25238 | 732 | static u32 esp4_get_mtu(struct xfrm_state *x, int mtu) |
1da177e4 | 733 | { |
1c5ad13f MK |
734 | struct crypto_aead *aead = x->data; |
735 | u32 blksize = ALIGN(crypto_aead_blocksize(aead), 4); | |
91657eaf | 736 | unsigned int net_adj; |
0a69452c DB |
737 | |
738 | switch (x->props.mode) { | |
0a69452c | 739 | case XFRM_MODE_TRANSPORT: |
0a69452c | 740 | case XFRM_MODE_BEET: |
91657eaf | 741 | net_adj = sizeof(struct iphdr); |
0a69452c | 742 | break; |
91657eaf BP |
743 | case XFRM_MODE_TUNNEL: |
744 | net_adj = 0; | |
745 | break; | |
746 | default: | |
747 | BUG(); | |
1da177e4 | 748 | } |
0a69452c | 749 | |
1c5ad13f | 750 | return ((mtu - x->props.header_len - crypto_aead_authsize(aead) - |
123b0d1b | 751 | net_adj) & ~(blksize - 1)) + net_adj - 2; |
1da177e4 LT |
752 | } |
753 | ||
827789cb | 754 | static int esp4_err(struct sk_buff *skb, u32 info) |
1da177e4 | 755 | { |
4fb236ba | 756 | struct net *net = dev_net(skb->dev); |
b71d1d42 | 757 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
d9319100 | 758 | struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data+(iph->ihl<<2)); |
1da177e4 LT |
759 | struct xfrm_state *x; |
760 | ||
55be7a9c DM |
761 | switch (icmp_hdr(skb)->type) { |
762 | case ICMP_DEST_UNREACH: | |
763 | if (icmp_hdr(skb)->code != ICMP_FRAG_NEEDED) | |
827789cb | 764 | return 0; |
55be7a9c DM |
765 | case ICMP_REDIRECT: |
766 | break; | |
767 | default: | |
827789cb | 768 | return 0; |
55be7a9c | 769 | } |
1da177e4 | 770 | |
b71d1d42 ED |
771 | x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr, |
772 | esph->spi, IPPROTO_ESP, AF_INET); | |
1da177e4 | 773 | if (!x) |
827789cb | 774 | return 0; |
55be7a9c | 775 | |
387aa65a | 776 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) |
55be7a9c | 777 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ESP, 0); |
387aa65a | 778 | else |
55be7a9c | 779 | ipv4_redirect(skb, net, 0, 0, IPPROTO_ESP, 0); |
1da177e4 | 780 | xfrm_state_put(x); |
827789cb SK |
781 | |
782 | return 0; | |
1da177e4 LT |
783 | } |
784 | ||
785 | static void esp_destroy(struct xfrm_state *x) | |
786 | { | |
1c5ad13f | 787 | struct crypto_aead *aead = x->data; |
1da177e4 | 788 | |
1c5ad13f | 789 | if (!aead) |
1da177e4 LT |
790 | return; |
791 | ||
1c5ad13f | 792 | crypto_free_aead(aead); |
1da177e4 LT |
793 | } |
794 | ||
1a6509d9 | 795 | static int esp_init_aead(struct xfrm_state *x) |
1da177e4 | 796 | { |
7021b2e1 | 797 | char aead_name[CRYPTO_MAX_ALG_NAME]; |
1a6509d9 HX |
798 | struct crypto_aead *aead; |
799 | int err; | |
b3859c8e | 800 | u32 mask = 0; |
1a6509d9 | 801 | |
7021b2e1 HX |
802 | err = -ENAMETOOLONG; |
803 | if (snprintf(aead_name, CRYPTO_MAX_ALG_NAME, "%s(%s)", | |
804 | x->geniv, x->aead->alg_name) >= CRYPTO_MAX_ALG_NAME) | |
805 | goto error; | |
806 | ||
b3859c8e SK |
807 | if (x->xso.offload_handle) |
808 | mask |= CRYPTO_ALG_ASYNC; | |
809 | ||
810 | aead = crypto_alloc_aead(aead_name, 0, mask); | |
1a6509d9 HX |
811 | err = PTR_ERR(aead); |
812 | if (IS_ERR(aead)) | |
813 | goto error; | |
814 | ||
1c5ad13f | 815 | x->data = aead; |
1a6509d9 HX |
816 | |
817 | err = crypto_aead_setkey(aead, x->aead->alg_key, | |
818 | (x->aead->alg_key_len + 7) / 8); | |
819 | if (err) | |
820 | goto error; | |
821 | ||
822 | err = crypto_aead_setauthsize(aead, x->aead->alg_icv_len / 8); | |
823 | if (err) | |
824 | goto error; | |
825 | ||
826 | error: | |
827 | return err; | |
828 | } | |
829 | ||
830 | static int esp_init_authenc(struct xfrm_state *x) | |
831 | { | |
38320c70 HX |
832 | struct crypto_aead *aead; |
833 | struct crypto_authenc_key_param *param; | |
834 | struct rtattr *rta; | |
835 | char *key; | |
836 | char *p; | |
837 | char authenc_name[CRYPTO_MAX_ALG_NAME]; | |
38320c70 HX |
838 | unsigned int keylen; |
839 | int err; | |
b3859c8e | 840 | u32 mask = 0; |
1da177e4 | 841 | |
1a6509d9 | 842 | err = -EINVAL; |
51456b29 | 843 | if (!x->ealg) |
1a6509d9 | 844 | goto error; |
38320c70 | 845 | |
1a6509d9 | 846 | err = -ENAMETOOLONG; |
0dc49e9b SK |
847 | |
848 | if ((x->props.flags & XFRM_STATE_ESN)) { | |
849 | if (snprintf(authenc_name, CRYPTO_MAX_ALG_NAME, | |
7021b2e1 HX |
850 | "%s%sauthencesn(%s,%s)%s", |
851 | x->geniv ?: "", x->geniv ? "(" : "", | |
0dc49e9b | 852 | x->aalg ? x->aalg->alg_name : "digest_null", |
7021b2e1 HX |
853 | x->ealg->alg_name, |
854 | x->geniv ? ")" : "") >= CRYPTO_MAX_ALG_NAME) | |
0dc49e9b SK |
855 | goto error; |
856 | } else { | |
857 | if (snprintf(authenc_name, CRYPTO_MAX_ALG_NAME, | |
7021b2e1 HX |
858 | "%s%sauthenc(%s,%s)%s", |
859 | x->geniv ?: "", x->geniv ? "(" : "", | |
0dc49e9b | 860 | x->aalg ? x->aalg->alg_name : "digest_null", |
7021b2e1 HX |
861 | x->ealg->alg_name, |
862 | x->geniv ? ")" : "") >= CRYPTO_MAX_ALG_NAME) | |
0dc49e9b SK |
863 | goto error; |
864 | } | |
38320c70 | 865 | |
b3859c8e SK |
866 | if (x->xso.offload_handle) |
867 | mask |= CRYPTO_ALG_ASYNC; | |
868 | ||
869 | aead = crypto_alloc_aead(authenc_name, 0, mask); | |
38320c70 HX |
870 | err = PTR_ERR(aead); |
871 | if (IS_ERR(aead)) | |
872 | goto error; | |
873 | ||
1c5ad13f | 874 | x->data = aead; |
38320c70 HX |
875 | |
876 | keylen = (x->aalg ? (x->aalg->alg_key_len + 7) / 8 : 0) + | |
877 | (x->ealg->alg_key_len + 7) / 8 + RTA_SPACE(sizeof(*param)); | |
878 | err = -ENOMEM; | |
879 | key = kmalloc(keylen, GFP_KERNEL); | |
880 | if (!key) | |
881 | goto error; | |
882 | ||
883 | p = key; | |
884 | rta = (void *)p; | |
885 | rta->rta_type = CRYPTO_AUTHENC_KEYA_PARAM; | |
886 | rta->rta_len = RTA_LENGTH(sizeof(*param)); | |
887 | param = RTA_DATA(rta); | |
888 | p += RTA_SPACE(sizeof(*param)); | |
889 | ||
1da177e4 LT |
890 | if (x->aalg) { |
891 | struct xfrm_algo_desc *aalg_desc; | |
892 | ||
38320c70 HX |
893 | memcpy(p, x->aalg->alg_key, (x->aalg->alg_key_len + 7) / 8); |
894 | p += (x->aalg->alg_key_len + 7) / 8; | |
1da177e4 LT |
895 | |
896 | aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0); | |
897 | BUG_ON(!aalg_desc); | |
898 | ||
38320c70 | 899 | err = -EINVAL; |
45083497 | 900 | if (aalg_desc->uinfo.auth.icv_fullbits / 8 != |
38320c70 | 901 | crypto_aead_authsize(aead)) { |
45083497 JP |
902 | pr_info("ESP: %s digestsize %u != %hu\n", |
903 | x->aalg->alg_name, | |
904 | crypto_aead_authsize(aead), | |
905 | aalg_desc->uinfo.auth.icv_fullbits / 8); | |
38320c70 | 906 | goto free_key; |
1da177e4 LT |
907 | } |
908 | ||
38320c70 | 909 | err = crypto_aead_setauthsize( |
8f8a088c | 910 | aead, x->aalg->alg_trunc_len / 8); |
38320c70 HX |
911 | if (err) |
912 | goto free_key; | |
1da177e4 | 913 | } |
4b7137ff | 914 | |
38320c70 HX |
915 | param->enckeylen = cpu_to_be32((x->ealg->alg_key_len + 7) / 8); |
916 | memcpy(p, x->ealg->alg_key, (x->ealg->alg_key_len + 7) / 8); | |
917 | ||
918 | err = crypto_aead_setkey(aead, key, keylen); | |
919 | ||
920 | free_key: | |
921 | kfree(key); | |
922 | ||
1a6509d9 HX |
923 | error: |
924 | return err; | |
925 | } | |
926 | ||
927 | static int esp_init_state(struct xfrm_state *x) | |
928 | { | |
1a6509d9 HX |
929 | struct crypto_aead *aead; |
930 | u32 align; | |
931 | int err; | |
932 | ||
1c5ad13f | 933 | x->data = NULL; |
1a6509d9 HX |
934 | |
935 | if (x->aead) | |
936 | err = esp_init_aead(x); | |
937 | else | |
938 | err = esp_init_authenc(x); | |
939 | ||
38320c70 | 940 | if (err) |
1da177e4 | 941 | goto error; |
38320c70 | 942 | |
1c5ad13f | 943 | aead = x->data; |
1a6509d9 | 944 | |
38320c70 HX |
945 | x->props.header_len = sizeof(struct ip_esp_hdr) + |
946 | crypto_aead_ivsize(aead); | |
7e49e6de | 947 | if (x->props.mode == XFRM_MODE_TUNNEL) |
1da177e4 | 948 | x->props.header_len += sizeof(struct iphdr); |
eb49e630 | 949 | else if (x->props.mode == XFRM_MODE_BEET && x->sel.family != AF_INET6) |
ac758e3c | 950 | x->props.header_len += IPV4_BEET_PHMAXLEN; |
1da177e4 LT |
951 | if (x->encap) { |
952 | struct xfrm_encap_tmpl *encap = x->encap; | |
953 | ||
954 | switch (encap->encap_type) { | |
955 | default: | |
956 | goto error; | |
957 | case UDP_ENCAP_ESPINUDP: | |
958 | x->props.header_len += sizeof(struct udphdr); | |
959 | break; | |
960 | case UDP_ENCAP_ESPINUDP_NON_IKE: | |
961 | x->props.header_len += sizeof(struct udphdr) + 2 * sizeof(u32); | |
962 | break; | |
963 | } | |
964 | } | |
38320c70 HX |
965 | |
966 | align = ALIGN(crypto_aead_blocksize(aead), 4); | |
1c5ad13f | 967 | x->props.trailer_len = align + 1 + crypto_aead_authsize(aead); |
1da177e4 LT |
968 | |
969 | error: | |
38320c70 | 970 | return err; |
1da177e4 LT |
971 | } |
972 | ||
827789cb SK |
973 | static int esp4_rcv_cb(struct sk_buff *skb, int err) |
974 | { | |
975 | return 0; | |
976 | } | |
977 | ||
533cb5b0 | 978 | static const struct xfrm_type esp_type = |
1da177e4 LT |
979 | { |
980 | .description = "ESP4", | |
981 | .owner = THIS_MODULE, | |
982 | .proto = IPPROTO_ESP, | |
436a0a40 | 983 | .flags = XFRM_TYPE_REPLAY_PROT, |
1da177e4 LT |
984 | .init_state = esp_init_state, |
985 | .destructor = esp_destroy, | |
c5c25238 | 986 | .get_mtu = esp4_get_mtu, |
1da177e4 | 987 | .input = esp_input, |
fca11ebd | 988 | .output = esp_output, |
1da177e4 LT |
989 | }; |
990 | ||
827789cb | 991 | static struct xfrm4_protocol esp4_protocol = { |
1da177e4 | 992 | .handler = xfrm4_rcv, |
827789cb SK |
993 | .input_handler = xfrm_input, |
994 | .cb_handler = esp4_rcv_cb, | |
1da177e4 | 995 | .err_handler = esp4_err, |
827789cb | 996 | .priority = 0, |
1da177e4 LT |
997 | }; |
998 | ||
999 | static int __init esp4_init(void) | |
1000 | { | |
1da177e4 | 1001 | if (xfrm_register_type(&esp_type, AF_INET) < 0) { |
058bd4d2 | 1002 | pr_info("%s: can't add xfrm type\n", __func__); |
1da177e4 LT |
1003 | return -EAGAIN; |
1004 | } | |
827789cb | 1005 | if (xfrm4_protocol_register(&esp4_protocol, IPPROTO_ESP) < 0) { |
058bd4d2 | 1006 | pr_info("%s: can't add protocol\n", __func__); |
1da177e4 LT |
1007 | xfrm_unregister_type(&esp_type, AF_INET); |
1008 | return -EAGAIN; | |
1009 | } | |
1010 | return 0; | |
1011 | } | |
1012 | ||
1013 | static void __exit esp4_fini(void) | |
1014 | { | |
827789cb | 1015 | if (xfrm4_protocol_deregister(&esp4_protocol, IPPROTO_ESP) < 0) |
058bd4d2 | 1016 | pr_info("%s: can't remove protocol\n", __func__); |
1da177e4 | 1017 | if (xfrm_unregister_type(&esp_type, AF_INET) < 0) |
058bd4d2 | 1018 | pr_info("%s: can't remove xfrm type\n", __func__); |
1da177e4 LT |
1019 | } |
1020 | ||
1021 | module_init(esp4_init); | |
1022 | module_exit(esp4_fini); | |
1023 | MODULE_LICENSE("GPL"); | |
d3d6dd3a | 1024 | MODULE_ALIAS_XFRM_TYPE(AF_INET, XFRM_PROTO_ESP); |