Skip to content

Commit

Permalink
Merge pull request #133 from gengithub17/s_server
Browse files Browse the repository at this point in the history
s_server command
  • Loading branch information
JacobBarthelmeh authored Aug 13, 2024
2 parents 7a99b48 + 7e6c033 commit 2a30f0f
Show file tree
Hide file tree
Showing 16 changed files with 4,183 additions and 45 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ include tests/genkey_sign_ver/include.am
include tests/hash/include.am
include tests/bench/include.am
include tests/client/include.am
include tests/server/include.am
include ide/include.am
#####include data/include.am

Expand Down
19 changes: 14 additions & 5 deletions src/client/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2104,6 +2104,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
#if defined(HAVE_PQC)
{ "pqc", 1, 259 },
#endif
{ "disable_stdin_check", 0, 260 },
{ 0, 0, 0 }
};
#endif
Expand Down Expand Up @@ -2213,6 +2214,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
int exitWithRet = 0;
int loadCertKeyIntoSSLObj = 0;
int isIpv6 = 0;
int disable_stdin_chk = 0;

#ifdef HAVE_ENCRYPT_THEN_MAC
int disallowETM = 0;
Expand Down Expand Up @@ -2275,6 +2277,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
(void)loadCertKeyIntoSSLObj;
(void)usePqc;
(void)pqcAlg;
(void)disable_stdin_chk;
StackTrap();

/* Reinitialize the global myVerifyAction. */
Expand Down Expand Up @@ -2308,6 +2311,10 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
Usage();
XEXIT_T(EXIT_SUCCESS);

case 260 :
disable_stdin_chk = 1;
break;

case 'g' :
sendGET = 1;
break;
Expand Down Expand Up @@ -4155,12 +4162,14 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
}

#ifndef USE_WINDOWS_API
int stop = checkStdin();
if (!disable_stdin_chk) {
int stop = checkStdin();

if(stop){
wolfSSL_free(ssl); ssl = NULL;
wolfSSL_CTX_free(ctx); ctx = NULL;
goto exit;
if(stop){
wolfSSL_free(ssl); ssl = NULL;
wolfSSL_CTX_free(ctx); ctx = NULL;
goto exit;
}
}
#endif

Expand Down
10 changes: 9 additions & 1 deletion src/client/clu_client_setup.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* clu_client_setup.c
*
* Copyright (C) 2006-2021 wolfSSL Inc.
* Copyright (C) 2006-2023 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
Expand Down Expand Up @@ -34,6 +34,7 @@ static const struct option client_options[] = {
{"-starttls", required_argument, 0, WOLFCLU_STARTTLS },
{"-CAfile", required_argument, 0, WOLFCLU_CAFILE },
{"-verify_return_error", no_argument, 0, WOLFCLU_VERIFY_RETURN_ERROR},
{"-disable_stdin_check", no_argument, 0, WOLFCLU_DISABLE_STDINCHK },
{"-help", no_argument, 0, WOLFCLU_HELP },
{"-h", no_argument, 0, WOLFCLU_HELP },

Expand All @@ -53,6 +54,7 @@ static void wolfCLU_ClientHelp(void)
WOLFCLU_LOG(WOLFCLU_L0, "\t-starttls <proto, i.e. smtp>");
WOLFCLU_LOG(WOLFCLU_L0, "\t-CAfile <ca file name>");
WOLFCLU_LOG(WOLFCLU_L0, "\t-verify_return_error close connection on verification error");
WOLFCLU_LOG(WOLFCLU_L0, "\t-disable_stdin_check ")
}

static const char hostFlag[] = "-h";
Expand Down Expand Up @@ -217,6 +219,12 @@ int wolfCLU_Client(int argc, char** argv)
}
break;

