'microhttps.h' merge

gnutls version added to configure.ac to enable assersion before running curl tests
GNUTLS symbol renaming
This commit is contained in:
lv-426 committed 2008-07-26 03:26:56 +00:00
1 parent 14a5721937
commit 16abaea132
69 files changed
+1790 -1811

No files matched your search

+17 -16
View File
@@ -6,47 +6,48 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/daemon/https/tls \
-I$(top_srcdir)/src/daemon/https/lgl \
-I$(top_srcdir)/src/daemon/https/x509 \
-I$(top_srcdir)/src/daemon
-I$(top_srcdir)/src/daemon \
$(LIBCURL_CPPFLAGS)
check_PROGRAMS = \
mhds_get_test \
tls_authentication_test \
mhds_multi_daemon_test \
mhds_session_info_test
mhds_get_test \
tls_authentication_test \
mhds_multi_daemon_test \
mhds_session_info_test
TESTS = $(check_PROGRAMS)
tls_alert_test_SOURCES = \
tls_alert_test.c \
$(top_builddir)/src/testcurl/curl_version_check.c
tls_alert_test.c
tls_alert_test_LDADD = \
$(top_builddir)/src/testcurl/libcurl_version_check.a \
$(top_builddir)/src/daemon/libmicrohttpd.la \
@LIBCURL@
tls_authentication_test_SOURCES = \
tls_authentication_test.c \
$(top_builddir)/src/testcurl/curl_version_check.c
tls_authentication_test.c
tls_authentication_test_LDADD = \
$(top_builddir)/src/testcurl/libcurl_version_check.a \
$(top_builddir)/src/daemon/libmicrohttpd.la \
@LIBCURL@
mhds_get_test_SOURCES = \
mhds_get_test.c \
$(top_builddir)/src/testcurl/curl_version_check.c
mhds_get_test_LDADD = \
mhds_get_test.c
mhds_get_test_LDADD = \
$(top_builddir)/src/testcurl/libcurl_version_check.a \
$(top_builddir)/src/daemon/libmicrohttpd.la \
@LIBCURL@
mhds_session_info_test_SOURCES = \
mhds_session_info_test.c \
$(top_builddir)/src/testcurl/curl_version_check.c
mhds_session_info_test.c
mhds_session_info_test_LDADD = \
$(top_builddir)/src/testcurl/libcurl_version_check.a \
$(top_builddir)/src/daemon/libmicrohttpd.la \
@LIBCURL@
mhds_multi_daemon_test_SOURCES = \
mhds_multi_daemon_test.c \
$(top_builddir)/src/testcurl/curl_version_check.c
mhds_multi_daemon_test.c
mhds_multi_daemon_test_LDADD = \
$(top_builddir)/src/testcurl/libcurl_version_check.a \
$(top_builddir)/src/daemon/libmicrohttpd.la \
@LIBCURL@
+22 -24
View File
@@ -24,20 +24,14 @@
* @author Sagie Amir
*/
#include "config.h"
#include "plibc.h"
#include "microhttpsd.h"
#include <errno.h>
#include "platform.h"
#include "microhttpd.h"
#include <curl/curl.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include "gnutls.h"
#include <curl/curl.h>
#define PAGE_NOT_FOUND "<html><head><title>File not found</title></head><body>File not found</body></html>"
#define MHD_E_MEM "Error: memory error\n"
@@ -51,7 +45,7 @@
const char *test_file_name = "https_test_file";
const char test_file_data[] = "Hello World\n";
extern int curl_check_version (const char *req_version, ...);
int curl_check_version (const char *req_version, ...);
struct CBC
{
@@ -183,14 +177,14 @@ test_daemon_get (FILE * test_fd, char *cipher_suite, int proto_version)
#endif
curl_easy_setopt (c, CURLOPT_URL, url);
curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_easy_setopt (c, CURLOPT_TIMEOUT, 10L);
curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 10L);
curl_easy_setopt (c, CURLOPT_TIMEOUT, 2L);
curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 2L);
curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
curl_easy_setopt (c, CURLOPT_FILE, &cbc);
/* TLS options */
curl_easy_setopt (c, CURLOPT_SSLVERSION, proto_version);
//curl_easy_setopt (c, CURLOPT_SSL_CIPHER_LIST, cipher_suite);
curl_easy_setopt (c, CURLOPT_SSL_CIPHER_LIST, cipher_suite);
/* currently skip any peer authentication */
curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, 0);
@@ -308,7 +302,7 @@ test_cipher_option (FILE * test_fd, char *cipher_suite, int proto_version)
{
int ret;
int ciper[] = { GNUTLS_CIPHER_3DES_CBC, 0 };
int ciper[] = { MHD_GNUTLS_CIPHER_3DES_CBC, 0 };
struct MHD_Daemon *d;
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL |
MHD_USE_DEBUG, 42433,
@@ -334,7 +328,8 @@ test_kx_option (FILE * test_fd, char *cipher_suite, int proto_version)
{
int ret;
int kx[] = { GNUTLS_KX_DHE_RSA, 0 };
int ciper[] = { MHD_GNUTLS_CIPHER_3DES_CBC, 0 };
int kx[] = { MHD_GNUTLS_KX_DHE_RSA, 0 };
struct MHD_Daemon *d;
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL |
@@ -342,7 +337,8 @@ test_kx_option (FILE * test_fd, char *cipher_suite, int proto_version)
NULL, NULL, &http_ahc, NULL,
MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
MHD_OPTION_KX_PRIORITY, kx, MHD_OPTION_END);
MHD_OPTION_KX_PRIORITY, kx,
MHD_OPTION_CIPHER_ALGORITHM, ciper, MHD_OPTION_END);
if (d == NULL)
{
@@ -361,7 +357,7 @@ test_mac_option (FILE * test_fd, char *cipher_suite, int proto_version)
{
int ret;
int mac[] = { GNUTLS_MAC_SHA1, 0 };
int mac[] = { MHD_GNUTLS_MAC_SHA1, 0 };
struct MHD_Daemon *d;
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL |
@@ -418,7 +414,9 @@ main (int argc, char *const *argv)
FILE *test_fd;
unsigned int errorCount = 0;
if (curl_check_version (MHD_REQ_CURL_VERSION, MHD_REQ_CURL_SSL_VERSION))
/* gnutls_global_set_log_level(11); */
if (curl_check_version (MHD_REQ_CURL_VERSION, MHD_REQ_CURL_OPENSSL_VERSION))
{
return -1;
}
@@ -436,16 +434,16 @@ main (int argc, char *const *argv)
}
errorCount +=
test_secure_get (test_fd, "AES256-SHA", CURL_SSLVERSION_SSLv3);
test_secure_get (test_fd, "AES256-SHA", CURL_SSLVERSION_TLSv1);
errorCount +=
test_secure_get (test_fd, "AES256-SHA", CURL_SSLVERSION_SSLv3);
errorCount +=
test_file_certificates (test_fd, "AES256-SHA", CURL_SSLVERSION_SSLv3);
/* TODO resolve cipher setting issue when compiling against GNU TLS */
errorCount +=
test_cipher_option (test_fd, "DES-CBC3-SHA", CURL_SSLVERSION_SSLv3);
errorCount +=
test_kx_option (test_fd, "EDH-RSA-DES-CBC3-SHA", CURL_SSLVERSION_SSLv3);
test_cipher_option (test_fd, "DES-CBC3-SHA", CURL_SSLVERSION_TLSv1);
/* errorCount +=
test_kx_option (test_fd, "EDH-RSA-DES-CBC3-SHA", CURL_SSLVERSION_SSLv3); */
curl_global_cleanup ();
+3 -12
View File
@@ -24,18 +24,9 @@
* @author Sagie Amir
*/
#include "config.h"
#include "plibc.h"
#include "microhttpsd.h"
#include <errno.h>
#include "platform.h"
#include "microhttpd.h"
#include <curl/curl.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#define PAGE_NOT_FOUND "<html><head><title>File not found</title></head><body>File not found</body></html>"
@@ -302,7 +293,7 @@ main (int argc, char *const *argv)
FILE *test_fd;
unsigned int errorCount = 0;
if (curl_check_version (MHD_REQ_CURL_VERSION, MHD_REQ_CURL_SSL_VERSION))
if (curl_check_version (MHD_REQ_CURL_VERSION, MHD_REQ_CURL_OPENSSL_VERSION))
{
return -1;
}
+17 -25
View File
@@ -24,17 +24,9 @@
* @author Sagie Amir
*/
#include "config.h"
#include "plibc.h"
#include "microhttpsd.h"
#include <errno.h>
#include "platform.h"
#include "microhttpd.h"
#include <curl/curl.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <fcntl.h>
#include <unistd.h>
#define EMPTY_PAGE "<html><head><title>Empty page</title></head><body>Empty page</body></html>"
@@ -77,56 +69,56 @@ query_session_ahc (void *cls, struct MHD_Connection *connection,
int ret;
/* assert actual connection cipher is the one negotiated */
if (MHD_get_tls_session_info (connection, MHS_INFO_CIPHER_ALGO).
cipher_algorithm != GNUTLS_CIPHER_AES_256_CBC)
if (MHD_get_session_info (connection, MHS_INFO_CIPHER_ALGO).
cipher_algorithm != MHD_GNUTLS_CIPHER_AES_256_CBC)
{
fprintf (stderr, "Error: requested cipher mismatch. %s\n",
strerror (errno));
return -1;
}
if (MHD_get_tls_session_info (connection, MHD_INFO_KX_ALGO).kx_algorithm !=
GNUTLS_KX_RSA)
if (MHD_get_session_info (connection, MHD_INFO_KX_ALGO).kx_algorithm !=
MHD_GNUTLS_KX_RSA)
{
fprintf (stderr, "Error: requested key exchange mismatch. %s\n",
strerror (errno));
return -1;
}
if (MHD_get_tls_session_info (connection, MHD_INFO_MAC_ALGO).
mac_algorithm != GNUTLS_MAC_SHA1)
if (MHD_get_session_info (connection, MHD_INFO_MAC_ALGO).
mac_algorithm != MHD_GNUTLS_MAC_SHA1)
{
fprintf (stderr, "Error: requested mac algorithm mismatch. %s\n",
strerror (errno));
return -1;
}
if (MHD_get_tls_session_info (connection, MHD_INFO_COMPRESSION_METHOD).
compression_method != GNUTLS_COMP_NULL)
if (MHD_get_session_info (connection, MHD_INFO_COMPRESSION_METHOD).
compression_method != MHD_GNUTLS_COMP_NULL)
{
fprintf (stderr, "Error: requested compression mismatch. %s\n",
strerror (errno));
return -1;
}
if (MHD_get_tls_session_info (connection, MHD_INFO_PROTOCOL).protocol !=
GNUTLS_SSL3)
if (MHD_get_session_info (connection, MHD_INFO_PROTOCOL).protocol !=
MHD_GNUTLS_SSL3)
{
fprintf (stderr, "Error: requested compression mismatch. %s\n",
strerror (errno));
return -1;
}
if (MHD_get_tls_session_info (connection, MHD_INFO_CERT_TYPE).
certificate_type != GNUTLS_CRT_X509)
if (MHD_get_session_info (connection, MHD_INFO_CERT_TYPE).
certificate_type != MHD_GNUTLS_CRT_X509)
{
fprintf (stderr, "Error: requested certificate mismatch. %s\n",
strerror (errno));
return -1;
}
if (MHD_get_tls_session_info (connection, MHD_INFO_CREDENTIALS_TYPE).
credentials_type != GNUTLS_CRD_CERTIFICATE)
if (MHD_get_session_info (connection, MHD_INFO_CREDENTIALS_TYPE).
credentials_type != MHD_GNUTLS_CRD_CERTIFICATE)
{
fprintf (stderr, "Error: requested certificate mismatch. %s\n",
strerror (errno));
@@ -215,7 +207,7 @@ main (int argc, char *const *argv)
FILE *test_fd;
unsigned int errorCount = 0;
if (curl_check_version (MHD_REQ_CURL_VERSION, MHD_REQ_CURL_SSL_VERSION))
if (curl_check_version (MHD_REQ_CURL_VERSION, MHD_REQ_CURL_OPENSSL_VERSION))
{
return -1;
}
+8 -22
View File
@@ -24,30 +24,16 @@
* @author Sagie Amir
*/
#include "config.h"
#include "plibc.h"
#include "microhttpsd.h"
#include <errno.h>
#include "platform.h"
#include "microhttpd.h"
#include <curl/curl.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <unistd.h>
#define MHD_E_MEM "Error: memory error\n"
#define MHD_E_SERVER_INIT "Error: failed to start server\n"
#include "gnutls_int.h"
#include "gnutls_datum.h"
#include "tls_test_keys.h"
#define MHD_E_MEM "Error: memory error\n"
#define MHD_E_SERVER_INIT "Error: failed to start server\n"
extern int curl_check_version (const char *req_version, ...);
const char *ca_cert_file_name = "ca_cert_pem";
@@ -110,7 +96,7 @@ test_alert_response ()
// ...
}
gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, xcred);
gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred);
sd = socket (AF_INET, SOCK_STREAM, 0);
memset (&sa, '\0', sizeof (struct sockaddr_in));
@@ -161,7 +147,7 @@ main (int argc, char *const *argv)
int ret, errorCount = 0;;
struct MHD_Daemon *d;
if (curl_check_version (MHD_REQ_CURL_VERSION, MHD_REQ_CURL_SSL_VERSION))
if (curl_check_version (MHD_REQ_CURL_VERSION, MHD_REQ_CURL_OPENSSL_VERSION))
{
return -1;
}
@@ -182,7 +168,7 @@ main (int argc, char *const *argv)
errorCount += test_alert_response ();
if (errorCount != 0)
fprintf (stderr, "Error (code: %u)\n", errorCount);
fprintf (stderr, "Error (code: %d)\n", errorCount);
MHD_stop_daemon (d);
return errorCount != 0;
+7 -16
View File
@@ -24,18 +24,9 @@
* @author Sagie Amir
*/
#include "config.h"
#include "plibc.h"
#include "microhttpsd.h"
#include <errno.h>
#include "platform.h"
#include "microhttpd.h"
#include <curl/curl.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#define PAGE_NOT_FOUND "<html><head><title>File not found</title></head><body>File not found</body></html>"
@@ -234,7 +225,7 @@ test_secure_get (FILE * test_fd, char *cipher_suite, int proto_version)
int ret;
struct MHD_Daemon *d;
int kx[] = { GNUTLS_KX_DHE_RSA, 0 };
int kx[] = { MHD_GNUTLS_KX_DHE_RSA, 0 };
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL |
MHD_USE_DEBUG, 42433,
@@ -317,10 +308,10 @@ main (int argc, char *const *argv)
FILE *test_fd;
unsigned int errorCount = 0;
if (curl_check_version (MHD_REQ_CURL_VERSION, MHD_REQ_CURL_SSL_VERSION))
{
return -1;
}
if (curl_check_version (MHD_REQ_CURL_VERSION, MHD_REQ_CURL_OPENSSL_VERSION))
{
return -1;
}
if ((test_fd = setupTestFile ()) == NULL)
{