xref: /netbsd-src/sys/opencrypto/cryptosoft.h (revision 2e4e5505e2e0a179143abf046a71405371c56161)
1*2e4e5505Sdrochner /*	$NetBSD: cryptosoft.h,v 1.7 2011/02/10 21:00:42 drochner Exp $ */
2cdfce9ceSjonathan /*	$OpenBSD: cryptosoft.h,v 1.10 2002/04/22 23:10:09 deraadt Exp $	*/
3cdfce9ceSjonathan 
4cdfce9ceSjonathan /*
5cdfce9ceSjonathan  * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
6cdfce9ceSjonathan  *
7cdfce9ceSjonathan  * This code was written by Angelos D. Keromytis in Athens, Greece, in
8cdfce9ceSjonathan  * February 2000. Network Security Technologies Inc. (NSTI) kindly
9cdfce9ceSjonathan  * supported the development of this code.
10cdfce9ceSjonathan  *
11cdfce9ceSjonathan  * Copyright (c) 2000 Angelos D. Keromytis
12cdfce9ceSjonathan  *
13cdfce9ceSjonathan  * Permission to use, copy, and modify this software with or without fee
14cdfce9ceSjonathan  * is hereby granted, provided that this entire notice is included in
15cdfce9ceSjonathan  * all source code copies of any software which is or includes a copy or
16cdfce9ceSjonathan  * modification of this software.
17cdfce9ceSjonathan  *
18cdfce9ceSjonathan  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
19cdfce9ceSjonathan  * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
20cdfce9ceSjonathan  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
21cdfce9ceSjonathan  * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
22cdfce9ceSjonathan  * PURPOSE.
23cdfce9ceSjonathan  */
24cdfce9ceSjonathan 
25cdfce9ceSjonathan #ifndef _CRYPTO_CRYPTOSOFT_H_
26cdfce9ceSjonathan #define _CRYPTO_CRYPTOSOFT_H_
27cdfce9ceSjonathan 
28cdfce9ceSjonathan /* Software session entry */
29cdfce9ceSjonathan struct swcr_data {
30cdfce9ceSjonathan 	int		sw_alg;		/* Algorithm */
31cdfce9ceSjonathan 	union {
32cdfce9ceSjonathan 		struct {
33cdfce9ceSjonathan 			u_int8_t	 *SW_ictx;
34cdfce9ceSjonathan 			u_int8_t	 *SW_octx;
35cdfce9ceSjonathan 			u_int32_t	 SW_klen;
367bc6d90cSthorpej 			const struct swcr_auth_hash *SW_axf;
37cdfce9ceSjonathan 		} SWCR_AUTH;
38cdfce9ceSjonathan 		struct {
39cdfce9ceSjonathan 			u_int8_t	 *SW_kschedule;
407bc6d90cSthorpej 			const struct swcr_enc_xform *SW_exf;
41cdfce9ceSjonathan 		} SWCR_ENC;
42cdfce9ceSjonathan 		struct {
437bc6d90cSthorpej 			const struct swcr_comp_algo *SW_cxf;
44cdfce9ceSjonathan 		} SWCR_COMP;
45cdfce9ceSjonathan 	} SWCR_UN;
46cdfce9ceSjonathan 
47cdfce9ceSjonathan #define sw_ictx		SWCR_UN.SWCR_AUTH.SW_ictx
48cdfce9ceSjonathan #define sw_octx		SWCR_UN.SWCR_AUTH.SW_octx
49cdfce9ceSjonathan #define sw_klen		SWCR_UN.SWCR_AUTH.SW_klen
50cdfce9ceSjonathan #define sw_axf		SWCR_UN.SWCR_AUTH.SW_axf
51cdfce9ceSjonathan #define sw_kschedule	SWCR_UN.SWCR_ENC.SW_kschedule
52cdfce9ceSjonathan #define sw_exf		SWCR_UN.SWCR_ENC.SW_exf
53cdfce9ceSjonathan #define sw_cxf		SWCR_UN.SWCR_COMP.SW_cxf
54cdfce9ceSjonathan 
55cdfce9ceSjonathan 	struct swcr_data *sw_next;
56cdfce9ceSjonathan };
57cdfce9ceSjonathan 
58c339e558Sdaniel #ifdef _KERNEL
59c339e558Sdaniel int swcr_authcompute(struct cryptop *crp, struct cryptodesc *crd,
60*2e4e5505Sdrochner     const struct swcr_data *sw, void *buf, int outtype);
61c339e558Sdaniel #endif /* _KERNEL */
62c339e558Sdaniel 
63cdfce9ceSjonathan #endif /* _CRYPTO_CRYPTO_H_ */
64