CVS commit: src/tests/dev/cgd

2020-08-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Aug 20 13:33:54 UTC 2020

Modified Files:
src/tests/dev/cgd: t_cgd_adiantum.c

Log Message:
clang can't handle __aligned on anonymous structure initializers.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/cgd/t_cgd_adiantum.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd_adiantum.c
diff -u src/tests/dev/cgd/t_cgd_adiantum.c:1.4 src/tests/dev/cgd/t_cgd_adiantum.c:1.5
--- src/tests/dev/cgd/t_cgd_adiantum.c:1.4	Sat Aug 15 10:03:10 2020
+++ src/tests/dev/cgd/t_cgd_adiantum.c	Thu Aug 20 13:33:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_adiantum.c,v 1.4 2020/08/15 10:03:10 mlelstv Exp $	*/
+/*	$NetBSD: t_cgd_adiantum.c,v 1.5 2020/08/20 13:33:54 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -47,6 +47,9 @@
 #define	MAXSECSIZE	512	/* for now; should be cgd parameter */
 #define	IMGSIZE		0x101*512
 
+/* Used as buffer for cgd device I/O, must be at least 32-bit aligned.  */
+static const uint8_t zerosector[512] __aligned(4);
+
 static const struct {
 	uint8_t		key[32];
 	uint64_t	blkno;
@@ -58,7 +61,7 @@ static const struct {
 		.key = {0},
 		.blkno = 0,
 		.secsize = 512,
-		.ptxt = (const __aligned(4) uint8_t[512]) {0},
+		.ptxt = zerosector,
 		.ctxt = (const uint8_t[512]) {
 			0x51,0x6d,0xe2,0x81, 0x26,0xd5,0xc8,0xd7,
 			0xff,0xc6,0xc2,0xff, 0x39,0xbf,0x15,0x15,
@@ -130,7 +133,7 @@ static const struct {
 		.key = {0},
 		.blkno = 1,
 		.secsize = 512,
-		.ptxt = (const __aligned(4) uint8_t[512]) {0},
+		.ptxt = zerosector,
 		.ctxt = (const uint8_t[512]) {
 			0xf2,0x23,0x68,0x5a, 0x15,0x11,0x56,0xa1,
 			0x71,0x57,0x5c,0x5e, 0x32,0xd4,0xdd,0xbb,
@@ -202,7 +205,7 @@ static const struct {
 		.key = {0},
 		.blkno = 0x100,
 		.secsize = 512,
-		.ptxt = (const __aligned(4) uint8_t[512]) {0},
+		.ptxt = zerosector,
 		.ctxt = (const uint8_t[512]) {
 			0x32,0x26,0xaf,0x56, 0xbc,0x43,0xac,0x37,
 			0xb2,0x8d,0xa4,0xfb, 0x32,0xdc,0x09,0x03,



CVS commit: src/tests/dev/cgd

2020-08-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Aug 20 13:33:54 UTC 2020

Modified Files:
src/tests/dev/cgd: t_cgd_adiantum.c

Log Message:
clang can't handle __aligned on anonymous structure initializers.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/cgd/t_cgd_adiantum.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2020-08-15 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 15 10:03:10 UTC 2020

Modified Files:
src/tests/dev/cgd: t_cgd_3des.c t_cgd_adiantum.c t_cgd_aes.c
t_cgd_blowfish.c

Log Message:
Plaintext buffers are used directly for write() operations to the raw device.
Align them to the needs of cgd(4).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/cgd/t_cgd_3des.c \
src/tests/dev/cgd/t_cgd_blowfish.c
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/t_cgd_adiantum.c
cvs rdiff -u -r1.7 -r1.8 src/tests/dev/cgd/t_cgd_aes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2020-08-15 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 15 10:03:10 UTC 2020

Modified Files:
src/tests/dev/cgd: t_cgd_3des.c t_cgd_adiantum.c t_cgd_aes.c
t_cgd_blowfish.c

Log Message:
Plaintext buffers are used directly for write() operations to the raw device.
Align them to the needs of cgd(4).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/cgd/t_cgd_3des.c \
src/tests/dev/cgd/t_cgd_blowfish.c
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/t_cgd_adiantum.c
cvs rdiff -u -r1.7 -r1.8 src/tests/dev/cgd/t_cgd_aes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd_3des.c
diff -u src/tests/dev/cgd/t_cgd_3des.c:1.2 src/tests/dev/cgd/t_cgd_3des.c:1.3
--- src/tests/dev/cgd/t_cgd_3des.c:1.2	Fri Jan 13 21:30:39 2017
+++ src/tests/dev/cgd/t_cgd_3des.c	Sat Aug 15 10:03:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_3des.c,v 1.2 2017/01/13 21:30:39 christos Exp $	*/
+/*	$NetBSD: t_cgd_3des.c,v 1.3 2020/08/15 10:03:10 mlelstv Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -68,7 +68,7 @@ static const char c3des_cbc_192_key[25] 
 	0
 };
 
-static const uint8_t c3des_cbc_ptxt[SECSIZE] =
+static const uint8_t c3des_cbc_ptxt[SECSIZE] __aligned(4) =
 	"abcdefghijklmnop"
 	"abcdefghijklmnop"
 	"abcdefghijklmnop"
Index: src/tests/dev/cgd/t_cgd_blowfish.c
diff -u src/tests/dev/cgd/t_cgd_blowfish.c:1.2 src/tests/dev/cgd/t_cgd_blowfish.c:1.3
--- src/tests/dev/cgd/t_cgd_blowfish.c:1.2	Fri Jan 13 21:30:39 2017
+++ src/tests/dev/cgd/t_cgd_blowfish.c	Sat Aug 15 10:03:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_blowfish.c,v 1.2 2017/01/13 21:30:39 christos Exp $	*/
+/*	$NetBSD: t_cgd_blowfish.c,v 1.3 2020/08/15 10:03:10 mlelstv Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -92,7 +92,7 @@ static const char bf_cbc_448_key[57] = {
 	0
 };
 
-static const uint8_t bf_cbc_ptxt[SECSIZE] =
+static const uint8_t bf_cbc_ptxt[SECSIZE] __aligned(4) =
 	"abcdefghijklmnop"
 	"abcdefghijklmnop"
 	"abcdefghijklmnop"

Index: src/tests/dev/cgd/t_cgd_adiantum.c
diff -u src/tests/dev/cgd/t_cgd_adiantum.c:1.3 src/tests/dev/cgd/t_cgd_adiantum.c:1.4
--- src/tests/dev/cgd/t_cgd_adiantum.c:1.3	Tue Jun 30 04:17:31 2020
+++ src/tests/dev/cgd/t_cgd_adiantum.c	Sat Aug 15 10:03:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_adiantum.c,v 1.3 2020/06/30 04:17:31 riastradh Exp $	*/
+/*	$NetBSD: t_cgd_adiantum.c,v 1.4 2020/08/15 10:03:10 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@ static const struct {
 		.key = {0},
 		.blkno = 0,
 		.secsize = 512,
-		.ptxt = (const uint8_t[512]) {0},
+		.ptxt = (const __aligned(4) uint8_t[512]) {0},
 		.ctxt = (const uint8_t[512]) {
 			0x51,0x6d,0xe2,0x81, 0x26,0xd5,0xc8,0xd7,
 			0xff,0xc6,0xc2,0xff, 0x39,0xbf,0x15,0x15,
@@ -130,7 +130,7 @@ static const struct {
 		.key = {0},
 		.blkno = 1,
 		.secsize = 512,
-		.ptxt = (const uint8_t[512]) {0},
+		.ptxt = (const __aligned(4) uint8_t[512]) {0},
 		.ctxt = (const uint8_t[512]) {
 			0xf2,0x23,0x68,0x5a, 0x15,0x11,0x56,0xa1,
 			0x71,0x57,0x5c,0x5e, 0x32,0xd4,0xdd,0xbb,
@@ -202,7 +202,7 @@ static const struct {
 		.key = {0},
 		.blkno = 0x100,
 		.secsize = 512,
-		.ptxt = (const uint8_t[512]) {0},
+		.ptxt = (const __aligned(4) uint8_t[512]) {0},
 		.ctxt = (const uint8_t[512]) {
 			0x32,0x26,0xaf,0x56, 0xbc,0x43,0xac,0x37,
 			0xb2,0x8d,0xa4,0xfb, 0x32,0xdc,0x09,0x03,

Index: src/tests/dev/cgd/t_cgd_aes.c
diff -u src/tests/dev/cgd/t_cgd_aes.c:1.7 src/tests/dev/cgd/t_cgd_aes.c:1.8
--- src/tests/dev/cgd/t_cgd_aes.c:1.7	Wed Jul 10 06:21:40 2019
+++ src/tests/dev/cgd/t_cgd_aes.c	Sat Aug 15 10:03:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_aes.c,v 1.7 2019/07/10 06:21:40 martin Exp $	*/
+/*	$NetBSD: t_cgd_aes.c,v 1.8 2020/08/15 10:03:10 mlelstv Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc
@@ -89,7 +89,7 @@ static const char aes_cbc_256_key[33] = 
 	0
 };
 
-static const uint8_t aes_cbc_ptxt[SECSIZE] =
+static const uint8_t aes_cbc_ptxt[SECSIZE] __aligned(4) =
 	"abcdefghijklmnop"
 	"abcdefghijklmnop"
 	"abcdefghijklmnop"
@@ -1954,7 +1954,7 @@ static const char aes_xts_512_key[65] = 
 /*
  * Vector 4 from IEEE 1619/D16, blkno 0.
  */
-static const uint8_t aes_xts_256_vec4_ptxt[SECSIZE] = {
+static const uint8_t aes_xts_256_vec4_ptxt[SECSIZE] __aligned(4) = {
 	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
 	0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
 	0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@@ -2091,7 +2091,7 @@ static const uint8_t aes_xts_256_vec4_ct
 /*
  * Vector 5 from IEEE 1619/D16, blkno 1.
  */
-static const uint8_t 

CVS commit: src/tests/dev/cgd

2020-06-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 30 04:17:31 UTC 2020

Modified Files:
src/tests/dev/cgd: t_cgd_adiantum.c

Log Message:
Missed a spot -- one more 32-bit sign-compare issue.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/cgd/t_cgd_adiantum.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd_adiantum.c
diff -u src/tests/dev/cgd/t_cgd_adiantum.c:1.2 src/tests/dev/cgd/t_cgd_adiantum.c:1.3
--- src/tests/dev/cgd/t_cgd_adiantum.c:1.2	Tue Jun 30 04:15:46 2020
+++ src/tests/dev/cgd/t_cgd_adiantum.c	Tue Jun 30 04:17:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_adiantum.c,v 1.2 2020/06/30 04:15:46 riastradh Exp $	*/
+/*	$NetBSD: t_cgd_adiantum.c,v 1.3 2020/06/30 04:17:31 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -348,7 +348,7 @@ ATF_TC_BODY(cgd_adiantum, tc)
 		RL(nwrit = rump_sys_pwrite(cgdfd, C[i].ptxt, C[i].secsize,
 			C[i].blkno * C[i].secsize));
 		RL(unconfigure_cgd(cgdfd));
-		if (nwrit != C[i].secsize) {
+		if ((size_t)nwrit != C[i].secsize) {
 			atf_tc_fail_nonfatal("truncated write: %zd != %u",
 			nwrit, C[i].secsize);
 			continue;



CVS commit: src/tests/dev/cgd

2020-06-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 30 04:17:31 UTC 2020

Modified Files:
src/tests/dev/cgd: t_cgd_adiantum.c

Log Message:
Missed a spot -- one more 32-bit sign-compare issue.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/cgd/t_cgd_adiantum.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2020-06-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 30 04:15:46 UTC 2020

Modified Files:
src/tests/dev/cgd: t_cgd_adiantum.c

Log Message:
Fix sign-compare issue on 32-bit systems.

Built fine on amd64, where all unsigned values are representable in
ssize_t, but I didn't try building on i386, where they're not.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/cgd/t_cgd_adiantum.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd_adiantum.c
diff -u src/tests/dev/cgd/t_cgd_adiantum.c:1.1 src/tests/dev/cgd/t_cgd_adiantum.c:1.2
--- src/tests/dev/cgd/t_cgd_adiantum.c:1.1	Mon Jun 29 23:44:01 2020
+++ src/tests/dev/cgd/t_cgd_adiantum.c	Tue Jun 30 04:15:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_adiantum.c,v 1.1 2020/06/29 23:44:01 riastradh Exp $	*/
+/*	$NetBSD: t_cgd_adiantum.c,v 1.2 2020/06/30 04:15:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -357,7 +357,7 @@ ATF_TC_BODY(cgd_adiantum, tc)
 		/* read the ciphertext out from the underlying file */
 		RL(nread = pread(dkfd, buf, C[i].secsize,
 			C[i].blkno * C[i].secsize));
-		if (nread != C[i].secsize) {
+		if ((size_t)nread != C[i].secsize) {
 			atf_tc_fail_nonfatal("truncated read: %zd != %u",
 			nread, C[i].secsize);
 			continue;
@@ -375,7 +375,7 @@ ATF_TC_BODY(cgd_adiantum, tc)
 		RL(nread = rump_sys_pread(cgdfd, buf, C[i].secsize,
 			C[i].blkno * C[i].secsize));
 		RL(unconfigure_cgd(cgdfd));
-		if (nread != C[i].secsize) {
+		if ((size_t)nread != C[i].secsize) {
 			atf_tc_fail_nonfatal("truncated read: %zd != %u",
 			nread, C[i].secsize);
 			continue;



CVS commit: src/tests/dev/cgd

2020-06-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 30 04:15:46 UTC 2020

Modified Files:
src/tests/dev/cgd: t_cgd_adiantum.c

Log Message:
Fix sign-compare issue on 32-bit systems.

Built fine on amd64, where all unsigned values are representable in
ssize_t, but I didn't try building on i386, where they're not.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/cgd/t_cgd_adiantum.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2020-03-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  1 17:06:26 UTC 2020

Modified Files:
src/tests/dev/cgd: Makefile

Log Message:
librump depends on vfs so add a dependency on for sun2.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/dev/cgd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/Makefile
diff -u src/tests/dev/cgd/Makefile:1.8 src/tests/dev/cgd/Makefile:1.9
--- src/tests/dev/cgd/Makefile:1.8	Sun May 21 11:28:42 2017
+++ src/tests/dev/cgd/Makefile	Sun Mar  1 12:06:26 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2017/05/21 15:28:42 riastradh Exp $
+#	$NetBSD: Makefile,v 1.9 2020/03/01 17:06:26 christos Exp $
 #
 
 .include 
@@ -15,7 +15,7 @@ TESTS_C=	t_cgd_3des t_cgd_aes t_cgd_blow
 WARNS=	4
 CPPFLAGS+=	-D_KERNTYPES
 LDADD+=	-lrumpdev -lrumpdev_disk -lrumpdev_cgd -lrumpkern_crypto -lrumpvfs
-LDADD+=	-lrump
+LDADD+=	-lrump -lrumpvfs
 LDADD+=	-lrumpuser
 LDADD+=	-lrump -lutil
 LDADD+=	-lpthread



CVS commit: src/tests/dev/cgd

2020-03-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  1 17:06:26 UTC 2020

Modified Files:
src/tests/dev/cgd: Makefile

Log Message:
librump depends on vfs so add a dependency on for sun2.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/dev/cgd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2019-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 10 06:21:40 UTC 2019

Modified Files:
src/tests/dev/cgd: t_cgd_aes.c

Log Message:
Gracefully skip test if not enough space in temporary directory.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/dev/cgd/t_cgd_aes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd_aes.c
diff -u src/tests/dev/cgd/t_cgd_aes.c:1.6 src/tests/dev/cgd/t_cgd_aes.c:1.7
--- src/tests/dev/cgd/t_cgd_aes.c:1.6	Fri Jan 13 21:30:39 2017
+++ src/tests/dev/cgd/t_cgd_aes.c	Wed Jul 10 06:21:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_aes.c,v 1.6 2017/01/13 21:30:39 christos Exp $	*/
+/*	$NetBSD: t_cgd_aes.c,v 1.7 2019/07/10 06:21:40 martin Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc
@@ -3565,7 +3565,12 @@ ATF_TC_BODY(cgd_aes_xts_512, tc)
 
 	rump_init();
 
-	RL(dkfd = open_disk(dkpath, imgpath, dksize));
+	dkfd = open_disk(dkpath, imgpath, dksize);
+	if (dkfd == -1 && errno == ENOSPC) {
+		atf_tc_skip("not enough space");
+	} else {
+		ATF_CHECK_MSG(dkfd != -1, "open_disk: %s", strerror(errno));
+	}
 
 	RL(cgdfd = open_cgd(0));
 	RL(configure_cgd(cgdfd, dkpath, "aes-xts", "encblkno1",



CVS commit: src/tests/dev/cgd

2019-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 10 06:21:40 UTC 2019

Modified Files:
src/tests/dev/cgd: t_cgd_aes.c

Log Message:
Gracefully skip test if not enough space in temporary directory.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/dev/cgd/t_cgd_aes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2019-04-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Apr 10 06:13:21 UTC 2019

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
Fix quoting (quotes really do not nest...) and remove a bunch of it
that is harmless, but also pointless (in sh, quotes do not make strings,
everything is a string, rather they hide characters which would have
some other meaning unquoted (like spaces) - quotes are not needed around
strings like "descr" so remove them...

Be more consistent with line wrap style, try to avoid wrapping in the
middle of a (sh) word where possible.   Avoid \ use when it is not needed.

Un-KNF (C style) - sh has no declarations, there is no need to leave
blank lines at the head of a function to mark the end of the declarations.

This should be a NFC - but the quoting really was broken before, just
was probably harmless breakage.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/dev/cgd/t_cgd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd.sh
diff -u src/tests/dev/cgd/t_cgd.sh:1.12 src/tests/dev/cgd/t_cgd.sh:1.13
--- src/tests/dev/cgd/t_cgd.sh:1.12	Wed Apr 10 06:09:39 2019
+++ src/tests/dev/cgd/t_cgd.sh	Wed Apr 10 06:13:21 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgd.sh,v 1.12 2019/04/10 06:09:39 kre Exp $
+#	$NetBSD: t_cgd.sh,v 1.13 2019/04/10 06:13:21 kre Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -34,13 +34,12 @@ atf_test_case basic cleanup
 basic_head()
 {
 
-	atf_set "descr" "Tests that encrypt/decrypt works"
-	atf_set "require.progs" "rump_server"
+	atf_set descr "Tests that encrypt/decrypt works"
+	atf_set require.progs rump_server
 }
 
 basic_body()
 {
-
 	d=$(atf_get_srcdir)
 	atf_check -s exit:0 \
 	${cgdserver} -d key=/dev/dk,hostpath=dk.img,size=1m unix://csock
@@ -57,7 +56,6 @@ basic_body()
 
 basic_cleanup()
 {
-
 	env RUMP_SERVER=unix://csock rump.halt || true
 }
 
@@ -65,28 +63,27 @@ atf_test_case wrongpass cleanup
 wrongpass_head()
 {
 
-	atf_set "descr" "Tests that wrong password does not give original " \
-	"plaintext"
-	atf_set "require.progs" "rump_server"
+	atf_set descr \
+	"Tests that wrong password does not give original plaintext"
+	atf_set require.progs rump_server
 }
 
 wrongpass_body()
 {
-
 	d=$(atf_get_srcdir)
 	atf_check -s exit:0 \
 	${cgdserver} -d key=/dev/dk,hostpath=dk.img,size=1m unix://csock
 
 	export RUMP_SERVER=unix://csock
-	atf_check -s exit:0 -x "echo 12345 | \
-	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile"
+	atf_check -s exit:0 -x \
+	"echo 12345 | rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile"
 	atf_check -s exit:0 -e ignore -x \
 	"dd if=${d}/t_cgd | rump.dd of=${rawcgd} count=2"
 
 	# unconfig and reconfig cgd
 	atf_check -s exit:0 rump.cgdconfig -u cgd0
-	atf_check -s exit:0 -x "echo 54321 | \
-	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile"
+	atf_check -s exit:0 -x \
+	"echo 54321 | rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile"
 
 	atf_check -s exit:0 -e ignore dd if=${d}/t_cgd of=testfile count=2
 	atf_check -s exit:0 -e ignore -o not-file:testfile \
@@ -95,7 +92,6 @@ wrongpass_body()
 
 wrongpass_cleanup()
 {
-
 	env RUMP_SERVER=unix://csock rump.halt || true
 }
 
@@ -103,9 +99,8 @@ wrongpass_cleanup()
 atf_test_case unaligned_write cleanup
 unaligned_write_head()
 {
-
-	atf_set "descr" "Attempt unaligned writes to a raw cgd device"
-	atf_set "require.progs" "rump_server"
+	atf_set descr "Attempt unaligned writes to a raw cgd device"
+	atf_set require.progs rump_server
 }
 
 unaligned_write_body()
@@ -115,8 +110,8 @@ unaligned_write_body()
 	${cgdserver} -d key=/dev/dk,hostpath=dk.img,size=1m unix://csock
 
 	export RUMP_SERVER=unix://csock
-	atf_check -s exit:0 -x "echo 12345 | \
-	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile"
+	atf_check -s exit:0 -x \
+	"echo 12345 | rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile"
 
 	# Check that cgd rejects writes of totally bogus lengths.
 	atf_check -s not-exit:0 -e ignore -x \
@@ -133,8 +128,8 @@ unaligned_write_body()
 	# packetizing the input on bogus boundaries and using the
 	# bizarre behaviour of `bs=N' in dd.
 	atf_check -s not-exit:0 -e ignore -x \
-	"(echo -n x && sleep 1 && head -c 511 /dev/null ; \
-		env RUMP_SERVER=unix://csock rump.halt || true ; \
+	eval "${name}_cleanup() {
+		rump.cgdconfig -u cgd0 2>/dev/null
+		env RUMP_SERVER=unix://csock rump.halt || true
 	}"
 }
 
@@ -191,7 +186,6 @@ test_case_vmeth_failure mbr
 
 atf_init_test_cases()
 {
-
 	atf_add_test_case basic
 	atf_add_test_case wrongpass
 	atf_add_test_case unaligned_write



CVS commit: src/tests/dev/cgd

2019-04-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Apr 10 06:13:21 UTC 2019

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
Fix quoting (quotes really do not nest...) and remove a bunch of it
that is harmless, but also pointless (in sh, quotes do not make strings,
everything is a string, rather they hide characters which would have
some other meaning unquoted (like spaces) - quotes are not needed around
strings like "descr" so remove them...

Be more consistent with line wrap style, try to avoid wrapping in the
middle of a (sh) word where possible.   Avoid \ use when it is not needed.

Un-KNF (C style) - sh has no declarations, there is no need to leave
blank lines at the head of a function to mark the end of the declarations.

This should be a NFC - but the quoting really was broken before, just
was probably harmless breakage.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/dev/cgd/t_cgd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2016-12-10 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sun Dec 11 00:23:44 UTC 2016

Modified Files:
src/tests/dev/cgd: t_cgd_aes.c

Log Message:
AES XTS unit tests should now pass.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/cgd/t_cgd_aes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd_aes.c
diff -u src/tests/dev/cgd/t_cgd_aes.c:1.4 src/tests/dev/cgd/t_cgd_aes.c:1.5
--- src/tests/dev/cgd/t_cgd_aes.c:1.4	Thu Nov 24 22:42:16 2016
+++ src/tests/dev/cgd/t_cgd_aes.c	Sun Dec 11 00:23:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_aes.c,v 1.4 2016/11/24 22:42:16 alnsn Exp $	*/
+/*	$NetBSD: t_cgd_aes.c,v 1.5 2016/12/11 00:23:44 alnsn Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc
@@ -3511,8 +3511,6 @@ ATF_TC_BODY(cgd_aes_xts_256, tc)
 	const size_t dksize = 256 * SECSIZE; /* Last blkno is 0xff. */
 	int dkfd, cgdfd;
 
-	atf_tc_expect_fail("aes-xts implementation not committed yet");
-
 	rump_init();
 
 	RL(dkfd = open_disk(dkpath, imgpath, dksize));
@@ -3565,8 +3563,6 @@ ATF_TC_BODY(cgd_aes_xts_512, tc)
 	const size_t dksize = 65536 * SECSIZE; /* Last blkno is 0x. */
 	int dkfd, cgdfd;
 
-	atf_tc_expect_fail("aes-xts implementation not committed yet");
-
 	rump_init();
 
 	RL(dkfd = open_disk(dkpath, imgpath, dksize));



CVS commit: src/tests/dev/cgd

2016-12-10 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sun Dec 11 00:23:44 UTC 2016

Modified Files:
src/tests/dev/cgd: t_cgd_aes.c

Log Message:
AES XTS unit tests should now pass.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/cgd/t_cgd_aes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2016-11-24 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Thu Nov 24 22:42:16 UTC 2016

Modified Files:
src/tests/dev/cgd: t_cgd_aes.c

Log Message:
Switch to CHECK_LIBC for writing.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/t_cgd_aes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd_aes.c
diff -u src/tests/dev/cgd/t_cgd_aes.c:1.3 src/tests/dev/cgd/t_cgd_aes.c:1.4
--- src/tests/dev/cgd/t_cgd_aes.c:1.3	Wed Nov  9 22:01:15 2016
+++ src/tests/dev/cgd/t_cgd_aes.c	Thu Nov 24 22:42:16 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_aes.c,v 1.3 2016/11/09 22:01:15 alnsn Exp $	*/
+/*	$NetBSD: t_cgd_aes.c,v 1.4 2016/11/24 22:42:16 alnsn Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc
@@ -3156,12 +3156,18 @@ unconfigure_cgd(int fd)
 static int
 write_testvec(int cgdfd, const struct testvec *tv)
 {
+	ssize_t written;
 
 	if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0)
 		return -1;
 
-	if (rump_sys_write(cgdfd, tv->ptxt, SECSIZE) != SECSIZE)
+	written = rump_sys_write(cgdfd, tv->ptxt, SECSIZE);
+	if (written < 0)
 		return -1;
+	if (written != SECSIZE) {
+		errno = EDOM; /* Something distinct. */
+		return -1;
+	}
 
 	return 0;
 }
@@ -3232,10 +3238,10 @@ ATF_TC_BODY(cgd_aes_cbc_128_encblkno1, t
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1",
 	aes_cbc_128_key, sizeof(aes_cbc_128_key)));
 
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_1_vectors[0]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_1_vectors[1]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_1_vectors[2]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_1_vectors[3]), 0);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_1_vectors[0]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_1_vectors[1]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_1_vectors[2]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_1_vectors[3]), -1);
 
 	RL(unconfigure_cgd(cgdfd));
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1",
@@ -3279,10 +3285,10 @@ ATF_TC_BODY(cgd_aes_cbc_128_encblkno8, t
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8",
 	aes_cbc_128_key, sizeof(aes_cbc_128_key)));
 
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_8_vectors[0]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_8_vectors[1]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_8_vectors[2]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_8_vectors[3]), 0);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_8_vectors[0]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_8_vectors[1]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_8_vectors[2]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_8_vectors[3]), -1);
 
 	RL(unconfigure_cgd(cgdfd));
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8",
@@ -3326,10 +3332,10 @@ ATF_TC_BODY(cgd_aes_cbc_192_encblkno1, t
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1",
 	aes_cbc_192_key, sizeof(aes_cbc_192_key)));
 
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_1_vectors[0]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_1_vectors[1]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_1_vectors[2]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_1_vectors[3]), 0);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_1_vectors[0]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_1_vectors[1]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_1_vectors[2]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_1_vectors[3]), -1);
 
 	RL(unconfigure_cgd(cgdfd));
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1",
@@ -3373,10 +3379,10 @@ ATF_TC_BODY(cgd_aes_cbc_192_encblkno8, t
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8",
 	aes_cbc_192_key, sizeof(aes_cbc_192_key)));
 
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_8_vectors[0]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_8_vectors[1]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_8_vectors[2]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_8_vectors[3]), 0);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_8_vectors[0]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_8_vectors[1]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_8_vectors[2]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_8_vectors[3]), -1);
 
 	RL(unconfigure_cgd(cgdfd));
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8",
@@ -3420,10 +3426,10 @@ ATF_TC_BODY(cgd_aes_cbc_256_encblkno1, t
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1",
 	aes_cbc_256_key, sizeof(aes_cbc_256_key)));
 
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_256_1_vectors[0]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_256_1_vectors[1]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_256_1_vectors[2]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_256_1_vectors[3]), 0);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_256_1_vectors[0]), -1);
+	

