add tests of ioctl for /dev/cryptodiff -r1.217 -r1.218 src/distrib/sets/lists/debug/mi
(knakahara)
--- src/distrib/sets/lists/debug/mi 2017/06/05 23:44:08 1.217
+++ src/distrib/sets/lists/debug/mi 2017/06/09 06:09:01 1.218
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: mi,v 1.217 2017/06/05 23:44:08 christos Exp $ | 1 | # $NetBSD: mi,v 1.218 2017/06/09 06:09:01 knakahara Exp $ | |
2 | ./etc/mtree/set.debug comp-sys-root | 2 | ./etc/mtree/set.debug comp-sys-root | |
3 | ./usr/lib comp-sys-usr compatdir | 3 | ./usr/lib comp-sys-usr compatdir | |
4 | ./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile | 4 | ./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile | |
5 | ./usr/lib/i18n/libDECHanyu_g.a comp-c-debuglib debuglib,compatfile | 5 | ./usr/lib/i18n/libDECHanyu_g.a comp-c-debuglib debuglib,compatfile | |
6 | ./usr/lib/i18n/libEUCTW_g.a comp-c-debuglib debuglib,compatfile | 6 | ./usr/lib/i18n/libEUCTW_g.a comp-c-debuglib debuglib,compatfile | |
7 | ./usr/lib/i18n/libEUC_g.a comp-c-debuglib debuglib,compatfile | 7 | ./usr/lib/i18n/libEUC_g.a comp-c-debuglib debuglib,compatfile | |
8 | ./usr/lib/i18n/libGBK2K_g.a comp-c-debuglib debuglib,compatfile | 8 | ./usr/lib/i18n/libGBK2K_g.a comp-c-debuglib debuglib,compatfile | |
9 | ./usr/lib/i18n/libHZ_g.a comp-c-debuglib debuglib,compatfile | 9 | ./usr/lib/i18n/libHZ_g.a comp-c-debuglib debuglib,compatfile | |
10 | ./usr/lib/i18n/libISO2022_g.a comp-c-debuglib debuglib,compatfile | 10 | ./usr/lib/i18n/libISO2022_g.a comp-c-debuglib debuglib,compatfile | |
11 | ./usr/lib/i18n/libJOHAB_g.a comp-c-debuglib debuglib,compatfile | 11 | ./usr/lib/i18n/libJOHAB_g.a comp-c-debuglib debuglib,compatfile | |
12 | ./usr/lib/i18n/libMSKanji_g.a comp-c-debuglib debuglib,compatfile | 12 | ./usr/lib/i18n/libMSKanji_g.a comp-c-debuglib debuglib,compatfile | |
13 | ./usr/lib/i18n/libUES_g.a comp-c-debuglib debuglib,compatfile | 13 | ./usr/lib/i18n/libUES_g.a comp-c-debuglib debuglib,compatfile | |
14 | ./usr/lib/i18n/libUTF1632_g.a comp-c-debuglib debuglib,compatfile | 14 | ./usr/lib/i18n/libUTF1632_g.a comp-c-debuglib debuglib,compatfile | |
@@ -1589,26 +1589,27 @@ | @@ -1589,26 +1589,27 @@ | |||
1589 | ./usr/libdata/debug/usr/tests/crypto/libcrypto/h_threadstest.debug tests-crypto-debug debug,atf,compattestfile | 1589 | ./usr/libdata/debug/usr/tests/crypto/libcrypto/h_threadstest.debug tests-crypto-debug debug,atf,compattestfile | |
1590 | ./usr/libdata/debug/usr/tests/crypto/libcrypto/h_x509v3test.debug tests-crypto-debug debug,atf,compattestfile | 1590 | ./usr/libdata/debug/usr/tests/crypto/libcrypto/h_x509v3test.debug tests-crypto-debug debug,atf,compattestfile | |
1591 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_aescbc.debug tests-crypto-debug debug,atf,compattestfile | 1591 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_aescbc.debug tests-crypto-debug debug,atf,compattestfile | |
1592 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_aesctr1.debug tests-crypto-debug debug,atf,compattestfile | 1592 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_aesctr1.debug tests-crypto-debug debug,atf,compattestfile | |
1593 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_aesctr2.debug tests-crypto-debug debug,atf,compattestfile | 1593 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_aesctr2.debug tests-crypto-debug debug,atf,compattestfile | |
1594 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_arc4.debug tests-crypto-debug debug,atf,compattestfile | 1594 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_arc4.debug tests-crypto-debug debug,atf,compattestfile | |
1595 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_camellia.debug tests-crypto-debug debug,atf,compattestfile | 1595 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_camellia.debug tests-crypto-debug debug,atf,compattestfile | |
1596 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_cbc3des.debug tests-crypto-debug debug,atf,compattestfile | 1596 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_cbc3des.debug tests-crypto-debug debug,atf,compattestfile | |
1597 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_cbcdes.debug tests-crypto-debug debug,atf,compattestfile | 1597 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_cbcdes.debug tests-crypto-debug debug,atf,compattestfile | |
1598 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_comp.debug tests-crypto-debug debug,atf,compattestfile | 1598 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_comp.debug tests-crypto-debug debug,atf,compattestfile | |
1599 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_comp_zlib.debug tests-crypto-debug debug,atf,compattestfile | 1599 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_comp_zlib.debug tests-crypto-debug debug,atf,compattestfile | |
1600 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_comp_zlib_rnd.debug tests-crypto-debug debug,atf,compattestfile | 1600 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_comp_zlib_rnd.debug tests-crypto-debug debug,atf,compattestfile | |
1601 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_gcm.debug tests-crypto-debug debug,atf,compattestfile | 1601 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_gcm.debug tests-crypto-debug debug,atf,compattestfile | |
1602 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_ioctl.debug tests-crypto-debug debug,atf,compattestfile | |||
1602 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_md5.debug tests-crypto-debug debug,atf,compattestfile | 1603 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_md5.debug tests-crypto-debug debug,atf,compattestfile | |
1603 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_md5hmac.debug tests-crypto-debug debug,atf,compattestfile | 1604 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_md5hmac.debug tests-crypto-debug debug,atf,compattestfile | |
1604 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_null.debug tests-crypto-debug debug,atf,compattestfile | 1605 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_null.debug tests-crypto-debug debug,atf,compattestfile | |
1605 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_sha1hmac.debug tests-crypto-debug debug,atf,compattestfile | 1606 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_sha1hmac.debug tests-crypto-debug debug,atf,compattestfile | |
1606 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_xcbcmac.debug tests-crypto-debug debug,atf,compattestfile | 1607 | ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_xcbcmac.debug tests-crypto-debug debug,atf,compattestfile | |
1607 | ./usr/libdata/debug/usr/tests/dev/audio/h_pad.debug tests-fs-debug debug,atf,rump | 1608 | ./usr/libdata/debug/usr/tests/dev/audio/h_pad.debug tests-fs-debug debug,atf,rump | |
1608 | ./usr/libdata/debug/usr/tests/dev/cgd/h_img2cgd/h_img2cgd.debug tests-obsolete obsolete,compattestfile | 1609 | ./usr/libdata/debug/usr/tests/dev/cgd/h_img2cgd/h_img2cgd.debug tests-obsolete obsolete,compattestfile | |
1609 | ./usr/libdata/debug/usr/tests/dev/cgd/t_cgd_3des.debug tests-fs-debug atf,compattestfile,debug,rump | 1610 | ./usr/libdata/debug/usr/tests/dev/cgd/t_cgd_3des.debug tests-fs-debug atf,compattestfile,debug,rump | |
1610 | ./usr/libdata/debug/usr/tests/dev/cgd/t_cgd_aes.debug tests-fs-debug atf,compattestfile,debug,rump | 1611 | ./usr/libdata/debug/usr/tests/dev/cgd/t_cgd_aes.debug tests-fs-debug atf,compattestfile,debug,rump | |
1611 | ./usr/libdata/debug/usr/tests/dev/cgd/t_cgd_blowfish.debug tests-fs-debug atf,compattestfile,debug,rump | 1612 | ./usr/libdata/debug/usr/tests/dev/cgd/t_cgd_blowfish.debug tests-fs-debug atf,compattestfile,debug,rump | |
1612 | ./usr/libdata/debug/usr/tests/dev/clock_subr/t_clock_subr.debug tests-fs-debug debug,atf | 1613 | ./usr/libdata/debug/usr/tests/dev/clock_subr/t_clock_subr.debug tests-fs-debug debug,atf | |
1613 | ./usr/libdata/debug/usr/tests/dev/md/h_mdserv.debug tests-fs-debug debug,atf,rump | 1614 | ./usr/libdata/debug/usr/tests/dev/md/h_mdserv.debug tests-fs-debug debug,atf,rump | |
1614 | ./usr/libdata/debug/usr/tests/dev/scsipi/t_cd.debug tests-fs-debug debug,atf,rump | 1615 | ./usr/libdata/debug/usr/tests/dev/scsipi/t_cd.debug tests-fs-debug debug,atf,rump |
--- src/distrib/sets/lists/tests/mi 2017/06/01 15:45:02 1.752
+++ src/distrib/sets/lists/tests/mi 2017/06/09 06:09:01 1.753
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: mi,v 1.752 2017/06/01 15:45:02 perseant Exp $ | 1 | # $NetBSD: mi,v 1.753 2017/06/09 06:09:01 knakahara Exp $ | |
2 | # | 2 | # | |
3 | # Note: don't delete entries from here - mark them as "obsolete" instead. | 3 | # Note: don't delete entries from here - mark them as "obsolete" instead. | |
4 | # | 4 | # | |
5 | ./etc/mtree/set.tests tests-sys-root | 5 | ./etc/mtree/set.tests tests-sys-root | |
6 | ./usr/libdata/debug/usr/tests tests-base-debug compattestdir | 6 | ./usr/libdata/debug/usr/tests tests-base-debug compattestdir | |
7 | ./usr/libdata/debug/usr/tests/atf tests-atf-debug compattestfile,atf | 7 | ./usr/libdata/debug/usr/tests/atf tests-atf-debug compattestfile,atf | |
8 | ./usr/libdata/debug/usr/tests/atf/atf-c tests-atf-debug compattestfile,atf | 8 | ./usr/libdata/debug/usr/tests/atf/atf-c tests-atf-debug compattestfile,atf | |
9 | ./usr/libdata/debug/usr/tests/atf/atf-c++ tests-atf-debug compattestfile,atf | 9 | ./usr/libdata/debug/usr/tests/atf/atf-c++ tests-atf-debug compattestfile,atf | |
10 | ./usr/libdata/debug/usr/tests/atf/atf-c++/detail tests-atf-debug compattestfile,atf | 10 | ./usr/libdata/debug/usr/tests/atf/atf-c++/detail tests-atf-debug compattestfile,atf | |
11 | ./usr/libdata/debug/usr/tests/atf/atf-c/detail tests-atf-debug compattestfile,atf | 11 | ./usr/libdata/debug/usr/tests/atf/atf-c/detail tests-atf-debug compattestfile,atf | |
12 | ./usr/libdata/debug/usr/tests/atf/atf-compile tests-obsolete obsolete | 12 | ./usr/libdata/debug/usr/tests/atf/atf-compile tests-obsolete obsolete | |
13 | ./usr/libdata/debug/usr/tests/atf/atf-report tests-obsolete obsolete | 13 | ./usr/libdata/debug/usr/tests/atf/atf-report tests-obsolete obsolete | |
14 | ./usr/libdata/debug/usr/tests/atf/atf-run tests-obsolete obsolete | 14 | ./usr/libdata/debug/usr/tests/atf/atf-run tests-obsolete obsolete | |
@@ -1344,26 +1344,27 @@ | @@ -1344,26 +1344,27 @@ | |||
1344 | ./usr/tests/crypto/opencrypto/Atffile tests-crypto-tests compattestfile,atf | 1344 | ./usr/tests/crypto/opencrypto/Atffile tests-crypto-tests compattestfile,atf | |
1345 | ./usr/tests/crypto/opencrypto/Kyuafile tests-crypto-tests compattestfile,atf,kyua | 1345 | ./usr/tests/crypto/opencrypto/Kyuafile tests-crypto-tests compattestfile,atf,kyua | |
1346 | ./usr/tests/crypto/opencrypto/h_aescbc tests-crypto-tests compattestfile,atf | 1346 | ./usr/tests/crypto/opencrypto/h_aescbc tests-crypto-tests compattestfile,atf | |
1347 | ./usr/tests/crypto/opencrypto/h_aesctr1 tests-crypto-tests compattestfile,atf | 1347 | ./usr/tests/crypto/opencrypto/h_aesctr1 tests-crypto-tests compattestfile,atf | |
1348 | ./usr/tests/crypto/opencrypto/h_aesctr2 tests-crypto-tests compattestfile,atf | 1348 | ./usr/tests/crypto/opencrypto/h_aesctr2 tests-crypto-tests compattestfile,atf | |
1349 | ./usr/tests/crypto/opencrypto/h_arc4 tests-crypto-tests compattestfile,atf | 1349 | ./usr/tests/crypto/opencrypto/h_arc4 tests-crypto-tests compattestfile,atf | |
1350 | ./usr/tests/crypto/opencrypto/h_camellia tests-crypto-tests compattestfile,atf | 1350 | ./usr/tests/crypto/opencrypto/h_camellia tests-crypto-tests compattestfile,atf | |
1351 | ./usr/tests/crypto/opencrypto/h_cbcdes tests-crypto-tests compattestfile,atf | 1351 | ./usr/tests/crypto/opencrypto/h_cbcdes tests-crypto-tests compattestfile,atf | |
1352 | ./usr/tests/crypto/opencrypto/h_cbc3des tests-crypto-tests compattestfile,atf | 1352 | ./usr/tests/crypto/opencrypto/h_cbc3des tests-crypto-tests compattestfile,atf | |
1353 | ./usr/tests/crypto/opencrypto/h_comp tests-crypto-tests compattestfile,atf | 1353 | ./usr/tests/crypto/opencrypto/h_comp tests-crypto-tests compattestfile,atf | |
1354 | ./usr/tests/crypto/opencrypto/h_comp_zlib tests-crypto-tests compattestfile,atf | 1354 | ./usr/tests/crypto/opencrypto/h_comp_zlib tests-crypto-tests compattestfile,atf | |
1355 | ./usr/tests/crypto/opencrypto/h_comp_zlib_rnd tests-crypto-tests compattestfile,atf | 1355 | ./usr/tests/crypto/opencrypto/h_comp_zlib_rnd tests-crypto-tests compattestfile,atf | |
1356 | ./usr/tests/crypto/opencrypto/h_gcm tests-crypto-tests compattestfile,atf | 1356 | ./usr/tests/crypto/opencrypto/h_gcm tests-crypto-tests compattestfile,atf | |
1357 | ./usr/tests/crypto/opencrypto/h_ioctl tests-crypto-tests compattestfile,atf | |||
1357 | ./usr/tests/crypto/opencrypto/h_md5 tests-crypto-tests compattestfile,atf | 1358 | ./usr/tests/crypto/opencrypto/h_md5 tests-crypto-tests compattestfile,atf | |
1358 | ./usr/tests/crypto/opencrypto/h_md5hmac tests-crypto-tests compattestfile,atf | 1359 | ./usr/tests/crypto/opencrypto/h_md5hmac tests-crypto-tests compattestfile,atf | |
1359 | ./usr/tests/crypto/opencrypto/h_null tests-crypto-tests compattestfile,atf | 1360 | ./usr/tests/crypto/opencrypto/h_null tests-crypto-tests compattestfile,atf | |
1360 | ./usr/tests/crypto/opencrypto/h_sha1hmac tests-crypto-tests compattestfile,atf | 1361 | ./usr/tests/crypto/opencrypto/h_sha1hmac tests-crypto-tests compattestfile,atf | |
1361 | ./usr/tests/crypto/opencrypto/h_xcbcmac tests-crypto-tests compattestfile,atf | 1362 | ./usr/tests/crypto/opencrypto/h_xcbcmac tests-crypto-tests compattestfile,atf | |
1362 | ./usr/tests/crypto/opencrypto/t_opencrypto tests-crypto-tests compattestfile,atf | 1363 | ./usr/tests/crypto/opencrypto/t_opencrypto tests-crypto-tests compattestfile,atf | |
1363 | ./usr/tests/dev tests-fs-tests compattestfile,atf | 1364 | ./usr/tests/dev tests-fs-tests compattestfile,atf | |
1364 | ./usr/tests/dev/Atffile tests-fs-tests compattestfile,atf | 1365 | ./usr/tests/dev/Atffile tests-fs-tests compattestfile,atf | |
1365 | ./usr/tests/dev/Kyuafile tests-fs-tests compattestfile,atf,kyua | 1366 | ./usr/tests/dev/Kyuafile tests-fs-tests compattestfile,atf,kyua | |
1366 | ./usr/tests/dev/audio tests-fs-tests compattestfile,atf | 1367 | ./usr/tests/dev/audio tests-fs-tests compattestfile,atf | |
1367 | ./usr/tests/dev/audio/Atffile tests-fs-tests atf,rump | 1368 | ./usr/tests/dev/audio/Atffile tests-fs-tests atf,rump | |
1368 | ./usr/tests/dev/audio/Kyuafile tests-fs-tests atf,rump,kyua | 1369 | ./usr/tests/dev/audio/Kyuafile tests-fs-tests atf,rump,kyua | |
1369 | ./usr/tests/dev/audio/h_pad tests-fs-tests atf,rump | 1370 | ./usr/tests/dev/audio/h_pad tests-fs-tests atf,rump |
--- src/tests/crypto/opencrypto/Makefile 2017/04/17 03:59:37 1.3
+++ src/tests/crypto/opencrypto/Makefile 2017/06/09 06:09:02 1.4
@@ -1,33 +1,33 @@ | @@ -1,33 +1,33 @@ | |||
1 | # $NetBSD: Makefile,v 1.3 2017/04/17 03:59:37 knakahara Exp $ | 1 | # $NetBSD: Makefile,v 1.4 2017/06/09 06:09:02 knakahara Exp $ | |
2 | 2 | |||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> | |
4 | 4 | |||
5 | TESTSDIR= ${TESTSBASE}/crypto/opencrypto | 5 | TESTSDIR= ${TESTSBASE}/crypto/opencrypto | |
6 | 6 | |||
7 | TESTS_SH+= t_opencrypto | 7 | TESTS_SH+= t_opencrypto | |
8 | 8 | |||
9 | BINDIR= ${TESTSDIR} | 9 | BINDIR= ${TESTSDIR} | |
10 | MKMAN= no | 10 | MKMAN= no | |
11 | 11 | |||
12 | PROGS+= h_aescbc | 12 | PROGS+= h_aescbc | |
13 | PROGS+= h_aesctr1 | 13 | PROGS+= h_aesctr1 | |
14 | PROGS+= h_aesctr2 | 14 | PROGS+= h_aesctr2 | |
15 | PROGS+= h_arc4 | 15 | PROGS+= h_arc4 | |
16 | PROGS+= h_camellia | 16 | PROGS+= h_camellia | |
17 | PROGS+= h_cbcdes | 17 | PROGS+= h_cbcdes | |
18 | PROGS+= h_cbc3des | 18 | PROGS+= h_cbc3des | |
19 | PROGS+= h_comp | 19 | PROGS+= h_comp | |
20 | PROGS+= h_comp_zlib | 20 | PROGS+= h_comp_zlib | |
21 | PROGS+= h_comp_zlib_rnd | 21 | PROGS+= h_comp_zlib_rnd | |
22 | PROGS+= h_gcm | 22 | PROGS+= h_gcm | |
23 | PROGS+= h_md5 | 23 | PROGS+= h_md5 | |
24 | PROGS+= h_md5hmac | 24 | PROGS+= h_md5hmac | |
25 | PROGS+= h_null | 25 | PROGS+= h_null | |
26 | PROGS+= h_sha1hmac | 26 | PROGS+= h_sha1hmac | |
27 | PROGS+= h_xcbcmac | 27 | PROGS+= h_xcbcmac | |
28 | PROGS+= h_ioctl | |||
28 | 29 | |||
29 | LDADD.h_comp_zlib+= -lz | 30 | LDADD.h_comp_zlib+= -lz | |
30 | LDADD.h_comp_zlib_rnd+= -lz | 31 | LDADD.h_comp_zlib_rnd+= -lz | |
31 | 32 | |||
32 | .include <bsd.test.mk> | 33 | .include <bsd.test.mk> | |
33 |
/* $NetBSD: h_ioctl.c,v 1.1 2017/06/09 06:09:02 knakahara Exp $ */
/*-
* Copyright (c) 2017 Internet Initiative Japan Inc.
* All rights reserved.
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/sysctl.h>
#include <crypto/cryptodev.h>
/* copy from h_aescbc.c */
#define AES_KEY_LEN 16
unsigned char aes_key[AES_KEY_LEN] =
{ 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b,
0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06, };
#define AES_IV_LEN 16
unsigned char aes_iv[AES_IV_LEN] =
{ 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30,
0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41, };
#define AES_PLAINTX_LEN 64
unsigned char aes_plaintx[AES_PLAINTX_LEN] = "Single block msg";
#define AES_CIPHER_LEN 64
unsigned char aes_cipher[AES_CIPHER_LEN] =
{ 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8,
0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a, };
/*
* CRIOGET is deprecated.
*/
/*
* CIOCNGSESSION
* Hmm, who uses? (1)
*/
static int
test_ngsession(int fd)
{
int ret;
int cs_count = 2;
struct crypt_sgop sg;
struct session_n_op css[cs_count];
for (int i = 0; i < cs_count; i++) {
struct session_n_op *cs = &css[i];
memset(cs, 0, sizeof(*cs));
cs->cipher = CRYPTO_AES_CBC;
cs->keylen = AES_KEY_LEN;
cs->key = __UNCONST(&aes_key);
}
memset(&sg, 0, sizeof(sg));
sg.count = cs_count;
sg.sessions = css;
ret = ioctl(fd, CIOCNGSESSION, &sg);
if (ret < 0)
fprintf(stderr, "failed: CIOCNGSESSION\n");
return ret;
}
/*
* CIOCNFSESSION
* Hmm, who uses? (2)
*/
static int
test_nfsession(int fd)
{
int ret;
int sid_count = 2;
struct crypt_sfop sf;
u_int32_t sids[sid_count];
memset(sids, 0, sizeof(sids));
memset(&sf, 0, sizeof(sf));
sf.count = sid_count;
sf.sesid = sids;
ret = ioctl(fd, CIOCNFSESSION, &sf);
if (ret < 0)
fprintf(stderr, "failed: CIOCNFSESSION\n");
return ret;
}
/*
* CIOCNCRYPTM
* Hmm, who uses? (3)
*/
static int
test_ncryptm(int fd)
{
int ret;
int cs_count = 2;
struct crypt_mop mop;
struct crypt_n_op css[cs_count];
for (int i = 0; i < cs_count; i++) {
struct crypt_n_op *cs;
cs = &css[i];
memset(cs, 0, sizeof(*cs));
cs->ses = 0; /* session id */
cs->op = COP_ENCRYPT;
/* XXX */
}
memset(&mop, 0, sizeof(mop));
mop.count = cs_count;
mop.reqs = css;
ret = ioctl(fd, CIOCNCRYPTM, &mop);
if (ret < 0)
fprintf(stderr, "failed: CIOCNCRYPTM\n");
return ret;
}
/*
* CIOCNCRYPTRETM
* Hmm, who uses? (4)
*/
static int
test_ncryptretm(int fd)
{
int ret;
int req_count = 2;
struct session_op cs;
struct crypt_mop mop;
struct crypt_n_op cnos[req_count];
unsigned char cno_dst[req_count][AES_CIPHER_LEN];
struct cryptret cret;
struct crypt_result crs[req_count];
memset(&cs, 0, sizeof(cs));
cs.cipher = CRYPTO_AES_CBC;
cs.keylen = AES_KEY_LEN;
cs.key = __UNCONST(&aes_key);
ret = ioctl(fd, CIOCGSESSION, &cs);
if (ret < 0) {
fprintf(stderr, "failed: CIOCGSESSION\n");
return ret;
}
for (int i = 0; i < req_count; i++) {
struct crypt_n_op *cno = &cnos[i];
memset(cno, 0, sizeof(*cno));
cno->ses = cs.ses;
cno->op = COP_ENCRYPT;
cno->len = AES_PLAINTX_LEN;
cno->src = aes_plaintx;
cno->dst_len = AES_CIPHER_LEN;
cno->dst = cno_dst[i];
}
memset(&mop, 0, sizeof(mop));
mop.count = req_count;
mop.reqs = cnos;
ret = ioctl(fd, CIOCNCRYPTM, &mop);
if (ret < 0)
fprintf(stderr, "failed: CIOCNCRYPTM\n");
for (int i = 0; i < req_count; i++) {
struct crypt_result *cr = &crs[i];
memset(cr, 0, sizeof(*cr));
cr->reqid = cnos[i].reqid;
}
memset(&cret, 0, sizeof(cret));
cret.count = req_count;
cret.results = crs;
ret = ioctl(fd, CIOCNCRYPTRETM, &cret);
if (ret < 0)
fprintf(stderr, "failed: CIOCNCRYPTRETM\n");
return ret;
}
/*
* CIOCNCRYPTRET
* Hmm, who uses? (5)
*/
/* test when it does not request yet. */
static int
test_ncryptret_noent(int fd)
{
int ret;
struct crypt_result cr;
memset(&cr, 0, sizeof(cr));
ret = ioctl(fd, CIOCNCRYPTRET, &cr);
if (ret == 0) {
fprintf(stderr,
"failed: CIOCNCRYPTRET unexpected success when no entry\n");
ret = -1;
} else if (errno == EINPROGRESS) {
/* expected fail */
ret = 0;
}
return ret;
}
static int
test_ncryptret_ent(int fd)
{
int ret;
struct session_op cs;
struct crypt_mop mop;
struct crypt_n_op cno;
unsigned char cno_dst[AES_CIPHER_LEN];
struct crypt_result cr;
memset(&cs, 0, sizeof(cs));
cs.cipher = CRYPTO_AES_CBC;
cs.keylen = AES_KEY_LEN;
cs.key = __UNCONST(&aes_key);
ret = ioctl(fd, CIOCGSESSION, &cs);
if (ret < 0) {
fprintf(stderr, "failed: CIOCGSESSION\n");
return ret;
}
memset(&cno, 0, sizeof(cno));
cno.ses = cs.ses;
cno.op = COP_ENCRYPT;
cno.len = AES_PLAINTX_LEN;
cno.src = aes_plaintx;
cno.dst_len = AES_CIPHER_LEN;
cno.dst = cno_dst;
memset(&mop, 0, sizeof(mop));
mop.count = 1;
mop.reqs = &cno;
ret = ioctl(fd, CIOCNCRYPTM, &mop);
if (ret < 0)
fprintf(stderr, "failed: CIOCNCRYPTM\n");
memset(&cr, 0, sizeof(cr));
cr.reqid = cno.reqid;
ret = ioctl(fd, CIOCNCRYPTRET, &cr);
if (ret < 0)
fprintf(stderr, "failed: CIOCNCRYPTRET\n");
return ret;
}
static int
test_ncryptret(int fd)
{
int ret;
ret = test_ncryptret_noent(fd);
if (ret < 0)
return ret;
ret = test_ncryptret_ent(fd);
if (ret < 0)
return ret;
return ret;
}
/*
* CIOCASYMFEAT
*/
static int
set_userasymcrypto(int new, int *old)
{
int ret;
ret = sysctlbyname("kern.userasymcrypto", NULL, NULL, &new, sizeof(new));
if (ret < 0) {
fprintf(stderr, "failed: kern.userasymcrypto=%d", new);
return ret;
}
if (old != NULL)
*old = new;
return ret;
}
static int
test_asymfeat_each(int fd, u_int32_t *asymfeat, int userasym)
{
int ret;
ret = ioctl(fd, CIOCASYMFEAT, asymfeat);
if (ret < 0)
fprintf(stderr, "failed: CIOCASYMFEAT when userasym=%d\n", userasym);
return ret;
}
static int
test_asymfeat(int fd)
{
int ret, new, orig;
u_int32_t asymfeat = 0;
/* test for kern.userasymcrypto=1 */
new = 1;
ret = set_userasymcrypto(new, &orig);
if (ret < 0)
return ret;
ret = test_asymfeat_each(fd, &asymfeat, new);
if (ret < 0)
return ret;
/* test for kern.userasymcrypto=0 */
new = 0;
ret = set_userasymcrypto(new, NULL);
if (ret < 0)
return ret;
ret = test_asymfeat_each(fd, &asymfeat, new);
if (ret < 0)
return ret;
/* cleanup */
ret = set_userasymcrypto(orig, NULL);
if (ret < 0)
fprintf(stderr, "failed: cleanup kern.userasymcrypto\n");
return ret;
}
int
main(void)
{
int fd, ret;
fd = open("/dev/crypto", O_RDWR, 0);
if (fd < 0)
err(1, "open");
ret = test_ngsession(fd);
if (ret < 0)
err(1, "test_ngsession");
ret = test_nfsession(fd);
if (ret < 0)
err(1, "test_ngsession");
ret = test_ncryptm(fd);
if (ret < 0)
err(1, "test_ncryptm");
test_ncryptretm(fd);
if (ret < 0)
err(1, "test_ncryptretm");
ret = test_ncryptret(fd);
if (ret < 0)
err(1, "test_ncryptret");
ret = test_asymfeat(fd);
if (ret < 0)
err(1, "test_asymfeat");
return 0;
}
--- src/tests/crypto/opencrypto/t_opencrypto.sh 2017/04/17 03:59:37 1.7
+++ src/tests/crypto/opencrypto/t_opencrypto.sh 2017/06/09 06:09:02 1.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: t_opencrypto.sh,v 1.7 2017/04/17 03:59:37 knakahara Exp $ | 1 | # $NetBSD: t_opencrypto.sh,v 1.8 2017/06/09 06:09:02 knakahara Exp $ | |
2 | # | 2 | # | |
3 | # Copyright (c) 2014 The NetBSD Foundation, Inc. | 3 | # Copyright (c) 2014 The NetBSD Foundation, Inc. | |
4 | # All rights reserved. | 4 | # All rights reserved. | |
5 | # | 5 | # | |
6 | # Redistribution and use in source and binary forms, with or without | 6 | # Redistribution and use in source and binary forms, with or without | |
7 | # modification, are permitted provided that the following conditions | 7 | # modification, are permitted provided that the following conditions | |
8 | # are met: | 8 | # are met: | |
9 | # 1. Redistributions of source code must retain the above copyright | 9 | # 1. Redistributions of source code must retain the above copyright | |
10 | # notice, this list of conditions and the following disclaimer. | 10 | # notice, this list of conditions and the following disclaimer. | |
11 | # 2. Redistributions in binary form must reproduce the above copyright | 11 | # 2. Redistributions in binary form must reproduce the above copyright | |
12 | # notice, this list of conditions and the following disclaimer in the | 12 | # notice, this list of conditions and the following disclaimer in the | |
13 | # documentation and/or other materials provided with the distribution. | 13 | # documentation and/or other materials provided with the distribution. | |
14 | # | 14 | # | |
@@ -272,33 +272,47 @@ sha1_hmac_cleanup() { | @@ -272,33 +272,47 @@ sha1_hmac_cleanup() { | |||
272 | atf_test_case xcbcmac cleanup | 272 | atf_test_case xcbcmac cleanup | |
273 | xcbcmac_head() { | 273 | xcbcmac_head() { | |
274 | common_head "Test XCBC_MAC_96 crypto" | 274 | common_head "Test XCBC_MAC_96 crypto" | |
275 | } | 275 | } | |
276 | 276 | |||
277 | xcbcmac_body() { | 277 | xcbcmac_body() { | |
278 | common_body h_xcbcmac | 278 | common_body h_xcbcmac | |
279 | } | 279 | } | |
280 | 280 | |||
281 | xcbcmac_cleanup() { | 281 | xcbcmac_cleanup() { | |
282 | common_cleanup | 282 | common_cleanup | |
283 | } | 283 | } | |
284 | 284 | |||
285 | atf_test_case ioctl cleanup | |||
286 | ioctl_head() { | |||
287 | common_head "Test ioctl for /dev/crypto" | |||
288 | } | |||
289 | ||||
290 | ioctl_body() { | |||
291 | common_body h_ioctl | |||
292 | } | |||
293 | ||||
294 | ioctl_cleanup() { | |||
295 | common_cleanup | |||
296 | } | |||
297 | ||||
285 | atf_init_test_cases() { | 298 | atf_init_test_cases() { | |
286 | RUMP_SERVER="unix://t_opencrypto_socket" ; export RUMP_SERVER | 299 | RUMP_SERVER="unix://t_opencrypto_socket" ; export RUMP_SERVER | |
287 | 300 | |||
288 | atf_add_test_case arc4 | 301 | atf_add_test_case arc4 | |
289 | atf_add_test_case camellia | 302 | atf_add_test_case camellia | |
290 | atf_add_test_case cbcdes | 303 | atf_add_test_case cbcdes | |
291 | atf_add_test_case cbc3des | 304 | atf_add_test_case cbc3des | |
292 | atf_add_test_case comp | 305 | atf_add_test_case comp | |
293 | atf_add_test_case comp_deflate | 306 | atf_add_test_case comp_deflate | |
294 | atf_add_test_case comp_zlib_rnd | 307 | atf_add_test_case comp_zlib_rnd | |
295 | atf_add_test_case aesctr1 | 308 | atf_add_test_case aesctr1 | |
296 | atf_add_test_case aesctr2 | 309 | atf_add_test_case aesctr2 | |
297 | atf_add_test_case aescbc | 310 | atf_add_test_case aescbc | |
298 | atf_add_test_case gcm | 311 | atf_add_test_case gcm | |
299 | atf_add_test_case md5 | 312 | atf_add_test_case md5 | |
300 | atf_add_test_case md5_hmac | 313 | atf_add_test_case md5_hmac | |
301 | atf_add_test_case null | 314 | atf_add_test_case null | |
302 | atf_add_test_case sha1_hmac | 315 | atf_add_test_case sha1_hmac | |
303 | atf_add_test_case xcbcmac | 316 | atf_add_test_case xcbcmac | |
317 | atf_add_test_case ioctl | |||
304 | } | 318 | } |