summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2024-02-05 18:54:38 +0000
committerHugo Landau <hlandau@openssl.org>2024-04-19 09:31:06 +0100
commit86e6b4ae1e8d18c93bd62d200834997903f3a63e (patch)
tree0c1c1444b1172421470ccfb89b168ed6122f2f8f
parent0c86f6ff35276bb084e3ca622146fc2098386744 (diff)
QUIC RADIX: Minor fixes
Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23487)
-rw-r--r--test/radix/quic_bindings.c12
-rw-r--r--test/radix/quic_ops.c28
-rw-r--r--test/radix/terp.c10
3 files changed, 28 insertions, 22 deletions
diff --git a/test/radix/quic_bindings.c b/test/radix/quic_bindings.c
index c5b9fe1d11..d90148e03d 100644
--- a/test/radix/quic_bindings.c
+++ b/test/radix/quic_bindings.c
@@ -142,8 +142,10 @@ static int RADIX_OBJ_cmp(const RADIX_OBJ *a, const RADIX_OBJ *b)
static int RADIX_PROCESS_init(RADIX_PROCESS *rp, size_t node_idx, size_t process_idx)
{
+#if defined(OPENSSL_THREADS)
if (!TEST_ptr(rp->gm = ossl_crypto_mutex_new()))
goto err;
+#endif
if (!TEST_ptr(rp->objs = lh_RADIX_OBJ_new(RADIX_OBJ_hash, RADIX_OBJ_cmp)))
goto err;
@@ -299,8 +301,8 @@ static void RADIX_PROCESS_report_state(RADIX_PROCESS *rp, BIO *bio,
BIO_printf(bio, " Threads (incl. main): %zu\n",
rp->next_thread_idx);
- BIO_printf(bio, " Time slip: %zu ms\n",
- ossl_time2ms(rp->time_slip));
+ BIO_printf(bio, " Time slip: %llu ms\n",
+ (unsigned long long)ossl_time2ms(rp->time_slip));
BIO_printf(bio, " Objects:\n");
lh_RADIX_OBJ_doall_arg(rp->objs, report_obj, bio);
@@ -482,10 +484,12 @@ static RADIX_THREAD *RADIX_THREAD_new(RADIX_PROCESS *rp)
rt->rp = rp;
+#if defined(OPENSSL_THREADS)
if (!TEST_ptr(rt->m = ossl_crypto_mutex_new())) {
OPENSSL_free(rt);
return 0;
}
+#endif
if (!TEST_true(sk_RADIX_THREAD_push(rp->threads, rt))) {
OPENSSL_free(rt);
@@ -672,6 +676,8 @@ static int expect_slot_ssl(FUNC_CTX *fctx, size_t idx, SSL **p_ssl)
#define S_UNI_ID(ordinal) \
(((ordinal) << 2) | QUIC_STREAM_INITIATOR_SERVER | QUIC_STREAM_DIR_UNI)
+#if defined(OPENSSL_THREADS)
+
static int RADIX_THREAD_worker_run(RADIX_THREAD *rt)
{
int ok = 0;
@@ -712,6 +718,8 @@ static unsigned int RADIX_THREAD_worker_main(void *p)
return 1;
}
+#endif
+
static void radix_activate_obj(RADIX_OBJ *obj)
{
if (obj != NULL)
diff --git a/test/radix/quic_ops.c b/test/radix/quic_ops.c
index f3dedc13ac..7289066419 100644
--- a/test/radix/quic_ops.c
+++ b/test/radix/quic_ops.c
@@ -1,4 +1,4 @@
-#include <netinet/in.h>
+#include "internal/sockets.h"
static const unsigned char alpn_ossltest[] = {
/* "\x08ossltest" (hex for EBCDIC resilience) */
@@ -56,7 +56,9 @@ static int ssl_create_bound_socket(uint16_t listen_port,
int fd = -1;
BIO_ADDR *addr = NULL;
union BIO_sock_info_u info;
- struct in_addr ina = { htonl(INADDR_LOOPBACK) };
+ struct in_addr ina;
+
+ ina.s_addr = htonl(INADDR_LOOPBACK);
fd = BIO_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP, 0);
if (!TEST_int_ge(fd, 0))
@@ -321,7 +323,7 @@ DEF_FUNC(hf_set_default_stream_mode)
F_POP(mode);
REQUIRE_SSL(ssl);
- if (!TEST_true(SSL_set_default_stream_mode(ssl, mode)))
+ if (!TEST_true(SSL_set_default_stream_mode(ssl, (uint32_t)mode)))
goto err;
ok = 1;
@@ -339,7 +341,7 @@ DEF_FUNC(hf_set_incoming_stream_policy)
F_POP(policy);
REQUIRE_SSL(ssl);
- if (!TEST_true(SSL_set_incoming_stream_policy(ssl, policy, error_code)))
+ if (!TEST_true(SSL_set_incoming_stream_policy(ssl, (int)policy, error_code)))
goto err;
ok = 1;
@@ -488,7 +490,7 @@ DEF_FUNC(hf_read_expect)
int ok = 0, r;
SSL *ssl;
const void *buf;
- uint64_t buf_len, bytes_read = 0;
+ size_t buf_len, bytes_read = 0;
F_POP2(buf, buf_len);
REQUIRE_SSL(ssl);
@@ -561,10 +563,6 @@ DEF_FUNC(hf_connect_wait)
if (!TEST_true(SSL_set_blocking_mode(ssl, 0)))
return 0;
- SSL_CONN_CLOSE_INFO cc_info = {0};
- if (!TEST_false(SSL_get_conn_close_info(ssl, &cc_info, sizeof(cc_info))))
- goto err;
-
/* 0 is the success case for SSL_set_alpn_protos(). */
if (!TEST_false(SSL_set_alpn_protos(ssl, alpn_ossltest,
sizeof(alpn_ossltest))))
@@ -685,9 +683,9 @@ DEF_FUNC(hf_expect_conn_close_info)
if (!SSL_get_conn_close_info(ssl, &cc_info, sizeof(cc_info)))
F_SPIN_AGAIN();
- if (!TEST_int_eq(expect_app,
+ if (!TEST_int_eq((int)expect_app,
(cc_info.flags & SSL_CONN_CLOSE_FLAG_TRANSPORT) == 0)
- || !TEST_int_eq(expect_remote,
+ || !TEST_int_eq((int)expect_remote,
(cc_info.flags & SSL_CONN_CLOSE_FLAG_LOCAL) == 0)
|| !TEST_uint64_t_eq(error_code, cc_info.error_code)) {
TEST_info("connection close reason: %s", cc_info.reason);
@@ -723,8 +721,10 @@ DEF_FUNC(hf_expect_err)
uint64_t lib, reason;
F_POP2(lib, reason);
- if (!TEST_size_t_eq((size_t)ERR_GET_LIB(ERR_peek_last_error()), lib)
- || !TEST_size_t_eq((size_t)ERR_GET_REASON(ERR_peek_last_error()), reason))
+ if (!TEST_size_t_eq((size_t)ERR_GET_LIB(ERR_peek_last_error()),
+ (size_t)lib)
+ || !TEST_size_t_eq((size_t)ERR_GET_REASON(ERR_peek_last_error()),
+ (size_t)reason))
goto err;
ok = 1;
@@ -741,7 +741,7 @@ DEF_FUNC(hf_expect_ssl_err)
F_POP(expected);
REQUIRE_SSL(ssl);
- if (!TEST_size_t_eq((size_t)SSL_get_error(ssl, 0), expected)
+ if (!TEST_size_t_eq((size_t)SSL_get_error(ssl, 0), (size_t)expected)
|| !TEST_int_eq(SSL_want(ssl), SSL_NOTHING))
goto err;
diff --git a/test/radix/terp.c b/test/radix/terp.c
index 89d3cbfeaf..151d133e4c 100644
--- a/test/radix/terp.c
+++ b/test/radix/terp.c
@@ -426,7 +426,7 @@ static int SRDR_print_one(SRDR *srdr, BIO *bio, size_t i, int *was_end)
GET_OPERAND(srdr, v);
PRINT_OPC(PUSH_U64);
- BIO_printf(bio, "%#20llx (%lld)",
+ BIO_printf(bio, "%#20llx (%llu)",
(unsigned long long)v, (unsigned long long)v);
}
break;
@@ -436,7 +436,7 @@ static int SRDR_print_one(SRDR *srdr, BIO *bio, size_t i, int *was_end)
GET_OPERAND(srdr, v);
PRINT_OPC(PUSH_SIZE);
- BIO_printf(bio, "%#20llx (%lld)",
+ BIO_printf(bio, "%#20llx (%llu)",
(unsigned long long)v, (unsigned long long)v);
}
break;
@@ -626,10 +626,8 @@ static ossl_inline int TERP_stk_push(TERP *terp,
static ossl_inline int TERP_stk_pop(TERP *terp,
void *buf, size_t buf_len)
{
- if (!TEST_size_t_ge(terp->stk_end - terp->stk_cur, buf_len)) {
- asm("int3");
+ if (!TEST_size_t_ge(terp->stk_end - terp->stk_cur, buf_len))
return 0;
- }
memcpy(buf, terp->stk_cur, buf_len);
terp->stk_cur += buf_len;
@@ -743,7 +741,7 @@ spin_again:
break;
case OPK_PUSH_SIZE:
{
- uint64_t v;
+ size_t v;
TERP_GET_OPERAND(v);
TERP_STK_PUSH(terp, v);