CVS commit: src/tests/dev/cgd

2016-11-24 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Thu Nov 24 22:42:16 UTC 2016

Modified Files:
src/tests/dev/cgd: t_cgd_aes.c

Log Message:
Switch to CHECK_LIBC for writing.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/t_cgd_aes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2016-11-09 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Nov  9 22:01:15 UTC 2016

Modified Files:
src/tests/dev/cgd: t_cgd_aes.c

Log Message:
Add aes-cbc tests.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/cgd/t_cgd_aes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2016-11-09 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Nov  9 22:01:15 UTC 2016

Modified Files:
src/tests/dev/cgd: t_cgd_aes.c

Log Message:
Add aes-cbc tests.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/cgd/t_cgd_aes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd_aes.c
diff -u src/tests/dev/cgd/t_cgd_aes.c:1.2 src/tests/dev/cgd/t_cgd_aes.c:1.3
--- src/tests/dev/cgd/t_cgd_aes.c:1.2	Mon Nov  7 18:11:45 2016
+++ src/tests/dev/cgd/t_cgd_aes.c	Wed Nov  9 22:01:15 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_aes.c,v 1.2 2016/11/07 18:11:45 alnsn Exp $	*/
+/*	$NetBSD: t_cgd_aes.c,v 1.3 2016/11/09 22:01:15 alnsn Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc
@@ -60,6 +60,1872 @@ struct testvec {
 };
 
 /*
+ * 128 bits CBC key, NUL terminated.
+ */
+static const char aes_cbc_128_key[17] = {
+	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+	0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */
+	0
+};
+
+/*
+ * 192 bits CBC key, NUL terminated.
+ */
+static const char aes_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 */
+	0
+};
+
+/*
+ * 256 bits CBC key, NUL terminated.
+ */
+static const char aes_cbc_256_key[33] = {
+	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+	0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */
+	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+	0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, /* 89abcdef */
+	0
+};
+
+static const uint8_t aes_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 aes_cbc_128_encblkno1_vec0_ctxt[SECSIZE] = {
+	0x1e, 0x95, 0x12, 0x15, 0xf6, 0xe0, 0xa7, 0x56,
+	0x95, 0xa0, 0xa7, 0x35, 0x77, 0xf4, 0xdd, 0xdc,
+	0x37, 0xc0, 0x28, 0x20, 0x00, 0x79, 0xa0, 0x35,
+	0xe0, 0x83, 0x23, 0x95, 0x4e, 0xea, 0x8d, 0xa2,
+	0x11, 0xbf, 0x9a, 0xd5, 0x21, 0x1e, 0x15, 0xb9,
+	0xd1, 0x2e, 0xd2, 0xd9, 0xa5, 0xcc, 0x26, 0x75,
+	0xba, 0x3e, 0x30, 0x11, 0xb2, 0x40, 0xdd, 0x1d,
+	0x07, 0x3b, 0xe6, 0x00, 0xa7, 0x31, 0x9e, 0x58,
+	0x41, 0xf3, 0x02, 0xf5, 0xad, 0x35, 0x79, 0x9a,
+	0x9e, 0x03, 0xc8, 0x7a, 0x9d, 0x1d, 0x58, 0x9f,
+	0x98, 0x67, 0xe2, 0x49, 0x81, 0x0c, 0x23, 0x90,
+	0xd8, 0xc6, 0xf0, 0xc5, 0x73, 0x46, 0xd5, 0x14,
+	0x1d, 0x78, 0x24, 0x7c, 0x9f, 0x5c, 0x8c, 0xe6,
+	0x5d, 0x85, 0x7a, 0x5f, 0x76, 0xcc, 0xd8, 0xe9,
+	0x03, 0xff, 0xfd, 0xd4, 0x12, 0x3f, 0xcb, 0xb0,
+	0xfe, 0xfd, 0x86, 0x00, 0x0c, 0xe3, 0xdd, 0xa6,
+	0x89, 0x92, 0xfe, 0xc8, 0x07, 0x5a, 0x94, 0x55,
+	0x75, 0xae, 0x68, 0x47, 0xba, 0x84, 0x75, 0x58,
+	0x33, 0x30, 0x2c, 0x16, 0x5b, 0xe9, 0x3f, 0x2a,
+	0x09, 0xf9, 0x69, 0x23, 0x77, 0xd7, 0x2b, 0x95,
+	0x4b, 0x78, 0x59, 0xcc, 0xfa, 0xf5, 0x79, 0xd2,
+	0x05, 0x87, 0x66, 0x57, 0x93, 0xbf, 0x05, 0x90,
+	0x4d, 0x6d, 0xd2, 0x72, 0x92, 0x24, 0xec, 0x14,
+	0xe7, 0xbf, 0x82, 0x57, 0xbb, 0x14, 0x51, 0xe6,
+	0xce, 0x3f, 0xa1, 0xfc, 0x63, 0x75, 0xee, 0xde,
+	0xf9, 0x31, 0xd3, 0xa0, 0x07, 0xcd, 0x4d, 0x8f,
+	0x83, 0x7d, 0x65, 0xe1, 0xc6, 0x60, 0x9e, 0x5c,
+	0x51, 0x76, 0xfa, 0x64, 0xdf, 0xdc, 0xaf, 0x38,
+	0xee, 0xe9, 0x8f, 0x4b, 0xa0, 0x3a, 0x21, 0xdf,
+	0x58, 0x3b, 0x73, 0xf5, 0x30, 0xbb, 0x29, 0xe0,
+	0xff, 0x60, 0xf0, 0x05, 0x5e, 0x37, 0xbc, 0x78,
+	0x95, 0x3f, 0xa8, 0xd4, 0xb4, 0x82, 0x0d, 0xe1,
+	0x10, 0xe3, 0xa7, 0x61, 0x37, 0x58, 0x28, 0x14,
+	0x22, 0x57, 0x32, 0x28, 0x80, 0x98, 0x3e, 0x5f,
+	0x71, 0xcf, 0x34, 0xb8, 0x6d, 0x6b, 0xc0, 0x23,
+	0xc1, 0x9e, 0x58, 0x4f, 0xd5, 0xa4, 0x14, 0x03,
+	0x2a, 0xed, 0xc4, 0xa7, 0x77, 0x7c, 0x4f, 0x94,
+	0x91, 0x1d, 0x47, 0x34, 0x82, 0xe8, 0x9d, 0x32,
+	0x5c, 0xc7, 0x38, 0xe9, 0x92, 0xcd, 0x35, 0xfd,
+	0x1c, 0xcc, 0x3c, 0x28, 0x75, 0x6f, 0xff, 0xd5,
+	0xe8, 0xbf, 0x90, 0x92, 0x34, 0x13, 0x11, 0x89,
+	0xe0, 0xa2, 0x25, 0xeb, 0x82, 0x63, 0x31, 0x80,
+	0x50, 0x6c, 0x99, 0xaa, 0x97, 0x0e, 0x59, 0x45,
+	0x64, 0xb8, 0x77, 0x78, 0x6b, 0x24, 0xac, 0xc0,
+	0xc9, 0xa9, 0xbc, 0x13, 0xd1, 0x5e, 0x50, 0x9a,
+	0x91, 0x1a, 0x08, 0xf7, 0xc5, 0x18, 0x9f, 0x87,
+	0x97, 0x9c, 0x0a, 0x27, 0xf1, 0x66, 0xf8, 0x09,
+	0x52, 0x09, 0x41, 0x07, 0xc1, 0xa1, 0x91, 0xa4,

Re: CVS commit: src/tests/dev/cgd

2016-11-07 Thread Sean Cole
Alexander Nasonov  writes:

> Sean Cole wrote:
>> Module Name: src
>> Committed By:scole
>> Date:Mon Nov  7 16:33:37 UTC 2016
>> 
>> Modified Files:
>>  src/tests/dev/cgd: Makefile
>> 
>> Log Message:
>> Only build t_cgd_aes if MKCRYPTO==yes and MKRUMP==yes.
>
> In my opinion, the whole directory should be excluded if MKRUMP=no.
>
> Alex

I don't have an opinion on this either way, feel free to fix how you
like if others have no objections.

I was just trying to fix distribution build for ia64, which doesn't have
a compiling-rump yet.

Thanks


Re: CVS commit: src/tests/dev/cgd

2016-11-07 Thread Alexander Nasonov
Sean Cole wrote:
> Module Name:  src
> Committed By: scole
> Date: Mon Nov  7 16:33:37 UTC 2016
> 
> Modified Files:
>   src/tests/dev/cgd: Makefile
> 
> Log Message:
> Only build t_cgd_aes if MKCRYPTO==yes and MKRUMP==yes.

In my opinion, the whole directory should be excluded if MKRUMP=no.

Alex


CVS commit: src/tests/dev/cgd

2016-11-07 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Mon Nov  7 18:11:45 UTC 2016

Modified Files:
src/tests/dev/cgd: t_cgd_aes.c

Log Message:
Don't use mktemp.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/cgd/t_cgd_aes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd_aes.c
diff -u src/tests/dev/cgd/t_cgd_aes.c:1.1 src/tests/dev/cgd/t_cgd_aes.c:1.2
--- src/tests/dev/cgd/t_cgd_aes.c:1.1	Sun Nov  6 10:54:42 2016
+++ src/tests/dev/cgd/t_cgd_aes.c	Mon Nov  7 18:11:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_aes.c,v 1.1 2016/11/06 10:54:42 alnsn Exp $	*/
+/*	$NetBSD: t_cgd_aes.c,v 1.2 2016/11/07 18:11:45 alnsn Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc
@@ -1232,7 +1232,7 @@ open_disk(const char *devpath, const cha
 {
 	int fd;
 
-	fd = open(imgpath, O_CREAT | O_RDWR | O_EXCL, 0600);
+	fd = open(imgpath, O_CREAT | O_RDWR | O_TRUNC, 0600);
 	if (fd < 0)
 		return -1;
 
@@ -1352,7 +1352,7 @@ ATF_TC_HEAD(cgd_aes_xts_256, tc)
 
 ATF_TC_BODY(cgd_aes_xts_256, tc)
 {
-	char imgpath[] = "aes-xts-256.XX";
+	const char imgpath[] = "aes-xts-256.img";
 	const char *dkpath = "/dev/dk";
 	const size_t dksize = 256 * SECSIZE; /* Last blkno is 0xff. */
 	int dkfd, cgdfd;
@@ -1361,7 +1361,6 @@ ATF_TC_BODY(cgd_aes_xts_256, tc)
 
 	rump_init();
 
-	mktemp(imgpath);
 	RL(dkfd = open_disk(dkpath, imgpath, dksize));
 
 	RL(cgdfd = open_cgd(0));
@@ -1407,7 +1406,7 @@ ATF_TC_HEAD(cgd_aes_xts_512, tc)
 
 ATF_TC_BODY(cgd_aes_xts_512, tc)
 {
-	char imgpath[] = "aes-xts-512.XX";
+	const char imgpath[] = "aes-xts-512.img";
 	const char *dkpath = "/dev/dk";
 	const size_t dksize = 65536 * SECSIZE; /* Last blkno is 0x. */
 	int dkfd, cgdfd;
@@ -1416,7 +1415,6 @@ ATF_TC_BODY(cgd_aes_xts_512, tc)
 
 	rump_init();
 
-	mktemp(imgpath);
 	RL(dkfd = open_disk(dkpath, imgpath, dksize));
 
 	RL(cgdfd = open_cgd(0));



CVS commit: src/tests/dev/cgd

2016-11-07 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Mon Nov  7 18:11:45 UTC 2016

Modified Files:
src/tests/dev/cgd: t_cgd_aes.c

Log Message:
Don't use mktemp.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/cgd/t_cgd_aes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2016-11-07 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Nov  7 16:33:37 UTC 2016

Modified Files:
src/tests/dev/cgd: Makefile

Log Message:
Only build t_cgd_aes if MKCRYPTO==yes and MKRUMP==yes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/cgd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2016-11-07 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Nov  7 16:33:37 UTC 2016

Modified Files:
src/tests/dev/cgd: Makefile

Log Message:
Only build t_cgd_aes if MKCRYPTO==yes and MKRUMP==yes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/cgd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/Makefile
diff -u src/tests/dev/cgd/Makefile:1.4 src/tests/dev/cgd/Makefile:1.5
--- src/tests/dev/cgd/Makefile:1.4	Sun Nov  6 21:29:54 2016
+++ src/tests/dev/cgd/Makefile	Mon Nov  7 16:33:37 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2016/11/06 21:29:54 alnsn Exp $
+#	$NetBSD: Makefile,v 1.5 2016/11/07 16:33:37 scole Exp $
 #
 
 .include 
@@ -9,7 +9,7 @@ FILESDIR=	${TESTSDIR}
 
 TESTS_SH=	t_cgd
 
-.if ${MKCRYPTO} != "no"
+.if ${MKCRYPTO} == "yes" && ${MKRUMP} == "yes"
 TESTS_C=	t_cgd_aes
 
 WARNS=	4



CVS commit: src/tests/dev/cgd

2016-11-06 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sun Nov  6 21:29:54 UTC 2016

Modified Files:
src/tests/dev/cgd: Makefile

Log Message:
Don't build t_cgd_aes if ${MKCRYPTO} == "no".


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/Makefile
diff -u src/tests/dev/cgd/Makefile:1.3 src/tests/dev/cgd/Makefile:1.4
--- src/tests/dev/cgd/Makefile:1.3	Sun Nov  6 10:54:42 2016
+++ src/tests/dev/cgd/Makefile	Sun Nov  6 21:29:54 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2016/11/06 10:54:42 alnsn Exp $
+#	$NetBSD: Makefile,v 1.4 2016/11/06 21:29:54 alnsn Exp $
 #
 
 .include 
@@ -8,15 +8,17 @@ FILES=		paramsfile
 FILESDIR=	${TESTSDIR}
 
 TESTS_SH=	t_cgd
+
+.if ${MKCRYPTO} != "no"
 TESTS_C=	t_cgd_aes
 
+WARNS=	4
 CPPFLAGS+=	-D_KERNTYPES
 LDADD+=	-lrumpdev -lrumpdev_disk -lrumpdev_cgd -lrumpkern_crypto -lrumpvfs
 LDADD+=	-lrump
 LDADD+=	-lrumpuser
 LDADD+=	-lrump -lutil
 LDADD+=	-lpthread
-
-WARNS=	4
+.endif
 
 .include 



CVS commit: src/tests/dev/cgd

2016-11-06 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sun Nov  6 21:29:54 UTC 2016

Modified Files:
src/tests/dev/cgd: Makefile

Log Message:
Don't build t_cgd_aes if ${MKCRYPTO} == "no".


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2011-05-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu May 19 20:37:50 UTC 2011

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
Expand tests for unaligned writes to cgd.  No more xfail.

PR kern/44515
PR kern/44965


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/dev/cgd/t_cgd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd.sh
diff -u src/tests/dev/cgd/t_cgd.sh:1.9 src/tests/dev/cgd/t_cgd.sh:1.10
--- src/tests/dev/cgd/t_cgd.sh:1.9	Sat May 14 17:42:28 2011
+++ src/tests/dev/cgd/t_cgd.sh	Thu May 19 20:37:50 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgd.sh,v 1.9 2011/05/14 17:42:28 jmmv Exp $
+#	$NetBSD: t_cgd.sh,v 1.10 2011/05/19 20:37:50 riastradh Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -98,14 +98,14 @@
 }
 
 
-atf_test_case non512 cleanup
-non512_head()
+atf_test_case unaligned_write cleanup
+unaligned_write_head()
 {
 
-	atf_set descr Write a non-512 block to a raw cgd device
+	atf_set descr Attempt unaligned writes to a raw cgd device
 }
 
-non512_body()
+unaligned_write_body()
 {
 	d=$(atf_get_srcdir)
 	atf_check -s exit:0 \
@@ -115,12 +115,34 @@
 	atf_check -s exit:0 -x echo 12345 | \
 	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile
 
-	atf_expect_fail PR kern/44515
-	atf_check -s exit:0 -e ignore -x \
+	# Check that cgd rejects writes of totally bogus lengths.
+	atf_check -s not-exit:0 -e ignore -x \
 	echo die hard | rump.dd of=${rawcgd} bs=123 conv=sync
+
+	# Check that cgd rejects non-sector-length writes even if they
+	# are integral multiples of the block size.
+	atf_check -s not-exit:0 -e ignore -x \
+	echo die hard | rump.dd of=${rawcgd} bs=64 conv=sync
+	atf_check -s not-exit:0 -e ignore -x \
+	echo die hard | rump.dd of=${rawcgd} bs=256 conv=sync
+
+	# Check that cgd rejects misaligned buffers, produced by
+	# packetizing the input on bogus boundaries and using the
+	# bizarre behaviour of `bs=N' in dd.
+	atf_check -s not-exit:0 -e ignore -x \
+	(echo -n x  sleep 1  head -c 511 /dev/zero) \
+		| rump.dd of=${rawcgd} bs=512
+
+	# Check that cgd rejects sector-length writes if they are not
+	# on sector boundaries.  Doesn't work because dd can't be
+	# persuaded to seek a non-integral multiple of the output
+	# buffer size and I can't be arsed to find the another way to
+	# do that.
+	#atf_check -s not-exit:0 -e ignore -x \
+	#echo die hard | rump.dd of=${rawcgd} seek=1 bs=512 conv=sync
 }
 
-non512_cleanup()
+unaligned_write_cleanup()
 {
 	env RUMP_SERVER=unix://csock rump.halt || true
 }
@@ -130,5 +152,5 @@
 
 	atf_add_test_case basic
 	atf_add_test_case wrongpass
-	atf_add_test_case non512
+	atf_add_test_case unaligned_write
 }



