[BACK]Return to t_cgd_3des.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / tests / dev / cgd

File: [cvs.NetBSD.org] / src / tests / dev / cgd / t_cgd_3des.c (download)

Revision 1.2, Fri Jan 13 21:30:39 2017 UTC (5 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, phil-wifi, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, is-mlppp-base, is-mlppp, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Changes since 1.1: +2 -2 lines

Don't play with "../.." in includes for h_macros.h; deal with it centrally.
Minor fixes.

/*	$NetBSD: t_cgd_3des.c,v 1.2 2017/01/13 21:30:39 christos Exp $	*/
 * Copyright (c) 2016 The NetBSD Foundation, Inc.
 * All rights reserved.
 * This code is derived from software contributed to The NetBSD Foundation
 * by Alexander Nasonov.
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.

#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/sysctl.h>

#include <atf-c.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <util.h>

#include <dev/cgdvar.h>

#include <rump/rump.h>
#include <rump/rump_syscalls.h>

#include "h_macros.h"

#define SECSIZE 512

struct testvec {
	unsigned int blkno;
	const uint8_t *ptxt;	/* PlainText  */
	const uint8_t *ctxt;	/* CipherText */

 * 192 bits CBC key, NUL terminated.
static const char c3des_cbc_192_key[25] = {
	0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, /* ABCDEFGH */
	0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* IJKLMNOP */
	0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* QRSTUVWX */

static const uint8_t c3des_cbc_ptxt[SECSIZE] =
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop"
	"                abcdefghijklmnop";

 * IV method encblkno1, blkno 0.
static const uint8_t c3des_cbc_192_encblkno1_vec0_ctxt[SECSIZE] = {
	0x19, 0x92, 0xc8, 0xce, 0xdf, 0xa3, 0x14, 0xef,
	0xff, 0x88, 0x9f, 0x01, 0xfa, 0x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, 0xd9, 0x39, 0x73,
	0x2b, 0xd0, 0xa3, 0xbc, 0x9e, 0x29, 0x4d, 0x88,
	0xff, 0x98, 0x02, 0xb4, 0xcf, 0xa1, 0xf9, 0x2a,
	0xa6, 0xef, 0x7c, 0x72, 0x26, 0x4e, 0xd7, 0xdf,
	0xec, 0x3a, 0xbc, 0x8e, 0xe6, 0xb3, 0x2b, 0x43,
	0xcd, 0x67, 0x8b, 0x72, 0x00, 0x6f, 0xe5, 0x85,
	0xe2, 0x2a, 0x4c, 0x8d, 0x02, 0x44, 0x6b, 0x7a,
	0x89, 0x7a, 0x18, 0x3b, 0xc8, 0x9c, 0x8d, 0x60,
	0xec, 0x79, 0x58, 0x15, 0x98, 0x71, 0x4b, 0x1a,
	0x34, 0x69, 0x96, 0xd0, 0x0f, 0x01, 0x27, 0x2e,
	0x19, 0x02, 0xf0, 0x17, 0x8c, 0x89, 0xbf, 0x05,
	0xf0, 0xfe, 0xc3, 0xe6, 0x90, 0x9d, 0xa2, 0xb1,
	0x40, 0x06, 0x7e, 0xcd, 0x20, 0x7e, 0x5f, 0x54,
	0x31, 0xfb, 0x79, 0x84, 0x47, 0x38, 0x71, 0x69,
	0xe1, 0xd5, 0x4e, 0x84, 0xa3, 0x2b, 0x4a, 0x86,
	0xc2, 0x21, 0x5b, 0x15, 0xc3, 0x63, 0xbb, 0xc5,
	0x5c, 0xc1, 0xfb, 0x31, 0x3a, 0x4d, 0xb1, 0x9e,
	0xe1, 0xd8, 0x67, 0x4b, 0x08, 0x42, 0xc4, 0xe8,

 * IV method encblkno1, blkno 1.
static const uint8_t c3des_cbc_192_encblkno1_vec1_ctxt[SECSIZE] = {
	0x1d, 0x65, 0xdf, 0x01, 0x9b, 0x24, 0xa5, 0x10,
	0x94, 0x9a, 0x5b, 0x81, 0x96, 0x4e, 0xa3, 0x42,
	0x42, 0xd5, 0x05, 0x52, 0xab, 0x3c, 0x67, 0x40,
	0x79, 0xf9, 0x4b, 0x58, 0x39, 0xf6, 0x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	0x26, 0x7f, 0xc9, 0x27, 0x00, 0x88, 0x7d, 0x45,
	0x4e, 0xe1, 0x36, 0xf6, 0xf5, 0xa8, 0xd4, 0xef,
	0x8b, 0x26, 0x76, 0x41, 0x28, 0x87, 0xf4, 0x51,
	0x14, 0x36, 0xad, 0x60, 0x8d, 0xe9, 0xe2, 0x9d,
	0x3c, 0xea, 0x09, 0x51, 0x3c, 0x81, 0xdf, 0x1a,
	0xc2, 0xc2, 0xf6, 0x45, 0xe1, 0x73, 0xac, 0xae,
	0x85, 0x74, 0x83, 0x8f, 0x56, 0x3c, 0x36, 0x1c,
	0xe0, 0x07, 0xc6, 0x6a, 0x48, 0xe4, 0x34, 0xe9,
	0x81, 0x53, 0xb7, 0x53, 0x95, 0xa7, 0x94, 0x21,
	0x7e, 0x32, 0x53, 0xda, 0x83, 0xd8, 0x57, 0x92,
	0xd1, 0x15, 0x45, 0x86, 0x40, 0xac, 0xf1, 0x6f,
	0x3c, 0x29, 0xef, 0x8d, 0x12, 0xe1, 0x9d, 0x04,
	0x17, 0x3a, 0xcc, 0xa6, 0xc5, 0xe4, 0x27, 0x41,
	0xcb, 0xfb, 0x5e, 0x77, 0x73, 0x5a, 0x2c, 0x03,
	0xe9, 0x2b, 0x76, 0x4e, 0x69, 0xea, 0xcb, 0xb3,

 * IV method encblkno1, blkno 2.
static const uint8_t c3des_cbc_192_encblkno1_vec2_ctxt[SECSIZE] = {
	0x87, 0xb1, 0x3c, 0xd6, 0x60, 0xa0, 0x5a, 0x35,
	0xf7, 0xe1, 0x6b, 0x87, 0xa0, 0x90, 0x2f, 0xc7,
	0x8c, 0xed, 0x53, 0xda, 0x93, 0x32, 0x78, 0x5d,
	0x24, 0x23, 0x42, 0xdd, 0x93, 0x5b, 0x2e, 0x40,
	0xa1, 0xb1, 0x3b, 0xbb, 0xf0, 0x50, 0xb4, 0x61,
	0xea, 0x15, 0x37, 0xf3, 0x49, 0xe1, 0xa0, 0x32,
	0x88, 0x85, 0x81, 0xfd,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0x86, 0x59,
	0x62, 0x5b, 0xeb, 0x2a, 0xaf, 0x40, 0x17, 0xed,
	0x2b, 0x60, 0x73, 0x7d, 0x99, 0x95, 0x3f, 0xd6,
	0x6c, 0xca, 0x1e, 0xf3, 0xb0, 0xcd, 0xd5, 0x1d,
	0x53, 0xe0, 0xd2, 0x8b, 0x57, 0x7b, 0xac, 0x67,
	0x5a, 0x5a, 0x0a, 0x64, 0x82, 0xab, 0x8f, 0x5a,
	0x36, 0xe2, 0x45, 0x50, 0xec, 0x3e, 0x14, 0x80,
	0x7c, 0xfd, 0x0c, 0xa9, 0x94, 0xfb, 0xfe, 0x72,
	0xec, 0x47, 0x71, 0x2e, 0x90, 0x97, 0xf6, 0x33,
	0xbd, 0x7d, 0x7e, 0x77, 0x8f, 0xad, 0xd4, 0x1d,
	0x1d, 0x53, 0x0f, 0x28, 0x39, 0x77, 0x06, 0x1a,
	0x75, 0xfc, 0x12, 0xe6, 0x45, 0xfc, 0x87, 0xe1,
	0x46, 0xac, 0xb0, 0x73, 0xca, 0x24, 0x7c, 0x71,

 * IV method encblkno1, blkno 3.
static const uint8_t c3des_cbc_192_encblkno1_vec3_ctxt[SECSIZE] = {
	0xb1, 0xef, 0x7c, 0xd0, 0xa0, 0x6b, 0xe4, 0x88,
	0x5c, 0xd7, 0xf1, 0xbf, 0x5f, 0xce, 0xda, 0x19,
	0x81, 0x32, 0xbb, 0x96, 0x7e, 0xb9, 0x6e, 0xa1,
	0x43, 0xde, 0x53, 0x66, 0x9c, 0x27, 0x94, 0x85,
	0xcb, 0x09, 0x4e, 0x16, 0xd8, 0x60, 0x7a, 0x38,
	0x27, 0x21, 0x4d, 0x08, 0xaa, 0xe2, 0x1e, 0x6e,
	0xa3, 0xcb, 0x9a, 0x7f, 0xd1, 0xbf, 0x18, 0x36,
	0x5a, 0x4d, 0x7a, 0x7f, 0xcf, 0x3f, 0xba, 0xa5,
	0x77, 0x5b, 0xb4, 0x79, 0xdc, 0xbf, 0x2a, 0x28,
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, 0x8e, 0x8b, 0x15, 0x57, 0x07, 0x41, 0xa3,
	0x91, 0xc1, 0xe4, 0x64, 0x92, 0x89, 0xed, 0x22,
	0x88, 0x8f, 0x17, 0x91, 0xde, 0xea, 0x0c, 0xa6,
	0x86, 0x8e, 0x4c, 0xd9, 0x63, 0xc9, 0xe5, 0xdc,
	0xd6, 0xd3, 0x7b, 0x2b, 0x65, 0xfa, 0x36, 0x47,
	0x20, 0xa4, 0xe7, 0x0b, 0x52, 0xfa, 0xa6, 0xeb,
	0x1d, 0x20, 0xd0, 0x4b, 0xfd, 0x88, 0x8c, 0xbb,
	0x52, 0x9c, 0x2f, 0xb7, 0xba, 0x8b, 0xdd, 0x10,
	0x2d, 0x7d, 0x77, 0x79, 0x40, 0xa7, 0xed, 0xf9,
	0xbd, 0x2a, 0x55, 0x1f, 0x87, 0x1e, 0x3c, 0xfc,

const struct testvec c3des_cbc_192_1_vectors[] = {
		.blkno = 0,
		.ptxt = c3des_cbc_ptxt,
		.ctxt = c3des_cbc_192_encblkno1_vec0_ctxt,
		.blkno = 1,
		.ptxt = c3des_cbc_ptxt,
		.ctxt = c3des_cbc_192_encblkno1_vec1_ctxt,
		.blkno = 2,
		.ptxt = c3des_cbc_ptxt,
		.ctxt = c3des_cbc_192_encblkno1_vec2_ctxt,
		.blkno = 3,
		.ptxt = c3des_cbc_ptxt,
		.ctxt = c3des_cbc_192_encblkno1_vec3_ctxt,

 * IV method encblkno8, blkno 0.
static const uint8_t c3des_cbc_192_encblkno8_vec0_ctxt[SECSIZE] = {
	0x9e, 0x5d, 0x35, 0x56, 0xa7, 0xcc, 0xc0, 0x1c,
	0x60, 0x4c, 0x42, 0x90, 0x35, 0xf3, 0xc1, 0x20,
	0xf2, 0x07, 0x6f, 0xf8, 0x7c, 0x33, 0x6a, 0x74,
	0xdc, 0x85, 0xbc, 0x9c, 0xa2, 0x29, 0xc6, 0x69,
	0x0e, 0xef, 0x0f, 0xa9, 0x6e, 0xec, 0xf2, 0x23,
	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, 0x64, 0x61, 0x36, 0x6a, 0x0c, 0xc4, 0x18,
	0x5f, 0xd7, 0xff, 0xbc, 0xf1, 0x94, 0x16, 0xfb,
	0x26, 0xa7, 0x80, 0xa4, 0x2d, 0x72, 0xc6, 0x9d,
	0xa7, 0xed, 0x04, 0x13, 0x0f, 0xe7, 0xf8, 0x93,
	0x57, 0x6b, 0xd5, 0xa4, 0xad, 0x9a, 0x97, 0xeb,
	0x97, 0xe7, 0x60, 0x01, 0x89, 0x3f, 0x88, 0xf2,
	0xee, 0xf3, 0x79, 0xd6, 0x5a, 0x03, 0x94, 0x07,
	0xd3, 0x33, 0xc8, 0xda, 0x15, 0x17, 0x0a, 0x8f,
	0xbd, 0x58, 0x1b, 0xfe, 0x3d, 0x77, 0x5d, 0x8f,
	0x4e, 0x0e, 0x98, 0x7d, 0x02, 0x63, 0x94, 0x73,
	0x4a, 0x58, 0x47, 0xed, 0x52, 0xfc, 0x85, 0x19,
	0x5d, 0x2f, 0xfa, 0x07, 0x44, 0xbd, 0x8e, 0xcb,
	0x20, 0x63, 0x9d, 0x2b, 0x61, 0x5c, 0x19, 0x71,
	0x80, 0xe5, 0x25, 0x5b, 0x2e, 0xc5, 0xfe, 0x1a,

 * IV method encblkno8, blkno 1.
static const uint8_t c3des_cbc_192_encblkno8_vec1_ctxt[SECSIZE] = {
	0xf4, 0xb0, 0xb0, 0xcb, 0x79, 0xcc, 0x8c, 0x0a,
	0x3b, 0xc7, 0x43, 0x4e, 0x62, 0x9d, 0xde, 0xb4,
	0xab, 0xa5, 0x62, 0x63, 0x32, 0xa7, 0x18, 0x2b,
	0xe3, 0xee, 0x44, 0xc6, 0x6f, 0xb2, 0xdc, 0x21,
	0xc5, 0xc8, 0x9e, 0x32, 0x71, 0x4c, 0x7a, 0x82,
	0x8d, 0xe0, 0xad, 0x91, 0x88, 0x0c, 0x41, 0x83,
	0x28, 0x0d, 0xed, 0xa7, 0xeb, 0x48, 0xb1, 0x31,
	0xfa, 0x40, 0xd9,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 0x30, 0xb8, 0x10, 0x47,
	0x7d, 0x7e, 0x87, 0x76, 0xc1, 0x4e, 0x85, 0x77,
	0xbc, 0x30, 0x32, 0x56, 0x0a, 0x5b, 0x1c, 0xd0,
	0xf6, 0x47, 0x48, 0x22, 0xf4, 0x6e, 0x38, 0xc5,
	0xab, 0xe2, 0xd0, 0x4d, 0x40, 0x27, 0xab, 0x8f,
	0x43, 0xb1, 0x60, 0x29, 0x07, 0xd0, 0xf5, 0x25,
	0xe5, 0xfa, 0xe7, 0x46, 0x32, 0x37, 0xb9, 0xae,
	0x2e, 0x02, 0x8c, 0x94, 0x15, 0x69, 0xd6, 0x74,
	0xb4, 0x36, 0xdd, 0x94, 0x70, 0xa7, 0x16, 0x7b,
	0x4c, 0xd3, 0x48, 0x83, 0xc5, 0xb2, 0xb0, 0x6a,
	0xfe, 0x7e, 0xd4, 0xe5, 0x6d, 0xa5, 0x96, 0x20,
	0x08, 0x59, 0xbd, 0x0c, 0x3d, 0x55, 0xa5, 0x03,

 * IV method encblkno8, blkno 2.
static const uint8_t c3des_cbc_192_encblkno8_vec2_ctxt[SECSIZE] = {
	0xea, 0x7c, 0x8c, 0x8e, 0x3e, 0x61, 0x34, 0x3d,
	0xe0, 0x7f, 0xd3, 0xe1, 0x3a, 0xb9, 0xc8, 0xf2,
	0x98, 0xdc, 0x59, 0x26, 0xd2, 0xd8, 0xa7, 0x7f,
	0x41, 0x98, 0x24, 0xa8, 0x28, 0x0c, 0x88, 0x55,
	0x91, 0xdb, 0x29, 0x17, 0x70, 0xd7, 0x03, 0xff,
	0xbd, 0x0e, 0xbf, 0xf8, 0x73, 0x92, 0x19, 0xe9,
	0x92, 0x67, 0xdb, 0x08, 0x94, 0x77, 0x71, 0x2d,
	0x00, 0xad, 0x26, 0x42, 0x2d, 0xac, 0x8c, 0x67,
	0x6f, 0xb3, 0x8e, 0x36, 0x22, 0xeb, 0x1f, 0x8c,
	0xd4, 0x9b, 0x9f, 0xa6, 0xa9, 0xb1, 0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36,
	0x88, 0xc2, 0x39, 0x51, 0xb6, 0xb8, 0x0d, 0x5c,
	0x20, 0x4e, 0x24, 0xee, 0x95, 0x32, 0x61, 0x25,
	0xda, 0x73, 0x0d, 0x8a, 0x58, 0xe6, 0xcc, 0xad,
	0x79, 0x3d, 0xef, 0x29, 0x0c, 0x9f, 0xe1, 0xa7,
	0x22, 0x1e, 0xea, 0x7a, 0x4f, 0xfb, 0xc1, 0x1f,
	0x17, 0xca, 0x69, 0xd6, 0xa4, 0xce, 0x6e, 0xc0,
	0x70, 0xa3, 0x08, 0x32, 0x87, 0xb4, 0x6b, 0x80,
	0x5c, 0x7f, 0x88, 0x5c, 0xbf, 0x07, 0xd8, 0xe9,
	0xdd, 0xd2, 0x76, 0xa9, 0xaa, 0xd9, 0x55, 0x48,

 * IV method encblkno8, blkno 3.
static const uint8_t c3des_cbc_192_encblkno8_vec3_ctxt[SECSIZE] = {
	0xf3, 0x49, 0xda, 0x5c, 0xde, 0x9d, 0x3e, 0x9d,
	0xb9, 0xc2, 0x6e, 0x96, 0xa9, 0x93, 0x10, 0x73,
	0x0e, 0x26, 0x39, 0xd6, 0x9f, 0x04, 0x5f, 0x69,
	0x54, 0xa3, 0x7c, 0x46, 0x7b, 0x18, 0x93, 0xc0,
	0xbb, 0x0c, 0x96, 0x6f, 0xb0, 0xbf, 0xce, 0x67,
	0x33, 0x3e, 0x56, 0xe8, 0x6b, 0x4d, 0x3f, 0xc8,
	0x3c, 0xc6, 0x89, 0x2c, 0x0b, 0x95, 0x3a, 0xaf,
	0xc0, 0xf3, 0x1f, 0x0e, 0x07, 0x01, 0xa6, 0x35,
	0x19, 0x79, 0x91, 0x24, 0xaa, 0x0d, 0xf0, 0x53,
	0x27, 0x7d, 0xbb, 0xa6, 0xb6, 0x44, 0x31, 0x4b,
	0xd4, 0xcf, 0xf6, 0x6d, 0x18, 0xa2, 0x28, 0x8a,
	0xc1, 0x0a, 0xbe, 0x57, 0x0c, 0x61, 0x5f, 0xd9,
	0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xf8, 0x82, 0x50, 0x6a, 0x41,
	0x28, 0x3e, 0x9f, 0x9a, 0x1a, 0x5d, 0x02, 0x7c,
	0xd0, 0x32, 0x52, 0xa5, 0xee, 0x09, 0x27, 0x2d,
	0x49, 0x17, 0xf7, 0x92, 0xa1, 0x63, 0x9d, 0x2a,
	0xfd, 0x53, 0x26, 0x14, 0x7c, 0x92, 0x72, 0xa6,
	0x38, 0x18, 0x8f, 0xb5, 0x54, 0xb3, 0x69, 0x63,
	0x6a, 0xdc, 0xb1, 0x5a, 0x12, 0x7a, 0x0b, 0xa3,

const struct testvec c3des_cbc_192_8_vectors[] = {
		.blkno = 0,
		.ptxt = c3des_cbc_ptxt,
		.ctxt = c3des_cbc_192_encblkno8_vec0_ctxt,
		.blkno = 1,
		.ptxt = c3des_cbc_ptxt,
		.ctxt = c3des_cbc_192_encblkno8_vec1_ctxt,
		.blkno = 2,
		.ptxt = c3des_cbc_ptxt,
		.ctxt = c3des_cbc_192_encblkno8_vec2_ctxt,
		.blkno = 3,
		.ptxt = c3des_cbc_ptxt,
		.ctxt = c3des_cbc_192_encblkno8_vec3_ctxt,

static int
open_disk(const char *devpath, const char *imgpath, size_t size)
	int fd;

	fd = open(imgpath, O_CREAT | O_RDWR | O_TRUNC, 0600);
	if (fd < 0)
		return -1;

	if (ftruncate(fd, size) < 0)
		goto fail;

	if (rump_pub_etfs_register_withsize(devpath,
	    imgpath, RUMP_ETFS_BLK, 0, size) < 0) {
		goto fail;

	return fd;
	return -1;

static int
open_cgd(int devno)
	char devpath[32];

	sprintf(devpath, "/dev/rcgd%d%c", devno, getrawpartition() + 'a');

	return rump_sys_open(devpath, O_RDWR, 0);

static int
configure_cgd(int fd, const char *dkpath, const char *alg,
    const char *ivmethod, const char *key, size_t keylen)
	struct cgd_ioctl ci;

	memset(&ci, 0, sizeof(ci));
	ci.ci_disk = dkpath;
	ci.ci_alg = alg;
	ci.ci_ivmethod = ivmethod;
	ci.ci_keylen = 8 * keylen - 8; /* Exclude the NUL terminator. */
	ci.ci_key = key;
	ci.ci_blocksize = 64;

	return rump_sys_ioctl(fd, CGDIOCSET, &ci);

static int
unconfigure_cgd(int fd)
	struct cgd_ioctl ci;

	return rump_sys_ioctl(fd, CGDIOCCLR, &ci);

static int
write_testvec(int cgdfd, const struct testvec *tv)

	if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0)
		return -1;

	if (rump_sys_write(cgdfd, tv->ptxt, SECSIZE) != SECSIZE)
		return -1;

	return 0;

static int
read_testvec(int cgdfd, const struct testvec *tv)
	char *buf;
	int res = -1;

	buf = malloc(SECSIZE);
	if (buf == NULL)
		return -1;

	if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0)
		goto fail;

	if (rump_sys_read(cgdfd, buf, SECSIZE) != SECSIZE)
		goto fail;

	res = memcmp(buf, tv->ptxt, SECSIZE);
	return res;

static int
check_testvec(int dkfd, const struct testvec *tv)
	char *buf;
	int res = -1;

	buf = malloc(SECSIZE);
	if (buf == NULL)
		return -1;

	if (lseek(dkfd, tv->blkno * SECSIZE, SEEK_SET) < 0)
		goto fail;

	if (read(dkfd, buf, SECSIZE) != SECSIZE)
		goto fail;

	res = memcmp(buf, tv->ctxt, SECSIZE);
	return res;

ATF_TC_HEAD(cgd_3des_cbc_192_encblkno1, tc)
	atf_tc_set_md_var(tc, "descr",
	    "Test 3des-cbc with 192 bits key, ivmethod encblkno1");

ATF_TC_BODY(cgd_3des_cbc_192_encblkno1, tc)
	const char imgpath[] = "3des-cbc-192-encblkno1.img";
	const char *dkpath = "/dev/dk";
	const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */
	int dkfd, cgdfd;


	RL(dkfd = open_disk(dkpath, imgpath, dksize));

	RL(cgdfd = open_cgd(0));
	RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno1",
	    c3des_cbc_192_key, sizeof(c3des_cbc_192_key)));

	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[0]), 0);
	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[1]), 0);
	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[2]), 0);
	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[3]), 0);

	RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno1",
	    c3des_cbc_192_key, sizeof(c3des_cbc_192_key)));

	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[0]), 0);
	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[1]), 0);
	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[2]), 0);
	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[3]), 0);


	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[0]), 0);
	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[1]), 0);
	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[2]), 0);
	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[3]), 0);


