77 * https://www.openssl.org/source/license.html
88 */
99
10+ #include "config.h"
1011#include <stdlib.h>
1112#include <stdio.h>
1213#include <string.h>
@@ -336,6 +337,9 @@ void usage(const char *progname)
336337 printf ("-P - use ossl_lib_ctx pool\n" );
337338 printf ("-l - use ssl ctx pool\n" );
338339 printf ("-o - set ossl_lib_ctx pool size\n" );
340+ #endif
341+ #ifdef HAVE_OSSL_LIB_CTX_FREEZE
342+ printf ("-f - freeze default context\n" );
339343#endif
340344 printf ("-S [n] - use secure memory\n" );
341345 printf ("-V - print version information and exit\n" );
@@ -353,15 +357,21 @@ int main(int argc, char * const argv[])
353357 int opt ;
354358 int p_flag = 0 , P_flag = 0 , l_flag = 0 ;
355359 char * endptr = NULL ;
356-
357- while (( opt = getopt ( argc , argv ,
358- #if OPENSSL_VERSION_NUMBER >= 0x30000000L
359- "tspPo:lS:V"
360+ char * getopt_options = "tsS:V" ;
361+ #if OPENSSL_VERSION_NUMBER >= 0x30000000L && defined( HAVE_OSSL_LIB_CTX_FREEZE )
362+ int freeze = 0 ;
363+ getopt_options = "tspPo:lS:Vf" ;
360364#else
361- "tsS:V"
365+ getopt_options = "tspPo:lS:V" ;
362366#endif
363- )) != -1 ) {
367+
368+ while ((opt = getopt (argc , argv , getopt_options )) != -1 ) {
364369 switch (opt ) {
370+ #ifdef HAVE_OSSL_LIB_CTX_FREEZE
371+ case 'f' :
372+ freeze = 1 ;
373+ break ;
374+ #endif
365375 case 't' :
366376 terse = 1 ;
367377 break ;
@@ -474,6 +484,15 @@ int main(int argc, char * const argv[])
474484
475485 max_time = ossl_time_add (ossl_time_now (), ossl_seconds2time (RUN_TIME ));
476486
487+ #ifdef HAVE_OSSL_LIB_CTX_FREEZE
488+ if (freeze ) {
489+ if (OSSL_LIB_CTX_freeze (NULL , NULL ) == 0 ) {
490+ fprintf (stderr , "Freezing LIB CTX failed\n" );
491+ goto err ;
492+ }
493+ }
494+ #endif
495+
477496 switch (test_case ) {
478497 case TC_SSL_CTX : {
479498 if (share_ctx == 1 ) {
0 commit comments