CVS commit: src/tests/dev/cgd

2011-05-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu May 19 20:37:50 UTC 2011

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
Expand tests for unaligned writes to cgd.  No more xfail.

PR kern/44515
PR kern/44965


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/dev/cgd/t_cgd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2011-03-22 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Tue Mar 22 16:16:31 UTC 2011

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
Force cleanup parts to exit with a success status.  Failures in cleanup
should not be allowed by atf-run (although they currently are ignored).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/dev/cgd/t_cgd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd.sh
diff -u src/tests/dev/cgd/t_cgd.sh:1.7 src/tests/dev/cgd/t_cgd.sh:1.8
--- src/tests/dev/cgd/t_cgd.sh:1.7	Fri Feb  4 19:58:10 2011
+++ src/tests/dev/cgd/t_cgd.sh	Tue Mar 22 16:16:30 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgd.sh,v 1.7 2011/02/04 19:58:10 pooka Exp $
+#	$NetBSD: t_cgd.sh,v 1.8 2011/03/22 16:16:30 jmmv Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -57,7 +57,7 @@
 basic_cleanup()
 {
 
-	env RUMP_SERVER=unix://csock rump.halt
+	env RUMP_SERVER=unix://csock rump.halt || true
 }
 
 atf_test_case wrongpass cleanup
