From 43ed9c9c3ff94fe176144f93f077e0d89e18d84d Mon Sep 17 00:00:00 2001 From: Henry Case Date: Mon, 29 Jul 2019 11:32:14 +0100 Subject: [PATCH] WIP --- bssl_perf/src/client.c | 32 ++++++++++++++------------------ bssl_perf/src/common.c | 2 +- bssl_perf/src/common.h | 9 ++++----- bssl_perf/src/server.c | 3 +-- 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/bssl_perf/src/client.c b/bssl_perf/src/client.c index cedc7c0..e934dae 100644 --- a/bssl_perf/src/client.c +++ b/bssl_perf/src/client.c @@ -52,8 +52,7 @@ int do_client_loop(SSL* ssl) return 1; } -void test_Handshake(size_t handshake_nb) { - +void test_Handshake(const char* IP, size_t handshake_nb) { SSL* ssl; SSL_CTX* ctx; int err; @@ -63,16 +62,14 @@ void test_Handshake(size_t handshake_nb) { DBG("Trying to connect"); for (size_t i=0; i: test_name\nOptions for 'test_name':\n\t" + ERR("\n\nUsage: %s test_name\nOptions for 'test_name':\n\t" "test_Handshake\n\ttest_Write\n\ttest_Read\n", argv[0]); goto exit; } \ No newline at end of file diff --git a/bssl_perf/src/common.c b/bssl_perf/src/common.c index 2258a04..85bfe2f 100644 --- a/bssl_perf/src/common.c +++ b/bssl_perf/src/common.c @@ -13,7 +13,7 @@ /* ----------------------------------------------------------------------------- * @brief Performs TCP 3-way handshake with IP:PORT * -------------------------------------------------------------------------------- */ -int connect_once(void) { +int connect_once(const char* IP) { struct sockaddr_in a; diff --git a/bssl_perf/src/common.h b/bssl_perf/src/common.h index a7dd17c..8fb410d 100644 --- a/bssl_perf/src/common.h +++ b/bssl_perf/src/common.h @@ -10,7 +10,6 @@ #endif #define PORT 1443 -#define IP "127.0.0.1" #define SERVER "localhost" #define CLIENT "localhost" #define CACERT "etc/ca/ca.cert.pem" @@ -51,14 +50,14 @@ #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) -int connect_once(void); +int connect_once(const char* IP); void init(void); void cleanup(void); void fill_buffer_from_file(unsigned char *b, size_t sz); // Available tests -void test_Write(void); -void test_Read(void); -void test_Handshake(size_t); +void test_Write(const char*); +void test_Read(const char*); +void test_Handshake(const char*, size_t); #endif // __COMMON_H__ \ No newline at end of file diff --git a/bssl_perf/src/server.c b/bssl_perf/src/server.c index afc5717..f2645ad 100644 --- a/bssl_perf/src/server.c +++ b/bssl_perf/src/server.c @@ -114,7 +114,7 @@ static SSL_CTX* setup_server_ctx(const char* cert_name) { ERR("Error setting cipher list"); } - if (!SSL_CTX_set1_curves(ctx, c->curves, 1)) { + if (!SSL_CTX_set1_curves(ctx, c->curves, 3)) { ERR("Enforcing curve"); } @@ -213,7 +213,6 @@ int main(int argc, char *argv[]) SSL_set_fd(ssl, fd); ret = SSL_accept(ssl); - //printf("%s\n", SSL_get_curve_name(SSL_get_curve_id(ssl))); if (ret<=0) { ret = SSL_get_error(ssl, ret);