Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ handshakes are performed divided evenly among each thread. It take 2 optional
and two required arguments:

```
handshake [-t] [-s] <certsdir> <threadcount>
handshake [-t] [-s] [-f] <certsdir> <threadcount>
-t - produce terse output
-f - freeze default context (available only with openssl >= 4.x.x)
-s - create an ssl_ctx per connection, rather than a single thread-shared ctx
-p - use ossl_lib_ctx per thread
-P - use ossl_lib_ctx pool (can be combined with -s. If sharing is enabled, ssl_ctx
Expand Down
31 changes: 25 additions & 6 deletions source/handshake.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* https://www.openssl.org/source/license.html
*/

#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -336,6 +337,9 @@ void usage(const char *progname)
printf("-P - use ossl_lib_ctx pool\n");
printf("-l - use ssl ctx pool\n");
printf("-o - set ossl_lib_ctx pool size\n");
#endif
#ifdef HAVE_OSSL_LIB_CTX_FREEZE
printf("-f - freeze default context\n");
#endif
printf("-S [n] - use secure memory\n");
printf("-V - print version information and exit\n");
Expand All @@ -353,15 +357,21 @@ int main(int argc, char * const argv[])
int opt;
int p_flag = 0, P_flag = 0, l_flag = 0;
char *endptr = NULL;

while ((opt = getopt(argc, argv,
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
"tspPo:lS:V"
char *getopt_options = "tsS:V";
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && defined(HAVE_OSSL_LIB_CTX_FREEZE)
int freeze = 0;
getopt_options = "tspPo:lS:Vf";
#else
"tsS:V"
getopt_options = "tspPo:lS:V";
#endif
)) != -1) {

while ((opt = getopt(argc, argv, getopt_options)) != -1) {
switch (opt) {
#ifdef HAVE_OSSL_LIB_CTX_FREEZE
case 'f':
freeze = 1;
break;
#endif
case 't':
terse = 1;
break;
Expand Down Expand Up @@ -474,6 +484,15 @@ int main(int argc, char * const argv[])

max_time = ossl_time_add(ossl_time_now(), ossl_seconds2time(RUN_TIME));

#ifdef HAVE_OSSL_LIB_CTX_FREEZE
if (freeze) {
if (OSSL_LIB_CTX_freeze(NULL, NULL) == 0) {
fprintf(stderr, "Freezing LIB CTX failed\n");
goto err;
}
}
#endif

switch (test_case) {
case TC_SSL_CTX: {
if (share_ctx == 1) {
Expand Down
Loading