summaryrefslogtreecommitdiff
path: root/src/regress/lib
diff options
context:
space:
mode:
authortb <>2021-01-10 23:59:32 +0000
committertb <>2021-01-10 23:59:32 +0000
commit75a29aff7e93987e4d69a00ff02242cb0571b848 (patch)
tree0037f1f355ffd196b919d8c5e647826a437026d6 /src/regress/lib
parent187dcf56d95a3737009285201373f7ba348530ee (diff)
downloadopenbsd-75a29aff7e93987e4d69a00ff02242cb0571b848.tar.gz
openbsd-75a29aff7e93987e4d69a00ff02242cb0571b848.tar.bz2
openbsd-75a29aff7e93987e4d69a00ff02242cb0571b848.zip
Merge handshake_loop() into handshake(). There's no benefit in having
this factored into a separate function.
Diffstat (limited to 'src/regress/lib')
-rw-r--r--src/regress/lib/libssl/unit/ssl_get_shared_ciphers.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/regress/lib/libssl/unit/ssl_get_shared_ciphers.c b/src/regress/lib/libssl/unit/ssl_get_shared_ciphers.c
index e8026217ce..ad46e210e2 100644
--- a/src/regress/lib/libssl/unit/ssl_get_shared_ciphers.c
+++ b/src/regress/lib/libssl/unit/ssl_get_shared_ciphers.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_get_shared_ciphers.c,v 1.2 2021/01/10 09:28:30 tb Exp $ */ 1/* $OpenBSD: ssl_get_shared_ciphers.c,v 1.3 2021/01/10 23:59:32 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2021 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2021 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -316,21 +316,6 @@ push_data_to_peer(SSL *ssl, int *ret, int (*func)(SSL *), const char *func_name,
316 return 1; 316 return 1;
317} 317}
318 318
319static int
320handshake_loop(SSL *client_ssl, int *client_ret, SSL *server_ssl,
321 int *server_ret, const char *description)
322{
323 if (!push_data_to_peer(client_ssl, client_ret, SSL_connect,
324 "SSL_connect", description))
325 return 0;
326
327 if (!push_data_to_peer(server_ssl, server_ret, SSL_accept,
328 "SSL_accept", description))
329 return 0;
330
331 return 1;
332}
333
334/* 319/*
335 * Alternate between loops of SSL_connect() and SSL_accept() as long as only 320 * Alternate between loops of SSL_connect() and SSL_accept() as long as only
336 * WANT_READ and WANT_WRITE situations are encountered. A function is repeated 321 * WANT_READ and WANT_WRITE situations are encountered. A function is repeated
@@ -343,8 +328,12 @@ handshake(SSL *client_ssl, SSL *server_ssl, const char *description)
343 int loops = 0, client_ret = 0, server_ret = 0; 328 int loops = 0, client_ret = 0, server_ret = 0;
344 329
345 while (loops++ < 10 && (client_ret <= 0 || server_ret <= 0)) { 330 while (loops++ < 10 && (client_ret <= 0 || server_ret <= 0)) {
346 if (!handshake_loop(client_ssl, &client_ret, server_ssl, 331 if (!push_data_to_peer(client_ssl, &client_ret, SSL_connect,
347 &server_ret, description)) 332 "SSL_connect", description))
333 return 0;
334
335 if (!push_data_to_peer(server_ssl, &server_ret, SSL_accept,
336 "SSL_accept", description))
348 return 0; 337 return 0;
349 } 338 }
350 339