@@ -94,7 +94,7 @@
 wrongpass_cleanup()
 {
 
-	env RUMP_SERVER=unix://csock rump.halt
+	env RUMP_SERVER=unix://csock rump.halt || true
 }
 
 
@@ -122,7 +122,7 @@
 
 non512_cleanup()
 {
-	env RUMP_SERVER=unix://csock rump.halt
+	env RUMP_SERVER=unix://csock rump.halt || true
 }
 
 atf_init_test_cases()



CVS commit: src/tests/dev/cgd

2011-03-22 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Tue Mar 22 16:16:31 UTC 2011

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
Force cleanup parts to exit with a success status.  Failures in cleanup
should not be allowed by atf-run (although they currently are ignored).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/dev/cgd/t_cgd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2011-02-04 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Feb  4 19:58:10 UTC 2011

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
test case for PR kern/44515


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/dev/cgd/t_cgd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd.sh
diff -u src/tests/dev/cgd/t_cgd.sh:1.6 src/tests/dev/cgd/t_cgd.sh:1.7
--- src/tests/dev/cgd/t_cgd.sh:1.6	Fri Feb  4 19:44:00 2011
+++ src/tests/dev/cgd/t_cgd.sh	Fri Feb  4 19:58:10 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgd.sh,v 1.6 2011/02/04 19:44:00 pooka Exp $
+#	$NetBSD: t_cgd.sh,v 1.7 2011/02/04 19:58:10 pooka Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -97,9 +97,38 @@
 	env RUMP_SERVER=unix://csock rump.halt
 }
 
