int main(int argc, char** argv) { func_args args; tcp_ready ready; StartTCP(); args.argc = argc; args.argv = argv; args.signal = &ready; InitTcpReady(&ready); #if defined(DEBUG_CYASSL) && !defined(WOLFSSL_MDK_SHELL) CyaSSL_Debugging_ON(); #endif CyaSSL_Init(); ChangeToWolfRoot(); #ifdef HAVE_STACK_SIZE StackSizeCheck(&args, server_test); #else server_test(&args); #endif CyaSSL_Cleanup(); FreeTcpReady(&ready); #ifdef HAVE_WNR if (wc_FreeNetRandom() < 0) err_sys("Failed to free netRandom context"); #endif /* HAVE_WNR */ return args.return_code; }
int main(int argc, char** argv) { func_args args; #ifdef HAVE_CAVIUM int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ StartTCP(); args.argc = argc; args.argv = argv; CyaSSL_Init(); #ifdef DEBUG_CYASSL CyaSSL_Debugging_ON(); #endif if (CurrentDir("echoclient") || CurrentDir("build")) ChangeDirBack(2); echoclient_test(&args); CyaSSL_Cleanup(); #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif return args.return_code; }
int main(int argc, char** argv) { func_args args; #ifdef HAVE_CAVIUM int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ StartTCP(); args.argc = argc; args.argv = argv; CyaSSL_Init(); #if defined(DEBUG_CYASSL) && !defined(WOLFSSL_MDK_SHELL) CyaSSL_Debugging_ON(); #endif #ifndef CYASSL_TIRTOS ChangeToWolfRoot(); #endif echoclient_test(&args); CyaSSL_Cleanup(); #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif return args.return_code; }
int main(int argc, char** argv) { func_args args; #ifdef HAVE_WNR if (wc_InitNetRandom(wnrConfig, NULL, 5000) != 0) err_sys("Whitewood netRandom global config failed"); #endif StartTCP(); args.argc = argc; args.argv = argv; CyaSSL_Init(); #if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) CyaSSL_Debugging_ON(); #endif ChangeToWolfRoot(); echoserver_test(&args); CyaSSL_Cleanup(); #ifdef HAVE_WNR if (wc_FreeNetRandom() < 0) err_sys("Failed to free netRandom context"); #endif /* HAVE_WNR */ return args.return_code; }
int main(int argc, char** argv) { func_args args; #ifdef HAVE_CAVIUM int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ StartTCP(); args.argc = argc; args.argv = argv; CyaSSL_Init(); #if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) CyaSSL_Debugging_ON(); #endif if (CurrentDir("client") || CurrentDir("build")) ChangeDirBack(2); #ifdef HAVE_STACK_SIZE StackSizeCheck(&args, client_test); #else client_test(&args); #endif CyaSSL_Cleanup(); #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif return args.return_code; }
int main(int argc, char** argv) { func_args args; #ifdef HAVE_CAVIUM int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ StartTCP(); args.argc = argc; args.argv = argv; CyaSSL_Init(); #if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) CyaSSL_Debugging_ON(); #endif if (CurrentDir("echoserver")) ChangeDirBack(2); else if (CurrentDir("Debug") || CurrentDir("Release")) ChangeDirBack(3); echoserver_test(&args); CyaSSL_Cleanup(); #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif return args.return_code; }
int main(int argc, char** argv) { func_args args; #ifdef HAVE_CAVIUM int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ StartTCP(); args.argc = argc; args.argv = argv; wolfSSL_Init(); #if defined(DEBUG_WOLFSSL) && !defined(WOLFSSL_MDK_SHELL) && !defined(STACK_TRAP) wolfSSL_Debugging_ON(); #endif ChangeToWolfRoot(); #ifdef HAVE_STACK_SIZE StackSizeCheck(&args, client_test); #else client_test(&args); #endif wolfSSL_Cleanup(); #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif return args.return_code; }
static void test_CyaSSL_read_write(void) { #ifdef HAVE_IO_TESTS_DEPENDENCIES /* The unit testing for read and write shall happen simutaneously, since * one can't do anything with one without the other. (Except for a failure * test case.) This function will call all the others that will set up, * execute, and report their test findings. * * Set up the success case first. This function will become the template * for the other tests. This should eventually be renamed * * The success case isn't interesting, how can this fail? * - Do not give the client context a CA certificate. The connect should * fail. Do not need server for this? * - Using NULL for the ssl object on server. Do not need client for this. * - Using NULL for the ssl object on client. Do not need server for this. * - Good ssl objects for client and server. Client write() without server * read(). * - Good ssl objects for client and server. Server write() without client * read(). * - Forgetting the password callback? */ tcp_ready ready; func_args client_args; func_args server_args; THREAD_TYPE serverThread; #ifdef CYASSL_TIRTOS fdOpenSession(Task_self()); #endif StartTCP(); InitTcpReady(&ready); server_args.signal = &ready; client_args.signal = &ready; start_thread(test_server_nofail, &server_args, &serverThread); wait_tcp_ready(&server_args); test_client_nofail(&client_args); join_thread(serverThread); AssertTrue(client_args.return_code); AssertTrue(server_args.return_code); FreeTcpReady(&ready); #ifdef CYASSL_TIRTOS fdOpenSession(Task_self()); #endif #endif }
static int test_CyaSSL_read_write(void) { /* The unit testing for read and write shall happen simutaneously, since * one can't do anything with one without the other. (Except for a failure * test case.) This function will call all the others that will set up, * execute, and report their test findings. * * Set up the success case first. This function will become the template * for the other tests. This should eventually be renamed * * The success case isn't interesting, how can this fail? * - Do not give the client context a CA certificate. The connect should * fail. Do not need server for this? * - Using NULL for the ssl object on server. Do not need client for this. * - Using NULL for the ssl object on client. Do not need server for this. * - Good ssl objects for client and server. Client write() without server * read(). * - Good ssl objects for client and server. Server write() without client * read(). * - Forgetting the password callback? */ int test_result = TEST_SUCCESS; tcp_ready ready; func_args client_args; func_args server_args; THREAD_TYPE serverThread; StartTCP(); InitTcpReady(&ready); server_args.signal = &ready; start_thread(test_server_nofail, &server_args, &serverThread); wait_tcp_ready(&server_args); test_client_nofail(&client_args); join_thread(serverThread); if (client_args.return_code != TEST_SUCCESS) { printf(resultFmt, "client failure"); test_result = TEST_FAIL; } if (server_args.return_code != TEST_SUCCESS) { printf(resultFmt, "server failure"); test_result = TEST_FAIL; } FreeTcpReady(&ready); return test_result; };
int main(int argc, char** argv) { func_args args; StartTCP(); args.argc = argc; args.argv = argv; InitCyaSSL(); echoclient_test(&args); FreeCyaSSL(); return args.return_code; }
int main(int argc, char** argv) { func_args args; StartTCP(); args.argc = argc; args.argv = argv; InitCyaSSL(); #ifdef DEBUG_CYASSL CyaSSL_Debugging_ON(); #endif echoserver_test(&args); FreeCyaSSL(); return args.return_code; }
int main(int argc, char** argv) { func_args args; tcp_ready ready; #ifdef HAVE_CAVIUM int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ StartTCP(); args.argc = argc; args.argv = argv; args.signal = &ready; InitTcpReady(&ready); #if defined(DEBUG_CYASSL) && !defined(WOLFSSL_MDK_SHELL) CyaSSL_Debugging_ON(); #endif CyaSSL_Init(); ChangeToWolfRoot(); #ifdef HAVE_STACK_SIZE StackSizeCheck(&args, server_test); #else server_test(&args); #endif CyaSSL_Cleanup(); FreeTcpReady(&ready); #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif #ifdef HAVE_WNR if (wc_FreeNetRandom() < 0) err_sys("Failed to free netRandom context"); #endif /* HAVE_WNR */ return args.return_code; }
int main(int argc, char** argv) { func_args args; #ifdef HAVE_CAVIUM int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ #ifdef HAVE_WNR if (wc_InitNetRandom(wnrConfig, NULL, 5000) != 0) err_sys("Whitewood netRandom global config failed"); #endif StartTCP(); args.argc = argc; args.argv = argv; CyaSSL_Init(); #if defined(DEBUG_CYASSL) && !defined(WOLFSSL_MDK_SHELL) CyaSSL_Debugging_ON(); #endif #ifndef CYASSL_TIRTOS ChangeToWolfRoot(); #endif echoclient_test(&args); CyaSSL_Cleanup(); #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif #ifdef HAVE_WNR if (wc_FreeNetRandom() < 0) err_sys("Failed to free netRandom context"); #endif /* HAVE_WNR */ return args.return_code; }
int main(int argc, char** argv) { func_args args; StartTCP(); args.argc = argc; args.argv = argv; CyaSSL_Init(); #ifdef DEBUG_CYASSL CyaSSL_Debugging_ON(); #endif if (CurrentDir("echoclient") || CurrentDir("build")) ChangeDirBack(2); echoclient_test(&args); CyaSSL_Cleanup(); return args.return_code; }
static void test_CyaSSL_client_server(callback_functions* client_callbacks, callback_functions* server_callbacks) { #ifdef HAVE_IO_TESTS_DEPENDENCIES tcp_ready ready; func_args client_args; func_args server_args; THREAD_TYPE serverThread; StartTCP(); client_args.callbacks = client_callbacks; server_args.callbacks = server_callbacks; #ifdef CYASSL_TIRTOS fdOpenSession(Task_self()); #endif /* RUN Server side */ InitTcpReady(&ready); server_args.signal = &ready; client_args.signal = &ready; start_thread(run_cyassl_server, &server_args, &serverThread); wait_tcp_ready(&server_args); /* RUN Client side */ run_cyassl_client(&client_args); join_thread(serverThread); FreeTcpReady(&ready); #ifdef CYASSL_TIRTOS fdCloseSession(Task_self()); #endif #else (void)client_callbacks; (void)server_callbacks; #endif }
int main(int argc, char** argv) { func_args args; func_args server_args; tcp_ready ready; THREAD_TYPE serverThread; StartTCP(); args.argc = server_args.argc = argc; args.argv = server_args.argv = argv; /* CTaoCrypt test */ ctaocrypt_test(&args); if (args.return_code != 0) return args.return_code; /* Simple CyaSSL client server test */ InitCyaSSL(); InitTcpReady(&ready); server_args.signal = &ready; start_thread(server_test, &server_args, &serverThread); wait_tcp_ready(&server_args); client_test(&args); if (args.return_code != 0) return args.return_code; join_thread(serverThread); if (server_args.return_code != 0) return server_args.return_code; /* Echo input yaSSL client server test */ start_thread(echoserver_test, &server_args, &serverThread); wait_tcp_ready(&server_args); { func_args echo_args; char* myArgv[NUMARGS]; char argc0[32]; char argc1[32]; char argc2[32]; myArgv[0] = argc0; myArgv[1] = argc1; myArgv[2] = argc2; echo_args.argc = NUMARGS; echo_args.argv = myArgv; strcpy(echo_args.argv[0], "echoclient"); strcpy(echo_args.argv[1], "input"); strcpy(echo_args.argv[2], "output"); remove("output"); /* make sure OK */ echoclient_test(&echo_args); if (echo_args.return_code != 0) return echo_args.return_code; #ifdef CYASSL_DTLS wait_tcp_ready(&server_args); #endif /* send quit to echoserver */ echo_args.argc = 2; strcpy(echo_args.argv[1], "quit"); echoclient_test(&echo_args); if (echo_args.return_code != 0) return echo_args.return_code; join_thread(serverThread); if (server_args.return_code != 0) return server_args.return_code; } /* validate output equals input */ { byte input[MD5_DIGEST_SIZE]; byte output[MD5_DIGEST_SIZE]; file_test("input", input); file_test("output", output); if (memcmp(input, output, sizeof(input)) != 0) return -1; } FreeCyaSSL(); FreeTcpReady(&ready); printf("\nAll tests passed!\n"); return 0; }
int main(int argc, char** argv) { func_args server_args; tcp_ready ready; THREAD_TYPE serverThread; #ifdef HAVE_CAVIUM int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ StartTCP(); server_args.argc = argc; server_args.argv = argv; CyaSSL_Init(); #if defined(DEBUG_CYASSL) && !defined(HAVE_VALGRIND) CyaSSL_Debugging_ON(); #endif if (CurrentDir("testsuite") || CurrentDir("_build")) ChangeDirBack(1); else if (CurrentDir("Debug") || CurrentDir("Release")) ChangeDirBack(3); /* Xcode->Preferences->Locations->Locations*/ /* Derived Data Advanced -> Custom */ /* Relative to Workspace, Build/Products */ /* Debug or Release */ server_args.signal = &ready; InitTcpReady(&ready); /* CTaoCrypt test */ ctaocrypt_test(&server_args); if (server_args.return_code != 0) return server_args.return_code; /* Simple CyaSSL client server test */ simple_test(&server_args); if (server_args.return_code != 0) return server_args.return_code; /* Echo input yaSSL client server test */ start_thread(echoserver_test, &server_args, &serverThread); wait_tcp_ready(&server_args); { func_args echo_args; char* myArgv[NUMARGS]; char argc0[32]; char argc1[32]; char argc2[32]; myArgv[0] = argc0; myArgv[1] = argc1; myArgv[2] = argc2; echo_args.argc = NUMARGS; echo_args.argv = myArgv; strcpy(echo_args.argv[0], "echoclient"); strcpy(echo_args.argv[1], "input"); strcpy(echo_args.argv[2], outputName); remove(outputName); /* Share the signal, it has the new port number in it. */ echo_args.signal = server_args.signal; /* make sure OK */ echoclient_test(&echo_args); if (echo_args.return_code != 0) return echo_args.return_code; #ifdef CYASSL_DTLS wait_tcp_ready(&server_args); #endif /* send quit to echoserver */ echo_args.argc = 2; strcpy(echo_args.argv[1], "quit"); echoclient_test(&echo_args); if (echo_args.return_code != 0) return echo_args.return_code; join_thread(serverThread); if (server_args.return_code != 0) return server_args.return_code; } /* validate output equals input */ { byte input[SHA256_DIGEST_SIZE]; byte output[SHA256_DIGEST_SIZE]; file_test("input", input); file_test(outputName, output); if (memcmp(input, output, sizeof(input)) != 0) return EXIT_FAILURE; } CyaSSL_Cleanup(); FreeTcpReady(&ready); #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif printf("\nAll tests passed!\n"); return EXIT_SUCCESS; }
int testsuite_test(int argc, char** argv) { func_args server_args; tcp_ready ready; THREAD_TYPE serverThread; #ifndef USE_WINDOWS_API char tempName[] = "/tmp/output-XXXXXX"; int len = 18; int num = 6; #else char tempName[] = "fnXXXXXX"; int len = 8; int num = 6; #endif #ifdef HAVE_CAVIUM int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ #ifdef HAVE_WNR if (wc_InitNetRandom(wnrConfig, NULL, 5000) != 0) { err_sys("Whitewood netRandom global config failed"); return -1237; } #endif /* HAVE_WNR */ StartTCP(); server_args.argc = argc; server_args.argv = argv; wolfSSL_Init(); #if defined(DEBUG_WOLFSSL) && !defined(HAVE_VALGRIND) wolfSSL_Debugging_ON(); #endif #if !defined(WOLFSSL_TIRTOS) ChangeToWolfRoot(); #endif #ifdef WOLFSSL_TIRTOS fdOpenSession(Task_self()); #endif server_args.signal = &ready; InitTcpReady(&ready); #ifndef NO_CRYPT_TEST /* wc_ test */ wolfcrypt_test(&server_args); if (server_args.return_code != 0) return server_args.return_code; #endif /* Simple wolfSSL client server test */ simple_test(&server_args); if (server_args.return_code != 0) return server_args.return_code; /* Echo input wolfSSL client server test */ start_thread(echoserver_test, &server_args, &serverThread); wait_tcp_ready(&server_args); { func_args echo_args; char* myArgv[NUMARGS]; char argc0[32]; char argc1[32]; char argc2[32]; myArgv[0] = argc0; myArgv[1] = argc1; myArgv[2] = argc2; echo_args.argc = 3; echo_args.argv = myArgv; /* Create unique file name */ outputName = mymktemp(tempName, len, num); if (outputName == NULL) { printf("Could not create unique file name"); return EXIT_FAILURE; } strcpy(echo_args.argv[0], "echoclient"); strcpy(echo_args.argv[1], "input"); strcpy(echo_args.argv[2], outputName); /* Share the signal, it has the new port number in it. */ echo_args.signal = server_args.signal; /* make sure OK */ echoclient_test(&echo_args); if (echo_args.return_code != 0) return echo_args.return_code; #ifdef WOLFSSL_DTLS wait_tcp_ready(&server_args); #endif /* send quit to echoserver */ echo_args.argc = 2; strcpy(echo_args.argv[1], "quit"); echoclient_test(&echo_args); if (echo_args.return_code != 0) return echo_args.return_code; join_thread(serverThread); if (server_args.return_code != 0) return server_args.return_code; } /* show ciphers */ { char ciphers[1024]; XMEMSET(ciphers, 0, sizeof(ciphers)); wolfSSL_get_ciphers(ciphers, sizeof(ciphers)-1); printf("ciphers = %s\n", ciphers); } /* validate output equals input */ { byte input[SHA256_DIGEST_SIZE]; byte output[SHA256_DIGEST_SIZE]; file_test("input", input); file_test(outputName, output); remove(outputName); if (memcmp(input, output, sizeof(input)) != 0) return EXIT_FAILURE; } wolfSSL_Cleanup(); FreeTcpReady(&ready); #ifdef WOLFSSL_TIRTOS fdCloseSession(Task_self()); #endif #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif #ifdef HAVE_WNR if (wc_FreeNetRandom() < 0) err_sys("Failed to free netRandom context"); #endif /* HAVE_WNR */ printf("\nAll tests passed!\n"); return EXIT_SUCCESS; }