| #include <linux/crypto.h> |
| #include <linux/scatterlist.h> |
| #define ESP_NUM_FAST_SG 4 |
| struct scatterlist sgbuf[ESP_NUM_FAST_SG]; |
| /* ivlen is offset from enc_data, where encrypted data start. |
| * It is logically different of crypto_tfm_alg_ivsize(tfm). |
| * We assume that it is either zero (no ivec), or |
| * >= crypto_tfm_alg_ivsize(tfm). */ |
| u8 *ivec; /* ivec buffer */ |
| struct crypto_blkcipher *tfm; /* crypto handle */ |
| /* Integrity. It is active when icv_full_len != 0 */ |
| extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); |
| static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb, |
| desc.tfm = esp->auth.tfm; |
| err = crypto_hash_init(&desc); |
| err = skb_icv_walk(skb, &desc, offset, len, crypto_hash_update); |
| return crypto_hash_final(&desc, esp->auth.work_icv); |
| static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb) |
| return (struct ip_esp_hdr *)skb_transport_header(skb); |