summaryrefslogtreecommitdiffstats
path: root/test/helpers
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2023-09-21 13:16:38 +0200
committerPauli <pauli@openssl.org>2023-09-24 23:46:45 +0200
commitd058ae6e0397faaa60c18c6ae3aecaff64dca47b (patch)
tree65be38a6e14bd3e3ef4baaea9ca885ab748fffbe /test/helpers
parentAdd documentation for the BIO_ADDR_copy() function (diff)
downloadopenssl-d058ae6e0397faaa60c18c6ae3aecaff64dca47b.tar.xz
openssl-d058ae6e0397faaa60c18c6ae3aecaff64dca47b.zip
Clean away the test code implementation of bio_addr_copy
We now have a public function for BIO_ADDR_copy() which can be used in preference to the test code's private implementation. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22164)
Diffstat (limited to 'test/helpers')
-rw-r--r--test/helpers/quictestlib.c42
-rw-r--r--test/helpers/quictestlib.h3
2 files changed, 2 insertions, 43 deletions
diff --git a/test/helpers/quictestlib.c b/test/helpers/quictestlib.c
index f5a46efb6f..17da14766f 100644
--- a/test/helpers/quictestlib.c
+++ b/test/helpers/quictestlib.c
@@ -1086,44 +1086,6 @@ int qtest_fault_resize_datagram(QTEST_FAULT *fault, size_t newlen)
return 1;
}
-/* There isn't a public function to do BIO_ADDR_copy() so we create one */
-int bio_addr_copy(BIO_ADDR *dst, BIO_ADDR *src)
-{
- size_t len;
- void *data = NULL;
- int res = 0;
- int family;
-
- if (src == NULL || dst == NULL)
- return 0;
-
- family = BIO_ADDR_family(src);
- if (family == AF_UNSPEC) {
- BIO_ADDR_clear(dst);
- return 1;
- }
-
- if (!BIO_ADDR_rawaddress(src, NULL, &len))
- return 0;
-
- if (len > 0) {
- data = OPENSSL_malloc(len);
- if (!TEST_ptr(data))
- return 0;
- }
-
- if (!BIO_ADDR_rawaddress(src, data, &len))
- goto err;
-
- if (!BIO_ADDR_rawmake(src, family, data, len, BIO_ADDR_rawport(src)))
- goto err;
-
- res = 1;
- err:
- OPENSSL_free(data);
- return res;
-}
-
int bio_msg_copy(BIO_MSG *dst, BIO_MSG *src)
{
/*
@@ -1135,13 +1097,13 @@ int bio_msg_copy(BIO_MSG *dst, BIO_MSG *src)
dst->flags = src->flags;
if (dst->local != NULL) {
if (src->local != NULL) {
- if (!TEST_true(bio_addr_copy(dst->local, src->local)))
+ if (!TEST_true(BIO_ADDR_copy(dst->local, src->local)))
return 0;
} else {
BIO_ADDR_clear(dst->local);
}
}
- if (!TEST_true(bio_addr_copy(dst->peer, src->peer)))
+ if (!TEST_true(BIO_ADDR_copy(dst->peer, src->peer)))
return 0;
return 1;
diff --git a/test/helpers/quictestlib.h b/test/helpers/quictestlib.h
index 844aec8a60..f090299b22 100644
--- a/test/helpers/quictestlib.h
+++ b/test/helpers/quictestlib.h
@@ -242,9 +242,6 @@ int qtest_fault_set_datagram_listener(QTEST_FAULT *fault,
*/
int qtest_fault_resize_datagram(QTEST_FAULT *fault, size_t newlen);
-/* Copy a BIO_ADDR */
-int bio_addr_copy(BIO_ADDR *dst, BIO_ADDR *src);
-
/* Copy a BIO_MSG */
int bio_msg_copy(BIO_MSG *dst, BIO_MSG *src);