forked from wolfSSL/wolfssl
Support psk ciphersuites in benchmarks.
Also fixed some small errors during shutdown in benchmarks. Tested with: ./configure --enable-psk CFLAGS=-DWOLFSSL_STATIC_PSK make all check ./examples/benchmark/tls_bench
This commit is contained in:
@ -973,11 +973,11 @@ static void client_thread(const void* args)
|
||||
#endif
|
||||
}
|
||||
info->client.ret = ret;
|
||||
info->client.done = 1;
|
||||
info->server.done = 1;
|
||||
osThreadSuspend(info->client.threadId);
|
||||
|
||||
if (info->doShutdown)
|
||||
info->client.done = 1;
|
||||
info->server.done = 1;
|
||||
} while (!info->doShutdown);
|
||||
|
||||
osThreadTerminate(info->client.threadId);
|
||||
@ -1248,11 +1248,11 @@ static void server_thread(const void* args)
|
||||
#endif
|
||||
}
|
||||
info->server.ret = ret;
|
||||
info->server.done = 1;
|
||||
info->client.done = 1;
|
||||
osThreadSuspend(info->server.threadId);
|
||||
|
||||
if (info->doShutdown)
|
||||
info->server.done = 1;
|
||||
info->client.done = 1;
|
||||
} while (!info->doShutdown);
|
||||
|
||||
osThreadTerminate(info->server.threadId);
|
||||
|
@ -968,6 +968,19 @@ static int bench_tls_client(info_t* info)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_PSK
|
||||
wolfSSL_CTX_set_psk_client_callback(cli_ctx, my_psk_client_cb);
|
||||
#ifdef WOLFSSL_TLS13
|
||||
#if !defined(WOLFSSL_PSK_TLS13_CB) && !defined(WOLFSSL_PSK_ONE_ID)
|
||||
wolfSSL_CTX_set_psk_client_cs_callback(cli_ctx, my_psk_client_cs_cb);
|
||||
#else
|
||||
wolfSSL_CTX_set_psk_client_tls13_callback(cli_ctx, my_psk_client_tls13_cb);
|
||||
#endif
|
||||
#endif
|
||||
wolfSSL_CTX_set_psk_callback_ctx(cli_ctx, (void*)info->cipher);
|
||||
#endif /* !NO_PSK */
|
||||
|
||||
|
||||
/* Allocate and initialize a packet sized buffer */
|
||||
writeBuf = (unsigned char*)XMALLOC(info->packetSize, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@ -1186,7 +1199,7 @@ static void* client_thread(void* args)
|
||||
ret = bench_tls_client(info);
|
||||
|
||||
pthread_cond_signal(&info->to_server.cond);
|
||||
info->to_client.done = 1;
|
||||
info->to_server.done = 1;
|
||||
info->client.ret = ret;
|
||||
|
||||
return NULL;
|
||||
@ -1413,6 +1426,13 @@ static int bench_tls_server(info_t* info)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_PSK
|
||||
wolfSSL_CTX_set_psk_server_callback(srv_ctx, my_psk_server_cb);
|
||||
#ifdef WOLFSSL_TLS13
|
||||
wolfSSL_CTX_set_psk_server_tls13_callback(srv_ctx, my_psk_server_tls13_cb);
|
||||
#endif
|
||||
#endif /* !NO_PSK */
|
||||
|
||||
/* Allocate read buffer */
|
||||
readBufSz = info->packetSize;
|
||||
readBuf = (unsigned char*)XMALLOC(readBufSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@ -1633,7 +1653,7 @@ static void* server_thread(void* args)
|
||||
}
|
||||
|
||||
pthread_cond_signal(&info->to_client.cond);
|
||||
info->to_server.done = 1;
|
||||
info->to_client.done = 1;
|
||||
info->server.ret = ret;
|
||||
|
||||
return NULL;
|
||||
|
@ -2473,7 +2473,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||
#ifndef NO_PSK
|
||||
const char *defaultCipherList = cipherList;
|
||||
|
||||
SSL_CTX_set_psk_server_callback(ctx, my_psk_server_cb);
|
||||
wolfSSL_CTX_set_psk_server_callback(ctx, my_psk_server_cb);
|
||||
#ifdef WOLFSSL_TLS13
|
||||
wolfSSL_CTX_set_psk_server_tls13_callback(ctx, my_psk_server_tls13_cb);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user