Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 81848
b: refs/heads/master
c: 38320c7
h: refs/heads/master
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Feb 1, 2008
1 parent 9cf2f53 commit 08e85d3
Show file tree
Hide file tree
Showing 6 changed files with 592 additions and 423 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bf164cc054d568fa7889ffab41d3b091f5758c75
refs/heads/master: 38320c70d282be1997a5204c7c7fe14c3aa6bfaa
54 changes: 8 additions & 46 deletions trunk/include/net/esp.h
Original file line number Diff line number Diff line change
@@ -1,58 +1,20 @@
#ifndef _NET_ESP_H
#define _NET_ESP_H

#include <linux/crypto.h>
#include <net/xfrm.h>
#include <linux/scatterlist.h>
#include <linux/skbuff.h>

#define ESP_NUM_FAST_SG 4
struct crypto_aead;

struct esp_data
{
struct scatterlist sgbuf[ESP_NUM_FAST_SG];

/* Confidentiality */
struct {
int padlen; /* 0..255 */
/* 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). */
int ivlen;
int ivinitted;
u8 *ivec; /* ivec buffer */
struct crypto_blkcipher *tfm; /* crypto handle */
} conf;

/* Integrity. It is active when icv_full_len != 0 */
struct {
u8 *work_icv;
int icv_full_len;
int icv_trunc_len;
struct crypto_hash *tfm;
} auth;
struct esp_data {
/* 0..255 */
int padlen;

/* Confidentiality & Integrity */
struct crypto_aead *aead;
};

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,
int offset, int len)
{
struct hash_desc desc;
int err;

desc.tfm = esp->auth.tfm;
desc.flags = 0;

err = crypto_hash_init(&desc);
if (unlikely(err))
return err;
err = skb_icv_walk(skb, &desc, offset, len, crypto_hash_update);
if (unlikely(err))
return err;
return crypto_hash_final(&desc, esp->auth.work_icv);
}

struct ip_esp_hdr;

static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
Expand Down
1 change: 1 addition & 0 deletions trunk/net/ipv4/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ config INET_ESP
tristate "IP: ESP transformation"
select XFRM
select CRYPTO
select CRYPTO_AEAD
select CRYPTO_HMAC
select CRYPTO_MD5
select CRYPTO_CBC
Expand Down
Loading

0 comments on commit 08e85d3

Please sign in to comment.