From 0ea3cfe5bf2f1de2119761e90760d06a37321aa9 Mon Sep 17 00:00:00 2001 From: Jarno Lamsa Date: Wed, 29 May 2019 13:33:32 +0300 Subject: [PATCH] Add option for serialization in ssl_client/server2 --- programs/ssl/ssl_client2.c | 10 ++++++++++ programs/ssl/ssl_server2.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index bbd4d2555..9d556268d 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -122,6 +122,7 @@ int main( void ) #define DFL_FALLBACK -1 #define DFL_EXTENDED_MS -1 #define DFL_ETM -1 +#define DFL_SERIALIZE 0 #define DFL_EXTENDED_MS_ENFORCE -1 #define GET_REQUEST "GET %s HTTP/1.0\r\nExtra-header: " @@ -343,6 +344,7 @@ int main( void ) " configuration macro is defined and 1\n" \ " otherwise. The expansion of the macro\n" \ " is printed if it is defined\n" \ + " serialize=%%d default: 0 (do not serialize/deserialize)\n" \ " acceptable ciphersuite names:\n" #define ALPN_LIST_SIZE 10 @@ -419,6 +421,7 @@ struct options int cid_enabled_renego; /* whether to use the CID extension or not * during renegotiation */ const char *cid_val; /* the CID to use for incoming messages */ + int serialize; /* serialize/deserialize connection */ const char *cid_val_renego; /* the CID to use for incoming messages * after renegotiation */ } opt; @@ -832,6 +835,7 @@ int main( int argc, char *argv[] ) opt.enforce_extended_master_secret = DFL_EXTENDED_MS_ENFORCE; opt.etm = DFL_ETM; opt.dgram_packing = DFL_DGRAM_PACKING; + opt.serialize = DFL_SERIALIZE; for( i = 1; i < argc; i++ ) { @@ -1215,6 +1219,12 @@ int main( int argc, char *argv[] ) { return query_config( q ); } + else if( strcmp( p, "serialize") == 0 ) + { + opt.serialize = atoi( q ); + if( opt.serialize < 0 || opt.serialize > 1) + goto usage; + } else goto usage; } diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index b048bc7bd..f09b4041c 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -163,6 +163,7 @@ int main( void ) #define DFL_DGRAM_PACKING 1 #define DFL_EXTENDED_MS -1 #define DFL_ETM -1 +#define DFL_SERIALIZE 0 #define DFL_EXTENDED_MS_ENFORCE -1 #define LONG_RESPONSE "

01-blah-blah-blah-blah-blah-blah-blah-blah-blah\r\n" \ @@ -445,6 +446,7 @@ int main( void ) " configuration macro is defined and 1\n" \ " otherwise. The expansion of the macro\n" \ " is printed if it is defined\n" \ + " serialize=%%d default: 0 (do not serialize/deserialize)\n" \ " acceptable ciphersuite names:\n" @@ -542,6 +544,7 @@ struct options int cid_enabled_renego; /* whether to use the CID extension or not * during renegotiation */ const char *cid_val; /* the CID to use for incoming messages */ + int serialize; /* serialize/deserialize connection */ const char *cid_val_renego; /* the CID to use for incoming messages * after renegotiation */ } opt; @@ -1500,6 +1503,7 @@ int main( int argc, char *argv[] ) opt.extended_ms = DFL_EXTENDED_MS; opt.enforce_extended_master_secret = DFL_EXTENDED_MS_ENFORCE; opt.etm = DFL_ETM; + opt.serialize = DFL_SERIALIZE; for( i = 1; i < argc; i++ ) { @@ -1917,6 +1921,12 @@ int main( int argc, char *argv[] ) { return query_config( q ); } + else if( strcmp( p, "serialize") == 0 ) + { + opt.serialize = atoi( q ); + if( opt.serialize < 0 || opt.serialize > 1) + goto usage; + } else goto usage; }