diff options
author | tb <> | 2024-02-02 06:22:01 +0000 |
---|---|---|
committer | tb <> | 2024-02-02 06:22:01 +0000 |
commit | e485e0ec35e5f90c03bd1bb89d3aad32e0a66536 (patch) | |
tree | d6b65ec71b670fb94d38af7ac6122764fe96aa3f | |
parent | 1a2091e2b9d474443262fc4e56a89d7be94af154 (diff) | |
download | openbsd-e485e0ec35e5f90c03bd1bb89d3aad32e0a66536.tar.gz openbsd-e485e0ec35e5f90c03bd1bb89d3aad32e0a66536.tar.bz2 openbsd-e485e0ec35e5f90c03bd1bb89d3aad32e0a66536.zip |
Add regress coverage for BIO_dump()
-rw-r--r-- | src/regress/lib/libcrypto/bio/Makefile | 3 | ||||
-rw-r--r-- | src/regress/lib/libcrypto/bio/bio_dump.c | 743 |
2 files changed, 745 insertions, 1 deletions
diff --git a/src/regress/lib/libcrypto/bio/Makefile b/src/regress/lib/libcrypto/bio/Makefile index 0402e3939a..336dc2ff60 100644 --- a/src/regress/lib/libcrypto/bio/Makefile +++ b/src/regress/lib/libcrypto/bio/Makefile | |||
@@ -1,7 +1,8 @@ | |||
1 | # $OpenBSD: Makefile,v 1.7 2023/04/25 19:48:24 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.8 2024/02/02 06:22:01 tb Exp $ |
2 | 2 | ||
3 | PROGS += bio_asn1 | 3 | PROGS += bio_asn1 |
4 | PROGS += bio_chain | 4 | PROGS += bio_chain |
5 | PROGS += bio_dump | ||
5 | PROGS += bio_host | 6 | PROGS += bio_host |
6 | PROGS += bio_mem | 7 | PROGS += bio_mem |
7 | 8 | ||
diff --git a/src/regress/lib/libcrypto/bio/bio_dump.c b/src/regress/lib/libcrypto/bio/bio_dump.c new file mode 100644 index 0000000000..02648d0f83 --- /dev/null +++ b/src/regress/lib/libcrypto/bio/bio_dump.c | |||
@@ -0,0 +1,743 @@ | |||
1 | /* $OpenBSD: bio_dump.c,v 1.1 2024/02/02 06:22:01 tb Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | ||
4 | * | ||
5 | * Permission to use, copy, modify, and distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | |||
18 | #include <err.h> | ||
19 | #include <string.h> | ||
20 | |||
21 | #include <openssl/bio.h> | ||
22 | |||
23 | const uint8_t dump[] = { | ||
24 | 0x74, 0x45, 0xc6, 0x20, 0x00, 0x00, 0x00, 0x00, | ||
25 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
26 | 0x36, 0xd8, 0x61, 0x48, 0x68, 0x3c, 0xc0, 0x68, | ||
27 | 0xaa, 0x15, 0x57, 0x77, 0xe3, 0xec, 0xb4, 0x98, | ||
28 | 0xc6, 0x08, 0xfc, 0x59, 0xb3, 0x4f, 0x45, 0xcf, | ||
29 | 0x4b, 0xc2, 0xae, 0x98, 0xb5, 0xeb, 0xe0, 0xb5, | ||
30 | 0xc1, 0x68, 0xba, 0xcf, 0x7c, 0xf7, 0x7b, 0x38, | ||
31 | 0x43, 0x2f, 0xb9, 0x0e, 0x23, 0x02, 0xb9, 0x4f, | ||
32 | 0x8c, 0x26, 0xeb, 0xef, 0x70, 0x98, 0x82, 0xa7, | ||
33 | 0xb9, 0x78, 0xc5, 0x08, 0x96, 0x99, 0xb3, 0x84, | ||
34 | 0xa3, 0x4f, 0xfb, 0xd7, 0x38, 0xa9, 0xd9, 0xd4, | ||
35 | 0x53, 0x0f, 0x4f, 0x64, 0x97, 0xdf, 0xcf, 0xf3, | ||
36 | 0x4f, 0xc8, 0xd2, 0x56, 0x3f, 0x0d, 0x72, 0xd4, | ||
37 | 0x55, 0x98, 0x89, 0xb0, 0x45, 0x26, 0x3f, 0x7a, | ||
38 | 0xbd, 0x9d, 0x96, 0x15, 0xa2, 0x10, 0x14, 0x85, | ||
39 | 0xaa, 0xa1, 0x7c, 0x84, 0xfb, 0xc4, 0xa5, 0x7b, | ||
40 | 0xc6, 0xe3, 0xad, 0x85, 0x57, 0x96, 0xbb, 0x81, | ||
41 | 0x18, 0x0c, 0xed, 0x2f, 0xf7, 0x6a, 0x4c, 0x4d, | ||
42 | 0x59, 0xe1, 0xcc, 0xc5, 0x3a, 0x9f, 0x48, 0xfc, | ||
43 | 0x1d, 0x7c, 0x0d, 0xa4, 0x79, 0x96, 0xe7, 0x2b, | ||
44 | 0x39, 0x15, 0xf9, 0x3a, 0x6a, 0x5e, 0x7c, 0x4e, | ||
45 | 0xc9, 0x3b, 0xaf, 0xeb, 0x3b, 0xcf, 0x8d, 0x6a, | ||
46 | 0x57, 0xe6, 0xc5, 0xba, 0xbd, 0xa6, 0xa0, 0x6b, | ||
47 | 0x03, 0xd5, 0xa3, 0x9f, 0x99, 0x2a, 0xea, 0x88, | ||
48 | 0x72, 0x1b, 0x66, 0x6c, 0x5e, 0x1d, 0x49, 0xd5, | ||
49 | 0x1e, 0x1e, 0xcc, 0x1a, 0xb1, 0xd8, 0xf7, 0x91, | ||
50 | 0x1e, 0x1e, 0xcc, 0x1a, 0x20, 0x00, 0x20, 0x00, | ||
51 | 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, | ||
52 | 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, | ||
53 | 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, | ||
54 | 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, | ||
55 | }; | ||
56 | #define DUMP_LEN (sizeof(dump) / sizeof(dump[0])) | ||
57 | |||
58 | static const struct bio_dump_testcase { | ||
59 | int indent; | ||
60 | const char *input; | ||
61 | int inlen; | ||
62 | const char *output; | ||
63 | } bio_dump_testcases[] = { | ||
64 | { | ||
65 | .indent = 0, | ||
66 | .input = "", | ||
67 | .inlen = 0, | ||
68 | .output = "", | ||
69 | }, | ||
70 | { | ||
71 | .indent = 0, | ||
72 | .input = "", | ||
73 | .inlen = 1, | ||
74 | .output = "0001 - <SPACES/NULS>\n", | ||
75 | }, | ||
76 | { | ||
77 | .indent = 6, | ||
78 | .input = " ", | ||
79 | .inlen = 1, | ||
80 | .output = " 0001 - <SPACES/NULS>\n", | ||
81 | }, | ||
82 | { | ||
83 | .indent = -1, | ||
84 | .input = "!", | ||
85 | .inlen = 1, | ||
86 | .output = | ||
87 | "0000 - 21 !\n", | ||
88 | }, | ||
89 | { | ||
90 | .indent = -1, | ||
91 | .input = "~", | ||
92 | .inlen = 1, | ||
93 | .output = | ||
94 | "0000 - 7e ~\n", | ||
95 | }, | ||
96 | { | ||
97 | .indent = 4, | ||
98 | .input = dump, | ||
99 | .inlen = DUMP_LEN, | ||
100 | .output = | ||
101 | " 0000 - 74 45 c6 20 00 00 00 00-00 00 00 00 00 00 00 00 tE. ............\n" | ||
102 | " 0010 - 36 d8 61 48 68 3c c0 68-aa 15 57 77 e3 ec b4 98 6.aHh<.h..Ww....\n" | ||
103 | " 0020 - c6 08 fc 59 b3 4f 45 cf-4b c2 ae 98 b5 eb e0 b5 ...Y.OE.K.......\n" | ||
104 | " 0030 - c1 68 ba cf 7c f7 7b 38-43 2f b9 0e 23 02 b9 4f .h..|.{8C/..#..O\n" | ||
105 | " 0040 - 8c 26 eb ef 70 98 82 a7-b9 78 c5 08 96 99 b3 84 .&..p....x......\n" | ||
106 | " 0050 - a3 4f fb d7 38 a9 d9 d4-53 0f 4f 64 97 df cf f3 .O..8...S.Od....\n" | ||
107 | " 0060 - 4f c8 d2 56 3f 0d 72 d4-55 98 89 b0 45 26 3f 7a O..V?.r.U...E&?z\n" | ||
108 | " 0070 - bd 9d 96 15 a2 10 14 85-aa a1 7c 84 fb c4 a5 7b ..........|....{\n" | ||
109 | " 0080 - c6 e3 ad 85 57 96 bb 81-18 0c ed 2f f7 6a 4c 4d ....W....../.jLM\n" | ||
110 | " 0090 - 59 e1 cc c5 3a 9f 48 fc-1d 7c 0d a4 79 96 e7 2b Y...:.H..|..y..+\n" | ||
111 | " 00a0 - 39 15 f9 3a 6a 5e 7c 4e-c9 3b af eb 3b cf 8d 6a 9..:j^|N.;..;..j\n" | ||
112 | " 00b0 - 57 e6 c5 ba bd a6 a0 6b-03 d5 a3 9f 99 2a ea 88 W......k.....*..\n" | ||
113 | " 00c0 - 72 1b 66 6c 5e 1d 49 d5-1e 1e cc 1a b1 d8 f7 91 r.fl^.I.........\n" | ||
114 | " 00d0 - 1e 1e cc 1a ....\n" | ||
115 | " 00f6 - <SPACES/NULS>\n", | ||
116 | }, | ||
117 | { | ||
118 | .indent = 11, | ||
119 | .input = dump, | ||
120 | .inlen = DUMP_LEN, | ||
121 | .output = | ||
122 | " 0000 - 74 45 c6 20 00 00 00 00-00 00 00 00 00 00 tE. ..........\n" | ||
123 | " 000e - 00 00 36 d8 61 48 68 3c-c0 68 aa 15 57 77 ..6.aHh<.h..Ww\n" | ||
124 | " 001c - e3 ec b4 98 c6 08 fc 59-b3 4f 45 cf 4b c2 .......Y.OE.K.\n" | ||
125 | " 002a - ae 98 b5 eb e0 b5 c1 68-ba cf 7c f7 7b 38 .......h..|.{8\n" | ||
126 | " 0038 - 43 2f b9 0e 23 02 b9 4f-8c 26 eb ef 70 98 C/..#..O.&..p.\n" | ||
127 | " 0046 - 82 a7 b9 78 c5 08 96 99-b3 84 a3 4f fb d7 ...x.......O..\n" | ||
128 | " 0054 - 38 a9 d9 d4 53 0f 4f 64-97 df cf f3 4f c8 8...S.Od....O.\n" | ||
129 | " 0062 - d2 56 3f 0d 72 d4 55 98-89 b0 45 26 3f 7a .V?.r.U...E&?z\n" | ||
130 | " 0070 - bd 9d 96 15 a2 10 14 85-aa a1 7c 84 fb c4 ..........|...\n" | ||
131 | " 007e - a5 7b c6 e3 ad 85 57 96-bb 81 18 0c ed 2f .{....W....../\n" | ||
132 | " 008c - f7 6a 4c 4d 59 e1 cc c5-3a 9f 48 fc 1d 7c .jLMY...:.H..|\n" | ||
133 | " 009a - 0d a4 79 96 e7 2b 39 15-f9 3a 6a 5e 7c 4e ..y..+9..:j^|N\n" | ||
134 | " 00a8 - c9 3b af eb 3b cf 8d 6a-57 e6 c5 ba bd a6 .;..;..jW.....\n" | ||
135 | " 00b6 - a0 6b 03 d5 a3 9f 99 2a-ea 88 72 1b 66 6c .k.....*..r.fl\n" | ||
136 | " 00c4 - 5e 1d 49 d5 1e 1e cc 1a-b1 d8 f7 91 1e 1e ^.I...........\n" | ||
137 | " 00d2 - cc 1a ..\n" | ||
138 | " 00f6 - <SPACES/NULS>\n", | ||
139 | }, | ||
140 | { | ||
141 | .indent = 18, | ||
142 | .input = dump, | ||
143 | .inlen = DUMP_LEN, | ||
144 | .output = | ||
145 | " 0000 - 74 45 c6 20 00 00 00 00-00 00 00 00 00 tE. .........\n" | ||
146 | " 000d - 00 00 00 36 d8 61 48 68-3c c0 68 aa 15 ...6.aHh<.h..\n" | ||
147 | " 001a - 57 77 e3 ec b4 98 c6 08-fc 59 b3 4f 45 Ww.......Y.OE\n" | ||
148 | " 0027 - cf 4b c2 ae 98 b5 eb e0-b5 c1 68 ba cf .K........h..\n" | ||
149 | " 0034 - 7c f7 7b 38 43 2f b9 0e-23 02 b9 4f 8c |.{8C/..#..O.\n" | ||
150 | " 0041 - 26 eb ef 70 98 82 a7 b9-78 c5 08 96 99 &..p....x....\n" | ||
151 | " 004e - b3 84 a3 4f fb d7 38 a9-d9 d4 53 0f 4f ...O..8...S.O\n" | ||
152 | " 005b - 64 97 df cf f3 4f c8 d2-56 3f 0d 72 d4 d....O..V?.r.\n" | ||
153 | " 0068 - 55 98 89 b0 45 26 3f 7a-bd 9d 96 15 a2 U...E&?z.....\n" | ||
154 | " 0075 - 10 14 85 aa a1 7c 84 fb-c4 a5 7b c6 e3 .....|....{..\n" | ||
155 | " 0082 - ad 85 57 96 bb 81 18 0c-ed 2f f7 6a 4c ..W....../.jL\n" | ||
156 | " 008f - 4d 59 e1 cc c5 3a 9f 48-fc 1d 7c 0d a4 MY...:.H..|..\n" | ||
157 | " 009c - 79 96 e7 2b 39 15 f9 3a-6a 5e 7c 4e c9 y..+9..:j^|N.\n" | ||
158 | " 00a9 - 3b af eb 3b cf 8d 6a 57-e6 c5 ba bd a6 ;..;..jW.....\n" | ||
159 | " 00b6 - a0 6b 03 d5 a3 9f 99 2a-ea 88 72 1b 66 .k.....*..r.f\n" | ||
160 | " 00c3 - 6c 5e 1d 49 d5 1e 1e cc-1a b1 d8 f7 91 l^.I.........\n" | ||
161 | " 00d0 - 1e 1e cc 1a ....\n" | ||
162 | " 00f6 - <SPACES/NULS>\n", | ||
163 | }, | ||
164 | { | ||
165 | .indent = 25, | ||
166 | .input = dump, | ||
167 | .inlen = DUMP_LEN, | ||
168 | .output = | ||
169 | " 0000 - 74 45 c6 20 00 00 00 00-00 00 00 tE. .......\n" | ||
170 | " 000b - 00 00 00 00 00 36 d8 61-48 68 3c .....6.aHh<\n" | ||
171 | " 0016 - c0 68 aa 15 57 77 e3 ec-b4 98 c6 .h..Ww.....\n" | ||
172 | " 0021 - 08 fc 59 b3 4f 45 cf 4b-c2 ae 98 ..Y.OE.K...\n" | ||
173 | " 002c - b5 eb e0 b5 c1 68 ba cf-7c f7 7b .....h..|.{\n" | ||
174 | " 0037 - 38 43 2f b9 0e 23 02 b9-4f 8c 26 8C/..#..O.&\n" | ||
175 | " 0042 - eb ef 70 98 82 a7 b9 78-c5 08 96 ..p....x...\n" | ||
176 | " 004d - 99 b3 84 a3 4f fb d7 38-a9 d9 d4 ....O..8...\n" | ||
177 | " 0058 - 53 0f 4f 64 97 df cf f3-4f c8 d2 S.Od....O..\n" | ||
178 | " 0063 - 56 3f 0d 72 d4 55 98 89-b0 45 26 V?.r.U...E&\n" | ||
179 | " 006e - 3f 7a bd 9d 96 15 a2 10-14 85 aa ?z.........\n" | ||
180 | " 0079 - a1 7c 84 fb c4 a5 7b c6-e3 ad 85 .|....{....\n" | ||
181 | " 0084 - 57 96 bb 81 18 0c ed 2f-f7 6a 4c W....../.jL\n" | ||
182 | " 008f - 4d 59 e1 cc c5 3a 9f 48-fc 1d 7c MY...:.H..|\n" | ||
183 | " 009a - 0d a4 79 96 e7 2b 39 15-f9 3a 6a ..y..+9..:j\n" | ||
184 | " 00a5 - 5e 7c 4e c9 3b af eb 3b-cf 8d 6a ^|N.;..;..j\n" | ||
185 | " 00b0 - 57 e6 c5 ba bd a6 a0 6b-03 d5 a3 W......k...\n" | ||
186 | " 00bb - 9f 99 2a ea 88 72 1b 66-6c 5e 1d ..*..r.fl^.\n" | ||
187 | " 00c6 - 49 d5 1e 1e cc 1a b1 d8-f7 91 1e I..........\n" | ||
188 | " 00d1 - 1e cc 1a ...\n" | ||
189 | " 00f6 - <SPACES/NULS>\n", | ||
190 | }, | ||
191 | { | ||
192 | .indent = 32, | ||
193 | .input = dump, | ||
194 | .inlen = DUMP_LEN, | ||
195 | .output = | ||
196 | " 0000 - 74 45 c6 20 00 00 00 00-00 tE. .....\n" | ||
197 | " 0009 - 00 00 00 00 00 00 00 36-d8 .......6.\n" | ||
198 | " 0012 - 61 48 68 3c c0 68 aa 15-57 aHh<.h..W\n" | ||
199 | " 001b - 77 e3 ec b4 98 c6 08 fc-59 w.......Y\n" | ||
200 | " 0024 - b3 4f 45 cf 4b c2 ae 98-b5 .OE.K....\n" | ||
201 | " 002d - eb e0 b5 c1 68 ba cf 7c-f7 ....h..|.\n" | ||
202 | " 0036 - 7b 38 43 2f b9 0e 23 02-b9 {8C/..#..\n" | ||
203 | " 003f - 4f 8c 26 eb ef 70 98 82-a7 O.&..p...\n" | ||
204 | " 0048 - b9 78 c5 08 96 99 b3 84-a3 .x.......\n" | ||
205 | " 0051 - 4f fb d7 38 a9 d9 d4 53-0f O..8...S.\n" | ||
206 | " 005a - 4f 64 97 df cf f3 4f c8-d2 Od....O..\n" | ||
207 | " 0063 - 56 3f 0d 72 d4 55 98 89-b0 V?.r.U...\n" | ||
208 | " 006c - 45 26 3f 7a bd 9d 96 15-a2 E&?z.....\n" | ||
209 | " 0075 - 10 14 85 aa a1 7c 84 fb-c4 .....|...\n" | ||
210 | " 007e - a5 7b c6 e3 ad 85 57 96-bb .{....W..\n" | ||
211 | " 0087 - 81 18 0c ed 2f f7 6a 4c-4d ..../.jLM\n" | ||
212 | " 0090 - 59 e1 cc c5 3a 9f 48 fc-1d Y...:.H..\n" | ||
213 | " 0099 - 7c 0d a4 79 96 e7 2b 39-15 |..y..+9.\n" | ||
214 | " 00a2 - f9 3a 6a 5e 7c 4e c9 3b-af .:j^|N.;.\n" | ||
215 | " 00ab - eb 3b cf 8d 6a 57 e6 c5-ba .;..jW...\n" | ||
216 | " 00b4 - bd a6 a0 6b 03 d5 a3 9f-99 ...k.....\n" | ||
217 | " 00bd - 2a ea 88 72 1b 66 6c 5e-1d *..r.fl^.\n" | ||
218 | " 00c6 - 49 d5 1e 1e cc 1a b1 d8-f7 I........\n" | ||
219 | " 00cf - 91 1e 1e cc 1a .....\n" | ||
220 | " 00f6 - <SPACES/NULS>\n", | ||
221 | }, | ||
222 | { | ||
223 | .indent = 39, | ||
224 | .input = dump, | ||
225 | .inlen = DUMP_LEN, | ||
226 | .output = | ||
227 | " 0000 - 74 45 c6 20 00 00 00 tE. ...\n" | ||
228 | " 0007 - 00 00 00 00 00 00 00 .......\n" | ||
229 | " 000e - 00 00 36 d8 61 48 68 ..6.aHh\n" | ||
230 | " 0015 - 3c c0 68 aa 15 57 77 <.h..Ww\n" | ||
231 | " 001c - e3 ec b4 98 c6 08 fc .......\n" | ||
232 | " 0023 - 59 b3 4f 45 cf 4b c2 Y.OE.K.\n" | ||
233 | " 002a - ae 98 b5 eb e0 b5 c1 .......\n" | ||
234 | " 0031 - 68 ba cf 7c f7 7b 38 h..|.{8\n" | ||
235 | " 0038 - 43 2f b9 0e 23 02 b9 C/..#..\n" | ||
236 | " 003f - 4f 8c 26 eb ef 70 98 O.&..p.\n" | ||
237 | " 0046 - 82 a7 b9 78 c5 08 96 ...x...\n" | ||
238 | " 004d - 99 b3 84 a3 4f fb d7 ....O..\n" | ||
239 | " 0054 - 38 a9 d9 d4 53 0f 4f 8...S.O\n" | ||
240 | " 005b - 64 97 df cf f3 4f c8 d....O.\n" | ||
241 | " 0062 - d2 56 3f 0d 72 d4 55 .V?.r.U\n" | ||
242 | " 0069 - 98 89 b0 45 26 3f 7a ...E&?z\n" | ||
243 | " 0070 - bd 9d 96 15 a2 10 14 .......\n" | ||
244 | " 0077 - 85 aa a1 7c 84 fb c4 ...|...\n" | ||
245 | " 007e - a5 7b c6 e3 ad 85 57 .{....W\n" | ||
246 | " 0085 - 96 bb 81 18 0c ed 2f ....../\n" | ||
247 | " 008c - f7 6a 4c 4d 59 e1 cc .jLMY..\n" | ||
248 | " 0093 - c5 3a 9f 48 fc 1d 7c .:.H..|\n" | ||
249 | " 009a - 0d a4 79 96 e7 2b 39 ..y..+9\n" | ||
250 | " 00a1 - 15 f9 3a 6a 5e 7c 4e ..:j^|N\n" | ||
251 | " 00a8 - c9 3b af eb 3b cf 8d .;..;..\n" | ||
252 | " 00af - 6a 57 e6 c5 ba bd a6 jW.....\n" | ||
253 | " 00b6 - a0 6b 03 d5 a3 9f 99 .k.....\n" | ||
254 | " 00bd - 2a ea 88 72 1b 66 6c *..r.fl\n" | ||
255 | " 00c4 - 5e 1d 49 d5 1e 1e cc ^.I....\n" | ||
256 | " 00cb - 1a b1 d8 f7 91 1e 1e .......\n" | ||
257 | " 00d2 - cc 1a ..\n" | ||
258 | " 00f6 - <SPACES/NULS>\n", | ||
259 | }, | ||
260 | { | ||
261 | .indent = 46, | ||
262 | .input = dump, | ||
263 | .inlen = DUMP_LEN, | ||
264 | .output = | ||
265 | " 0000 - 74 45 c6 20 00 00 tE. ..\n" | ||
266 | " 0006 - 00 00 00 00 00 00 ......\n" | ||
267 | " 000c - 00 00 00 00 36 d8 ....6.\n" | ||
268 | " 0012 - 61 48 68 3c c0 68 aHh<.h\n" | ||
269 | " 0018 - aa 15 57 77 e3 ec ..Ww..\n" | ||
270 | " 001e - b4 98 c6 08 fc 59 .....Y\n" | ||
271 | " 0024 - b3 4f 45 cf 4b c2 .OE.K.\n" | ||
272 | " 002a - ae 98 b5 eb e0 b5 ......\n" | ||
273 | " 0030 - c1 68 ba cf 7c f7 .h..|.\n" | ||
274 | " 0036 - 7b 38 43 2f b9 0e {8C/..\n" | ||
275 | " 003c - 23 02 b9 4f 8c 26 #..O.&\n" | ||
276 | " 0042 - eb ef 70 98 82 a7 ..p...\n" | ||
277 | " 0048 - b9 78 c5 08 96 99 .x....\n" | ||
278 | " 004e - b3 84 a3 4f fb d7 ...O..\n" | ||
279 | " 0054 - 38 a9 d9 d4 53 0f 8...S.\n" | ||
280 | " 005a - 4f 64 97 df cf f3 Od....\n" | ||
281 | " 0060 - 4f c8 d2 56 3f 0d O..V?.\n" | ||
282 | " 0066 - 72 d4 55 98 89 b0 r.U...\n" | ||
283 | " 006c - 45 26 3f 7a bd 9d E&?z..\n" | ||
284 | " 0072 - 96 15 a2 10 14 85 ......\n" | ||
285 | " 0078 - aa a1 7c 84 fb c4 ..|...\n" | ||
286 | " 007e - a5 7b c6 e3 ad 85 .{....\n" | ||
287 | " 0084 - 57 96 bb 81 18 0c W.....\n" | ||
288 | " 008a - ed 2f f7 6a 4c 4d ./.jLM\n" | ||
289 | " 0090 - 59 e1 cc c5 3a 9f Y...:.\n" | ||
290 | " 0096 - 48 fc 1d 7c 0d a4 H..|..\n" | ||
291 | " 009c - 79 96 e7 2b 39 15 y..+9.\n" | ||
292 | " 00a2 - f9 3a 6a 5e 7c 4e .:j^|N\n" | ||
293 | " 00a8 - c9 3b af eb 3b cf .;..;.\n" | ||
294 | " 00ae - 8d 6a 57 e6 c5 ba .jW...\n" | ||
295 | " 00b4 - bd a6 a0 6b 03 d5 ...k..\n" | ||
296 | " 00ba - a3 9f 99 2a ea 88 ...*..\n" | ||
297 | " 00c0 - 72 1b 66 6c 5e 1d r.fl^.\n" | ||
298 | " 00c6 - 49 d5 1e 1e cc 1a I.....\n" | ||
299 | " 00cc - b1 d8 f7 91 1e 1e ......\n" | ||
300 | " 00d2 - cc 1a ..\n" | ||
301 | " 00f6 - <SPACES/NULS>\n", | ||
302 | }, | ||
303 | { | ||
304 | .indent = 53, | ||
305 | .input = dump, | ||
306 | .inlen = DUMP_LEN, | ||
307 | .output = | ||
308 | " 0000 - 74 45 c6 20 tE. \n" | ||
309 | " 0004 - 00 00 00 00 ....\n" | ||
310 | " 0008 - 00 00 00 00 ....\n" | ||
311 | " 000c - 00 00 00 00 ....\n" | ||
312 | " 0010 - 36 d8 61 48 6.aH\n" | ||
313 | " 0014 - 68 3c c0 68 h<.h\n" | ||
314 | " 0018 - aa 15 57 77 ..Ww\n" | ||
315 | " 001c - e3 ec b4 98 ....\n" | ||
316 | " 0020 - c6 08 fc 59 ...Y\n" | ||
317 | " 0024 - b3 4f 45 cf .OE.\n" | ||
318 | " 0028 - 4b c2 ae 98 K...\n" | ||
319 | " 002c - b5 eb e0 b5 ....\n" | ||
320 | " 0030 - c1 68 ba cf .h..\n" | ||
321 | " 0034 - 7c f7 7b 38 |.{8\n" | ||
322 | " 0038 - 43 2f b9 0e C/..\n" | ||
323 | " 003c - 23 02 b9 4f #..O\n" | ||
324 | " 0040 - 8c 26 eb ef .&..\n" | ||
325 | " 0044 - 70 98 82 a7 p...\n" | ||
326 | " 0048 - b9 78 c5 08 .x..\n" | ||
327 | " 004c - 96 99 b3 84 ....\n" | ||
328 | " 0050 - a3 4f fb d7 .O..\n" | ||
329 | " 0054 - 38 a9 d9 d4 8...\n" | ||
330 | " 0058 - 53 0f 4f 64 S.Od\n" | ||
331 | " 005c - 97 df cf f3 ....\n" | ||
332 | " 0060 - 4f c8 d2 56 O..V\n" | ||
333 | " 0064 - 3f 0d 72 d4 ?.r.\n" | ||
334 | " 0068 - 55 98 89 b0 U...\n" | ||
335 | " 006c - 45 26 3f 7a E&?z\n" | ||
336 | " 0070 - bd 9d 96 15 ....\n" | ||
337 | " 0074 - a2 10 14 85 ....\n" | ||
338 | " 0078 - aa a1 7c 84 ..|.\n" | ||
339 | " 007c - fb c4 a5 7b ...{\n" | ||
340 | " 0080 - c6 e3 ad 85 ....\n" | ||
341 | " 0084 - 57 96 bb 81 W...\n" | ||
342 | " 0088 - 18 0c ed 2f .../\n" | ||
343 | " 008c - f7 6a 4c 4d .jLM\n" | ||
344 | " 0090 - 59 e1 cc c5 Y...\n" | ||
345 | " 0094 - 3a 9f 48 fc :.H.\n" | ||
346 | " 0098 - 1d 7c 0d a4 .|..\n" | ||
347 | " 009c - 79 96 e7 2b y..+\n" | ||
348 | " 00a0 - 39 15 f9 3a 9..:\n" | ||
349 | " 00a4 - 6a 5e 7c 4e j^|N\n" | ||
350 | " 00a8 - c9 3b af eb .;..\n" | ||
351 | " 00ac - 3b cf 8d 6a ;..j\n" | ||
352 | " 00b0 - 57 e6 c5 ba W...\n" | ||
353 | " 00b4 - bd a6 a0 6b ...k\n" | ||
354 | " 00b8 - 03 d5 a3 9f ....\n" | ||
355 | " 00bc - 99 2a ea 88 .*..\n" | ||
356 | " 00c0 - 72 1b 66 6c r.fl\n" | ||
357 | " 00c4 - 5e 1d 49 d5 ^.I.\n" | ||
358 | " 00c8 - 1e 1e cc 1a ....\n" | ||
359 | " 00cc - b1 d8 f7 91 ....\n" | ||
360 | " 00d0 - 1e 1e cc 1a ....\n" | ||
361 | " 00f6 - <SPACES/NULS>\n", | ||
362 | }, | ||
363 | { | ||
364 | .indent = 60, | ||
365 | .input = dump, | ||
366 | .inlen = DUMP_LEN, | ||
367 | .output = | ||
368 | " 0000 - 74 45 tE\n" | ||
369 | " 0002 - c6 20 . \n" | ||
370 | " 0004 - 00 00 ..\n" | ||
371 | " 0006 - 00 00 ..\n" | ||
372 | " 0008 - 00 00 ..\n" | ||
373 | " 000a - 00 00 ..\n" | ||
374 | " 000c - 00 00 ..\n" | ||
375 | " 000e - 00 00 ..\n" | ||
376 | " 0010 - 36 d8 6.\n" | ||
377 | " 0012 - 61 48 aH\n" | ||
378 | " 0014 - 68 3c h<\n" | ||
379 | " 0016 - c0 68 .h\n" | ||
380 | " 0018 - aa 15 ..\n" | ||
381 | " 001a - 57 77 Ww\n" | ||
382 | " 001c - e3 ec ..\n" | ||
383 | " 001e - b4 98 ..\n" | ||
384 | " 0020 - c6 08 ..\n" | ||
385 | " 0022 - fc 59 .Y\n" | ||
386 | " 0024 - b3 4f .O\n" | ||
387 | " 0026 - 45 cf E.\n" | ||
388 | " 0028 - 4b c2 K.\n" | ||
389 | " 002a - ae 98 ..\n" | ||
390 | " 002c - b5 eb ..\n" | ||
391 | " 002e - e0 b5 ..\n" | ||
392 | " 0030 - c1 68 .h\n" | ||
393 | " 0032 - ba cf ..\n" | ||
394 | " 0034 - 7c f7 |.\n" | ||
395 | " 0036 - 7b 38 {8\n" | ||
396 | " 0038 - 43 2f C/\n" | ||
397 | " 003a - b9 0e ..\n" | ||
398 | " 003c - 23 02 #.\n" | ||
399 | " 003e - b9 4f .O\n" | ||
400 | " 0040 - 8c 26 .&\n" | ||
401 | " 0042 - eb ef ..\n" | ||
402 | " 0044 - 70 98 p.\n" | ||
403 | " 0046 - 82 a7 ..\n" | ||
404 | " 0048 - b9 78 .x\n" | ||
405 | " 004a - c5 08 ..\n" | ||
406 | " 004c - 96 99 ..\n" | ||
407 | " 004e - b3 84 ..\n" | ||
408 | " 0050 - a3 4f .O\n" | ||
409 | " 0052 - fb d7 ..\n" | ||
410 | " 0054 - 38 a9 8.\n" | ||
411 | " 0056 - d9 d4 ..\n" | ||
412 | " 0058 - 53 0f S.\n" | ||
413 | " 005a - 4f 64 Od\n" | ||
414 | " 005c - 97 df ..\n" | ||
415 | " 005e - cf f3 ..\n" | ||
416 | " 0060 - 4f c8 O.\n" | ||
417 | " 0062 - d2 56 .V\n" | ||
418 | " 0064 - 3f 0d ?.\n" | ||
419 | " 0066 - 72 d4 r.\n" | ||
420 | " 0068 - 55 98 U.\n" | ||
421 | " 006a - 89 b0 ..\n" | ||
422 | " 006c - 45 26 E&\n" | ||
423 | " 006e - 3f 7a ?z\n" | ||
424 | " 0070 - bd 9d ..\n" | ||
425 | " 0072 - 96 15 ..\n" | ||
426 | " 0074 - a2 10 ..\n" | ||
427 | " 0076 - 14 85 ..\n" | ||
428 | " 0078 - aa a1 ..\n" | ||
429 | " 007a - 7c 84 |.\n" | ||
430 | " 007c - fb c4 ..\n" | ||
431 | " 007e - a5 7b .{\n" | ||
432 | " 0080 - c6 e3 ..\n" | ||
433 | " 0082 - ad 85 ..\n" | ||
434 | " 0084 - 57 96 W.\n" | ||
435 | " 0086 - bb 81 ..\n" | ||
436 | " 0088 - 18 0c ..\n" | ||
437 | " 008a - ed 2f ./\n" | ||
438 | " 008c - f7 6a .j\n" | ||
439 | " 008e - 4c 4d LM\n" | ||
440 | " 0090 - 59 e1 Y.\n" | ||
441 | " 0092 - cc c5 ..\n" | ||
442 | " 0094 - 3a 9f :.\n" | ||
443 | " 0096 - 48 fc H.\n" | ||
444 | " 0098 - 1d 7c .|\n" | ||
445 | " 009a - 0d a4 ..\n" | ||
446 | " 009c - 79 96 y.\n" | ||
447 | " 009e - e7 2b .+\n" | ||
448 | " 00a0 - 39 15 9.\n" | ||
449 | " 00a2 - f9 3a .:\n" | ||
450 | " 00a4 - 6a 5e j^\n" | ||
451 | " 00a6 - 7c 4e |N\n" | ||
452 | " 00a8 - c9 3b .;\n" | ||
453 | " 00aa - af eb ..\n" | ||
454 | " 00ac - 3b cf ;.\n" | ||
455 | " 00ae - 8d 6a .j\n" | ||
456 | " 00b0 - 57 e6 W.\n" | ||
457 | " 00b2 - c5 ba ..\n" | ||
458 | " 00b4 - bd a6 ..\n" | ||
459 | " 00b6 - a0 6b .k\n" | ||
460 | " 00b8 - 03 d5 ..\n" | ||
461 | " 00ba - a3 9f ..\n" | ||
462 | " 00bc - 99 2a .*\n" | ||
463 | " 00be - ea 88 ..\n" | ||
464 | " 00c0 - 72 1b r.\n" | ||
465 | " 00c2 - 66 6c fl\n" | ||
466 | " 00c4 - 5e 1d ^.\n" | ||
467 | " 00c6 - 49 d5 I.\n" | ||
468 | " 00c8 - 1e 1e ..\n" | ||
469 | " 00ca - cc 1a ..\n" | ||
470 | " 00cc - b1 d8 ..\n" | ||
471 | " 00ce - f7 91 ..\n" | ||
472 | " 00d0 - 1e 1e ..\n" | ||
473 | " 00d2 - cc 1a ..\n" | ||
474 | " 00f6 - <SPACES/NULS>\n", | ||
475 | }, | ||
476 | { | ||
477 | .indent = 67, | ||
478 | .input = dump, | ||
479 | .inlen = DUMP_LEN, | ||
480 | .output = | ||
481 | " 0000 - 74 t\n" | ||
482 | " 0001 - 45 E\n" | ||
483 | " 0002 - c6 .\n" | ||
484 | " 0003 - 20 \n" | ||
485 | " 0004 - 00 .\n" | ||
486 | " 0005 - 00 .\n" | ||
487 | " 0006 - 00 .\n" | ||
488 | " 0007 - 00 .\n" | ||
489 | " 0008 - 00 .\n" | ||
490 | " 0009 - 00 .\n" | ||
491 | " 000a - 00 .\n" | ||
492 | " 000b - 00 .\n" | ||
493 | " 000c - 00 .\n" | ||
494 | " 000d - 00 .\n" | ||
495 | " 000e - 00 .\n" | ||
496 | " 000f - 00 .\n" | ||
497 | " 0010 - 36 6\n" | ||
498 | " 0011 - d8 .\n" | ||
499 | " 0012 - 61 a\n" | ||
500 | " 0013 - 48 H\n" | ||
501 | " 0014 - 68 h\n" | ||
502 | " 0015 - 3c <\n" | ||
503 | " 0016 - c0 .\n" | ||
504 | " 0017 - 68 h\n" | ||
505 | " 0018 - aa .\n" | ||
506 | " 0019 - 15 .\n" | ||
507 | " 001a - 57 W\n" | ||
508 | " 001b - 77 w\n" | ||
509 | " 001c - e3 .\n" | ||
510 | " 001d - ec .\n" | ||
511 | " 001e - b4 .\n" | ||
512 | " 001f - 98 .\n" | ||
513 | " 0020 - c6 .\n" | ||
514 | " 0021 - 08 .\n" | ||
515 | " 0022 - fc .\n" | ||
516 | " 0023 - 59 Y\n" | ||
517 | " 0024 - b3 .\n" | ||
518 | " 0025 - 4f O\n" | ||
519 | " 0026 - 45 E\n" | ||
520 | " 0027 - cf .\n" | ||
521 | " 0028 - 4b K\n" | ||
522 | " 0029 - c2 .\n" | ||
523 | " 002a - ae .\n" | ||
524 | " 002b - 98 .\n" | ||
525 | " 002c - b5 .\n" | ||
526 | " 002d - eb .\n" | ||
527 | " 002e - e0 .\n" | ||
528 | " 002f - b5 .\n" | ||
529 | " 0030 - c1 .\n" | ||
530 | " 0031 - 68 h\n" | ||
531 | " 0032 - ba .\n" | ||
532 | " 0033 - cf .\n" | ||
533 | " 0034 - 7c |\n" | ||
534 | " 0035 - f7 .\n" | ||
535 | " 0036 - 7b {\n" | ||
536 | " 0037 - 38 8\n" | ||
537 | " 0038 - 43 C\n" | ||
538 | " 0039 - 2f /\n" | ||
539 | " 003a - b9 .\n" | ||
540 | " 003b - 0e .\n" | ||
541 | " 003c - 23 #\n" | ||
542 | " 003d - 02 .\n" | ||
543 | " 003e - b9 .\n" | ||
544 | " 003f - 4f O\n" | ||
545 | " 0040 - 8c .\n" | ||
546 | " 0041 - 26 &\n" | ||
547 | " 0042 - eb .\n" | ||
548 | " 0043 - ef .\n" | ||
549 | " 0044 - 70 p\n" | ||
550 | " 0045 - 98 .\n" | ||
551 | " 0046 - 82 .\n" | ||
552 | " 0047 - a7 .\n" | ||
553 | " 0048 - b9 .\n" | ||
554 | " 0049 - 78 x\n" | ||
555 | " 004a - c5 .\n" | ||
556 | " 004b - 08 .\n" | ||
557 | " 004c - 96 .\n" | ||
558 | " 004d - 99 .\n" | ||
559 | " 004e - b3 .\n" | ||
560 | " 004f - 84 .\n" | ||
561 | " 0050 - a3 .\n" | ||
562 | " 0051 - 4f O\n" | ||
563 | " 0052 - fb .\n" | ||
564 | " 0053 - d7 .\n" | ||
565 | " 0054 - 38 8\n" | ||
566 | " 0055 - a9 .\n" | ||
567 | " 0056 - d9 .\n" | ||
568 | " 0057 - d4 .\n" | ||
569 | " 0058 - 53 S\n" | ||
570 | " 0059 - 0f .\n" | ||
571 | " 005a - 4f O\n" | ||
572 | " 005b - 64 d\n" | ||
573 | " 005c - 97 .\n" | ||
574 | " 005d - df .\n" | ||
575 | " 005e - cf .\n" | ||
576 | " 005f - f3 .\n" | ||
577 | " 0060 - 4f O\n" | ||
578 | " 0061 - c8 .\n" | ||
579 | " 0062 - d2 .\n" | ||
580 | " 0063 - 56 V\n" | ||
581 | " 0064 - 3f ?\n" | ||
582 | " 0065 - 0d .\n" | ||
583 | " 0066 - 72 r\n" | ||
584 | " 0067 - d4 .\n" | ||
585 | " 0068 - 55 U\n" | ||
586 | " 0069 - 98 .\n" | ||
587 | " 006a - 89 .\n" | ||
588 | " 006b - b0 .\n" | ||
589 | " 006c - 45 E\n" | ||
590 | " 006d - 26 &\n" | ||
591 | " 006e - 3f ?\n" | ||
592 | " 006f - 7a z\n" | ||
593 | " 0070 - bd .\n" | ||
594 | " 0071 - 9d .\n" | ||
595 | " 0072 - 96 .\n" | ||
596 | " 0073 - 15 .\n" | ||
597 | " 0074 - a2 .\n" | ||
598 | " 0075 - 10 .\n" | ||
599 | " 0076 - 14 .\n" | ||
600 | " 0077 - 85 .\n" | ||
601 | " 0078 - aa .\n" | ||
602 | " 0079 - a1 .\n" | ||
603 | " 007a - 7c |\n" | ||
604 | " 007b - 84 .\n" | ||
605 | " 007c - fb .\n" | ||
606 | " 007d - c4 .\n" | ||
607 | " 007e - a5 .\n" | ||
608 | " 007f - 7b {\n" | ||
609 | " 0080 - c6 .\n" | ||
610 | " 0081 - e3 .\n" | ||
611 | " 0082 - ad .\n" | ||
612 | " 0083 - 85 .\n" | ||
613 | " 0084 - 57 W\n" | ||
614 | " 0085 - 96 .\n" | ||
615 | " 0086 - bb .\n" | ||
616 | " 0087 - 81 .\n" | ||
617 | " 0088 - 18 .\n" | ||
618 | " 0089 - 0c .\n" | ||
619 | " 008a - ed .\n" | ||
620 | " 008b - 2f /\n" | ||
621 | " 008c - f7 .\n" | ||
622 | " 008d - 6a j\n" | ||
623 | " 008e - 4c L\n" | ||
624 | " 008f - 4d M\n" | ||
625 | " 0090 - 59 Y\n" | ||
626 | " 0091 - e1 .\n" | ||
627 | " 0092 - cc .\n" | ||
628 | " 0093 - c5 .\n" | ||
629 | " 0094 - 3a :\n" | ||
630 | " 0095 - 9f .\n" | ||
631 | " 0096 - 48 H\n" | ||
632 | " 0097 - fc .\n" | ||
633 | " 0098 - 1d .\n" | ||
634 | " 0099 - 7c |\n" | ||
635 | " 009a - 0d .\n" | ||
636 | " 009b - a4 .\n" | ||
637 | " 009c - 79 y\n" | ||
638 | " 009d - 96 .\n" | ||
639 | " 009e - e7 .\n" | ||
640 | " 009f - 2b +\n" | ||
641 | " 00a0 - 39 9\n" | ||
642 | " 00a1 - 15 .\n" | ||
643 | " 00a2 - f9 .\n" | ||
644 | " 00a3 - 3a :\n" | ||
645 | " 00a4 - 6a j\n" | ||
646 | " 00a5 - 5e ^\n" | ||
647 | " 00a6 - 7c |\n" | ||
648 | " 00a7 - 4e N\n" | ||
649 | " 00a8 - c9 .\n" | ||
650 | " 00a9 - 3b ;\n" | ||
651 | " 00aa - af .\n" | ||
652 | " 00ab - eb .\n" | ||
653 | " 00ac - 3b ;\n" | ||
654 | " 00ad - cf .\n" | ||
655 | " 00ae - 8d .\n" | ||
656 | " 00af - 6a j\n" | ||
657 | " 00b0 - 57 W\n" | ||
658 | " 00b1 - e6 .\n" | ||
659 | " 00b2 - c5 .\n" | ||
660 | " 00b3 - ba .\n" | ||
661 | " 00b4 - bd .\n" | ||
662 | " 00b5 - a6 .\n" | ||
663 | " 00b6 - a0 .\n" | ||
664 | " 00b7 - 6b k\n" | ||
665 | " 00b8 - 03 .\n" | ||
666 | " 00b9 - d5 .\n" | ||
667 | " 00ba - a3 .\n" | ||
668 | " 00bb - 9f .\n" | ||
669 | " 00bc - 99 .\n" | ||
670 | " 00bd - 2a *\n" | ||
671 | " 00be - ea .\n" | ||
672 | " 00bf - 88 .\n" | ||
673 | " 00c0 - 72 r\n" | ||
674 | " 00c1 - 1b .\n" | ||
675 | " 00c2 - 66 f\n" | ||
676 | " 00c3 - 6c l\n" | ||
677 | " 00c4 - 5e ^\n" | ||
678 | " 00c5 - 1d .\n" | ||
679 | " 00c6 - 49 I\n" | ||
680 | " 00c7 - d5 .\n" | ||
681 | " 00c8 - 1e .\n" | ||
682 | " 00c9 - 1e .\n" | ||
683 | " 00ca - cc .\n" | ||
684 | " 00cb - 1a .\n" | ||
685 | " 00cc - b1 .\n" | ||
686 | " 00cd - d8 .\n" | ||
687 | " 00ce - f7 .\n" | ||
688 | " 00cf - 91 .\n" | ||
689 | " 00d0 - 1e .\n" | ||
690 | " 00d1 - 1e .\n" | ||
691 | " 00d2 - cc .\n" | ||
692 | " 00d3 - 1a .\n" | ||
693 | " 00f6 - <SPACES/NULS>\n", | ||
694 | }, | ||
695 | }; | ||
696 | |||
697 | #define N_TESTS (sizeof(bio_dump_testcases) / sizeof(bio_dump_testcases[0])) | ||
698 | |||
699 | static int | ||
700 | bio_dump_test(const struct bio_dump_testcase *tc) | ||
701 | { | ||
702 | BIO *bio; | ||
703 | char *got; | ||
704 | long got_len; | ||
705 | int ret; | ||
706 | int failed = 1; | ||
707 | |||
708 | if ((bio = BIO_new(BIO_s_mem())) == NULL) | ||
709 | errx(1, "BIO_new"); | ||
710 | |||
711 | if ((ret = BIO_dump_indent(bio, tc->input, tc->inlen, tc->indent)) == -1) | ||
712 | errx(1, "BIO_dump_indent"); | ||
713 | if ((got_len = BIO_get_mem_data(bio, &got)) < 0) | ||
714 | errx(1, "BIO_get_mem_data"); | ||
715 | if (ret != got_len || strlen(tc->output) != (size_t)ret) { | ||
716 | fprintf(stderr, "indent %d: ret %d, got_len %ld, strlen %zu", | ||
717 | tc->indent, ret, got_len, strlen(tc->output)); | ||
718 | goto err; | ||
719 | } | ||
720 | if (strncmp(tc->output, got, got_len) != 0) { | ||
721 | fprintf(stderr, "%d: mismatch\n", tc->indent); | ||
722 | goto err; | ||
723 | } | ||
724 | |||
725 | failed = 0; | ||
726 | |||
727 | err: | ||
728 | BIO_free(bio); | ||
729 | |||
730 | return failed; | ||
731 | } | ||
732 | |||
733 | int | ||
734 | main(void) | ||
735 | { | ||
736 | size_t i; | ||
737 | int failed = 0; | ||
738 | |||
739 | for (i = 0; i < N_TESTS; i++) | ||
740 | failed |= bio_dump_test(&bio_dump_testcases[i]); | ||
741 | |||
742 | return failed; | ||
743 | } | ||