t_cgdconfig.sh revision 1.2 1 1.2 riastrad # $NetBSD: t_cgdconfig.sh,v 1.2 2022/08/12 10:48:44 riastradh Exp $
2 1.1 riastrad #
3 1.1 riastrad # Copyright (c) 2022 The NetBSD Foundation, Inc.
4 1.1 riastrad # All rights reserved.
5 1.1 riastrad #
6 1.1 riastrad # Redistribution and use in source and binary forms, with or without
7 1.1 riastrad # modification, are permitted provided that the following conditions
8 1.1 riastrad # are met:
9 1.1 riastrad # 1. Redistributions of source code must retain the above copyright
10 1.1 riastrad # notice, this list of conditions and the following disclaimer.
11 1.1 riastrad # 2. Redistributions in binary form must reproduce the above copyright
12 1.1 riastrad # notice, this list of conditions and the following disclaimer in the
13 1.1 riastrad # documentation and/or other materials provided with the distribution.
14 1.1 riastrad #
15 1.1 riastrad # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 1.1 riastrad # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 1.1 riastrad # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 1.1 riastrad # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 1.1 riastrad # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 1.1 riastrad # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 1.1 riastrad # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 1.1 riastrad # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 1.1 riastrad # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 1.1 riastrad # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 1.1 riastrad # POSSIBILITY OF SUCH DAMAGE.
26 1.1 riastrad #
27 1.1 riastrad
28 1.1 riastrad atf_test_case storedkey
29 1.1 riastrad storedkey_head()
30 1.1 riastrad {
31 1.1 riastrad atf_set descr "Test key generation with storedkey"
32 1.1 riastrad }
33 1.1 riastrad storedkey_body()
34 1.1 riastrad {
35 1.1 riastrad cat <<EOF >params
36 1.1 riastrad algorithm adiantum;
37 1.1 riastrad iv-method encblkno1;
38 1.1 riastrad keylength 256;
39 1.1 riastrad verify_method none;
40 1.1 riastrad keygen storedkey key AAABAJtnmp3XZspMBAFpCYnB8Hekn0 \
41 1.1 riastrad gj5cDVngslfGLSqwcy;
42 1.1 riastrad EOF
43 1.1 riastrad atf_check -o inline:'m2eanddmykwEAWkJicHwd6SfSCPlwNWeCyV8YtKrBzI=\n' \
44 1.1 riastrad cgdconfig -t params
45 1.1 riastrad }
46 1.1 riastrad
47 1.2 riastrad atf_test_case storedkeys
48 1.2 riastrad storedkeys_head()
49 1.2 riastrad {
50 1.2 riastrad atf_set descr "Test multiple stored keys with cgd.conf"
51 1.2 riastrad }
52 1.2 riastrad storedkeys_body()
53 1.2 riastrad {
54 1.2 riastrad cat <<EOF >wd0e
55 1.2 riastrad algorithm adiantum;
56 1.2 riastrad iv-method encblkno1;
57 1.2 riastrad keylength 256;
58 1.2 riastrad verify_method none;
59 1.2 riastrad keygen storedkey key AAABAJtnmp3XZspMBAFpCYnB8Hekn0 \
60 1.2 riastrad gj5cDVngslfGLSqwcy;
61 1.2 riastrad EOF
62 1.2 riastrad cat <<EOF >ld1e
63 1.2 riastrad algorithm adiantum;
64 1.2 riastrad iv-method encblkno1;
65 1.2 riastrad keylength 256;
66 1.2 riastrad verify_method none;
67 1.2 riastrad keygen storedkey key AAABAK1pbgIayXftX0RQ3AaMK4YEd/ \
68 1.2 riastrad fowKwQbENxpu3o1k9m;
69 1.2 riastrad EOF
70 1.2 riastrad cat <<EOF >cgd.conf
71 1.2 riastrad cgd0 /dev/wd0e wd0e
72 1.2 riastrad cgd1 /dev/ld1e ld1e
73 1.2 riastrad EOF
74 1.2 riastrad cat <<EOF >expected
75 1.2 riastrad /dev/wd0e: m2eanddmykwEAWkJicHwd6SfSCPlwNWeCyV8YtKrBzI=
76 1.2 riastrad /dev/ld1e: rWluAhrJd+1fRFDcBowrhgR39+jArBBsQ3Gm7ejWT2Y=
77 1.2 riastrad EOF
78 1.2 riastrad atf_check -o file:expected cgdconfig -T -f cgd.conf
79 1.2 riastrad }
80 1.2 riastrad
81 1.1 riastrad atf_test_case storedkey2a
82 1.1 riastrad storedkey2a_head()
83 1.1 riastrad {
84 1.1 riastrad atf_set descr "Test key generation with combined storedkeys"
85 1.1 riastrad }
86 1.1 riastrad storedkey2a_body()
87 1.1 riastrad {
88 1.1 riastrad cat <<EOF >params
89 1.1 riastrad algorithm adiantum;
90 1.1 riastrad iv-method encblkno1;
91 1.1 riastrad keylength 256;
92 1.1 riastrad verify_method none;
93 1.1 riastrad keygen storedkey key AAABAJtnmp3XZspMBAFpCYnB8Hekn0 \
94 1.1 riastrad gj5cDVngslfGLSqwcy;
95 1.1 riastrad keygen storedkey key AAABAK1pbgIayXftX0RQ3AaMK4YEd/ \
96 1.1 riastrad fowKwQbENxpu3o1k9m;
97 1.1 riastrad EOF
98 1.1 riastrad atf_check -o inline:'Ng70n82vvaFbRTnVj03b8aDov8slbMXySFTajzp9SFQ=\n' \
99 1.1 riastrad cgdconfig -t params
100 1.1 riastrad }
101 1.1 riastrad
102 1.1 riastrad atf_test_case storedkey2b
103 1.1 riastrad storedkey2b_head()
104 1.1 riastrad {
105 1.1 riastrad atf_set descr "Test key generation with combined storedkeys, reversed"
106 1.1 riastrad }
107 1.1 riastrad storedkey2b_body()
108 1.1 riastrad {
109 1.1 riastrad cat <<EOF >params
110 1.1 riastrad algorithm adiantum;
111 1.1 riastrad iv-method encblkno1;
112 1.1 riastrad keylength 256;
113 1.1 riastrad verify_method none;
114 1.1 riastrad keygen storedkey key AAABAK1pbgIayXftX0RQ3AaMK4YEd/ \
115 1.1 riastrad fowKwQbENxpu3o1k9m;
116 1.1 riastrad keygen storedkey key AAABAJtnmp3XZspMBAFpCYnB8Hekn0 \
117 1.1 riastrad gj5cDVngslfGLSqwcy;
118 1.1 riastrad EOF
119 1.1 riastrad atf_check -o inline:'Ng70n82vvaFbRTnVj03b8aDov8slbMXySFTajzp9SFQ=\n' \
120 1.1 riastrad cgdconfig -t params
121 1.1 riastrad }
122 1.1 riastrad
123 1.1 riastrad atf_init_test_cases()
124 1.1 riastrad {
125 1.1 riastrad atf_add_test_case storedkey
126 1.1 riastrad atf_add_test_case storedkey2a
127 1.1 riastrad atf_add_test_case storedkey2b
128 1.2 riastrad atf_add_test_case storedkeys
129 1.1 riastrad }
130