case WOLFCLU_DISABLE_STDINCHK:
if (ret == WOLFCLU_SUCCESS) {
ret = _addClientArg(clientArgv, "--disable_stdin_check",
&clientArgc);
}
break;
case WOLFCLU_HELP:
wolfCLU_ClientHelp();
return WOLFCLU_SUCCESS;
Expand Down
7 changes: 6 additions & 1 deletion src/clu_main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* clu_main.c
*
* Copyright (C) 2006-2021 wolfSSL Inc.
* Copyright (C) 2006-2023 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
Expand Down Expand Up @@ -65,6 +65,7 @@ static const struct option mode_options[] = {
{"pkcs12", no_argument, 0, WOLFCLU_PKCS12 },
{"crl", no_argument, 0, WOLFCLU_CRL },
{"s_client", no_argument, 0, WOLFCLU_CLIENT },
{"s_server", no_argument, 0, WOLFCLU_SERVER },
{"rand", no_argument, 0, WOLFCLU_RAND },
{"dsaparam", no_argument, 0, WOLFCLU_DSA },
{"dhparam", no_argument, 0, WOLFCLU_DH },
Expand Down Expand Up @@ -285,6 +286,10 @@ int main(int argc, char** argv)
ret = wolfCLU_Client(argc, argv);
break;

case WOLFCLU_SERVER:
ret = wolfCLU_Server(argc, argv);
break;

case WOLFCLU_RAND:
ret = wolfCLU_Rand(argc, argv);
break;
Expand Down
74 changes: 38 additions & 36 deletions src/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,43 @@
bin_PROGRAMS = wolfssl
wolfssl_SOURCES = src/clu_main.c \
src/clu_log.c \
src/tools/clu_funcs.c \
src/tools/clu_hex_to_bin.c \
src/tools/clu_rand.c \
src/crypto/clu_crypto_setup.c \
src/crypto/clu_encrypt.c \
src/crypto/clu_decrypt.c \
src/crypto/clu_evp_crypto.c \
src/hash/clu_hash_setup.c \
src/hash/clu_hash.c \
src/hash/clu_alg_hash.c \
src/benchmark/clu_bench_setup.c \
src/benchmark/clu_benchmark.c \
src/x509/clu_request_setup.c \
src/x509/clu_ca_setup.c \
src/x509/clu_cert_setup.c \
src/x509/clu_parse.c \
src/x509/clu_config.c \
src/x509/clu_x509_sign.c \
src/genkey/clu_genkey_setup.c \
src/genkey/clu_genkey.c \
src/ecparam/clu_ecparam.c \
src/sign-verify/clu_sign.c \
src/sign-verify/clu_verify.c \
src/sign-verify/clu_x509_verify.c \
src/sign-verify/clu_crl_verify.c \
src/sign-verify/clu_sign_verify_setup.c \
src/sign-verify/clu_dgst_setup.c \
src/certgen/clu_certgen_ed25519.c \
src/certgen/clu_certgen_rsa.c \
src/pkey/clu_rsa.c \
src/pkey/clu_pkey.c \
src/pkcs/clu_pkcs12.c \
src/client/client.c \
src/client/clu_client_setup.c \
src/dsa/clu_dsa.c \
src/dh/clu_dh.c
src/tools/clu_funcs.c \
src/tools/clu_hex_to_bin.c \
src/tools/clu_rand.c \
src/crypto/clu_crypto_setup.c \
src/crypto/clu_encrypt.c \
src/crypto/clu_decrypt.c \
src/crypto/clu_evp_crypto.c \
src/hash/clu_hash_setup.c \
src/hash/clu_hash.c \
src/hash/clu_alg_hash.c \
src/benchmark/clu_bench_setup.c \
src/benchmark/clu_benchmark.c \
src/x509/clu_request_setup.c \
src/x509/clu_ca_setup.c \
src/x509/clu_cert_setup.c \
src/x509/clu_parse.c \
src/x509/clu_config.c \
src/x509/clu_x509_sign.c \
src/genkey/clu_genkey_setup.c \
src/genkey/clu_genkey.c \
src/ecparam/clu_ecparam.c \
src/sign-verify/clu_sign.c \
src/sign-verify/clu_verify.c \
src/sign-verify/clu_x509_verify.c \
src/sign-verify/clu_crl_verify.c \
src/sign-verify/clu_sign_verify_setup.c \
src/sign-verify/clu_dgst_setup.c \
src/certgen/clu_certgen_ed25519.c \
src/certgen/clu_certgen_rsa.c \
src/pkey/clu_rsa.c \
src/pkey/clu_pkey.c \
src/pkcs/clu_pkcs12.c \
src/client/client.c \
src/client/clu_client_setup.c \
src/dsa/clu_dsa.c \
src/dh/clu_dh.c \
src/server/server.c \
src/server/clu_server_setup.c


Loading

0 comments on commit 2a30f0f

Please sign in to comment.