Add option for serialization in ssl_client/server2

This commit is contained in:
Jarno Lamsa 2019-05-29 13:33:32 +03:00
parent 7667afd4fc
commit 0ea3cfe5bf
2 changed files with 20 additions and 0 deletions

View File

@ -122,6 +122,7 @@ int main( void )
#define DFL_FALLBACK -1 #define DFL_FALLBACK -1
#define DFL_EXTENDED_MS -1 #define DFL_EXTENDED_MS -1
#define DFL_ETM -1 #define DFL_ETM -1
#define DFL_SERIALIZE 0
#define DFL_EXTENDED_MS_ENFORCE -1 #define DFL_EXTENDED_MS_ENFORCE -1
#define GET_REQUEST "GET %s HTTP/1.0\r\nExtra-header: " #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" \ " configuration macro is defined and 1\n" \
" otherwise. The expansion of the macro\n" \ " otherwise. The expansion of the macro\n" \
" is printed if it is defined\n" \ " is printed if it is defined\n" \
" serialize=%%d default: 0 (do not serialize/deserialize)\n" \
" acceptable ciphersuite names:\n" " acceptable ciphersuite names:\n"
#define ALPN_LIST_SIZE 10 #define ALPN_LIST_SIZE 10
@ -419,6 +421,7 @@ struct options
int cid_enabled_renego; /* whether to use the CID extension or not int cid_enabled_renego; /* whether to use the CID extension or not
* during renegotiation */ * during renegotiation */
const char *cid_val; /* the CID to use for incoming messages */ 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 const char *cid_val_renego; /* the CID to use for incoming messages
* after renegotiation */ * after renegotiation */
} opt; } opt;
@ -832,6 +835,7 @@ int main( int argc, char *argv[] )
opt.enforce_extended_master_secret = DFL_EXTENDED_MS_ENFORCE; opt.enforce_extended_master_secret = DFL_EXTENDED_MS_ENFORCE;
opt.etm = DFL_ETM; opt.etm = DFL_ETM;
opt.dgram_packing = DFL_DGRAM_PACKING; opt.dgram_packing = DFL_DGRAM_PACKING;
opt.serialize = DFL_SERIALIZE;
for( i = 1; i < argc; i++ ) for( i = 1; i < argc; i++ )
{ {
@ -1215,6 +1219,12 @@ int main( int argc, char *argv[] )
{ {
return query_config( q ); return query_config( q );
} }
else if( strcmp( p, "serialize") == 0 )
{
opt.serialize = atoi( q );
if( opt.serialize < 0 || opt.serialize > 1)
goto usage;
}
else else
goto usage; goto usage;
} }

View File

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