Home | History | Annotate | Line # | Download | only in netipsec
xform.h revision 1.14.2.3
      1  1.14.2.3  pgoyette /*	$NetBSD: xform.h,v 1.14.2.3 2018/05/21 04:36:16 pgoyette Exp $	*/
      2  1.14.2.1  pgoyette /*	$FreeBSD: xform.h,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
      3       1.1  jonathan /*	$OpenBSD: ip_ipsp.h,v 1.119 2002/03/14 01:27:11 millert Exp $	*/
      4       1.1  jonathan /*
      5       1.1  jonathan  * The authors of this code are John Ioannidis (ji (at) tla.org),
      6       1.1  jonathan  * Angelos D. Keromytis (kermit (at) csd.uch.gr),
      7       1.1  jonathan  * Niels Provos (provos (at) physnet.uni-hamburg.de) and
      8       1.1  jonathan  * Niklas Hallqvist (niklas (at) appli.se).
      9       1.1  jonathan  *
     10       1.1  jonathan  * The original version of this code was written by John Ioannidis
     11       1.1  jonathan  * for BSD/OS in Athens, Greece, in November 1995.
     12       1.1  jonathan  *
     13       1.1  jonathan  * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
     14       1.1  jonathan  * by Angelos D. Keromytis.
     15       1.1  jonathan  *
     16       1.1  jonathan  * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
     17       1.1  jonathan  * and Niels Provos.
     18       1.1  jonathan  *
     19       1.1  jonathan  * Additional features in 1999 by Angelos D. Keromytis and Niklas Hallqvist.
     20       1.1  jonathan  *
     21       1.1  jonathan  * Copyright (c) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,
     22       1.1  jonathan  * Angelos D. Keromytis and Niels Provos.
     23       1.1  jonathan  * Copyright (c) 1999 Niklas Hallqvist.
     24       1.1  jonathan  * Copyright (c) 2001, Angelos D. Keromytis.
     25       1.1  jonathan  *
     26       1.1  jonathan  * Permission to use, copy, and modify this software with or without fee
     27       1.1  jonathan  * is hereby granted, provided that this entire notice is included in
     28       1.1  jonathan  * all copies of any software which is or includes a copy or
     29       1.1  jonathan  * modification of this software.
     30       1.1  jonathan  * You may use this code under the GNU public license if you so wish. Please
     31       1.1  jonathan  * contribute changes back to the authors under this freer than GPL license
     32       1.1  jonathan  * so that we may further the use of strong encryption without limitations to
     33       1.1  jonathan  * all.
     34       1.1  jonathan  *
     35       1.1  jonathan  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
     36       1.1  jonathan  * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
     37       1.1  jonathan  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
     38       1.1  jonathan  * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
     39       1.1  jonathan  * PURPOSE.
     40       1.1  jonathan  */
     41       1.1  jonathan 
     42       1.1  jonathan #ifndef _NETIPSEC_XFORM_H_
     43       1.1  jonathan #define _NETIPSEC_XFORM_H_
     44       1.1  jonathan 
     45       1.1  jonathan #include <sys/types.h>
     46       1.1  jonathan #include <netinet/in.h>
     47       1.1  jonathan #include <opencrypto/xform.h>
     48       1.1  jonathan 
     49       1.1  jonathan /*
     50       1.1  jonathan  * Opaque data structure hung off a crypto operation descriptor.
     51       1.1  jonathan  */
     52      1.10     ozaki struct secasvar;
     53       1.1  jonathan struct tdb_crypto {
     54      1.12     ozaki 	const struct ipsecrequest *tc_isr;	/* ipsec request state */
     55       1.1  jonathan 	u_int32_t		tc_spi;		/* associated SPI */
     56       1.1  jonathan 	union sockaddr_union	tc_dst;		/* dst addr of packet */
     57       1.1  jonathan 	u_int8_t		tc_proto;	/* current protocol, e.g. AH */
     58       1.1  jonathan 	u_int8_t		tc_nxt;		/* next protocol, e.g. IPV4 */
     59       1.1  jonathan 	int			tc_protoff;	/* current protocol offset */
     60       1.1  jonathan 	int			tc_skip;	/* data offset */
     61      1.10     ozaki 	struct secasvar		*tc_sav;	/* ipsec SA */
     62       1.1  jonathan };
     63       1.1  jonathan 
     64       1.1  jonathan struct ipescrequest;
     65       1.1  jonathan 
     66       1.1  jonathan struct xformsw {
     67  1.14.2.3  pgoyette 	u_short xf_type;
     68       1.1  jonathan #define	XF_IP4		1	/* IP inside IP */
     69       1.1  jonathan #define	XF_AH		2	/* AH */
     70       1.1  jonathan #define	XF_ESP		3	/* ESP */
     71       1.1  jonathan #define	XF_TCPSIGNATURE	5	/* TCP MD5 Signature option, RFC 2358 */
     72       1.1  jonathan #define	XF_IPCOMP	6	/* IPCOMP */
     73  1.14.2.3  pgoyette 	u_short xf_flags;
     74       1.1  jonathan #define	XFT_AUTH	0x0001
     75       1.1  jonathan #define	XFT_CONF	0x0100
     76       1.1  jonathan #define	XFT_COMP	0x1000
     77  1.14.2.3  pgoyette 	const char *xf_name;
     78  1.14.2.3  pgoyette 	int (*xf_init)(struct secasvar *, const struct xformsw *);
     79  1.14.2.3  pgoyette 	int (*xf_zeroize)(struct secasvar *);
     80  1.14.2.3  pgoyette 	int (*xf_input)(struct mbuf *, struct secasvar *, int, int);
     81  1.14.2.3  pgoyette 	int (*xf_output)(struct mbuf *, const struct ipsecrequest *,
     82  1.14.2.3  pgoyette 	    struct secasvar *, int, int);
     83  1.14.2.3  pgoyette 	struct xformsw *xf_next;	/* list of registered xforms */
     84       1.1  jonathan };
     85       1.1  jonathan 
     86       1.1  jonathan #ifdef _KERNEL
     87  1.14.2.3  pgoyette void xform_register(struct xformsw *);
     88  1.14.2.3  pgoyette int xform_init(struct secasvar *sav, int);
     89       1.1  jonathan 
     90       1.1  jonathan struct cryptoini;
     91       1.1  jonathan 
     92       1.1  jonathan /* XF_IP4 */
     93  1.14.2.3  pgoyette int ipip_output(struct mbuf *, struct secasvar *, struct mbuf **);
     94       1.1  jonathan 
     95       1.1  jonathan /* XF_AH */
     96      1.14      maxv int ah_init0(struct secasvar *, const struct xformsw *, struct cryptoini *);
     97  1.14.2.3  pgoyette int ah_zeroize(struct secasvar *);
     98  1.14.2.3  pgoyette const struct auth_hash *ah_algorithm_lookup(int);
     99      1.14      maxv size_t ah_hdrsiz(const struct secasvar *);
    100       1.1  jonathan 
    101       1.1  jonathan /* XF_ESP */
    102  1.14.2.3  pgoyette const struct enc_xform *esp_algorithm_lookup(int);
    103  1.14.2.3  pgoyette size_t esp_hdrsiz(const struct secasvar *);
    104       1.1  jonathan 
    105       1.1  jonathan /* XF_COMP */
    106  1.14.2.3  pgoyette const struct comp_algo *ipcomp_algorithm_lookup(int);
    107       1.1  jonathan 
    108       1.1  jonathan #endif /* _KERNEL */
    109       1.3      elad #endif /* !_NETIPSEC_XFORM_H_ */
    110