1 .\" $NetBSD: cgd.4,v 1.11 2008/09/12 16:51:55 christos Exp $
3 .\" Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Roland C. Dowdeswell.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
30 .Dd September 12, 2008
35 .Nd cryptographic disk driver
37 .Cd "pseudo-device cgd" Op Ar count
41 driver provides the capability of encrypting blocks on their way
42 to and from a disk or partition.
44 In order to compile support for the
46 into your kernel, you must add the driver to your kernel configuration
48 To do this, add a line similar to:
49 .Bd -unfilled -offset indent
50 pseudo-device cgd 4 # cryptographic disk driver
53 The count argument defines how many
55 may be configured at a time.
56 .Ss Encryption Algorithms
57 Currently the following cryptographic algorithms are supported:
58 .Bl -tag -width indentxxxxxxx
61 AES uses a 128 bit blocksize and can accept keys of
62 length 128, 192, or 256.
63 The default key length is 128.
65 Triple DES in CBC mode.
66 Triple DES uses a 64 bit blocksize and is
67 performed in EDE3 mode with a 168 bit key.
68 The key passed to the kernel
69 is 192 bits but the parity bits are ignored.
72 Blowfish uses a 64 bit blocksize and can accept keys between 40 and
73 448 bits in multiples of 8.
74 It is strongly encouraged that keys be at least 128 bits long.
75 There are no performance advantages of using shorter keys.
76 The default key length is 128 bits.
79 Currently, the following IV Methods are supported:
80 .Bl -tag -width encblkno1
82 This method encrypts the block number of the physical disk block once with
83 the cipher and key provided and uses the result as the IV for CBC mode.
84 This method should ensure that each block has a different IV and that the IV
85 is reasonably unpredictable.
86 This is the default method used by
91 This is the original IV method used by
93 and provided for backward compatibility.
94 It repeatedly encrypts the block number of the physical disk block
95 eight times and uses the result as the IV for CBC mode.
96 This method should ensure that each block has a different IV and that the IV
97 is reasonably unpredictable.
98 The eightfold encryption was not intended and causes a notable
99 performance loss with little (if any) increase in security over a
105 responds to all of the standard disk
109 and also defines the following:
110 .Bl -tag -width CGDIOCSET
116 sets up the encryption parameters and points the
118 at the underlying disk.
126 and their associated data structures are defined in
127 .Pa /usr/include/dev/cgdvar.h .
129 It goes without saying that if you forget the passphrase that you used
132 then you have irrevocably lost all of the data on the disk.
133 Please ensure that you are using an appropriate backup strategy.
135 .Bl -tag -width indentxxxxxxxxxxx
138 device special files.
149 driver was written by Roland C. Dowdeswell for
153 driver originally appeared in