+
+atf_test_case non512 cleanup
+non512_head()
+{
+
+	atf_set descr Write a non-512 block to a raw cgd device
+}
+
+non512_body()
+{
+	d=$(atf_get_srcdir)
+	atf_check -s exit:0 \
+	${cgdserver} -d key=/dev/dk,hostpath=dk.img,size=1m unix://csock
+
+	export RUMP_SERVER=unix://csock
+	atf_check -s exit:0 sh -c echo 12345 | \
+	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile
+
+	atf_expect_fail PR kern/44515
+	atf_check -s exit:0 -e ignore sh -c \
+	echo die hard | rump.dd of=${rawcgd} bs=123 conv=sync
+}
+
+non512_cleanup()
+{
+	env RUMP_SERVER=unix://csock rump.halt
+}
+
 atf_init_test_cases()
 {
 
 	atf_add_test_case basic
 	atf_add_test_case wrongpass
+	atf_add_test_case non512
 }



CVS commit: src/tests/dev/cgd

2011-02-04 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Feb  4 19:58:10 UTC 2011

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
test case for PR kern/44515


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/dev/cgd/t_cgd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2011-01-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jan  3 09:37:43 UTC 2011

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
make this work when rawpart != d


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/cgd/t_cgd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd.sh
diff -u src/tests/dev/cgd/t_cgd.sh:1.4 src/tests/dev/cgd/t_cgd.sh:1.5
--- src/tests/dev/cgd/t_cgd.sh:1.4	Thu Dec 30 16:58:07 2010
+++ src/tests/dev/cgd/t_cgd.sh	Mon Jan  3 09:37:42 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgd.sh,v 1.4 2010/12/30 16:58:07 pooka Exp $
+#	$NetBSD: t_cgd.sh,v 1.5 2011/01/03 09:37:42 pooka Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -25,6 +25,8 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
+rawpart=`sysctl -n kern.rawpartition | tr '01234' 'abcde'`
+rawcgd=/dev/rcgd0${rawpart}
 cgdserver=\
 rump_server -lrumpvfs -lrumpkern_crypto -lrumpdev -lrumpdev_disk -lrumpdev_cgd
 
