1 /* $NetBSD: cgdvar.h,v 1.12 2008/09/12 16:51:55 christos Exp $ */
4 * Copyright (c) 2002 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Roland C. Dowdeswell.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _DEV_CGDVAR_H_
33 #define _DEV_CGDVAR_H_
35 #include <sys/simplelock.h>
44 const char *ci_ivmethod
;
52 #include <dev/cgd_crypto.h>
54 /* This cryptdata structure is here rather than cgd_crypto.h, since
55 * it stores local state which will not be generalised beyond the
60 size_t cf_blocksize
; /* block size (in bytes) */
61 int cf_mode
; /* Cipher Mode and IV Gen method */
62 #define CGD_CIPHER_CBC_ENCBLKNO8 1 /* CBC Mode w/ Enc Block Number
63 * 8 passes (compat only)
65 #define CGD_CIPHER_CBC_ENCBLKNO1 2 /* CBC Mode w/ Enc Block Number
68 void *cf_priv
; /* enc alg private data */
72 struct dk_softc sc_dksc
; /* generic disk interface */
73 struct cryptinfo
*sc_crypt
; /* the alg/key/etc */
74 struct vnode
*sc_tvn
; /* target device's vnode */
75 dev_t sc_tdev
; /* target device */
76 char *sc_tpath
; /* target device's path */
77 void * sc_data
; /* emergency buffer */
78 int sc_data_used
; /* Really lame, we'll change */
79 size_t sc_tpathlen
; /* length of prior string */
80 struct cryptdata sc_cdata
; /* crypto data */
81 struct cryptfuncs
*sc_cfuncs
; /* encryption functions */
82 struct simplelock sc_slock
; /* our lock */
86 /* XXX XAX XXX elric: check these out properly. */
87 #define CGDIOCSET _IOWR('F', 18, struct cgd_ioctl)
88 #define CGDIOCCLR _IOW('F', 19, struct cgd_ioctl)
90 /* Maximum block sized to be used by the ciphers */
91 #define CGD_MAXBLOCKSIZE 128
93 #endif /* _DEV_CGDVAR_H_ */