mariadb/extra/yassl/testsuite/input
unknown 78697215c1 Update yassl to 1.2.2
extra/yassl/examples/client/client.cpp:
  Import patch yassl.diff
extra/yassl/README:
  Import patch yassl.diff
extra/yassl/examples/client/client.dsp:
  Import patch yassl.diff
extra/yassl/examples/echoclient/echoclient.cpp:
  Import patch yassl.diff
extra/yassl/examples/echoclient/echoclient.dsp:
  Import patch yassl.diff
extra/yassl/examples/echoclient/input:
  Import patch yassl.diff
extra/yassl/examples/echoclient/quit:
  Import patch yassl.diff
extra/yassl/examples/echoserver/echoserver.cpp:
  Import patch yassl.diff
extra/yassl/examples/echoserver/echoserver.dsp:
  Import patch yassl.diff
extra/yassl/examples/server/server.cpp:
  Import patch yassl.diff
extra/yassl/examples/server/server.dsp:
  Import patch yassl.diff
extra/yassl/include/cert_wrapper.hpp:
  Import patch yassl.diff
extra/yassl/include/crypto_wrapper.hpp:
  Import patch yassl.diff
extra/yassl/include/openssl/ssl.h:
  Import patch yassl.diff
extra/yassl/include/socket_wrapper.hpp:
  Import patch yassl.diff
extra/yassl/include/yassl.hpp:
  Import patch yassl.diff
extra/yassl/include/yassl_error.hpp:
  Import patch yassl.diff
extra/yassl/include/yassl_imp.hpp:
  Import patch yassl.diff
extra/yassl/include/yassl_int.hpp:
  Import patch yassl.diff
extra/yassl/include/yassl_types.hpp:
  Import patch yassl.diff
extra/yassl/mySTL/helpers.hpp:
  Import patch yassl.diff
extra/yassl/mySTL/list.hpp:
  Import patch yassl.diff
extra/yassl/mySTL/vector.hpp:
  Import patch yassl.diff
extra/yassl/src/buffer.cpp:
  Import patch yassl.diff
extra/yassl/src/cert_wrapper.cpp:
  Import patch yassl.diff
extra/yassl/src/crypto_wrapper.cpp:
  Import patch yassl.diff
extra/yassl/src/handshake.cpp:
  Import patch yassl.diff
extra/yassl/src/make.bat:
  Import patch yassl.diff
extra/yassl/src/socket_wrapper.cpp:
  Import patch yassl.diff
extra/yassl/src/ssl.cpp:
  Import patch yassl.diff
extra/yassl/src/yassl.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/benchmark/benchmark.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/benchmark/benchmark.dsp:
  Import patch yassl.diff
extra/yassl/taocrypt/benchmark/make.bat:
  Import patch yassl.diff
extra/yassl/taocrypt/include/blowfish.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/kernelc.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/pwdbased.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/twofish.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/bftables.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/blowfish.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/make.bat:
  Import patch yassl.diff
extra/yassl/taocrypt/src/tftables.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/twofish.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/test.dsp:
  Import patch yassl.diff
extra/yassl/taocrypt/test.dsw:
  Import patch yassl.diff
extra/yassl/taocrypt/test/make.bat:
  Import patch yassl.diff
extra/yassl/taocrypt/test/memory.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/test/test.cpp:
  Import patch yassl.diff
extra/yassl/testsuite/input:
  Import patch yassl.diff
extra/yassl/src/timer.cpp:
  Import patch yassl.diff
extra/yassl/src/yassl_error.cpp:
  Import patch yassl.diff
extra/yassl/src/yassl_imp.cpp:
  Import patch yassl.diff
extra/yassl/src/yassl_int.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/aes.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/arc4.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/asn.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/block.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/des.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/dh.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/hash.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/hmac.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/md5.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/misc.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/modes.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/ripemd.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/runtime.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/sha.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/types.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/aes.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/aestables.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/algebra.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/arc4.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/asn.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/coding.cpp:
  Import patch yassl.diff
extra/yassl/testsuite/make.bat:
  Import patch yassl.diff
extra/yassl/testsuite/quit:
  Import patch yassl.diff
extra/yassl/testsuite/test.hpp:
  Import patch yassl.diff
extra/yassl/testsuite/testsuite.cpp:
  Import patch yassl.diff
extra/yassl/testsuite/testsuite.dsp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/des.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/dh.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/hash.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/integer.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/md5.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/misc.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/random.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/ripemd.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/sha.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/taocrypt.dsp:
  Import patch yassl.diff
extra/yassl/yassl.dsp:
  Import patch yassl.diff
extra/yassl/yassl.dsw:
  Import patch yassl.diff
2006-04-07 11:35:12 +02:00

107 lines
2.4 KiB
Text

// testsuite.cpp
#include "test.hpp"
#include "md5.hpp"
typedef unsigned char byte;
void taocrypt_test(void*);
void file_test(char*, byte*);
void client_test(void*);
void echoclient_test(void*);
THREAD_RETURN YASSL_API server_test(void*);
THREAD_RETURN YASSL_API echoserver_test(void*);
int main(int argc, char** argv)
{
func_args args(argc, argv);
func_args server_args(args);
// *** Crypto Test ***
taocrypt_test(&args);
assert(args.return_code == 0);
// *** Simple yaSSL client server test ***
THREAD_TYPE thread;
start_thread(server_test, &server_args, &thread);
client_test(&args);
assert(args.return_code == 0);
join_thread(thread);
assert(server_args.return_code == 0);
// *** Echo input yaSSL client server test ***
start_thread(echoserver_test, &server_args, &thread);
func_args echo_args;
// setup args
echo_args.argc = 3;
echo_args.argv = new char*[echo_args.argc];
for (int i = 0; i < echo_args.argc; i++)
echo_args.argv[i] = new char[32];
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);
assert(echo_args.return_code == 0);
// *** Echo quit yaSSL client server test ***
echo_args.argc = 2;
strcpy(echo_args.argv[1], "quit");
echoclient_test(&echo_args);
assert(echo_args.return_code == 0);
join_thread(thread);
assert(server_args.return_code == 0);
// input output compare
byte input[TaoCrypt::MD5::DIGEST_SIZE];
byte output[TaoCrypt::MD5::DIGEST_SIZE];
file_test("input", input);
file_test("output", output);
assert(memcmp(input, output, sizeof(input)) == 0);
printf("\nAll tests passed!\n");
// cleanup
for (int j = echo_args.argc; j >= 0; j--)
delete[] echo_args.argv[j];
delete[] echo_args.argv;
return 0;
}
void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread)
{
#ifdef _WIN32
*thread = _beginthreadex(0, 0, fun, args, 0, 0);
#else
pthread_create(thread, 0, fun, args);
#endif
}
void join_thread(THREAD_TYPE thread)
{
#ifdef _WIN32
int res = WaitForSingleObject(reinterpret_cast<HANDLE>(thread), INFINITE);
assert(res == WAIT_OBJECT_0);
res = CloseHandle(reinterpret_cast<HANDLE>(thread));
assert(res);
#else
pthread_join(thread, 0);
#endif
}