@@ -45,10 +47,9 @@
 	export RUMP_SERVER=unix://csock
 	atf_check -s exit:0 sh -c echo 12345 | \
 	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile
-	atf_check -s exit:0 -e ignore dd if=${d}/t_cgd rof=/dev/rcgd0d count=2
+	atf_check -s exit:0 -e ignore dd if=${d}/t_cgd rof=${rawcgd} count=2
 	atf_check -s exit:0 -e ignore dd if=${d}/t_cgd of=testfile count=2
-	atf_check -s exit:0 -e ignore -o file:testfile \
-	dd rif=/dev/rcgd0d count=2
+	atf_check -s exit:0 -e ignore -o file:testfile dd rif=${rawcgd} count=2
 }
 
 basic_cleanup()
@@ -75,7 +76,7 @@
 	export RUMP_SERVER=unix://csock
 	atf_check -s exit:0 sh -c echo 12345 | \
 	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile
-	atf_check -s exit:0 -e ignore dd if=${d}/t_cgd rof=/dev/rcgd0d count=2
+	atf_check -s exit:0 -e ignore dd if=${d}/t_cgd rof=${rawcgd} count=2
 
 	# unconfig and reconfig cgd
 	atf_check -s exit:0 rump.cgdconfig -u cgd0
@@ -84,7 +85,7 @@
 
 	atf_check -s exit:0 -e ignore dd if=${d}/t_cgd of=testfile count=2
 	atf_check -s exit:0 -e ignore -o not-file:testfile \
