diff options
author | tb <> | 2024-02-02 06:39:58 +0000 |
---|---|---|
committer | tb <> | 2024-02-02 06:39:58 +0000 |
commit | ba21b2538baeebcd359e7ce789353ecdbf8e8ce6 (patch) | |
tree | a8d4d8478ae2eade7ddc6efb8db6cde90ceb95b9 /src/regress/lib | |
parent | e485e0ec35e5f90c03bd1bb89d3aad32e0a66536 (diff) | |
download | openbsd-ba21b2538baeebcd359e7ce789353ecdbf8e8ce6.tar.gz openbsd-ba21b2538baeebcd359e7ce789353ecdbf8e8ce6.tar.bz2 openbsd-ba21b2538baeebcd359e7ce789353ecdbf8e8ce6.zip |
bio_dump: add one more testcase
This one covers the silly minuses between the hexdump and the ASCII dump
when dumping eight bytes per line.
Diffstat (limited to 'src/regress/lib')
-rw-r--r-- | src/regress/lib/libcrypto/bio/bio_dump.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/regress/lib/libcrypto/bio/bio_dump.c b/src/regress/lib/libcrypto/bio/bio_dump.c index 02648d0f83..540fd84f83 100644 --- a/src/regress/lib/libcrypto/bio/bio_dump.c +++ b/src/regress/lib/libcrypto/bio/bio_dump.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_dump.c,v 1.1 2024/02/02 06:22:01 tb Exp $ */ | 1 | /* $OpenBSD: bio_dump.c,v 1.2 2024/02/02 06:39:58 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> |
4 | * | 4 | * |
@@ -220,6 +220,40 @@ static const struct bio_dump_testcase { | |||
220 | " 00f6 - <SPACES/NULS>\n", | 220 | " 00f6 - <SPACES/NULS>\n", |
221 | }, | 221 | }, |
222 | { | 222 | { |
223 | .indent = 35, | ||
224 | .input = dump, | ||
225 | .inlen = DUMP_LEN, | ||
226 | .output = | ||
227 | " 0000 - 74 45 c6 20 00 00 00 00- tE. ....\n" | ||
228 | " 0008 - 00 00 00 00 00 00 00 00- ........\n" | ||
229 | " 0010 - 36 d8 61 48 68 3c c0 68- 6.aHh<.h\n" | ||
230 | " 0018 - aa 15 57 77 e3 ec b4 98- ..Ww....\n" | ||
231 | " 0020 - c6 08 fc 59 b3 4f 45 cf- ...Y.OE.\n" | ||
232 | " 0028 - 4b c2 ae 98 b5 eb e0 b5- K.......\n" | ||
233 | " 0030 - c1 68 ba cf 7c f7 7b 38- .h..|.{8\n" | ||
234 | " 0038 - 43 2f b9 0e 23 02 b9 4f- C/..#..O\n" | ||
235 | " 0040 - 8c 26 eb ef 70 98 82 a7- .&..p...\n" | ||
236 | " 0048 - b9 78 c5 08 96 99 b3 84- .x......\n" | ||
237 | " 0050 - a3 4f fb d7 38 a9 d9 d4- .O..8...\n" | ||
238 | " 0058 - 53 0f 4f 64 97 df cf f3- S.Od....\n" | ||
239 | " 0060 - 4f c8 d2 56 3f 0d 72 d4- O..V?.r.\n" | ||
240 | " 0068 - 55 98 89 b0 45 26 3f 7a- U...E&?z\n" | ||
241 | " 0070 - bd 9d 96 15 a2 10 14 85- ........\n" | ||
242 | " 0078 - aa a1 7c 84 fb c4 a5 7b- ..|....{\n" | ||
243 | " 0080 - c6 e3 ad 85 57 96 bb 81- ....W...\n" | ||
244 | " 0088 - 18 0c ed 2f f7 6a 4c 4d- .../.jLM\n" | ||
245 | " 0090 - 59 e1 cc c5 3a 9f 48 fc- Y...:.H.\n" | ||
246 | " 0098 - 1d 7c 0d a4 79 96 e7 2b- .|..y..+\n" | ||
247 | " 00a0 - 39 15 f9 3a 6a 5e 7c 4e- 9..:j^|N\n" | ||
248 | " 00a8 - c9 3b af eb 3b cf 8d 6a- .;..;..j\n" | ||
249 | " 00b0 - 57 e6 c5 ba bd a6 a0 6b- W......k\n" | ||
250 | " 00b8 - 03 d5 a3 9f 99 2a ea 88- .....*..\n" | ||
251 | " 00c0 - 72 1b 66 6c 5e 1d 49 d5- r.fl^.I.\n" | ||
252 | " 00c8 - 1e 1e cc 1a b1 d8 f7 91- ........\n" | ||
253 | " 00d0 - 1e 1e cc 1a ....\n" | ||
254 | " 00f6 - <SPACES/NULS>\n", | ||
255 | }, | ||
256 | { | ||
223 | .indent = 39, | 257 | .indent = 39, |
224 | .input = dump, | 258 | .input = dump, |
225 | .inlen = DUMP_LEN, | 259 | .inlen = DUMP_LEN, |
@@ -713,7 +747,7 @@ bio_dump_test(const struct bio_dump_testcase *tc) | |||
713 | if ((got_len = BIO_get_mem_data(bio, &got)) < 0) | 747 | if ((got_len = BIO_get_mem_data(bio, &got)) < 0) |
714 | errx(1, "BIO_get_mem_data"); | 748 | errx(1, "BIO_get_mem_data"); |
715 | if (ret != got_len || strlen(tc->output) != (size_t)ret) { | 749 | if (ret != got_len || strlen(tc->output) != (size_t)ret) { |
716 | fprintf(stderr, "indent %d: ret %d, got_len %ld, strlen %zu", | 750 | fprintf(stderr, "indent %d: ret %d, got_len %ld, strlen %zu\n", |
717 | tc->indent, ret, got_len, strlen(tc->output)); | 751 | tc->indent, ret, got_len, strlen(tc->output)); |
718 | goto err; | 752 | goto err; |
719 | } | 753 | } |