Skip to content

Commit 523c727

Browse files
committed
perflib: add perflib_print_version()
A helper function that prints version information, so far the version of the OpenSSL library a program is run with. Signed-off-by: Eugene Syromiatnikov <[email protected]>
1 parent 41f5631 commit 523c727

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

source/perflib/perfhelper.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* https://www.openssl.org/source/license.html
88
*/
99

10+
#include <stdio.h>
1011
#include <string.h>
1112
#include <openssl/crypto.h>
1213
#include <openssl/bio.h>
@@ -31,3 +32,13 @@ char *perflib_mk_file_path(const char *dir, const char *file)
3132

3233
return full_file;
3334
}
35+
36+
void perflib_print_version(const char * const progname)
37+
{
38+
fprintf(stderr,
39+
"%s version information:\n"
40+
" OpenSSL library: %s (%s)\n",
41+
progname,
42+
OpenSSL_version(OPENSSL_VERSION),
43+
OpenSSL_version(OPENSSL_BUILT_ON));
44+
}

source/perflib/perflib.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,11 @@ int perflib_create_ssl_connection(SSL *serverssl, SSL *clientssl, int want);
6161
void perflib_shutdown_ssl_connection(SSL *serverssl, SSL *clientssl);
6262

6363
#endif
64+
65+
/**
66+
* Print relevant version information. So far only prints OpenSSL library
67+
* version and build date.
68+
*
69+
* @param progname The name of the program.
70+
*/
71+
void perflib_print_version(const char *progname);

0 commit comments

Comments
 (0)