diff options
| author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-02-19 06:14:24 +0000 |
|---|---|---|
| committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-02-19 06:14:24 +0000 |
| commit | 6fafeb146e9efd59140ea58cebd7dd38ae9a6379 (patch) | |
| tree | 7db89ba6a28932514b105d620bba4884ec332ec3 /libdde_linux26/contrib/include/net/ah.h | |
| parent | 38c2c2458e3f4ecb329ff35621806252aac209b9 (diff) | |
| parent | 8df772b3c665e663f6f9d2a70f9c691590bd3f91 (diff) | |
Merge branch 'dde' into upstream-merged
Diffstat (limited to 'libdde_linux26/contrib/include/net/ah.h')
| -rw-r--r-- | libdde_linux26/contrib/include/net/ah.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libdde_linux26/contrib/include/net/ah.h b/libdde_linux26/contrib/include/net/ah.h new file mode 100644 index 00000000..ae1c322f --- /dev/null +++ b/libdde_linux26/contrib/include/net/ah.h @@ -0,0 +1,48 @@ +#ifndef _NET_AH_H +#define _NET_AH_H + +#include <linux/crypto.h> +#include <net/xfrm.h> + +/* This is the maximum truncated ICV length that we know of. */ +#define MAX_AH_AUTH_LEN 12 + +struct ah_data +{ + u8 *work_icv; + int icv_full_len; + int icv_trunc_len; + + struct crypto_hash *tfm; +}; + +static inline int ah_mac_digest(struct ah_data *ahp, struct sk_buff *skb, + u8 *auth_data) +{ + struct hash_desc desc; + int err; + + desc.tfm = ahp->tfm; + desc.flags = 0; + + memset(auth_data, 0, ahp->icv_trunc_len); + err = crypto_hash_init(&desc); + if (unlikely(err)) + goto out; + err = skb_icv_walk(skb, &desc, 0, skb->len, crypto_hash_update); + if (unlikely(err)) + goto out; + err = crypto_hash_final(&desc, ahp->work_icv); + +out: + return err; +} + +struct ip_auth_hdr; + +static inline struct ip_auth_hdr *ip_auth_hdr(const struct sk_buff *skb) +{ + return (struct ip_auth_hdr *)skb_transport_header(skb); +} + +#endif |