ATF_TC_HEAD(cgd_3des_cbc_192_encblkno8, tc)
	atf_tc_set_md_var(tc, "descr",
	    "Test 3des-cbc with 192 bits key, ivmethod encblkno8");

ATF_TC_BODY(cgd_3des_cbc_192_encblkno8, tc)
	const char imgpath[] = "3des-cbc-192-encblkno8.img";
	const char *dkpath = "/dev/dk";
	const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */
	int dkfd, cgdfd;


	RL(dkfd = open_disk(dkpath, imgpath, dksize));

	RL(cgdfd = open_cgd(0));
	RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno8",
	    c3des_cbc_192_key, sizeof(c3des_cbc_192_key)));

	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[0]), 0);
	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[1]), 0);
	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[2]), 0);
	ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[3]), 0);

	RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno8",
	    c3des_cbc_192_key, sizeof(c3des_cbc_192_key)));

	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[0]), 0);
	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[1]), 0);
	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[2]), 0);
	ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[3]), 0);


	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[0]), 0);
	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[1]), 0);
	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[2]), 0);
	ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[3]), 0);



	ATF_TP_ADD_TC(tp, cgd_3des_cbc_192_encblkno1);
	ATF_TP_ADD_TC(tp, cgd_3des_cbc_192_encblkno8);

	return atf_no_error();