]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - include/net/esp.h
4 #include <linux/crypto.h>
6 #include <asm/scatterlist.h>
8 #define ESP_NUM_FAST_SG 4
12 struct scatterlist sgbuf
[ESP_NUM_FAST_SG
];
17 int key_len
; /* Key length */
18 int padlen
; /* 0..255 */
19 /* ivlen is offset from enc_data, where encrypted data start.
20 * It is logically different of crypto_tfm_alg_ivsize(tfm).
21 * We assume that it is either zero (no ivec), or
22 * >= crypto_tfm_alg_ivsize(tfm). */
25 u8
*ivec
; /* ivec buffer */
26 struct crypto_blkcipher
*tfm
; /* crypto handle */
29 /* Integrity. It is active when icv_full_len != 0 */
32 int key_len
; /* Length of the key */
36 void (*icv
)(struct esp_data
*,
38 int offset
, int len
, u8
*icv
);
39 struct crypto_hash
*tfm
;
43 extern int skb_to_sgvec(struct sk_buff
*skb
, struct scatterlist
*sg
, int offset
, int len
);
44 extern int skb_cow_data(struct sk_buff
*skb
, int tailbits
, struct sk_buff
**trailer
);
45 extern void *pskb_put(struct sk_buff
*skb
, struct sk_buff
*tail
, int len
);
47 static inline int esp_mac_digest(struct esp_data
*esp
, struct sk_buff
*skb
,
50 struct hash_desc desc
;
53 desc
.tfm
= esp
->auth
.tfm
;
56 err
= crypto_hash_init(&desc
);
59 err
= skb_icv_walk(skb
, &desc
, offset
, len
, crypto_hash_update
);
62 return crypto_hash_final(&desc
, esp
->auth
.work_icv
);