1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-29 05:21:37 +03:00

TLSv1.1 feature added.

git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@207 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
cameronrich
2011-05-06 12:35:32 +00:00
parent 1a19505e76
commit 70a8f79fa6
6 changed files with 123 additions and 51 deletions

View File

@ -802,7 +802,7 @@ static void do_client(client_t *clnt)
"-connect localhost:%d %s 2>&1 | grep \"Session-ID:\"",
g_port, clnt->openssl_option);
}
else
else if (strstr(clnt->testname, "GNUTLS") == NULL)
{
sprintf(openssl_buf, "echo \"hello client\" | openssl s_client -tls1 "
#ifdef WIN32
@ -812,6 +812,16 @@ static void do_client(client_t *clnt)
#endif
g_port, clnt->openssl_option);
}
else /* gnutls */
{
sprintf(openssl_buf, "echo \"hello client\" | gnutls-cli "
#ifdef WIN32
"-p %d %s 127.0.0.1",
#else
"-p %d %s 127.0.0.1 > /dev/null 2>&1",
#endif
g_port, clnt->openssl_option);
}
system(openssl_buf);
}
@ -1243,6 +1253,15 @@ int SSL_server_tests(void)
NULL, "abcd", DEFAULT_SVR_OPTION)))
goto cleanup;
/*
* GNUTLS
*/
if ((ret = SSL_server_test("GNUTLS client",
"",
"../ssl/test/axTLS.x509_1024.cer", NULL,
"../ssl/test/axTLS.key_1024",
NULL, NULL, DEFAULT_SVR_OPTION)))
goto cleanup;
ret = 0;
cleanup:
@ -1279,6 +1298,7 @@ typedef struct
{
const char *testname;
const char *openssl_option;
int do_gnutls;
} server_t;
static void do_server(server_t *svr)
@ -1287,8 +1307,17 @@ static void do_server(server_t *svr)
#ifndef WIN32
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
#endif
sprintf(openssl_buf, "openssl s_server -tls1 "
"-accept %d -quiet %s ", g_port, svr->openssl_option);
if (svr->do_gnutls)
{
sprintf(openssl_buf, "gnutls-serv "
"-p %d --quiet %s ", g_port, svr->openssl_option);
}
else
{
sprintf(openssl_buf, "openssl s_server -tls1 "
"-accept %d -quiet %s ", g_port, svr->openssl_option);
}
system(openssl_buf);
}
@ -1311,6 +1340,8 @@ static int SSL_client_test(
pthread_t thread;
#endif
server_data.do_gnutls = strstr(test, "GNUTLS") != NULL;
if (sess_resume == NULL || sess_resume->start_server)
{
g_port++;
@ -1592,6 +1623,14 @@ int SSL_client_tests(void)
}
printf("SSL client test \"Invalid certificate type\" passed\n");
if ((ret = SSL_client_test("GNUTLS client",
&ssl_ctx,
"--x509certfile ../ssl/test/axTLS.x509_1024.pem "
"--x509keyfile ../ssl/test/axTLS.key_1024.pem -q", NULL,
DEFAULT_CLNT_OPTION, NULL, NULL, NULL)))
goto cleanup;
ret = 0;
cleanup:
@ -1600,6 +1639,7 @@ cleanup:
ssl_display_error(ret);
printf("Error: A client test failed\n");
system("sh ../ssl/test/killopenssl.sh");
system("sh ../ssl/test/killgnutls.sh");
exit(1);
}
else
@ -2171,6 +2211,7 @@ int main(int argc, char *argv[])
goto cleanup;
system("sh ../ssl/test/killopenssl.sh");
system("sh ../ssl/test/killgnutls.sh");
if (SSL_server_tests())
goto cleanup;