xref: /freebsd/contrib/netbsd-tests/dev/cgd/t_cgd_3des.c (revision 924226fba12cc9a228c73b956e1b7fa24c60b055)
1 /*	$NetBSD: t_cgd_3des.c,v 1.2 2017/01/13 21:30:39 christos Exp $	*/
2 /*-
3  * Copyright (c) 2016 The NetBSD Foundation, Inc.
4  * All rights reserved.
5  *
6  * This code is derived from software contributed to The NetBSD Foundation
7  * by Alexander Nasonov.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
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
17  *    the documentation and/or other materials provided with the
18  *    distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
24  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33 
34 #include <sys/types.h>
35 #include <sys/ioctl.h>
36 #include <sys/sysctl.h>
37 
38 #include <atf-c.h>
39 #include <fcntl.h>
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <string.h>
43 #include <unistd.h>
44 #include <util.h>
45 
46 #include <dev/cgdvar.h>
47 
48 #include <rump/rump.h>
49 #include <rump/rump_syscalls.h>
50 
51 #include "h_macros.h"
52 
53 #define SECSIZE 512
54 
55 struct testvec {
56 	unsigned int blkno;
57 	const uint8_t *ptxt;	/* PlainText  */
58 	const uint8_t *ctxt;	/* CipherText */
59 };
60 
61 /*
62  * 192 bits CBC key, NUL terminated.
63  */
64 static const char c3des_cbc_192_key[25] = {
65 	0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, /* ABCDEFGH */
66 	0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* IJKLMNOP */
67 	0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* QRSTUVWX */
68 	0
69 };
70 
71 static const uint8_t c3des_cbc_ptxt[SECSIZE] =
72 	"                abcdefghijklmnop"
73 	"                abcdefghijklmnop"
74 	"                abcdefghijklmnop"
75 	"                abcdefghijklmnop"
76 	"                abcdefghijklmnop"
77 	"                abcdefghijklmnop"
78 	"                abcdefghijklmnop"
79 	"                abcdefghijklmnop"
80 	"                abcdefghijklmnop"
81 	"                abcdefghijklmnop"
82 	"                abcdefghijklmnop"
83 	"                abcdefghijklmnop"
84 	"                abcdefghijklmnop"
85 	"                abcdefghijklmnop"
86 	"                abcdefghijklmnop"
87 	"                abcdefghijklmnop";
88 
89 /*
90  * IV method encblkno1, blkno 0.
91  */
92 static const uint8_t c3des_cbc_192_encblkno1_vec0_ctxt[SECSIZE] = {
93 	0x19, 0x92, 0xc8, 0xce, 0xdf, 0xa3, 0x14, 0xef,
94 	0xff, 0x88, 0x9f, 0x01, 0xfa, 0x6f, 0xfa, 0xa6,
95 	0xdd, 0x2b, 0x43, 0x67, 0xfa, 0xce, 0x37, 0x95,
96 	0x73, 0x4d, 0x18, 0x33, 0x0c, 0x29, 0xb6, 0xbb,
97 	0x37, 0x77, 0x31, 0x74, 0xf6, 0x62, 0x03, 0xd2,
98 	0x78, 0x13, 0x55, 0xf6, 0x58, 0x49, 0xaf, 0x2a,
99 	0x15, 0x4c, 0xc2, 0x4a, 0x55, 0x99, 0x82, 0xb9,
100 	0xfb, 0x8b, 0x4f, 0x92, 0xe3, 0xbc, 0x9b, 0x09,
101 	0x42, 0x7b, 0x5f, 0x54, 0xed, 0xf0, 0xcb, 0x5d,
102 	0x93, 0xba, 0x09, 0x4b, 0x20, 0xf3, 0xe6, 0x44,
103 	0x30, 0x5e, 0x9e, 0xfc, 0x7a, 0x3c, 0x7d, 0x11,
104 	0x63, 0xea, 0x40, 0x94, 0xaa, 0xd0, 0xa9, 0xf6,
105 	0xc7, 0x1e, 0x8f, 0xc8, 0xa6, 0x2c, 0xf7, 0xeb,
106 	0x51, 0x26, 0xdc, 0xf8, 0x73, 0xf9, 0xb4, 0xa8,
107 	0x80, 0x4a, 0xe5, 0x6f, 0xb6, 0x33, 0x13, 0x6b,
108 	0x1b, 0x7d, 0x00, 0xde, 0x44, 0x7e, 0x26, 0xa2,
109 	0x82, 0xa7, 0x80, 0x16, 0x34, 0xde, 0xb9, 0x82,
110 	0x4c, 0x42, 0x8e, 0x0d, 0x48, 0x7e, 0x38, 0xbd,
111 	0x1d, 0x7d, 0x98, 0xbb, 0x11, 0x8a, 0x72, 0x14,
112 	0x4e, 0xaa, 0xd0, 0xef, 0x4d, 0x7f, 0xa3, 0xa6,
113 	0xfc, 0x85, 0x9d, 0x74, 0x63, 0x9d, 0xe4, 0x5c,
114 	0xf7, 0xa8, 0xd0, 0xd7, 0x95, 0xb4, 0x28, 0x64,
115 	0x41, 0x2d, 0x5d, 0xd9, 0xba, 0x79, 0xa7, 0xb3,
116 	0x9c, 0x16, 0xfa, 0xb8, 0x10, 0x5d, 0x1d, 0xd4,
117 	0xce, 0xad, 0x67, 0x27, 0x91, 0x8a, 0xb3, 0xbc,
118 	0x37, 0x20, 0x95, 0xac, 0xf7, 0x0d, 0xe0, 0x1e,
119 	0x59, 0xa7, 0xe5, 0x81, 0x82, 0x6a, 0x71, 0x07,
120 	0x85, 0x43, 0x43, 0xdb, 0xbf, 0x56, 0xb0, 0x0a,
121 	0x4c, 0xf1, 0xcd, 0xcd, 0xa3, 0x9a, 0x10, 0x8e,
122 	0x0c, 0xe2, 0x6d, 0xf2, 0x16, 0xd0, 0x4c, 0xac,
123 	0xf9, 0xfc, 0xc9, 0x56, 0x1f, 0x31, 0x89, 0x1c,
124 	0xfa, 0xb7, 0x49, 0xea, 0x69, 0x91, 0xfe, 0x45,
125 	0x96, 0x5e, 0x45, 0xc3, 0x2c, 0xb1, 0x40, 0xd9,
126 	0x1f, 0x82, 0x3f, 0xc1, 0x45, 0x7c, 0x39, 0x72,
127 	0x6f, 0x52, 0xe4, 0xaf, 0x15, 0xa4, 0xe2, 0xd4,
128 	0xa1, 0xa4, 0xb2, 0xb5, 0x4a, 0x0b, 0xad, 0xe4,
129 	0x1e, 0x5c, 0x26, 0x62, 0x81, 0x78, 0x3e, 0xd3,
130 	0x6a, 0x98, 0x94, 0x2a, 0x00, 0xa7, 0xe4, 0x04,
131 	0x9d, 0x9a, 0xfc, 0xcf, 0xad, 0x2b, 0xba, 0x9b,
132 	0x40, 0x1e, 0x71, 0x3a, 0xb6, 0x92, 0xc4, 0xc5,
133 	0x56, 0x58, 0x92, 0x2a, 0x69, 0xbe, 0x0f, 0xb0,
134 	0x91, 0xae, 0xaa, 0x3f, 0x07, 0xe8, 0xf9, 0x71,
135 	0x20, 0x06, 0xed, 0xe0, 0x80, 0xec, 0xc9, 0xe7,
136 	0x54, 0xaa, 0xaa, 0xf4, 0x4c, 0xb2, 0x34, 0xf7,
137 	0x8a, 0x76, 0xc2, 0x4a, 0xae, 0x71, 0x7a, 0x07,
138 	0xd7, 0xec, 0x75, 0x2f, 0x8a, 0x99, 0x59, 0x13,
139 	0xd0, 0x8d, 0x18, 0x69, 0x0d, 0xd9, 0x39, 0x73,
140 	0x2b, 0xd0, 0xa3, 0xbc, 0x9e, 0x29, 0x4d, 0x88,
141 	0xff, 0x98, 0x02, 0xb4, 0xcf, 0xa1, 0xf9, 0x2a,
142 	0xa6, 0xef, 0x7c, 0x72, 0x26, 0x4e, 0xd7, 0xdf,
143 	0xec, 0x3a, 0xbc, 0x8e, 0xe6, 0xb3, 0x2b, 0x43,
144 	0xcd, 0x67, 0x8b, 0x72, 0x00, 0x6f, 0xe5, 0x85,
145 	0xe2, 0x2a, 0x4c, 0x8d, 0x02, 0x44, 0x6b, 0x7a,
146 	0x89, 0x7a, 0x18, 0x3b, 0xc8, 0x9c, 0x8d, 0x60,
147 	0xec, 0x79, 0x58, 0x15, 0x98, 0x71, 0x4b, 0x1a,
148 	0x34, 0x69, 0x96, 0xd0, 0x0f, 0x01, 0x27, 0x2e,
149 	0x19, 0x02, 0xf0, 0x17, 0x8c, 0x89, 0xbf, 0x05,
150 	0xf0, 0xfe, 0xc3, 0xe6, 0x90, 0x9d, 0xa2, 0xb1,
151 	0x40, 0x06, 0x7e, 0xcd, 0x20, 0x7e, 0x5f, 0x54,
152 	0x31, 0xfb, 0x79, 0x84, 0x47, 0x38, 0x71, 0x69,
153 	0xe1, 0xd5, 0x4e, 0x84, 0xa3, 0x2b, 0x4a, 0x86,
154 	0xc2, 0x21, 0x5b, 0x15, 0xc3, 0x63, 0xbb, 0xc5,
155 	0x5c, 0xc1, 0xfb, 0x31, 0x3a, 0x4d, 0xb1, 0x9e,
156 	0xe1, 0xd8, 0x67, 0x4b, 0x08, 0x42, 0xc4, 0xe8,
157 };
158 
159 /*
160  * IV method encblkno1, blkno 1.
161  */
162 static const uint8_t c3des_cbc_192_encblkno1_vec1_ctxt[SECSIZE] = {
163 	0x1d, 0x65, 0xdf, 0x01, 0x9b, 0x24, 0xa5, 0x10,
164 	0x94, 0x9a, 0x5b, 0x81, 0x96, 0x4e, 0xa3, 0x42,
165 	0x42, 0xd5, 0x05, 0x52, 0xab, 0x3c, 0x67, 0x40,
166 	0x79, 0xf9, 0x4b, 0x58, 0x39, 0xf6, 0xd0, 0x97,
167 	0x48, 0xf4, 0x77, 0xb8, 0xac, 0xe2, 0x10, 0x66,
168 	0xa8, 0x04, 0x0a, 0x1e, 0xa6, 0xbb, 0x4c, 0xd9,
169 	0x5d, 0x0c, 0x11, 0xb5, 0xe0, 0x26, 0x84, 0x50,
170 	0x10, 0x80, 0xbf, 0xd6, 0xdc, 0x82, 0x53, 0x0a,
171 	0xcf, 0xf6, 0xd3, 0x07, 0x45, 0xb0, 0x8e, 0x36,
172 	0x2e, 0x60, 0x0f, 0xd0, 0xc1, 0xb9, 0xd8, 0x29,
173 	0x6e, 0x13, 0x8e, 0xc1, 0xa8, 0x63, 0x20, 0xe0,
174 	0x8d, 0x47, 0x8b, 0xf9, 0xa0, 0x60, 0x55, 0x53,
175 	0x1d, 0xaf, 0x43, 0x46, 0xe5, 0x10, 0xd5, 0xcd,
176 	0x91, 0x9e, 0x11, 0x4a, 0x6f, 0x6a, 0x13, 0xdf,
177 	0xee, 0x7a, 0x88, 0xbe, 0x59, 0x96, 0xdb, 0x65,
178 	0x25, 0x57, 0x9e, 0x82, 0xad, 0xc2, 0xd6, 0x28,
179 	0x96, 0xb3, 0x7f, 0x57, 0x5d, 0xb2, 0xfa, 0x60,
180 	0x43, 0x22, 0xa5, 0x33, 0x14, 0x99, 0x8f, 0x68,
181 	0x5a, 0x7f, 0xaf, 0x9e, 0xe9, 0x23, 0x57, 0x9b,
182 	0x52, 0xe9, 0x20, 0x59, 0x26, 0x89, 0x9b, 0x59,
183 	0xb0, 0xee, 0xe8, 0x6d, 0x06, 0x8c, 0x01, 0xc2,
184 	0xea, 0xbc, 0x7d, 0x93, 0x3f, 0x79, 0x7f, 0xeb,
185 	0x57, 0xc9, 0x0a, 0xca, 0x37, 0x81, 0xa7, 0x82,
186 	0xde, 0x37, 0x7d, 0x69, 0x01, 0xaa, 0x19, 0x98,
187 	0x26, 0xfe, 0x06, 0x83, 0xeb, 0x9d, 0x26, 0xdc,
188 	0x04, 0x5d, 0xc9, 0x05, 0xee, 0x1a, 0xd3, 0xeb,
189 	0x20, 0x8c, 0xb7, 0x99, 0x75, 0xe0, 0x19, 0x98,
190 	0xca, 0x83, 0xae, 0x94, 0x28, 0xbf, 0x47, 0x42,
191 	0x92, 0x05, 0x8c, 0xaa, 0xeb, 0x99, 0x0f, 0xcc,
192 	0x33, 0x79, 0x24, 0x62, 0xa0, 0x7a, 0x65, 0xcb,
193 	0x53, 0xb7, 0x86, 0x0d, 0xcb, 0x44, 0x2d, 0xbf,
194 	0xe8, 0x5d, 0x62, 0xeb, 0x21, 0x4d, 0x35, 0x86,
195 	0x56, 0x6c, 0x51, 0xff, 0xa3, 0x45, 0xcc, 0x88,
196 	0x09, 0x43, 0x08, 0x97, 0x13, 0x7d, 0x00, 0xd8,
197 	0x82, 0x2d, 0xbe, 0xbe, 0x44, 0x0c, 0x2c, 0xa4,
198 	0x4f, 0x84, 0x07, 0x20, 0x9c, 0x3f, 0xf6, 0x5b,
199 	0x9e, 0xe8, 0x68, 0x40, 0xd3, 0x64, 0x8f, 0xb4,
200 	0x9e, 0xac, 0xc6, 0x41, 0x11, 0xda, 0xf2, 0x60,
201 	0xfa, 0x29, 0x9d, 0x26, 0x68, 0x5b, 0x79, 0x3a,
202 	0xd1, 0x66, 0x78, 0xca, 0x80, 0x87, 0xae, 0xab,
203 	0x7b, 0x29, 0x3c, 0xb0, 0xe6, 0xa2, 0x6b, 0x24,
204 	0x81, 0xeb, 0x51, 0xf9, 0xcb, 0x4a, 0x08, 0x37,
205 	0x2a, 0x75, 0xb5, 0xd3, 0xb3, 0x8f, 0x3d, 0x13,
206 	0x11, 0x0c, 0xa9, 0xf7, 0xf6, 0x57, 0x7e, 0xb7,
207 	0xa6, 0x22, 0xe8, 0x13, 0xfd, 0xf1, 0x6a, 0xe9,
208 	0xc1, 0x94, 0xa6, 0xf5, 0xa5, 0xec, 0xfa, 0x31,
209 	0xd2, 0x66, 0x8f, 0xe3, 0x6e, 0x9a, 0xaa, 0xb0,
210 	0xe3, 0x04, 0x09, 0x00, 0x1e, 0x67, 0x3c, 0xbe,
211 	0x2a, 0x8c, 0xd5, 0x1f, 0x4f, 0x55, 0x2c, 0x1d,
212 	0x26, 0x7f, 0xc9, 0x27, 0x00, 0x88, 0x7d, 0x45,
213 	0x4e, 0xe1, 0x36, 0xf6, 0xf5, 0xa8, 0xd4, 0xef,
214 	0x8b, 0x26, 0x76, 0x41, 0x28, 0x87, 0xf4, 0x51,
215 	0x14, 0x36, 0xad, 0x60, 0x8d, 0xe9, 0xe2, 0x9d,
216 	0x3c, 0xea, 0x09, 0x51, 0x3c, 0x81, 0xdf, 0x1a,
217 	0xc2, 0xc2, 0xf6, 0x45, 0xe1, 0x73, 0xac, 0xae,
218 	0x85, 0x74, 0x83, 0x8f, 0x56, 0x3c, 0x36, 0x1c,
219 	0xe0, 0x07, 0xc6, 0x6a, 0x48, 0xe4, 0x34, 0xe9,
220 	0x81, 0x53, 0xb7, 0x53, 0x95, 0xa7, 0x94, 0x21,
221 	0x7e, 0x32, 0x53, 0xda, 0x83, 0xd8, 0x57, 0x92,
222 	0xd1, 0x15, 0x45, 0x86, 0x40, 0xac, 0xf1, 0x6f,
223 	0x3c, 0x29, 0xef, 0x8d, 0x12, 0xe1, 0x9d, 0x04,
224 	0x17, 0x3a, 0xcc, 0xa6, 0xc5, 0xe4, 0x27, 0x41,
225 	0xcb, 0xfb, 0x5e, 0x77, 0x73, 0x5a, 0x2c, 0x03,
226 	0xe9, 0x2b, 0x76, 0x4e, 0x69, 0xea, 0xcb, 0xb3,
227 };
228 
229 /*
230  * IV method encblkno1, blkno 2.
231  */
232 static const uint8_t c3des_cbc_192_encblkno1_vec2_ctxt[SECSIZE] = {
233 	0x87, 0xb1, 0x3c, 0xd6, 0x60, 0xa0, 0x5a, 0x35,
234 	0xf7, 0xe1, 0x6b, 0x87, 0xa0, 0x90, 0x2f, 0xc7,
235 	0x8c, 0xed, 0x53, 0xda, 0x93, 0x32, 0x78, 0x5d,
236 	0x24, 0x23, 0x42, 0xdd, 0x93, 0x5b, 0x2e, 0x40,
237 	0xa1, 0xb1, 0x3b, 0xbb, 0xf0, 0x50, 0xb4, 0x61,
238 	0xea, 0x15, 0x37, 0xf3, 0x49, 0xe1, 0xa0, 0x32,
239 	0x88, 0x85, 0x81, 0xfd, 0xb7, 0x96, 0xd7, 0x9d,
240 	0xd7, 0x29, 0x4b, 0x14, 0xf9, 0x18, 0x6a, 0xf6,
241 	0x46, 0xae, 0x69, 0xdf, 0x63, 0x9a, 0xe0, 0x0b,
242 	0x2c, 0x53, 0xd7, 0x82, 0x6f, 0xe5, 0xa0, 0x95,
243 	0x2f, 0x61, 0x7f, 0x15, 0xff, 0xc7, 0xe8, 0x83,
244 	0xfc, 0xfc, 0x16, 0x1c, 0x37, 0x0f, 0x9b, 0xbb,
245 	0x14, 0xb2, 0xe2, 0xb7, 0x1f, 0x85, 0xb7, 0x07,
246 	0x8a, 0x18, 0xed, 0xf7, 0x5f, 0x27, 0xff, 0x2f,
247 	0x07, 0xf9, 0x9d, 0xe3, 0x79, 0x45, 0x1f, 0x51,
248 	0x08, 0x54, 0x0f, 0x56, 0x84, 0xee, 0x87, 0x9a,
249 	0xa9, 0x46, 0xb8, 0x77, 0x85, 0x40, 0x46, 0x50,
250 	0xc1, 0x58, 0x07, 0xfd, 0xfa, 0x2b, 0x20, 0xd6,
251 	0x4e, 0xba, 0x08, 0x02, 0x59, 0x3d, 0x23, 0x3b,
252 	0x5d, 0xf9, 0x5e, 0x2f, 0xac, 0x9e, 0xa0, 0xd7,
253 	0x3f, 0x9a, 0xdf, 0x50, 0x66, 0xcc, 0x28, 0xce,
254 	0x93, 0xc8, 0x11, 0x5c, 0x74, 0xe2, 0x4f, 0xfd,
255 	0xaf, 0x33, 0xbb, 0xce, 0x96, 0x1f, 0xb3, 0x46,
256 	0x6e, 0xcd, 0xe4, 0xef, 0xfa, 0x2f, 0x93, 0xb1,
257 	0xe5, 0x7c, 0x54, 0xbc, 0x17, 0x1f, 0xd5, 0x31,
258 	0x0e, 0x88, 0xe7, 0xcd, 0xb0, 0xb5, 0x2e, 0x1e,
259 	0x9e, 0x40, 0x36, 0xa5, 0xbb, 0xa7, 0x4e, 0xc8,
260 	0x11, 0x6c, 0xae, 0x1c, 0x2d, 0xdb, 0x55, 0xd8,
261 	0x14, 0x40, 0x02, 0xad, 0xaf, 0x19, 0x28, 0x59,
262 	0xd7, 0x4f, 0x81, 0xd0, 0xc1, 0x54, 0x63, 0x73,
263 	0x0e, 0xfb, 0x26, 0xf2, 0xa6, 0x80, 0xca, 0x2e,
264 	0xf3, 0xca, 0x1e, 0xa4, 0x62, 0x07, 0x22, 0x10,
265 	0x11, 0x6a, 0x57, 0x28, 0x45, 0x80, 0xdf, 0x34,
266 	0x88, 0xe5, 0xf1, 0x23, 0xe0, 0xb6, 0x44, 0x51,
267 	0x54, 0xd8, 0xb3, 0x66, 0xac, 0x46, 0x4d, 0xdf,
268 	0xa2, 0x8e, 0x72, 0x3a, 0x1c, 0x87, 0x2a, 0x43,
269 	0xfe, 0xdb, 0x00, 0xff, 0xb7, 0x1c, 0x13, 0xc3,
270 	0x18, 0xfc, 0x71, 0x13, 0xe3, 0xd1, 0x1f, 0xde,
271 	0x16, 0x63, 0x73, 0xf5, 0x0e, 0xf7, 0x18, 0xe5,
272 	0x48, 0x8d, 0x30, 0xd9, 0x26, 0x20, 0x6d, 0xa1,
273 	0xba, 0xde, 0xe8, 0x7d, 0x77, 0x02, 0x33, 0x0d,
274 	0x73, 0xb2, 0xab, 0x35, 0xfd, 0xa5, 0x6e, 0x4c,
275 	0x5c, 0x27, 0xc7, 0x7e, 0x4a, 0x28, 0xf8, 0xf5,
276 	0x00, 0xbe, 0x4c, 0xd7, 0x2c, 0x27, 0x83, 0x16,
277 	0x37, 0xda, 0x0c, 0xb1, 0xd7, 0x89, 0xd8, 0x8f,
278 	0x17, 0x69, 0x1b, 0x6b, 0x48, 0x2b, 0xce, 0x9c,
279 	0xbd, 0xf4, 0x0d, 0xb5, 0x4d, 0x12, 0x11, 0x36,
280 	0x49, 0xd3, 0x8b, 0x52, 0xce, 0x7e, 0x47, 0xb0,
281 	0xb5, 0x54, 0x77, 0xef, 0x90, 0xb8, 0x0e, 0xaf,
282 	0x6f, 0x97, 0x88, 0xde, 0x6b, 0x37, 0x24, 0xdd,
283 	0x91, 0x84, 0x00, 0x51, 0xab, 0x06, 0x96, 0x3c,
284 	0x82, 0x73, 0xcf, 0xae, 0x8d, 0x23, 0x86, 0x59,
285 	0x62, 0x5b, 0xeb, 0x2a, 0xaf, 0x40, 0x17, 0xed,
286 	0x2b, 0x60, 0x73, 0x7d, 0x99, 0x95, 0x3f, 0xd6,
287 	0x6c, 0xca, 0x1e, 0xf3, 0xb0, 0xcd, 0xd5, 0x1d,
288 	0x53, 0xe0, 0xd2, 0x8b, 0x57, 0x7b, 0xac, 0x67,
289 	0x5a, 0x5a, 0x0a, 0x64, 0x82, 0xab, 0x8f, 0x5a,
290 	0x36, 0xe2, 0x45, 0x50, 0xec, 0x3e, 0x14, 0x80,
291 	0x7c, 0xfd, 0x0c, 0xa9, 0x94, 0xfb, 0xfe, 0x72,
292 	0xec, 0x47, 0x71, 0x2e, 0x90, 0x97, 0xf6, 0x33,
293 	0xbd, 0x7d, 0x7e, 0x77, 0x8f, 0xad, 0xd4, 0x1d,
294 	0x1d, 0x53, 0x0f, 0x28, 0x39, 0x77, 0x06, 0x1a,
295 	0x75, 0xfc, 0x12, 0xe6, 0x45, 0xfc, 0x87, 0xe1,
296 	0x46, 0xac, 0xb0, 0x73, 0xca, 0x24, 0x7c, 0x71,
297 };
298 
299 /*
300  * IV method encblkno1, blkno 3.
301  */
302 static const uint8_t c3des_cbc_192_encblkno1_vec3_ctxt[SECSIZE] = {
303 	0xb1, 0xef, 0x7c, 0xd0, 0xa0, 0x6b, 0xe4, 0x88,
304 	0x5c, 0xd7, 0xf1, 0xbf, 0x5f, 0xce, 0xda, 0x19,
305 	0x81, 0x32, 0xbb, 0x96, 0x7e, 0xb9, 0x6e, 0xa1,
306 	0x43, 0xde, 0x53, 0x66, 0x9c, 0x27, 0x94, 0x85,
307 	0xcb, 0x09, 0x4e, 0x16, 0xd8, 0x60, 0x7a, 0x38,
308 	0x27, 0x21, 0x4d, 0x08, 0xaa, 0xe2, 0x1e, 0x6e,
309 	0xa3, 0xcb, 0x9a, 0x7f, 0xd1, 0xbf, 0x18, 0x36,
310 	0x5a, 0x4d, 0x7a, 0x7f, 0xcf, 0x3f, 0xba, 0xa5,
311 	0x77, 0x5b, 0xb4, 0x79, 0xdc, 0xbf, 0x2a, 0x28,
312 	0x16, 0x27, 0x0f, 0x8b, 0xd7, 0x95, 0xc3, 0xcb,
313 	0xa1, 0x6a, 0x49, 0x53, 0xa8, 0x0c, 0x70, 0xde,
314 	0x90, 0x2e, 0x36, 0x74, 0x40, 0x5d, 0x81, 0x74,
315 	0x03, 0x11, 0xbd, 0xba, 0x40, 0x8d, 0x03, 0x86,
316 	0x2b, 0x17, 0x55, 0x20, 0xd8, 0x81, 0x30, 0xd2,
317 	0x2a, 0xbd, 0xea, 0xff, 0x5c, 0x69, 0x9b, 0xe6,
318 	0xe3, 0x21, 0x9a, 0x10, 0x3e, 0xb0, 0xf4, 0x7a,
319 	0xfc, 0x6e, 0x66, 0xec, 0x44, 0x0b, 0x95, 0x8d,
320 	0x13, 0xd4, 0xf6, 0x3e, 0xa1, 0xa1, 0xac, 0xb1,
321 	0xd8, 0x3d, 0x86, 0xaf, 0x5e, 0xef, 0x14, 0x6a,
322 	0x32, 0xf3, 0x13, 0x75, 0x3b, 0x64, 0x9a, 0xf4,
323 	0xd0, 0xf5, 0x00, 0x36, 0x9e, 0xdb, 0xfd, 0xcb,
324 	0xda, 0x1f, 0xed, 0x9d, 0x6d, 0x52, 0xd7, 0xb5,
325 	0x48, 0xce, 0x53, 0x5e, 0xdc, 0xc8, 0xe4, 0x96,
326 	0x04, 0x32, 0xa5, 0xcf, 0x0c, 0xba, 0xa0, 0xd0,
327 	0x44, 0xb3, 0xe8, 0x72, 0xc6, 0xff, 0x8f, 0xd4,
328 	0x4d, 0x0a, 0x22, 0x89, 0x74, 0x50, 0xaa, 0x65,
329 	0x15, 0xab, 0x99, 0xc8, 0xf9, 0xa4, 0x10, 0xe6,
330 	0xa6, 0x4b, 0x0c, 0xc8, 0xb9, 0xa7, 0x60, 0x41,
331 	0xe7, 0x57, 0x31, 0xfa, 0x86, 0x55, 0xdf, 0x29,
332 	0x49, 0xac, 0x55, 0x7b, 0x21, 0xf9, 0x3b, 0x1e,
333 	0x1f, 0xb4, 0x1c, 0x0b, 0x77, 0xcb, 0x88, 0xbf,
334 	0xa6, 0x79, 0xbf, 0x9a, 0x51, 0xc4, 0x8e, 0x59,
335 	0x9c, 0xb3, 0x9d, 0x9d, 0x6b, 0xb2, 0x15, 0x41,
336 	0x0d, 0x6c, 0xf7, 0x5e, 0xe2, 0xf9, 0xb3, 0x80,
337 	0x8f, 0x03, 0x67, 0x68, 0x6e, 0x4b, 0x4d, 0x52,
338 	0xbc, 0x9b, 0xa2, 0xd8, 0x29, 0x1e, 0x5c, 0xd7,
339 	0x59, 0x67, 0x94, 0x40, 0x9e, 0x08, 0x15, 0x0d,
340 	0x7e, 0xc9, 0x14, 0x53, 0xa8, 0x67, 0xb3, 0xb8,
341 	0xaa, 0x21, 0x0f, 0x79, 0x69, 0x48, 0x52, 0xea,
342 	0x56, 0x03, 0x7b, 0x55, 0xb7, 0xf3, 0xfe, 0xb1,
343 	0x8a, 0x22, 0x7d, 0x75, 0x55, 0x31, 0xad, 0x20,
344 	0x6a, 0xc2, 0xa4, 0xd1, 0x1e, 0xab, 0xdd, 0x29,
345 	0xb5, 0xf8, 0xdd, 0x9b, 0x1a, 0xb8, 0xe7, 0xde,
346 	0xae, 0xa1, 0xab, 0xbb, 0xf6, 0x00, 0x87, 0xc4,
347 	0x29, 0xee, 0x2b, 0xa1, 0xa9, 0x1a, 0x46, 0x05,
348 	0x5a, 0x12, 0x3f, 0x32, 0x81, 0x25, 0x20, 0x71,
349 	0xb6, 0xfa, 0x1f, 0x27, 0x2a, 0x33, 0x49, 0xfc,
350 	0x95, 0x00, 0x72, 0x6b, 0x03, 0x53, 0x94, 0x57,
351 	0x2f, 0x47, 0x3d, 0x2d, 0x7c, 0xb4, 0xde, 0xa7,
352 	0x96, 0x81, 0x12, 0xff, 0x2c, 0xec, 0x5c, 0x03,
353 	0x2a, 0x8c, 0x76, 0xc4, 0xed, 0x09, 0xe6, 0x00,
354 	0x28, 0xdb, 0x9b, 0x44, 0xb0, 0xb4, 0x7b, 0x57,
355 	0x3b, 0xb6, 0x4f, 0x0b, 0xff, 0xf2, 0xf5, 0x02,
356 	0x56, 0xcf, 0xd5, 0xbf, 0x71, 0xe6, 0x66, 0xf3,
357 	0x08, 0x8e, 0x8b, 0x15, 0x57, 0x07, 0x41, 0xa3,
358 	0x91, 0xc1, 0xe4, 0x64, 0x92, 0x89, 0xed, 0x22,
359 	0x88, 0x8f, 0x17, 0x91, 0xde, 0xea, 0x0c, 0xa6,
360 	0x86, 0x8e, 0x4c, 0xd9, 0x63, 0xc9, 0xe5, 0xdc,
361 	0xd6, 0xd3, 0x7b, 0x2b, 0x65, 0xfa, 0x36, 0x47,
362 	0x20, 0xa4, 0xe7, 0x0b, 0x52, 0xfa, 0xa6, 0xeb,
363 	0x1d, 0x20, 0xd0, 0x4b, 0xfd, 0x88, 0x8c, 0xbb,
364 	0x52, 0x9c, 0x2f, 0xb7, 0xba, 0x8b, 0xdd, 0x10,
365 	0x2d, 0x7d, 0x77, 0x79, 0x40, 0xa7, 0xed, 0xf9,
366 	0xbd, 0x2a, 0x55, 0x1f, 0x87, 0x1e, 0x3c, 0xfc,
367 };
368 
369 const struct testvec c3des_cbc_192_1_vectors[] = {
370 	{
371 		.blkno = 0,
372 		.ptxt = c3des_cbc_ptxt,
373 		.ctxt = c3des_cbc_192_encblkno1_vec0_ctxt,
374 	},
375 	{
376 		.blkno = 1,
377 		.ptxt = c3des_cbc_ptxt,
378 		.ctxt = c3des_cbc_192_encblkno1_vec1_ctxt,
379 	},
380 	{
381 		.blkno = 2,
382 		.ptxt = c3des_cbc_ptxt,
383 		.ctxt = c3des_cbc_192_encblkno1_vec2_ctxt,
384 	},
385 	{
386 		.blkno = 3,
387 		.ptxt = c3des_cbc_ptxt,
388 		.ctxt = c3des_cbc_192_encblkno1_vec3_ctxt,
389 	},
390 };
391 
392 /*
393  * IV method encblkno8, blkno 0.
394  */
395 static const uint8_t c3des_cbc_192_encblkno8_vec0_ctxt[SECSIZE] = {
396 	0x9e, 0x5d, 0x35, 0x56, 0xa7, 0xcc, 0xc0, 0x1c,
397 	0x60, 0x4c, 0x42, 0x90, 0x35, 0xf3, 0xc1, 0x20,
398 	0xf2, 0x07, 0x6f, 0xf8, 0x7c, 0x33, 0x6a, 0x74,
399 	0xdc, 0x85, 0xbc, 0x9c, 0xa2, 0x29, 0xc6, 0x69,
400 	0x0e, 0xef, 0x0f, 0xa9, 0x6e, 0xec, 0xf2, 0x23,
401 	0x2f, 0x9a, 0xbe, 0x1a, 0x89, 0x22, 0x00, 0xc4,
402 	0x5a, 0xaf, 0x4a, 0xa0, 0x4f, 0x30, 0x8f, 0x99,
403 	0xd2, 0x93, 0x6d, 0xfa, 0xcd, 0x2f, 0xad, 0x19,
404 	0x10, 0x14, 0x90, 0x3a, 0x4b, 0xab, 0x17, 0x2e,
405 	0x2c, 0xe1, 0x26, 0xe5, 0x76, 0xf1, 0xd1, 0x1d,
406 	0x4c, 0x77, 0x68, 0xfb, 0x45, 0x9a, 0x3e, 0x19,
407 	0xe0, 0xfb, 0xdc, 0xd4, 0x0e, 0x29, 0x7c, 0x06,
408 	0xd3, 0x45, 0xa8, 0xf7, 0x39, 0x91, 0xe6, 0x18,
409 	0x0f, 0x81, 0xe6, 0x7d, 0x6c, 0x65, 0x2e, 0x16,
410 	0x24, 0xa4, 0x16, 0x96, 0x0a, 0x7b, 0x5f, 0x3a,
411 	0x0c, 0xe9, 0x0e, 0x3f, 0x34, 0x38, 0xb0, 0xe1,
412 	0x39, 0x23, 0x5c, 0x3c, 0x00, 0xb4, 0xa0, 0xf7,
413 	0x42, 0x18, 0x70, 0x25, 0x82, 0x13, 0x24, 0x49,
414 	0xbb, 0x3f, 0xfb, 0xef, 0xb6, 0xc6, 0x7f, 0x3d,
415 	0x8c, 0x17, 0x62, 0x60, 0x6f, 0xd5, 0xda, 0x2c,
416 	0xf8, 0x85, 0xee, 0xa7, 0xc2, 0x76, 0x5d, 0x34,
417 	0x4c, 0xe1, 0x0d, 0x36, 0x6e, 0x02, 0xdd, 0x08,
418 	0x85, 0xe4, 0x90, 0xfe, 0x1f, 0x81, 0x4a, 0x06,
419 	0xa6, 0x72, 0x81, 0x79, 0x47, 0xd7, 0x6d, 0x92,
420 	0x8f, 0xb7, 0xb2, 0xfd, 0xd0, 0x60, 0x6c, 0x06,
421 	0x44, 0xcd, 0x20, 0x28, 0xef, 0x16, 0xc3, 0x01,
422 	0x19, 0x14, 0x34, 0x39, 0xad, 0x87, 0x9f, 0xde,
423 	0x76, 0xb9, 0xb9, 0x87, 0x1a, 0xbd, 0x8e, 0x2c,
424 	0xe6, 0xb3, 0xe7, 0xb6, 0x80, 0xf8, 0xc5, 0x22,
425 	0x5f, 0x53, 0xed, 0x03, 0xfe, 0x09, 0x2c, 0x9d,
426 	0xb6, 0x61, 0x4a, 0xbb, 0x07, 0x5d, 0xbd, 0x68,
427 	0x74, 0xab, 0x02, 0x81, 0x64, 0x7b, 0x97, 0xa3,
428 	0xad, 0x15, 0x99, 0x7a, 0x04, 0x33, 0xbd, 0x50,
429 	0x94, 0x11, 0xcc, 0xf7, 0x8b, 0x77, 0x88, 0x78,
430 	0x80, 0xfe, 0x5f, 0xa1, 0x63, 0xbc, 0xb0, 0x65,
431 	0xcb, 0x9d, 0x4c, 0xfe, 0x66, 0x4e, 0xff, 0xe3,
432 	0x43, 0x61, 0x99, 0x88, 0x88, 0x4c, 0xbc, 0x8a,
433 	0xf1, 0x69, 0x00, 0xc2, 0xe5, 0xb9, 0x65, 0x8b,
434 	0x10, 0xdf, 0x38, 0x3e, 0x9e, 0x9f, 0x87, 0xed,
435 	0x84, 0x71, 0xe7, 0xf2, 0xb5, 0xb6, 0x11, 0xed,
436 	0x1e, 0xd4, 0xc0, 0x6d, 0x77, 0x08, 0x4b, 0xfd,
437 	0x95, 0xd5, 0xc0, 0xbe, 0xa6, 0xcc, 0x3b, 0xea,
438 	0x11, 0x38, 0xa5, 0x59, 0x36, 0x2a, 0xf4, 0x98,
439 	0x52, 0x9d, 0x3b, 0x8c, 0x8a, 0x19, 0xbd, 0xfb,
440 	0x49, 0xcb, 0xb0, 0x57, 0x91, 0xc7, 0xf8, 0x2a,
441 	0x89, 0xa8, 0x85, 0x03, 0xdf, 0x6e, 0xad, 0xf4,
442 	0x8a, 0x88, 0x9a, 0x2b, 0x5d, 0xe8, 0xca, 0xa9,
443 	0x8f, 0x18, 0xa3, 0x6a, 0x37, 0x84, 0xa9, 0x24,
444 	0x5b, 0xce, 0xd6, 0xbe, 0x7e, 0x40, 0x86, 0x6a,
445 	0xc3, 0x47, 0x28, 0x66, 0xf0, 0x8c, 0x2d, 0x69,
446 	0x22, 0x64, 0x61, 0x36, 0x6a, 0x0c, 0xc4, 0x18,
447 	0x5f, 0xd7, 0xff, 0xbc, 0xf1, 0x94, 0x16, 0xfb,
448 	0x26, 0xa7, 0x80, 0xa4, 0x2d, 0x72, 0xc6, 0x9d,
449 	0xa7, 0xed, 0x04, 0x13, 0x0f, 0xe7, 0xf8, 0x93,
450 	0x57, 0x6b, 0xd5, 0xa4, 0xad, 0x9a, 0x97, 0xeb,
451 	0x97, 0xe7, 0x60, 0x01, 0x89, 0x3f, 0x88, 0xf2,
452 	0xee, 0xf3, 0x79, 0xd6, 0x5a, 0x03, 0x94, 0x07,
453 	0xd3, 0x33, 0xc8, 0xda, 0x15, 0x17, 0x0a, 0x8f,
454 	0xbd, 0x58, 0x1b, 0xfe, 0x3d, 0x77, 0x5d, 0x8f,
455 	0x4e, 0x0e, 0x98, 0x7d, 0x02, 0x63, 0x94, 0x73,
456 	0x4a, 0x58, 0x47, 0xed, 0x52, 0xfc, 0x85, 0x19,
457 	0x5d, 0x2f, 0xfa, 0x07, 0x44, 0xbd, 0x8e, 0xcb,
458 	0x20, 0x63, 0x9d, 0x2b, 0x61, 0x5c, 0x19, 0x71,
459 	0x80, 0xe5, 0x25, 0x5b, 0x2e, 0xc5, 0xfe, 0x1a,
460 };
461 
462 /*
463  * IV method encblkno8, blkno 1.
464  */
465 static const uint8_t c3des_cbc_192_encblkno8_vec1_ctxt[SECSIZE] = {
466 	0xf4, 0xb0, 0xb0, 0xcb, 0x79, 0xcc, 0x8c, 0x0a,
467 	0x3b, 0xc7, 0x43, 0x4e, 0x62, 0x9d, 0xde, 0xb4,
468 	0xab, 0xa5, 0x62, 0x63, 0x32, 0xa7, 0x18, 0x2b,
469 	0xe3, 0xee, 0x44, 0xc6, 0x6f, 0xb2, 0xdc, 0x21,
470 	0xc5, 0xc8, 0x9e, 0x32, 0x71, 0x4c, 0x7a, 0x82,
471 	0x8d, 0xe0, 0xad, 0x91, 0x88, 0x0c, 0x41, 0x83,
472 	0x28, 0x0d, 0xed, 0xa7, 0xeb, 0x48, 0xb1, 0x31,
473 	0xfa, 0x40, 0xd9, 0x44, 0x19, 0xee, 0x8d, 0x2c,
474 	0x7d, 0xe2, 0x39, 0xa0, 0x39, 0xaa, 0x86, 0xab,
475 	0xb5, 0x68, 0xe5, 0x83, 0x06, 0x61, 0xec, 0xe6,
476 	0xc2, 0x85, 0xb2, 0x46, 0xf4, 0x5b, 0x0e, 0x34,
477 	0x7e, 0x0c, 0xa0, 0xda, 0xef, 0x58, 0x9c, 0x39,
478 	0x95, 0xa2, 0xca, 0xd3, 0x3b, 0x4d, 0x76, 0xe3,
479 	0x34, 0x6d, 0x08, 0xa4, 0xba, 0x88, 0x58, 0x39,
480 	0xb4, 0xe4, 0x6b, 0xb6, 0x32, 0x50, 0x2c, 0xe2,
481 	0x0a, 0x37, 0xbc, 0x98, 0x38, 0x32, 0x17, 0x1b,
482 	0x12, 0xef, 0xdc, 0x9d, 0x91, 0x09, 0x8e, 0xd8,
483 	0xc3, 0xf8, 0x7b, 0x35, 0x41, 0x3b, 0xf8, 0xf5,
484 	0x37, 0x48, 0x04, 0xf7, 0x94, 0xbf, 0x54, 0x8d,
485 	0x79, 0x49, 0x8f, 0xf0, 0x3f, 0xb7, 0x90, 0x76,
486 	0x14, 0x09, 0xc6, 0x8c, 0xba, 0x1a, 0x30, 0x1b,
487 	0xbb, 0xd9, 0xe2, 0xb5, 0xe8, 0xd9, 0x9b, 0x68,
488 	0x60, 0x90, 0xd3, 0x4a, 0xe8, 0x65, 0x7b, 0xaa,
489 	0xb0, 0xda, 0x69, 0x1d, 0x45, 0x78, 0x2c, 0x3b,
490 	0x59, 0x29, 0x3c, 0x26, 0x9a, 0xd2, 0xa5, 0xfd,
491 	0xb7, 0x16, 0x59, 0x7c, 0x46, 0xea, 0x99, 0xd0,
492 	0x06, 0x01, 0x3f, 0xd2, 0x23, 0xcc, 0xde, 0xb8,
493 	0xaa, 0x88, 0x17, 0x03, 0xe1, 0x48, 0x2c, 0xdd,
494 	0xce, 0xd1, 0x2c, 0xce, 0x37, 0xee, 0xe6, 0xa6,
495 	0x47, 0x8c, 0x07, 0xe5, 0xfe, 0x01, 0xc6, 0x27,
496 	0xfe, 0x3f, 0x9d, 0x30, 0x18, 0x36, 0xe7, 0xa7,
497 	0x37, 0x1d, 0xcf, 0x6d, 0x4c, 0x82, 0xec, 0x58,
498 	0xa1, 0x6f, 0x56, 0xc6, 0x08, 0x25, 0x94, 0xda,
499 	0xae, 0x1a, 0x4f, 0xda, 0xb2, 0xf4, 0xbf, 0x94,
500 	0xff, 0x66, 0x6a, 0xb1, 0x1f, 0x42, 0xfe, 0x32,
501 	0xa4, 0x0e, 0x3d, 0x6a, 0x16, 0x44, 0xe0, 0xac,
502 	0xe8, 0xc1, 0xe2, 0xa8, 0x73, 0xab, 0xac, 0x58,
503 	0xb1, 0xbc, 0x94, 0xb2, 0x6a, 0xe4, 0x45, 0xf5,
504 	0x90, 0x6b, 0x82, 0xeb, 0x9e, 0x22, 0x9e, 0xb2,
505 	0x27, 0x3e, 0xc8, 0x55, 0xf4, 0x8f, 0xda, 0x04,
506 	0xa3, 0x9c, 0xa4, 0x79, 0xbd, 0x79, 0xd3, 0xbd,
507 	0xbe, 0x72, 0x7f, 0x90, 0xef, 0xc3, 0x34, 0x17,
508 	0x72, 0x6f, 0xb4, 0xfe, 0x62, 0x56, 0xc3, 0xd6,
509 	0x43, 0xc8, 0x4c, 0x76, 0x91, 0x04, 0x97, 0x4c,
510 	0x84, 0x98, 0x56, 0xb7, 0x7b, 0x4f, 0xd5, 0xcf,
511 	0x1b, 0x9c, 0x09, 0xe3, 0x1d, 0xdf, 0x0e, 0xfa,
512 	0x39, 0xc8, 0x48, 0x43, 0x84, 0xec, 0x79, 0xc8,
513 	0x7f, 0x4f, 0xa8, 0xc0, 0xb4, 0xde, 0x8b, 0x79,
514 	0xcb, 0x9c, 0x42, 0x81, 0x49, 0xdc, 0x39, 0xb5,
515 	0x31, 0xa6, 0x22, 0xba, 0x71, 0xb8, 0x2d, 0x1d,
516 	0xc8, 0x17, 0xd8, 0x9d, 0x26, 0x2b, 0xd5, 0xcf,
517 	0x57, 0x46, 0x0a, 0x61, 0x7e, 0xb7, 0xc3, 0x9c,
518 	0xa6, 0x44, 0x60, 0x2d, 0x30, 0xb8, 0x10, 0x47,
519 	0x7d, 0x7e, 0x87, 0x76, 0xc1, 0x4e, 0x85, 0x77,
520 	0xbc, 0x30, 0x32, 0x56, 0x0a, 0x5b, 0x1c, 0xd0,
521 	0xf6, 0x47, 0x48, 0x22, 0xf4, 0x6e, 0x38, 0xc5,
522 	0xab, 0xe2, 0xd0, 0x4d, 0x40, 0x27, 0xab, 0x8f,
523 	0x43, 0xb1, 0x60, 0x29, 0x07, 0xd0, 0xf5, 0x25,
524 	0xe5, 0xfa, 0xe7, 0x46, 0x32, 0x37, 0xb9, 0xae,
525 	0x2e, 0x02, 0x8c, 0x94, 0x15, 0x69, 0xd6, 0x74,
526 	0xb4, 0x36, 0xdd, 0x94, 0x70, 0xa7, 0x16, 0x7b,
527 	0x4c, 0xd3, 0x48, 0x83, 0xc5, 0xb2, 0xb0, 0x6a,
528 	0xfe, 0x7e, 0xd4, 0xe5, 0x6d, 0xa5, 0x96, 0x20,
529 	0x08, 0x59, 0xbd, 0x0c, 0x3d, 0x55, 0xa5, 0x03,
530 };
531 
532 /*
533  * IV method encblkno8, blkno 2.
534  */
535 static const uint8_t c3des_cbc_192_encblkno8_vec2_ctxt[SECSIZE] = {
536 	0xea, 0x7c, 0x8c, 0x8e, 0x3e, 0x61, 0x34, 0x3d,
537 	0xe0, 0x7f, 0xd3, 0xe1, 0x3a, 0xb9, 0xc8, 0xf2,
538 	0x98, 0xdc, 0x59, 0x26, 0xd2, 0xd8, 0xa7, 0x7f,
539 	0x41, 0x98, 0x24, 0xa8, 0x28, 0x0c, 0x88, 0x55,
540 	0x91, 0xdb, 0x29, 0x17, 0x70, 0xd7, 0x03, 0xff,
541 	0xbd, 0x0e, 0xbf, 0xf8, 0x73, 0x92, 0x19, 0xe9,
542 	0x92, 0x67, 0xdb, 0x08, 0x94, 0x77, 0x71, 0x2d,
543 	0x00, 0xad, 0x26, 0x42, 0x2d, 0xac, 0x8c, 0x67,
544 	0x6f, 0xb3, 0x8e, 0x36, 0x22, 0xeb, 0x1f, 0x8c,
545 	0xd4, 0x9b, 0x9f, 0xa6, 0xa9, 0xb1, 0x52, 0x65,
546 	0x9a, 0xfe, 0xcc, 0x92, 0x48, 0x75, 0xf6, 0xb8,
547 	0x59, 0xfe, 0x0e, 0x67, 0x93, 0xce, 0x3b, 0x7e,
548 	0x51, 0x74, 0xe5, 0x24, 0x35, 0x08, 0x68, 0x21,
549 	0x6a, 0x7f, 0xdd, 0x8c, 0xfd, 0xcd, 0x6d, 0x90,
550 	0xc5, 0x3b, 0x26, 0x9e, 0x00, 0xf4, 0x1e, 0x70,
551 	0xd3, 0xe7, 0xe8, 0x2f, 0x52, 0x87, 0x76, 0x84,
552 	0xbb, 0x5c, 0x76, 0x5a, 0xc8, 0xea, 0x74, 0xe2,
553 	0x9e, 0x85, 0xf6, 0x53, 0x85, 0x1a, 0x6e, 0x02,
554 	0x0d, 0x32, 0x11, 0xc4, 0xec, 0xee, 0x79, 0x27,
555 	0xda, 0xca, 0xc0, 0x0b, 0x8e, 0x2d, 0xb7, 0x7d,
556 	0x8c, 0x6e, 0xfb, 0xa3, 0xa8, 0x24, 0x24, 0x62,
557 	0xc8, 0xdd, 0xc7, 0x16, 0x09, 0x33, 0x0f, 0xe5,
558 	0xc8, 0x60, 0x3d, 0xb6, 0xbf, 0x6c, 0x28, 0xd2,
559 	0x0b, 0x9c, 0xd9, 0xcb, 0x64, 0x49, 0xe4, 0x80,
560 	0x72, 0x58, 0xaa, 0xaa, 0x7e, 0x1d, 0x9f, 0xd7,
561 	0x29, 0x15, 0x65, 0xfc, 0xfd, 0x3f, 0xe1, 0x82,
562 	0x25, 0x3c, 0xd4, 0xbe, 0x59, 0x79, 0x63, 0xd1,
563 	0xd6, 0x0e, 0xda, 0x00, 0xf3, 0xaa, 0x13, 0xd3,
564 	0xed, 0xef, 0xca, 0x8b, 0x97, 0x15, 0x2d, 0x10,
565 	0x6f, 0xcf, 0xee, 0xc7, 0x21, 0xad, 0xe3, 0xe4,
566 	0xd8, 0x95, 0x21, 0x1f, 0xc0, 0x06, 0x3a, 0xbc,
567 	0xbb, 0x2a, 0x92, 0x78, 0x76, 0x9d, 0x1e, 0x7b,
568 	0xb5, 0x29, 0xaf, 0x96, 0x75, 0x2b, 0x41, 0xbd,
569 	0xae, 0x79, 0x28, 0x72, 0xe7, 0x54, 0xc4, 0x08,
570 	0xd3, 0xd2, 0xac, 0x96, 0xd0, 0x0f, 0x9b, 0x68,
571 	0x7d, 0x3f, 0xc2, 0xdd, 0x3d, 0xfc, 0xca, 0xcd,
572 	0x11, 0x71, 0xd9, 0x48, 0x53, 0x9f, 0xd3, 0x79,
573 	0x7d, 0x47, 0x71, 0x2a, 0x6d, 0x9e, 0xa9, 0x47,
574 	0xa1, 0xf7, 0x97, 0x80, 0x83, 0x70, 0x6b, 0xfe,
575 	0x10, 0x11, 0x6a, 0x0e, 0xdd, 0xde, 0x22, 0x3c,
576 	0x19, 0x30, 0x73, 0x73, 0x2e, 0x4b, 0x54, 0x17,
577 	0xc3, 0x2e, 0xe9, 0xce, 0xe0, 0xe3, 0xa0, 0x1a,
578 	0x28, 0xd1, 0x50, 0xa8, 0xd2, 0x40, 0xe2, 0x1b,
579 	0xfa, 0x49, 0x06, 0x49, 0x8b, 0x4b, 0xd9, 0xd5,
580 	0xf5, 0x50, 0xae, 0x64, 0x19, 0xe1, 0xd9, 0x4e,
581 	0xbb, 0x29, 0x70, 0x66, 0x46, 0xa8, 0x7e, 0x5b,
582 	0xdc, 0xe2, 0xd5, 0x9d, 0x56, 0x6d, 0x4c, 0xe6,
583 	0x0e, 0x6b, 0x71, 0x40, 0x82, 0xf7, 0xb3, 0xad,
584 	0x23, 0x17, 0xe3, 0x1c, 0x61, 0x1d, 0x3b, 0x71,
585 	0xfc, 0x06, 0x17, 0xec, 0x6c, 0x77, 0x98, 0x27,
586 	0xc7, 0x4b, 0x65, 0x17, 0x81, 0xe7, 0xcb, 0xce,
587 	0x09, 0x76, 0x82, 0x82, 0x4a, 0x53, 0x67, 0xa0,
588 	0x05, 0x25, 0x4c, 0xc4, 0xa7, 0xad, 0xa7, 0xaf,
589 	0xa0, 0x11, 0xd7, 0x73, 0x3b, 0x30, 0xbf, 0x53,
590 	0x50, 0x9b, 0xd8, 0xf3, 0x32, 0x15, 0xdd, 0x36,
591 	0x88, 0xc2, 0x39, 0x51, 0xb6, 0xb8, 0x0d, 0x5c,
592 	0x20, 0x4e, 0x24, 0xee, 0x95, 0x32, 0x61, 0x25,
593 	0xda, 0x73, 0x0d, 0x8a, 0x58, 0xe6, 0xcc, 0xad,
594 	0x79, 0x3d, 0xef, 0x29, 0x0c, 0x9f, 0xe1, 0xa7,
595 	0x22, 0x1e, 0xea, 0x7a, 0x4f, 0xfb, 0xc1, 0x1f,
596 	0x17, 0xca, 0x69, 0xd6, 0xa4, 0xce, 0x6e, 0xc0,
597 	0x70, 0xa3, 0x08, 0x32, 0x87, 0xb4, 0x6b, 0x80,
598 	0x5c, 0x7f, 0x88, 0x5c, 0xbf, 0x07, 0xd8, 0xe9,
599 	0xdd, 0xd2, 0x76, 0xa9, 0xaa, 0xd9, 0x55, 0x48,
600 };
601 
602 /*
603  * IV method encblkno8, blkno 3.
604  */
605 static const uint8_t c3des_cbc_192_encblkno8_vec3_ctxt[SECSIZE] = {
606 	0xf3, 0x49, 0xda, 0x5c, 0xde, 0x9d, 0x3e, 0x9d,
607 	0xb9, 0xc2, 0x6e, 0x96, 0xa9, 0x93, 0x10, 0x73,
608 	0x0e, 0x26, 0x39, 0xd6, 0x9f, 0x04, 0x5f, 0x69,
609 	0x54, 0xa3, 0x7c, 0x46, 0x7b, 0x18, 0x93, 0xc0,
610 	0xbb, 0x0c, 0x96, 0x6f, 0xb0, 0xbf, 0xce, 0x67,
611 	0x33, 0x3e, 0x56, 0xe8, 0x6b, 0x4d, 0x3f, 0xc8,
612 	0x3c, 0xc6, 0x89, 0x2c, 0x0b, 0x95, 0x3a, 0xaf,
613 	0xc0, 0xf3, 0x1f, 0x0e, 0x07, 0x01, 0xa6, 0x35,
614 	0x19, 0x79, 0x91, 0x24, 0xaa, 0x0d, 0xf0, 0x53,
615 	0x27, 0x7d, 0xbb, 0xa6, 0xb6, 0x44, 0x31, 0x4b,
616 	0xd4, 0xcf, 0xf6, 0x6d, 0x18, 0xa2, 0x28, 0x8a,
617 	0xc1, 0x0a, 0xbe, 0x57, 0x0c, 0x61, 0x5f, 0xd9,
618 	0x12, 0x14, 0xfe, 0xe2, 0xc7, 0x10, 0x72, 0xee,
619 	0x19, 0xb8, 0x16, 0x0b, 0x88, 0x87, 0xce, 0xf3,
620 	0xfe, 0x57, 0x37, 0xd1, 0xa2, 0xf7, 0xd0, 0x5e,
621 	0x73, 0xde, 0x39, 0x35, 0xbc, 0xde, 0xed, 0x61,
622 	0x4b, 0x31, 0xdc, 0xfe, 0x3c, 0x4d, 0x98, 0xa9,
623 	0x36, 0xb0, 0x34, 0x5b, 0xb4, 0xb7, 0x79, 0x25,
624 	0x6e, 0x24, 0x7e, 0x10, 0xfe, 0x20, 0xd5, 0x16,
625 	0x86, 0xaf, 0xcd, 0x26, 0x34, 0xd3, 0x2e, 0xdc,
626 	0x7c, 0x69, 0xe3, 0xc5, 0x62, 0x0c, 0xba, 0x29,
627 	0x9c, 0x4b, 0x2f, 0x39, 0x45, 0xe1, 0xcf, 0xc5,
628 	0xfe, 0x35, 0xb6, 0x2f, 0xb1, 0x1a, 0x90, 0xe1,
629 	0xa7, 0x39, 0xe8, 0x1e, 0x5f, 0xac, 0xab, 0x1e,
630 	0x32, 0xba, 0xc5, 0x92, 0x39, 0x62, 0x37, 0x2c,
631 	0x49, 0xf1, 0x62, 0x90, 0xf7, 0x1e, 0x10, 0xce,
632 	0x8e, 0x95, 0xa3, 0xc6, 0xd8, 0xe5, 0xc8, 0xdf,
633 	0xcc, 0x94, 0x7d, 0x26, 0xab, 0x29, 0xbb, 0x9d,
634 	0xf3, 0x73, 0xce, 0xac, 0x76, 0xdf, 0x75, 0x2a,
635 	0x3e, 0x8f, 0x47, 0xff, 0x76, 0xfe, 0xea, 0xd4,
636 	0x4a, 0xa9, 0x36, 0x9d, 0x12, 0x45, 0xb7, 0x99,
637 	0x81, 0xb6, 0x77, 0x98, 0x13, 0xfb, 0x5a, 0xe5,
638 	0x40, 0x87, 0x61, 0x0d, 0x10, 0x76, 0xf6, 0x3e,
639 	0x48, 0xac, 0xc4, 0x27, 0x87, 0xcd, 0x07, 0xde,
640 	0x0b, 0x23, 0x97, 0x61, 0x3d, 0x18, 0x64, 0x7f,
641 	0xbf, 0xd6, 0x87, 0xc1, 0x11, 0xfb, 0xf9, 0xda,
642 	0x14, 0xa1, 0x01, 0xf8, 0x7e, 0xea, 0x5b, 0x5b,
643 	0xdd, 0x09, 0xf9, 0x31, 0x80, 0x3c, 0xee, 0x34,
644 	0x2d, 0xda, 0x71, 0xd9, 0x32, 0x7d, 0x45, 0xb2,
645 	0x53, 0xea, 0xd5, 0x7c, 0x85, 0x45, 0xce, 0x1d,
646 	0x2b, 0xe9, 0xd7, 0x95, 0xf8, 0x8c, 0x08, 0xe4,
647 	0xd0, 0x2f, 0x60, 0x75, 0x02, 0xf3, 0xde, 0xeb,
648 	0x46, 0x40, 0xa8, 0xd2, 0x37, 0xd6, 0xca, 0x5d,
649 	0xb9, 0xf4, 0x51, 0x31, 0x8a, 0x1a, 0x82, 0xbd,
650 	0x6f, 0x6d, 0x88, 0x2b, 0x63, 0x0f, 0xe1, 0xf0,
651 	0xcf, 0x13, 0x79, 0x1d, 0x78, 0x82, 0x66, 0xa1,
652 	0xef, 0xdb, 0x34, 0x50, 0xd2, 0x71, 0x47, 0x49,
653 	0x41, 0x74, 0xd9, 0x0b, 0x14, 0x38, 0x1f, 0xc3,
654 	0x09, 0x4d, 0xb3, 0xa6, 0x03, 0x3f, 0x56, 0x67,
655 	0xd7, 0x51, 0x4c, 0x8a, 0x1d, 0x37, 0x99, 0xfb,
656 	0xe1, 0x84, 0x57, 0x55, 0x9b, 0xf8, 0x73, 0x63,
657 	0x68, 0x73, 0x89, 0x52, 0x06, 0xe7, 0x34, 0xe7,
658 	0x1a, 0x15, 0x7e, 0xd9, 0x84, 0xa3, 0x0e, 0x68,
659 	0x14, 0x1c, 0xe8, 0x23, 0x9e, 0xe3, 0x8f, 0x71,
660 	0x02, 0x9b, 0x87, 0xd4, 0xd9, 0x1b, 0xd1, 0x9e,
661 	0x9e, 0xa0, 0x7e, 0x49, 0x8e, 0xaa, 0x89, 0xb5,
662 	0x16, 0x48, 0x07, 0xb3, 0x3d, 0x9e, 0x4c, 0x35,
663 	0x3e, 0x94, 0xa9, 0xf8, 0x82, 0x50, 0x6a, 0x41,
664 	0x28, 0x3e, 0x9f, 0x9a, 0x1a, 0x5d, 0x02, 0x7c,
665 	0xd0, 0x32, 0x52, 0xa5, 0xee, 0x09, 0x27, 0x2d,
666 	0x49, 0x17, 0xf7, 0x92, 0xa1, 0x63, 0x9d, 0x2a,
667 	0xfd, 0x53, 0x26, 0x14, 0x7c, 0x92, 0x72, 0xa6,
668 	0x38, 0x18, 0x8f, 0xb5, 0x54, 0xb3, 0x69, 0x63,
669 	0x6a, 0xdc, 0xb1, 0x5a, 0x12, 0x7a, 0x0b, 0xa3,
670 };
671 
672 const struct testvec c3des_cbc_192_8_vectors[] = {
673 	{
674 		.blkno = 0,
675 		.ptxt = c3des_cbc_ptxt,
676 		.ctxt = c3des_cbc_192_encblkno8_vec0_ctxt,
677 	},
678 	{
679 		.blkno = 1,
680 		.ptxt = c3des_cbc_ptxt,
681 		.ctxt = c3des_cbc_192_encblkno8_vec1_ctxt,
682 	},
683 	{
684 		.blkno = 2,
685 		.ptxt = c3des_cbc_ptxt,
686 		.ctxt = c3des_cbc_192_encblkno8_vec2_ctxt,
687 	},
688 	{
689 		.blkno = 3,
690 		.ptxt = c3des_cbc_ptxt,
691 		.ctxt = c3des_cbc_192_encblkno8_vec3_ctxt,
692 	},
693 };
694 
695 static int
696 open_disk(const char *devpath, const char *imgpath, size_t size)
697 {
698 	int fd;
699 
700 	fd = open(imgpath, O_CREAT | O_RDWR | O_TRUNC, 0600);
701 	if (fd < 0)
702 		return -1;
703 
704 	if (ftruncate(fd, size) < 0)
705 		goto fail;
706 
707 	if (rump_pub_etfs_register_withsize(devpath,
708 	    imgpath, RUMP_ETFS_BLK, 0, size) < 0) {
709 		goto fail;
710 	}
711 
712 	unlink(imgpath);
713 	return fd;
714 fail:
715 	close(fd);
716 	unlink(imgpath);
717 	return -1;
718 }
719 
720 static int
721 open_cgd(int devno)
722 {
723 	char devpath[32];
724 
725 	sprintf(devpath, "/dev/rcgd%d%c", devno, getrawpartition() + 'a');
726 
727 	return rump_sys_open(devpath, O_RDWR, 0);
728 }
729 
730 static int
731 configure_cgd(int fd, const char *dkpath, const char *alg,
732     const char *ivmethod, const char *key, size_t keylen)
733 {
734 	struct cgd_ioctl ci;
735 
736 	memset(&ci, 0, sizeof(ci));
737 	ci.ci_disk = dkpath;
738 	ci.ci_alg = alg;
739 	ci.ci_ivmethod = ivmethod;
740 	ci.ci_keylen = 8 * keylen - 8; /* Exclude the NUL terminator. */
741 	ci.ci_key = key;
742 	ci.ci_blocksize = 64;
743 
744 	return rump_sys_ioctl(fd, CGDIOCSET, &ci);
745 }
746 
747 static int
748 unconfigure_cgd(int fd)
749 {
750 	struct cgd_ioctl ci;
751 
752 	return rump_sys_ioctl(fd, CGDIOCCLR, &ci);
753 }
754 
755 static int
756 write_testvec(int cgdfd, const struct testvec *tv)
757 {
758 
759 	if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0)
760 		return -1;
761 
762 	if (rump_sys_write(cgdfd, tv->ptxt, SECSIZE) != SECSIZE)
763 		return -1;
764 
765 	return 0;
766 }
767 
768 static int
769 read_testvec(int cgdfd, const struct testvec *tv)
770 {
771 	char *buf;
772 	int res = -1;
773 
774 	buf = malloc(SECSIZE);
775 	if (buf == NULL)
776 		return -1;
777 
778 	if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0)
779 		goto fail;
780 
781 	if (rump_sys_read(cgdfd, buf, SECSIZE) != SECSIZE)
782 		goto fail;
783 
784 	res = memcmp(buf, tv->ptxt, SECSIZE);
785 fail:
786 	free(buf);
787 	return res;
788 }
789 
790 static int
791 check_testvec(int dkfd, const struct testvec *tv)
792 {
793 	char *buf;
794 	int res = -1;
795 
796 	buf = malloc(SECSIZE);
797 	if (buf == NULL)
798 		return -1;
799 
800 	if (lseek(dkfd, tv->blkno * SECSIZE, SEEK_SET) < 0)
801 		goto fail;
802 
803 	if (read(dkfd, buf, SECSIZE) != SECSIZE)
804 		goto fail;
805 
806 	res = memcmp(buf, tv->ctxt, SECSIZE);
807 fail:
808 	free(buf);
809 	return res;
810 }
811 
812 ATF_TC(cgd_3des_cbc_192_encblkno1);
813 ATF_TC_HEAD(cgd_3des_cbc_192_encblkno1, tc)
814 {
815 	atf_tc_set_md_var(tc, "descr",
816 	    "Test 3des-cbc with 192 bits key, ivmethod encblkno1");
817 }
818 
819 ATF_TC_BODY(cgd_3des_cbc_192_encblkno1, tc)
820 {
821 	const char imgpath[] = "3des-cbc-192-encblkno1.img";
822 	const char *dkpath = "/dev/dk";
823 	const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */
824 	int dkfd, cgdfd;
825 
826 	rump_init();
827 
828 	RL(dkfd = open_disk(dkpath, imgpath, dksize));
829 
830 	RL(cgdfd = open_cgd(0));
831 	RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno1",
832 	    c3des_cbc_192_key, sizeof(c3des_cbc_192_key)));
833 
834 	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[0]), 0);
835 	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[1]), 0);
836 	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[2]), 0);
837 	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[3]), 0);
838 
839 	RL(unconfigure_cgd(cgdfd));
840 	RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno1",
841 	    c3des_cbc_192_key, sizeof(c3des_cbc_192_key)));
842 
843 	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[0]), 0);
844 	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[1]), 0);
845 	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[2]), 0);
846 	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[3]), 0);
847 
848 	RL(unconfigure_cgd(cgdfd));
849 	RL(rump_sys_close(cgdfd));
850 
851 	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[0]), 0);
852 	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[1]), 0);
853 	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[2]), 0);
854 	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[3]), 0);
855 
856 	RL(close(dkfd));
857 }
858 
859 ATF_TC(cgd_3des_cbc_192_encblkno8);
860 ATF_TC_HEAD(cgd_3des_cbc_192_encblkno8, tc)
861 {
862 	atf_tc_set_md_var(tc, "descr",
863 	    "Test 3des-cbc with 192 bits key, ivmethod encblkno8");
864 }
865 
866 ATF_TC_BODY(cgd_3des_cbc_192_encblkno8, tc)
867 {
868 	const char imgpath[] = "3des-cbc-192-encblkno8.img";
869 	const char *dkpath = "/dev/dk";
870 	const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */
871 	int dkfd, cgdfd;
872 
873 	rump_init();
874 
875 	RL(dkfd = open_disk(dkpath, imgpath, dksize));
876 
877 	RL(cgdfd = open_cgd(0));
878 	RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno8",
879 	    c3des_cbc_192_key, sizeof(c3des_cbc_192_key)));
880 
881 	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[0]), 0);
882 	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[1]), 0);
883 	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[2]), 0);
884 	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[3]), 0);
885 
886 	RL(unconfigure_cgd(cgdfd));
887 	RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno8",
888 	    c3des_cbc_192_key, sizeof(c3des_cbc_192_key)));
889 
890 	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[0]), 0);
891 	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[1]), 0);
892 	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[2]), 0);
893 	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[3]), 0);
894 
895 	RL(unconfigure_cgd(cgdfd));
896 	RL(rump_sys_close(cgdfd));
897 
898 	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[0]), 0);
899 	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[1]), 0);
900 	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[2]), 0);
901 	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[3]), 0);
902 
903 	RL(close(dkfd));
904 }
905 
906 ATF_TP_ADD_TCS(tp)
907 {
908 
909 	ATF_TP_ADD_TC(tp, cgd_3des_cbc_192_encblkno1);
910 	ATF_TP_ADD_TC(tp, cgd_3des_cbc_192_encblkno8);
911 
912 	return atf_no_error();
913 }
914