2012-08-04 10:19:24 +04:00
|
|
|
/* suites.c
|
|
|
|
*
|
2014-04-12 01:58:58 +04:00
|
|
|
* Copyright (C) 2006-2014 wolfSSL Inc.
|
2012-08-04 10:19:24 +04:00
|
|
|
*
|
|
|
|
* This file is part of CyaSSL.
|
|
|
|
*
|
|
|
|
* CyaSSL is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* CyaSSL is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2014-04-12 01:58:58 +04:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2012-08-04 10:19:24 +04:00
|
|
|
*/
|
|
|
|
|
2012-09-22 00:29:04 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2013-04-10 23:17:23 +04:00
|
|
|
#include <cyassl/ctaocrypt/settings.h>
|
|
|
|
|
2012-08-04 10:19:24 +04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2012-09-22 00:29:04 +04:00
|
|
|
#include <string.h>
|
2012-08-04 10:19:24 +04:00
|
|
|
#include <cyassl/ssl.h>
|
2012-08-07 04:14:31 +04:00
|
|
|
#include <tests/unit.h>
|
2012-08-04 10:19:24 +04:00
|
|
|
|
|
|
|
|
|
|
|
#define MAX_ARGS 40
|
2012-08-07 04:14:31 +04:00
|
|
|
#define MAX_COMMAND_SZ 240
|
2013-03-11 21:59:08 +04:00
|
|
|
#define MAX_SUITE_SZ 80
|
2013-03-11 23:02:22 +04:00
|
|
|
#define NOT_BUILT_IN -123
|
2014-03-02 22:59:03 +04:00
|
|
|
#ifdef NO_OLD_TLS
|
|
|
|
#define VERSION_TOO_OLD -124
|
|
|
|
#endif
|
2012-08-07 04:14:31 +04:00
|
|
|
|
2012-09-20 10:38:41 +04:00
|
|
|
#include "examples/client/client.h"
|
|
|
|
#include "examples/server/server.h"
|
2012-08-04 10:19:24 +04:00
|
|
|
|
2013-03-11 21:59:08 +04:00
|
|
|
|
2014-03-02 23:06:41 +04:00
|
|
|
static CYASSL_CTX* cipherSuiteCtx = NULL;
|
|
|
|
static char nonblockFlag[] = "-N";
|
|
|
|
static char noVerifyFlag[] = "-d";
|
|
|
|
static char portFlag[] = "-p";
|
|
|
|
static char flagSep[] = " ";
|
|
|
|
static char svrPort[] = "0";
|
2013-03-11 21:59:08 +04:00
|
|
|
|
2013-03-12 04:37:08 +04:00
|
|
|
|
|
|
|
#ifdef NO_OLD_TLS
|
2013-03-13 02:56:58 +04:00
|
|
|
/* if the protocol version is less than tls 1.2 return 1, else 0 */
|
2013-03-12 04:37:08 +04:00
|
|
|
static int IsOldTlsVersion(const char* line)
|
|
|
|
{
|
|
|
|
const char* find = "-v ";
|
2013-03-12 20:46:15 +04:00
|
|
|
char* begin = strstr(line, find);
|
2013-03-12 04:37:08 +04:00
|
|
|
|
|
|
|
if (begin) {
|
|
|
|
int version = -1;
|
|
|
|
|
|
|
|
begin += 3;
|
|
|
|
|
|
|
|
version = atoi(begin);
|
|
|
|
|
|
|
|
if (version < 3)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* NO_OLD_TLS */
|
|
|
|
|
|
|
|
|
2013-03-11 21:59:08 +04:00
|
|
|
/* if the cipher suite on line is valid store in suite and return 1, else 0 */
|
|
|
|
static int IsValidCipherSuite(const char* line, char* suite)
|
|
|
|
{
|
|
|
|
int found = 0;
|
|
|
|
int valid = 0;
|
|
|
|
|
|
|
|
const char* find = "-l ";
|
2014-02-08 02:52:44 +04:00
|
|
|
const char* begin = strstr(line, find);
|
|
|
|
const char* end;
|
2013-03-11 21:59:08 +04:00
|
|
|
|
|
|
|
suite[0] = '\0';
|
|
|
|
|
|
|
|
if (begin) {
|
|
|
|
begin += 3;
|
|
|
|
|
2013-03-12 20:46:15 +04:00
|
|
|
end = strstr(begin, " ");
|
2013-03-11 21:59:08 +04:00
|
|
|
|
|
|
|
if (end) {
|
|
|
|
long len = end - begin;
|
|
|
|
if (len > MAX_SUITE_SZ) {
|
|
|
|
printf("suite too long!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
memcpy(suite, begin, len);
|
|
|
|
suite[len] = '\0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
strncpy(suite, begin, MAX_SUITE_SZ);
|
|
|
|
|
|
|
|
suite[MAX_SUITE_SZ] = '\0';
|
|
|
|
found = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found) {
|
|
|
|
if (CyaSSL_CTX_set_cipher_list(cipherSuiteCtx, suite) == SSL_SUCCESS)
|
|
|
|
valid = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return valid;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-11 23:02:22 +04:00
|
|
|
static int execute_test_case(int svr_argc, char** svr_argv,
|
2013-03-11 22:07:46 +04:00
|
|
|
int cli_argc, char** cli_argv,
|
|
|
|
int addNoVerify, int addNonBlocking)
|
2012-08-04 10:19:24 +04:00
|
|
|
{
|
2013-06-19 22:45:06 +04:00
|
|
|
func_args cliArgs = {cli_argc, cli_argv, 0, NULL, NULL};
|
|
|
|
func_args svrArgs = {svr_argc, svr_argv, 0, NULL, NULL};
|
2012-08-04 10:19:24 +04:00
|
|
|
|
2012-08-07 04:14:31 +04:00
|
|
|
tcp_ready ready;
|
|
|
|
THREAD_TYPE serverThread;
|
|
|
|
char commandLine[MAX_COMMAND_SZ];
|
2013-03-11 21:59:08 +04:00
|
|
|
char cipherSuite[MAX_SUITE_SZ+1];
|
2012-08-07 04:14:31 +04:00
|
|
|
int i;
|
2013-02-15 02:09:41 +04:00
|
|
|
size_t added = 0;
|
2012-08-08 02:06:53 +04:00
|
|
|
static int tests = 1;
|
2012-08-07 04:14:31 +04:00
|
|
|
|
|
|
|
commandLine[0] = '\0';
|
2012-08-08 02:06:53 +04:00
|
|
|
for (i = 0; i < svr_argc; i++) {
|
2013-02-15 02:09:41 +04:00
|
|
|
added += strlen(svr_argv[i]) + 2;
|
|
|
|
if (added >= MAX_COMMAND_SZ) {
|
|
|
|
printf("server command line too long\n");
|
|
|
|
break;
|
|
|
|
}
|
2012-08-08 02:06:53 +04:00
|
|
|
strcat(commandLine, svr_argv[i]);
|
2013-03-25 19:41:44 +04:00
|
|
|
strcat(commandLine, flagSep);
|
2012-08-07 04:14:31 +04:00
|
|
|
}
|
2013-03-11 23:02:22 +04:00
|
|
|
|
|
|
|
if (IsValidCipherSuite(commandLine, cipherSuite) == 0) {
|
2013-03-11 23:12:04 +04:00
|
|
|
#ifdef DEBUG_SUITE_TESTS
|
|
|
|
printf("cipher suite %s not supported in build\n", cipherSuite);
|
|
|
|
#endif
|
2013-03-11 23:02:22 +04:00
|
|
|
return NOT_BUILT_IN;
|
|
|
|
}
|
|
|
|
|
2013-03-12 04:37:08 +04:00
|
|
|
#ifdef NO_OLD_TLS
|
|
|
|
if (IsOldTlsVersion(commandLine) == 1) {
|
|
|
|
#ifdef DEBUG_SUITE_TESTS
|
|
|
|
printf("protocol version on line %s is too old\n", commandLine);
|
|
|
|
#endif
|
|
|
|
return VERSION_TOO_OLD;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-02-19 02:12:03 +04:00
|
|
|
if (addNoVerify) {
|
|
|
|
printf("repeating test with client cert request off\n");
|
2013-03-11 22:07:46 +04:00
|
|
|
added += 4; /* -d plus space plus terminator */
|
2013-03-27 09:00:39 +04:00
|
|
|
if (added >= MAX_COMMAND_SZ || svr_argc >= MAX_ARGS)
|
2013-02-19 02:12:03 +04:00
|
|
|
printf("server command line too long\n");
|
2013-03-25 19:41:44 +04:00
|
|
|
else {
|
2013-03-27 09:00:39 +04:00
|
|
|
svr_argv[svr_argc++] = noVerifyFlag;
|
2013-03-25 19:41:44 +04:00
|
|
|
svrArgs.argc = svr_argc;
|
|
|
|
strcat(commandLine, noVerifyFlag);
|
|
|
|
strcat(commandLine, flagSep);
|
|
|
|
}
|
2013-03-11 22:07:46 +04:00
|
|
|
}
|
|
|
|
if (addNonBlocking) {
|
|
|
|
printf("repeating test with non blocking on\n");
|
|
|
|
added += 4; /* -N plus terminator */
|
2013-03-27 09:00:39 +04:00
|
|
|
if (added >= MAX_COMMAND_SZ || svr_argc >= MAX_ARGS)
|
2013-03-11 22:07:46 +04:00
|
|
|
printf("server command line too long\n");
|
2013-03-25 19:41:44 +04:00
|
|
|
else {
|
2013-03-27 09:00:39 +04:00
|
|
|
svr_argv[svr_argc++] = nonblockFlag;
|
2013-03-25 19:41:44 +04:00
|
|
|
svrArgs.argc = svr_argc;
|
|
|
|
strcat(commandLine, nonblockFlag);
|
|
|
|
strcat(commandLine, flagSep);
|
|
|
|
}
|
2013-02-19 02:12:03 +04:00
|
|
|
}
|
2013-03-27 21:22:50 +04:00
|
|
|
#ifndef USE_WINDOWS_API
|
|
|
|
/* add port 0 */
|
|
|
|
if (svr_argc + 2 > MAX_ARGS)
|
|
|
|
printf("cannot add the magic port number flag to server\n");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
svr_argv[svr_argc++] = portFlag;
|
|
|
|
svr_argv[svr_argc++] = svrPort;
|
|
|
|
svrArgs.argc = svr_argc;
|
|
|
|
}
|
|
|
|
#endif
|
2012-08-08 02:06:53 +04:00
|
|
|
printf("trying server command line[%d]: %s\n", tests, commandLine);
|
|
|
|
|
|
|
|
commandLine[0] = '\0';
|
2013-02-15 02:09:41 +04:00
|
|
|
added = 0;
|
2012-08-08 02:06:53 +04:00
|
|
|
for (i = 0; i < cli_argc; i++) {
|
2013-02-15 02:09:41 +04:00
|
|
|
added += strlen(cli_argv[i]) + 2;
|
|
|
|
if (added >= MAX_COMMAND_SZ) {
|
|
|
|
printf("client command line too long\n");
|
|
|
|
break;
|
|
|
|
}
|
2012-08-08 02:06:53 +04:00
|
|
|
strcat(commandLine, cli_argv[i]);
|
2013-03-25 19:41:44 +04:00
|
|
|
strcat(commandLine, flagSep);
|
2012-08-08 02:06:53 +04:00
|
|
|
}
|
2013-03-11 22:07:46 +04:00
|
|
|
if (addNonBlocking) {
|
|
|
|
added += 4; /* -N plus space plus terminator */
|
|
|
|
if (added >= MAX_COMMAND_SZ)
|
|
|
|
printf("client command line too long\n");
|
2013-03-25 19:41:44 +04:00
|
|
|
else {
|
2013-03-27 21:22:50 +04:00
|
|
|
cli_argv[cli_argc++] = nonblockFlag;
|
2013-03-25 19:41:44 +04:00
|
|
|
strcat(commandLine, nonblockFlag);
|
|
|
|
strcat(commandLine, flagSep);
|
2013-03-27 21:22:50 +04:00
|
|
|
cliArgs.argc = cli_argc;
|
2013-03-25 19:41:44 +04:00
|
|
|
}
|
2013-03-11 22:07:46 +04:00
|
|
|
}
|
2012-08-08 02:06:53 +04:00
|
|
|
printf("trying client command line[%d]: %s\n", tests++, commandLine);
|
2012-08-07 04:14:31 +04:00
|
|
|
|
|
|
|
InitTcpReady(&ready);
|
|
|
|
|
|
|
|
/* start server */
|
|
|
|
svrArgs.signal = &ready;
|
|
|
|
start_thread(server_test, &svrArgs, &serverThread);
|
|
|
|
wait_tcp_ready(&svrArgs);
|
2013-03-27 21:22:50 +04:00
|
|
|
#ifndef USE_WINDOWS_API
|
|
|
|
if (ready.port != 0)
|
|
|
|
{
|
|
|
|
if (cli_argc + 2 > MAX_ARGS)
|
|
|
|
printf("cannot add the magic port number flag to client\n");
|
|
|
|
else {
|
|
|
|
char portNumber[8];
|
|
|
|
snprintf(portNumber, sizeof(portNumber), "%d", ready.port);
|
|
|
|
cli_argv[cli_argc++] = portFlag;
|
|
|
|
cli_argv[cli_argc++] = portNumber;
|
|
|
|
cliArgs.argc = cli_argc;
|
|
|
|
}
|
2013-03-27 09:00:39 +04:00
|
|
|
}
|
2013-03-27 21:22:50 +04:00
|
|
|
#endif
|
2012-08-07 04:14:31 +04:00
|
|
|
/* start client */
|
|
|
|
client_test(&cliArgs);
|
|
|
|
|
|
|
|
/* verify results */
|
|
|
|
if (cliArgs.return_code != 0) {
|
|
|
|
printf("client_test failed\n");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
join_thread(serverThread);
|
|
|
|
if (svrArgs.return_code != 0) {
|
|
|
|
printf("server_test failed\n");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
FreeTcpReady(&ready);
|
2013-03-11 23:02:22 +04:00
|
|
|
|
|
|
|
return 0;
|
2012-08-04 10:19:24 +04:00
|
|
|
}
|
|
|
|
|
2012-09-20 10:38:41 +04:00
|
|
|
static void test_harness(void* vargs)
|
2012-08-04 10:19:24 +04:00
|
|
|
{
|
|
|
|
func_args* args = (func_args*)vargs;
|
|
|
|
char* script;
|
2012-08-08 02:06:53 +04:00
|
|
|
long sz, len;
|
|
|
|
int cliMode = 0; /* server or client command flag, server first */
|
2013-03-11 23:02:22 +04:00
|
|
|
int ret;
|
2012-08-04 10:19:24 +04:00
|
|
|
FILE* file;
|
2012-08-08 02:06:53 +04:00
|
|
|
char* svrArgs[MAX_ARGS];
|
|
|
|
int svrArgsSz;
|
|
|
|
char* cliArgs[MAX_ARGS];
|
|
|
|
int cliArgsSz;
|
2012-08-04 10:19:24 +04:00
|
|
|
char* cursor;
|
|
|
|
char* comment;
|
2012-09-21 02:39:15 +04:00
|
|
|
const char* fname = "tests/test.conf";
|
2012-08-04 10:19:24 +04:00
|
|
|
|
|
|
|
if (args->argc == 1) {
|
|
|
|
printf("notice: using default file %s\n", fname);
|
|
|
|
}
|
|
|
|
else if(args->argc != 2) {
|
|
|
|
printf("usage: harness [FILE]\n");
|
|
|
|
args->return_code = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fname = args->argv[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
file = fopen(fname, "r");
|
|
|
|
if (file == NULL) {
|
|
|
|
fprintf(stderr, "unable to open %s\n", fname);
|
|
|
|
args->return_code = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fseek(file, 0, SEEK_END);
|
|
|
|
sz = ftell(file);
|
|
|
|
rewind(file);
|
2013-02-15 02:09:41 +04:00
|
|
|
if (sz <= 0) {
|
2012-08-04 10:19:24 +04:00
|
|
|
fprintf(stderr, "%s is empty\n", fname);
|
|
|
|
fclose(file);
|
|
|
|
args->return_code = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
script = (char*)malloc(sz+1);
|
|
|
|
if (script == 0) {
|
|
|
|
fprintf(stderr, "unable to allocte script buffer\n");
|
|
|
|
fclose(file);
|
|
|
|
args->return_code = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
len = fread(script, 1, sz, file);
|
|
|
|
if (len != sz) {
|
|
|
|
fprintf(stderr, "read error\n");
|
|
|
|
fclose(file);
|
2013-02-15 02:09:41 +04:00
|
|
|
free(script);
|
2012-08-04 10:19:24 +04:00
|
|
|
args->return_code = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(file);
|
|
|
|
script[sz] = 0;
|
|
|
|
|
|
|
|
cursor = script;
|
2012-08-08 02:06:53 +04:00
|
|
|
svrArgsSz = 1;
|
|
|
|
svrArgs[0] = args->argv[0];
|
|
|
|
cliArgsSz = 1;
|
|
|
|
cliArgs[0] = args->argv[0];
|
2012-08-04 10:19:24 +04:00
|
|
|
|
|
|
|
while (*cursor != 0) {
|
2012-08-08 02:06:53 +04:00
|
|
|
int do_it = 0;
|
2012-08-04 10:19:24 +04:00
|
|
|
|
|
|
|
switch (*cursor) {
|
|
|
|
case '\n':
|
2012-08-08 02:06:53 +04:00
|
|
|
/* A blank line triggers test case execution or switches
|
|
|
|
to client mode if we don't have the client command yet */
|
|
|
|
if (cliMode == 0)
|
|
|
|
cliMode = 1; /* switch to client mode processing */
|
|
|
|
else
|
|
|
|
do_it = 1; /* Do It, we have server and client */
|
2012-08-04 10:19:24 +04:00
|
|
|
cursor++;
|
|
|
|
break;
|
|
|
|
case '#':
|
|
|
|
/* Ignore lines that start with a #. */
|
|
|
|
comment = strsep(&cursor, "\n");
|
2013-03-11 23:09:49 +04:00
|
|
|
#ifdef DEBUG_SUITE_TESTS
|
2012-08-04 10:19:24 +04:00
|
|
|
printf("%s\n", comment);
|
2013-03-12 20:52:16 +04:00
|
|
|
#else
|
|
|
|
(void)comment;
|
2013-03-11 23:09:49 +04:00
|
|
|
#endif
|
2012-08-04 10:19:24 +04:00
|
|
|
break;
|
|
|
|
case '-':
|
|
|
|
/* Parameters start with a -. They end in either a newline
|
2012-08-08 02:06:53 +04:00
|
|
|
* or a space. Capture until either, save in Args list. */
|
|
|
|
if (cliMode)
|
|
|
|
cliArgs[cliArgsSz++] = strsep(&cursor, " \n");
|
|
|
|
else
|
|
|
|
svrArgs[svrArgsSz++] = strsep(&cursor, " \n");
|
2012-08-04 10:19:24 +04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Anything from cursor until end of line that isn't the above
|
|
|
|
* is data for a paramter. Just up until the next newline in
|
2012-08-08 02:06:53 +04:00
|
|
|
* the Args list. */
|
|
|
|
if (cliMode)
|
|
|
|
cliArgs[cliArgsSz++] = strsep(&cursor, "\n");
|
|
|
|
else
|
|
|
|
svrArgs[svrArgsSz++] = strsep(&cursor, "\n");
|
|
|
|
if (*cursor == 0) /* eof */
|
|
|
|
do_it = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (svrArgsSz == MAX_ARGS || cliArgsSz == MAX_ARGS) {
|
|
|
|
fprintf(stderr, "too many arguments, forcing test run\n");
|
|
|
|
do_it = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (do_it) {
|
2013-03-11 23:02:22 +04:00
|
|
|
ret = execute_test_case(svrArgsSz, svrArgs, cliArgsSz, cliArgs,0,0);
|
|
|
|
/* don't repeat if not supported in build */
|
|
|
|
if (ret == 0) {
|
|
|
|
execute_test_case(svrArgsSz, svrArgs, cliArgsSz, cliArgs, 0, 1);
|
|
|
|
execute_test_case(svrArgsSz, svrArgs, cliArgsSz, cliArgs, 1, 0);
|
|
|
|
execute_test_case(svrArgsSz, svrArgs, cliArgsSz, cliArgs, 1, 1);
|
|
|
|
}
|
2012-08-08 02:06:53 +04:00
|
|
|
svrArgsSz = 1;
|
|
|
|
cliArgsSz = 1;
|
|
|
|
cliMode = 0;
|
2012-08-04 10:19:24 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
free(script);
|
|
|
|
args->return_code = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int SuiteTest(void)
|
|
|
|
{
|
|
|
|
func_args args;
|
2012-11-01 02:25:39 +04:00
|
|
|
char argv0[2][80];
|
2012-08-07 04:14:31 +04:00
|
|
|
char* myArgv[2];
|
2012-08-04 10:19:24 +04:00
|
|
|
|
2012-08-07 04:14:31 +04:00
|
|
|
printf(" Begin Cipher Suite Tests\n");
|
|
|
|
|
|
|
|
/* setup */
|
|
|
|
myArgv[0] = argv0[0];
|
|
|
|
myArgv[1] = argv0[1];
|
2012-08-04 10:19:24 +04:00
|
|
|
args.argv = myArgv;
|
2012-08-07 04:14:31 +04:00
|
|
|
strcpy(argv0[0], "SuiteTest");
|
2012-08-04 10:19:24 +04:00
|
|
|
|
2013-03-08 05:44:40 +04:00
|
|
|
(void)test_harness;
|
|
|
|
|
2013-03-11 21:59:08 +04:00
|
|
|
cipherSuiteCtx = CyaSSL_CTX_new(CyaTLSv1_2_client_method());
|
|
|
|
if (cipherSuiteCtx == NULL) {
|
|
|
|
printf("can't get cipher suite ctx\n");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
2012-08-07 04:14:31 +04:00
|
|
|
/* default case */
|
|
|
|
args.argc = 1;
|
|
|
|
printf("starting default cipher suite tests\n");
|
2012-08-04 10:19:24 +04:00
|
|
|
test_harness(&args);
|
2012-08-07 04:14:31 +04:00
|
|
|
if (args.return_code != 0) {
|
|
|
|
printf("error from script %d\n", args.return_code);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
2012-08-04 10:19:24 +04:00
|
|
|
|
2012-08-07 04:14:31 +04:00
|
|
|
/* any extra cases will need another argument */
|
|
|
|
args.argc = 2;
|
2012-08-04 10:19:24 +04:00
|
|
|
|
2012-08-09 04:09:09 +04:00
|
|
|
#ifdef CYASSL_DTLS
|
|
|
|
/* add dtls extra suites */
|
|
|
|
strcpy(argv0[1], "tests/test-dtls.conf");
|
|
|
|
printf("starting dtls extra cipher suite tests\n");
|
|
|
|
test_harness(&args);
|
|
|
|
if (args.return_code != 0) {
|
|
|
|
printf("error from script %d\n", args.return_code);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-08-07 04:14:31 +04:00
|
|
|
printf(" End Cipher Suite Tests\n");
|
|
|
|
|
2013-03-11 21:59:08 +04:00
|
|
|
CyaSSL_CTX_free(cipherSuiteCtx);
|
|
|
|
|
2012-08-07 04:14:31 +04:00
|
|
|
return args.return_code;
|
|
|
|
}
|
2012-08-04 10:19:24 +04:00
|
|
|
|
|
|
|
|