0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _NET_SEG6_HMAC_H
0010 #define _NET_SEG6_HMAC_H
0011
0012 #include <net/flow.h>
0013 #include <net/ip6_fib.h>
0014 #include <net/sock.h>
0015 #include <linux/ip.h>
0016 #include <linux/ipv6.h>
0017 #include <linux/route.h>
0018 #include <net/seg6.h>
0019 #include <linux/seg6_hmac.h>
0020 #include <linux/rhashtable-types.h>
0021
0022 #define SEG6_HMAC_MAX_DIGESTSIZE 160
0023 #define SEG6_HMAC_RING_SIZE 256
0024
0025 struct seg6_hmac_info {
0026 struct rhash_head node;
0027 struct rcu_head rcu;
0028
0029 u32 hmackeyid;
0030 char secret[SEG6_HMAC_SECRET_LEN];
0031 u8 slen;
0032 u8 alg_id;
0033 };
0034
0035 struct seg6_hmac_algo {
0036 u8 alg_id;
0037 char name[64];
0038 struct crypto_shash * __percpu *tfms;
0039 struct shash_desc * __percpu *shashs;
0040 };
0041
0042 extern int seg6_hmac_compute(struct seg6_hmac_info *hinfo,
0043 struct ipv6_sr_hdr *hdr, struct in6_addr *saddr,
0044 u8 *output);
0045 extern struct seg6_hmac_info *seg6_hmac_info_lookup(struct net *net, u32 key);
0046 extern int seg6_hmac_info_add(struct net *net, u32 key,
0047 struct seg6_hmac_info *hinfo);
0048 extern int seg6_hmac_info_del(struct net *net, u32 key);
0049 extern int seg6_push_hmac(struct net *net, struct in6_addr *saddr,
0050 struct ipv6_sr_hdr *srh);
0051 extern bool seg6_hmac_validate_skb(struct sk_buff *skb);
0052 extern int seg6_hmac_init(void);
0053 extern void seg6_hmac_exit(void);
0054 extern int seg6_hmac_net_init(struct net *net);
0055 extern void seg6_hmac_net_exit(struct net *net);
0056
0057 #endif