-	dd rif=/dev/rcgd0d count=2
+	dd rif=${rawcgd} count=2
 }
 
 wrongpass_cleanup()



CVS commit: src/tests/dev/cgd

2011-01-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jan  3 09:37:43 UTC 2011

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
make this work when rawpart != d


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/cgd/t_cgd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2010-12-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Dec 15 19:14:37 UTC 2010

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
Use proper cleanup.

XXX: the atf sh compiler should check for errors.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/cgd/t_cgd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd.sh
diff -u src/tests/dev/cgd/t_cgd.sh:1.2 src/tests/dev/cgd/t_cgd.sh:1.3
--- src/tests/dev/cgd/t_cgd.sh:1.2	Tue Dec 14 17:48:31 2010
+++ src/tests/dev/cgd/t_cgd.sh	Wed Dec 15 19:14:37 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgd.sh,v 1.2 2010/12/14 17:48:31 pooka Exp $
+#	$NetBSD: t_cgd.sh,v 1.3 2010/12/15 19:14:37 pooka Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -25,7 +25,7 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-atf_test_case basic
+atf_test_case basic cleanup
 basic_head()
 {
 
@@ -54,7 +54,7 @@
 	env RUMP_SERVER=unix://csock rump.halt
 }
 
-atf_test_case wrongpass
+atf_test_case wrongpass cleanup
 wrongpass_head()
 {
 
@@ -84,6 +84,12 @@
 	dd rif=/dev/rcgd0d count=2
 }
 
