diff options
| author | cvs2svn <admin@example.com> | 2019-11-19 19:57:05 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2019-11-19 19:57:05 +0000 |
| commit | e9f9eb6198f1757b7c0dfef043fadf1fa8243022 (patch) | |
| tree | b5a648f6ccaf6c1cd9915ddb45503d1fccfeba0e /src/regress/lib/libcrypto/bio | |
| parent | ab72e3a6f7e8d5c71bbba034410468781d5923b6 (diff) | |
| download | openbsd-bluhm_20191119.tar.gz openbsd-bluhm_20191119.tar.bz2 openbsd-bluhm_20191119.zip | |
This commit was manufactured by cvs2git to create tag 'bluhm_20191119'.bluhm_20191119
Diffstat (limited to 'src/regress/lib/libcrypto/bio')
| -rw-r--r-- | src/regress/lib/libcrypto/bio/Makefile | 9 | ||||
| -rw-r--r-- | src/regress/lib/libcrypto/bio/biotest.c | 155 |
2 files changed, 0 insertions, 164 deletions
diff --git a/src/regress/lib/libcrypto/bio/Makefile b/src/regress/lib/libcrypto/bio/Makefile deleted file mode 100644 index fab7d44d50..0000000000 --- a/src/regress/lib/libcrypto/bio/Makefile +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.2 2014/07/08 15:53:52 jsing Exp $ | ||
| 2 | |||
| 3 | PROG= biotest | ||
| 4 | LDADD= -lcrypto | ||
| 5 | DPADD= ${LIBCRYPTO} | ||
| 6 | WARNINGS= Yes | ||
| 7 | CFLAGS+= -DLIBRESSL_INTERNAL -Werror | ||
| 8 | |||
| 9 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libcrypto/bio/biotest.c b/src/regress/lib/libcrypto/bio/biotest.c deleted file mode 100644 index 867305a904..0000000000 --- a/src/regress/lib/libcrypto/bio/biotest.c +++ /dev/null | |||
| @@ -1,155 +0,0 @@ | |||
| 1 | /* $OpenBSD: biotest.c,v 1.6 2017/04/30 17:46:27 beck Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2014 Joel Sing <jsing@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 <sys/types.h> | ||
| 19 | |||
| 20 | #include <stdint.h> | ||
| 21 | #include <stdlib.h> | ||
| 22 | #include <string.h> | ||
| 23 | |||
| 24 | #include <netinet/in.h> | ||
| 25 | |||
| 26 | #include <openssl/bio.h> | ||
| 27 | #include <openssl/err.h> | ||
| 28 | |||
| 29 | struct bio_get_host_ip_test { | ||
| 30 | char *input; | ||
| 31 | uint32_t ip; | ||
| 32 | int ret; | ||
| 33 | }; | ||
| 34 | |||
| 35 | struct bio_get_host_ip_test bio_get_host_ip_tests[] = { | ||
| 36 | {"", 0, 0}, | ||
| 37 | {".", 0, 0}, | ||
| 38 | {"1", 0, 0}, | ||
| 39 | {"1.2", 0, 0}, | ||
| 40 | {"1.2.3", 0, 0}, | ||
| 41 | {"1.2.3.", 0, 0}, | ||
| 42 | {"1.2.3.4", 0x01020304, 1}, | ||
| 43 | {"1.2.3.256", 0, 0}, | ||
| 44 | {"1:2:3::4", 0, 0}, | ||
| 45 | {"0.0.0.0", INADDR_ANY, 1}, | ||
| 46 | {"127.0.0.1", INADDR_LOOPBACK, 1}, | ||
| 47 | {"localhost", INADDR_LOOPBACK, 1}, | ||
| 48 | {"255.255.255.255", INADDR_BROADCAST, 1}, | ||
| 49 | {"0xff.0xff.0xff.0xff", 0, 0}, | ||
| 50 | }; | ||
| 51 | |||
| 52 | #define N_BIO_GET_IP_TESTS \ | ||
| 53 | (sizeof(bio_get_host_ip_tests) / sizeof(*bio_get_host_ip_tests)) | ||
| 54 | |||
| 55 | struct bio_get_port_test { | ||
| 56 | char *input; | ||
| 57 | unsigned short port; | ||
| 58 | int ret; | ||
| 59 | }; | ||
| 60 | |||
| 61 | struct bio_get_port_test bio_get_port_tests[] = { | ||
| 62 | {NULL, 0, 0}, | ||
| 63 | {"", 0, 0}, | ||
| 64 | {"-1", 0, 0}, | ||
| 65 | {"0", 0, 1}, | ||
| 66 | {"1", 1, 1}, | ||
| 67 | {"12345", 12345, 1}, | ||
| 68 | {"65535", 65535, 1}, | ||
| 69 | {"65536", 0, 0}, | ||
| 70 | {"999999999999", 0, 0}, | ||
| 71 | {"xyzzy", 0, 0}, | ||
| 72 | {"https", 443, 1}, | ||
| 73 | {"imaps", 993, 1}, | ||
| 74 | {"telnet", 23, 1}, | ||
| 75 | }; | ||
| 76 | |||
| 77 | #define N_BIO_GET_PORT_TESTS \ | ||
| 78 | (sizeof(bio_get_port_tests) / sizeof(*bio_get_port_tests)) | ||
| 79 | |||
| 80 | static int | ||
| 81 | do_bio_get_host_ip_tests(void) | ||
| 82 | { | ||
| 83 | struct bio_get_host_ip_test *bgit; | ||
| 84 | union { | ||
| 85 | unsigned char c[4]; | ||
| 86 | uint32_t i; | ||
| 87 | } ip; | ||
| 88 | int failed = 0; | ||
| 89 | size_t i; | ||
| 90 | int ret; | ||
| 91 | |||
| 92 | for (i = 0; i < N_BIO_GET_IP_TESTS; i++) { | ||
| 93 | bgit = &bio_get_host_ip_tests[i]; | ||
| 94 | memset(&ip, 0, sizeof(ip)); | ||
| 95 | |||
| 96 | ret = BIO_get_host_ip(bgit->input, ip.c); | ||
| 97 | if (ret != bgit->ret) { | ||
| 98 | fprintf(stderr, "FAIL: test %zi (\"%s\") %s, want %s\n", | ||
| 99 | i, bgit->input, ret ? "success" : "failure", | ||
| 100 | bgit->ret ? "success" : "failure"); | ||
| 101 | failed = 1; | ||
| 102 | continue; | ||
| 103 | } | ||
| 104 | if (ret && ntohl(ip.i) != bgit->ip) { | ||
| 105 | fprintf(stderr, "FAIL: test %zi (\"%s\") returned ip " | ||
| 106 | "%x != %x\n", i, bgit->input, | ||
| 107 | ntohl(ip.i), bgit->ip); | ||
| 108 | failed = 1; | ||
| 109 | } | ||
| 110 | } | ||
| 111 | |||
| 112 | return failed; | ||
| 113 | } | ||
| 114 | |||
| 115 | static int | ||
| 116 | do_bio_get_port_tests(void) | ||
| 117 | { | ||
| 118 | struct bio_get_port_test *bgpt; | ||
| 119 | unsigned short port; | ||
| 120 | int failed = 0; | ||
| 121 | size_t i; | ||
| 122 | int ret; | ||
| 123 | |||
| 124 | for (i = 0; i < N_BIO_GET_PORT_TESTS; i++) { | ||
| 125 | bgpt = &bio_get_port_tests[i]; | ||
| 126 | port = 0; | ||
| 127 | |||
| 128 | ret = BIO_get_port(bgpt->input, &port); | ||
| 129 | if (ret != bgpt->ret) { | ||
| 130 | fprintf(stderr, "FAIL: test %zi (\"%s\") %s, want %s\n", | ||
| 131 | i, bgpt->input, ret ? "success" : "failure", | ||
| 132 | bgpt->ret ? "success" : "failure"); | ||
| 133 | failed = 1; | ||
| 134 | continue; | ||
| 135 | } | ||
| 136 | if (ret && port != bgpt->port) { | ||
| 137 | fprintf(stderr, "FAIL: test %zi (\"%s\") returned port " | ||
| 138 | "%u != %u\n", i, bgpt->input, port, bgpt->port); | ||
| 139 | failed = 1; | ||
| 140 | } | ||
| 141 | } | ||
| 142 | |||
| 143 | return failed; | ||
| 144 | } | ||
| 145 | |||
| 146 | int | ||
| 147 | main(int argc, char **argv) | ||
| 148 | { | ||
| 149 | int ret = 0; | ||
| 150 | |||
| 151 | ret |= do_bio_get_host_ip_tests(); | ||
| 152 | ret |= do_bio_get_port_tests(); | ||
| 153 | |||
| 154 | return (ret); | ||
| 155 | } | ||
