Query config through ssl_server2 and ssl_client2 cmdline

This commit is contained in:
Andres Amaya Garcia 2018-10-16 21:08:38 +01:00
parent 6f76795bf5
commit bfa3e0914b
4 changed files with 2490 additions and 4 deletions

View File

@ -212,17 +212,17 @@ ssl/ssl_client1$(EXEXT): ssl/ssl_client1.c $(DEP)
echo " CC ssl/ssl_client1.c" echo " CC ssl/ssl_client1.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
ssl/ssl_client2$(EXEXT): ssl/ssl_client2.c $(DEP) ssl/ssl_client2$(EXEXT): ssl/ssl_client2.c ssl/query_config.c $(DEP)
echo " CC ssl/ssl_client2.c" echo " CC ssl/ssl_client2.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client2.c ssl/query_config.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
ssl/ssl_server$(EXEXT): ssl/ssl_server.c $(DEP) ssl/ssl_server$(EXEXT): ssl/ssl_server.c $(DEP)
echo " CC ssl/ssl_server.c" echo " CC ssl/ssl_server.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
ssl/ssl_server2$(EXEXT): ssl/ssl_server2.c $(DEP) ssl/ssl_server2$(EXEXT): ssl/ssl_server2.c ssl/query_config.c $(DEP)
echo " CC ssl/ssl_server2.c" echo " CC ssl/ssl_server2.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server2.c ssl/query_config.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
ssl/ssl_fork_server$(EXEXT): ssl/ssl_fork_server.c $(DEP) ssl/ssl_fork_server$(EXEXT): ssl/ssl_fork_server.c $(DEP)
echo " CC ssl/ssl_fork_server.c" echo " CC ssl/ssl_fork_server.c"

2466
programs/ssl/query_config.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -312,6 +312,10 @@ int main( void )
" options: ssl3, tls1, tls1_1, tls1_2, dtls1, dtls1_2\n" \ " options: ssl3, tls1, tls1_1, tls1_2, dtls1, dtls1_2\n" \
"\n" \ "\n" \
" force_ciphersuite=<name> default: all enabled\n"\ " force_ciphersuite=<name> default: all enabled\n"\
" query_config=<name> return 0 if the specified\n" \
" configuration macro is defined and 1\n" \
" otherwise. The expansion of the macro\n" \
" is printed if it is defined\n" \
" acceptable ciphersuite names:\n" " acceptable ciphersuite names:\n"
#define ALPN_LIST_SIZE 10 #define ALPN_LIST_SIZE 10
@ -383,6 +387,8 @@ struct options
int etm; /* negotiate encrypt then mac? */ int etm; /* negotiate encrypt then mac? */
} opt; } opt;
int query_config( const char *config );
static void my_debug( void *ctx, int level, static void my_debug( void *ctx, int level,
const char *file, int line, const char *file, int line,
const char *str ) const char *str )
@ -992,6 +998,10 @@ int main( int argc, char *argv[] )
if( opt.dhmlen < 0 ) if( opt.dhmlen < 0 )
goto usage; goto usage;
} }
else if( strcmp( p, "query_config" ) == 0 )
{
return query_config( q );
}
else else
goto usage; goto usage;
} }

View File

@ -415,6 +415,10 @@ int main( void )
" in order from ssl3 to tls1_2\n" \ " in order from ssl3 to tls1_2\n" \
" default: all enabled\n" \ " default: all enabled\n" \
" force_ciphersuite=<name> default: all enabled\n" \ " force_ciphersuite=<name> default: all enabled\n" \
" query_config=<name> return 0 if the specified\n" \
" configuration macro is defined and 1\n" \
" otherwise. The expansion of the macro\n" \
" is printed if it is defined\n" \
" acceptable ciphersuite names:\n" " acceptable ciphersuite names:\n"
@ -508,6 +512,8 @@ struct options
int badmac_limit; /* Limit of records with bad MAC */ int badmac_limit; /* Limit of records with bad MAC */
} opt; } opt;
int query_config( const char *config );
static void my_debug( void *ctx, int level, static void my_debug( void *ctx, int level,
const char *file, int line, const char *file, int line,
const char *str ) const char *str )
@ -1756,6 +1762,10 @@ int main( int argc, char *argv[] )
{ {
opt.sni = q; opt.sni = q;
} }
else if( strcmp( p, "query_config" ) == 0 )
{
return query_config( q );
}
else else
goto usage; goto usage;
} }