+wrongpass_cleanup()
+{
+
+	env RUMP_SERVER=unix://csock rump.halt
+}
+
 atf_init_test_cases()
 {
 



CVS commit: src/tests/dev/cgd

2010-12-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Dec 15 19:14:37 UTC 2010

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
Use proper cleanup.

XXX: the atf sh compiler should check for errors.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/cgd/t_cgd.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd

2010-12-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Dec 14 17:48:32 UTC 2010

Modified Files:
src/tests/dev/cgd: Makefile t_cgd.sh
Added Files:
src/tests/dev/cgd: paramsfile
Removed Files:
src/tests/dev/cgd/h_img2cgd: Makefile cgd.conf img2cgd.c

Log Message:
Retire the old C helper in h_img2cgd since we can now write everything
with a shellscript in terms of rump.cgdconfig and dd.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/cgd/Makefile \
src/tests/dev/cgd/t_cgd.sh
cvs rdiff -u -r0 -r1.1 src/tests/dev/cgd/paramsfile
cvs rdiff -u -r1.2 -r0 src/tests/dev/cgd/h_img2cgd/Makefile
cvs rdiff -u -r1.1 -r0 src/tests/dev/cgd/h_img2cgd/cgd.conf \
src/tests/dev/cgd/h_img2cgd/img2cgd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/Makefile
diff -u src/tests/dev/cgd/Makefile:1.1 src/tests/dev/cgd/Makefile:1.2
--- src/tests/dev/cgd/Makefile:1.1	Thu Nov 11 22:38:47 2010
+++ src/tests/dev/cgd/Makefile	Tue Dec 14 17:48:31 2010
@@ -1,18 +1,12 @@
-#	$NetBSD: Makefile,v 1.1 2010/11/11 22:38:47 pooka Exp $
+#	$NetBSD: Makefile,v 1.2 2010/12/14 17:48:31 pooka Exp $
 #
 
 .include bsd.own.mk
 
 TESTSDIR=	${TESTSBASE}/dev/cgd
+FILES=		paramsfile
+FILESDIR=	${TESTSDIR}
 
 TESTS_SH=	t_cgd
 
-SUBDIR=		h_img2cgd
-
-LDADD+=	-lrumpdev_cgd -lrumpdev -lrumpvfs
-LDADD+=	-lrump
-LDADD+=	-lrumpuser -lpthread
-
-NOMAN=
-
 .include bsd.test.mk
Index: src/tests/dev/cgd/t_cgd.sh
diff -u src/tests/dev/cgd/t_cgd.sh:1.1 src/tests/dev/cgd/t_cgd.sh:1.2
--- src/tests/dev/cgd/t_cgd.sh:1.1	Thu Nov 11 22:38:47 2010
+++ src/tests/dev/cgd/t_cgd.sh	Tue Dec 14 17:48:31 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgd.sh,v 1.1 2010/11/11 22:38:47 pooka Exp $
+#	$NetBSD: t_cgd.sh,v 1.2 2010/12/14 17:48:31 pooka Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -36,13 +36,22 @@
 {
 
 	d=$(atf_get_srcdir)
+	atf_check -s exit:0 \
+	rump_allserver -d key=/dev/dk,hostpath=dk.img,size=1m unix://csock
+
+	export RUMP_SERVER=unix://csock
 	atf_check -s exit:0 sh -c echo 12345 | \
-	$d/h_img2cgd/h_img2cgd $d/h_img2cgd/cgd.conf write \
-	enc.img $d/h_img2cgd/cgd.conf
-	atf_check -s exit:0 sh -c echo 12345 | \
-	$d/h_img2cgd/h_img2cgd $d/h_img2cgd/cgd.conf read \
-	enc.img clear.txt
-	atf_check -s exit:0 cmp clear.txt $d/h_img2cgd/cgd.conf
+	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile
+	atf_check -s exit:0 -e ignore dd if=${d}/t_cgd rof=/dev/rcgd0d count=2
+	atf_check -s exit:0 -e ignore dd if=${d}/t_cgd of=testfile count=2
+	atf_check -s exit:0 -e ignore -o file:testfile \
+	dd rif=/dev/rcgd0d count=2
+}
+
+basic_cleanup()
+{
+
+	env RUMP_SERVER=unix://csock rump.halt
 }
 
 atf_test_case wrongpass
@@ -57,13 +66,22 @@
 {
 
 	d=$(atf_get_srcdir)
+	atf_check -s exit:0 \
+	rump_allserver -d key=/dev/dk,hostpath=dk.img,size=1m unix://csock
+
+	export RUMP_SERVER=unix://csock
 	atf_check -s exit:0 sh -c echo 12345 | \
-	$d/h_img2cgd/h_img2cgd $d/h_img2cgd/cgd.conf write \
-	enc.img $d/h_img2cgd/cgd.conf
+	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile
+	atf_check -s exit:0 -e ignore dd if=${d}/t_cgd rof=/dev/rcgd0d count=2
+
+	# unconfig and reconfig cgd
+	atf_check -s exit:0 rump.cgdconfig -u cgd0
 	atf_check -s exit:0 sh -c echo 54321 | \
-	$d/h_img2cgd/h_img2cgd $d/h_img2cgd/cgd.conf read \
-	enc.img clear.txt
-	atf_check -s not-exit:0 cmp -s clear.txt $d/h_img2cgd/cgd.conf
+	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile
+
+	atf_check -s exit:0 -e ignore dd if=${d}/t_cgd of=testfile count=2
+	atf_check -s exit:0 -e ignore -o not-file:testfile \
+	dd rif=/dev/rcgd0d count=2
 }
 
 atf_init_test_cases()

Added files:

Index: src/tests/dev/cgd/paramsfile
diff -u /dev/null src/tests/dev/cgd/paramsfile:1.1
--- /dev/null	Tue Dec 14 17:48:32 2010
+++ src/tests/dev/cgd/paramsfile	Tue Dec 14 17:48:31 2010
@@ -0,0 +1,8 @@
+algorithm aes-cbc;
+iv-method encblkno1;
+keylength 128;
+verify_method none;
+keygen pkcs5_pbkdf2/sha1 {
+iterations 42;
+salt gKajcCnHR7sR1k1RKQ9Q0uY=;
+};



CVS commit: src/tests/dev/cgd

2010-12-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Dec 14 17:48:32 UTC 2010

Modified Files:
src/tests/dev/cgd: Makefile t_cgd.sh
Added Files:
src/tests/dev/cgd: paramsfile
Removed Files:
src/tests/dev/cgd/h_img2cgd: Makefile cgd.conf img2cgd.c

Log Message:
Retire the old C helper in h_img2cgd since we can now write everything
with a shellscript in terms of rump.cgdconfig and dd.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/cgd/Makefile \
src/tests/dev/cgd/t_cgd.sh
cvs rdiff -u -r0 -r1.1 src/tests/dev/cgd/paramsfile
cvs rdiff -u -r1.2 -r0 src/tests/dev/cgd/h_img2cgd/Makefile
cvs rdiff -u -r1.1 -r0 src/tests/dev/cgd/h_img2cgd/cgd.conf \
src/tests/dev/cgd/h_img2cgd/img2cgd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/dev/cgd/h_img2cgd

2010-11-11 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Nov 11 22:44:50 UTC 2010

Modified Files:
src/tests/dev/cgd/h_img2cgd: Makefile

Log Message:
fix


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/cgd/h_img2cgd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/h_img2cgd/Makefile
diff -u src/tests/dev/cgd/h_img2cgd/Makefile:1.1 src/tests/dev/cgd/h_img2cgd/Makefile:1.2
--- src/tests/dev/cgd/h_img2cgd/Makefile:1.1	Thu Nov 11 22:38:47 2010
+++ src/tests/dev/cgd/h_img2cgd/Makefile	Thu Nov 11 22:44:50 2010
@@ -1,9 +1,13 @@
-#	$NetBSD: Makefile,v 1.1 2010/11/11 22:38:47 pooka Exp $
+#	$NetBSD: Makefile,v 1.2 2010/11/11 22:44:50 pooka Exp $
 #
 
-PROG=	h_img2cgd
-SRCS=	img2cgd.c
-NOMAN=
+PROG=		h_img2cgd
+SRCS=		img2cgd.c
+FILES=		cgd.conf
+NOMAN=1
+
+BINDIR=		${TESTSBASE}/dev/cgd/h_img2cgd
+FILESDIR=	${TESTSBASE}/dev/cgd/h_img2cgd
 
 .include bsd.own.mk
 
@@ -11,7 +15,6 @@
 CPPFLAGS+=	-DCGDCONFIG_AS_LIB
 .include ${NETBSDSRCDIR}/sbin/cgdconfig/Makefile.cgdconfig
 
-DBG=	-g -O0
 WARNS=	3
 
 .include bsd.prog.mk



CVS commit: src/tests/dev/cgd/h_img2cgd

2010-11-11 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Nov 11 22:44:50 UTC 2010

Modified Files:
src/tests/dev/cgd/h_img2cgd: Makefile

Log Message:
fix


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/cgd/h_img2cgd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.