gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r29284 - libmicrohttpd/src/testcurl/https


From: gnunet
Subject: [GNUnet-SVN] r29284 - libmicrohttpd/src/testcurl/https
Date: Sun, 15 Sep 2013 22:22:40 +0200

Author: grothoff
Date: 2013-09-15 22:22:40 +0200 (Sun, 15 Sep 2013)
New Revision: 29284

Modified:
   libmicrohttpd/src/testcurl/https/test_https_get.c
   libmicrohttpd/src/testcurl/https/test_https_get_parallel_threads.c
   libmicrohttpd/src/testcurl/https/test_https_multi_daemon.c
   libmicrohttpd/src/testcurl/https/test_https_session_info.c
   libmicrohttpd/src/testcurl/https/test_https_time_out.c
   libmicrohttpd/src/testcurl/https/test_tls_authentication.c
   libmicrohttpd/src/testcurl/https/test_tls_extensions.c
   libmicrohttpd/src/testcurl/https/test_tls_options.c
   libmicrohttpd/src/testcurl/https/tls_test_common.c
   libmicrohttpd/src/testcurl/https/tls_test_common.h
Log:
proper gcrypt thread initialization in tests

Modified: libmicrohttpd/src/testcurl/https/test_https_get.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_https_get.c   2013-09-15 20:04:29 UTC 
(rev 29283)
+++ libmicrohttpd/src/testcurl/https/test_https_get.c   2013-09-15 20:22:40 UTC 
(rev 29284)
@@ -95,6 +95,9 @@
 }
 
 
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+
+
 int
 main (int argc, char *const *argv)
 {
@@ -106,6 +109,11 @@
 
   if (!gcry_check_version (GCRYPT_VERSION))
     abort ();
+  gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
+  gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#ifdef GCRYCTL_INITIALIZATION_FINISHED
+  gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+#endif
   if (0 != curl_global_init (CURL_GLOBAL_ALL))
     {
       fprintf (stderr, "Error: %s\n", strerror (errno));

Modified: libmicrohttpd/src/testcurl/https/test_https_get_parallel_threads.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_https_get_parallel_threads.c  
2013-09-15 20:04:29 UTC (rev 29283)
+++ libmicrohttpd/src/testcurl/https/test_https_get_parallel_threads.c  
2013-09-15 20:22:40 UTC (rev 29284)
@@ -32,6 +32,7 @@
 #include <sys/stat.h>
 #include <limits.h>
 #include <curl/curl.h>
+#include <gcrypt.h>
 #include "tls_test_common.h"
 
 extern const char srv_key_pem[];
@@ -122,6 +123,10 @@
 }
 
 
+
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+
+
 int
 main (int argc, char *const *argv)
 {
@@ -130,6 +135,13 @@
 
   /* initialize random seed used by curl clients */
   unsigned int iseed = (unsigned int) time (NULL);
+
+
+  gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
+  gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#ifdef GCRYCTL_INITIALIZATION_FINISHED
+  gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+#endif
   srand (iseed);
   ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version;
   if (NULL == ssl_version)

Modified: libmicrohttpd/src/testcurl/https/test_https_multi_daemon.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_https_multi_daemon.c  2013-09-15 
20:04:29 UTC (rev 29283)
+++ libmicrohttpd/src/testcurl/https/test_https_multi_daemon.c  2013-09-15 
20:22:40 UTC (rev 29284)
@@ -29,7 +29,7 @@
 #include <curl/curl.h>
 #include <limits.h>
 #include <sys/stat.h>
-
+#include <gcrypt.h>
 #include "tls_test_common.h"
 
 extern int curl_check_version (const char *req_version, ...);
@@ -40,14 +40,16 @@
  * assert initiating two separate daemons and having one shut down
  * doesn't affect the other
  */
-int
-test_concurent_daemon_pair (void * cls, char *cipher_suite,
+static int
+test_concurent_daemon_pair (void *cls, 
+                           const char *cipher_suite,
                             int proto_version)
 {
 
   int ret;
   struct MHD_Daemon *d1;
   struct MHD_Daemon *d2;
+
   d1 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL |
                          MHD_USE_DEBUG, DEAMON_TEST_PORT,
                          NULL, NULL, &http_ahc, NULL,
@@ -88,12 +90,21 @@
   return ret;
 }
 
+
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+
+
 int
 main (int argc, char *const *argv)
 {
   unsigned int errorCount = 0;
   FILE *cert;
 
+  gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
+  gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#ifdef GCRYCTL_INITIALIZATION_FINISHED
+  gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+#endif
   if (0 != curl_global_init (CURL_GLOBAL_ALL))
     {
       fprintf (stderr, "Error (code: %u). l:%d f:%s\n", errorCount, __LINE__,
@@ -106,7 +117,7 @@
       return -1;
     }
 
-  char *aes256_sha = "AES256-SHA";
+  const char *aes256_sha = "AES256-SHA";
   if (curl_uses_nss_ssl() == 0)
     {
       aes256_sha = "rsa_aes_256_sha";

Modified: libmicrohttpd/src/testcurl/https/test_https_session_info.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_https_session_info.c  2013-09-15 
20:04:29 UTC (rev 29283)
+++ libmicrohttpd/src/testcurl/https/test_https_session_info.c  2013-09-15 
20:22:40 UTC (rev 29284)
@@ -27,7 +27,7 @@
 #include "platform.h"
 #include "microhttpd.h"
 #include <curl/curl.h>
-
+#include <gcrypt.h>
 #include "tls_test_common.h"
 
 extern int curl_check_version (const char *req_version, ...);
@@ -151,11 +151,19 @@
 }
 
 
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+
+
 int
 main (int argc, char *const *argv)
 {
   unsigned int errorCount = 0;
 
+  gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
+  gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#ifdef GCRYCTL_INITIALIZATION_FINISHED
+  gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+#endif
   if (0 != curl_global_init (CURL_GLOBAL_ALL))
     {
       fprintf (stderr, "Error (code: %u)\n", errorCount);

Modified: libmicrohttpd/src/testcurl/https/test_https_time_out.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_https_time_out.c      2013-09-15 
20:04:29 UTC (rev 29283)
+++ libmicrohttpd/src/testcurl/https/test_https_time_out.c      2013-09-15 
20:22:40 UTC (rev 29284)
@@ -29,13 +29,14 @@
 #include "microhttpd.h"
 #include "internal.h"
 #include "tls_test_common.h"
+#include <gcrypt.h>
 
 extern const char srv_key_pem[];
 extern const char srv_self_signed_cert_pem[];
 
 static const int TIME_OUT = 3;
 
-char *http_get_req = "GET / HTTP/1.1\r\n\r\n";
+static const char *http_get_req = "GET / HTTP/1.1\r\n\r\n";
 
 static int
 test_tls_session_time_out (gnutls_session_t session)
@@ -89,6 +90,8 @@
   return 0;
 }
 
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+
 int
 main (int argc, char *const *argv)
 {
@@ -99,6 +102,12 @@
   gnutls_datum_t cert;
   gnutls_certificate_credentials_t xcred;
 
+
+  gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
+  gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#ifdef GCRYCTL_INITIALIZATION_FINISHED
+  gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+#endif
   gnutls_global_init ();
   gnutls_global_set_log_level (11);
 

Modified: libmicrohttpd/src/testcurl/https/test_tls_authentication.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_tls_authentication.c  2013-09-15 
20:04:29 UTC (rev 29283)
+++ libmicrohttpd/src/testcurl/https/test_tls_authentication.c  2013-09-15 
20:22:40 UTC (rev 29284)
@@ -29,7 +29,7 @@
 #include <curl/curl.h>
 #include <limits.h>
 #include <sys/stat.h>
-
+#include <gcrypt.h>
 #include "tls_test_common.h"
 
 extern int curl_check_version (const char *req_version, ...);
@@ -69,11 +69,19 @@
 }
 
 
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+
+
 int
 main (int argc, char *const *argv)
 {
   unsigned int errorCount = 0;
 
+  gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
+  gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#ifdef GCRYCTL_INITIALIZATION_FINISHED
+  gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+#endif
   if (setup_ca_cert () == NULL)
     {
       fprintf (stderr, MHD_E_TEST_FILE_CREAT);

Modified: libmicrohttpd/src/testcurl/https/test_tls_extensions.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_tls_extensions.c      2013-09-15 
20:04:29 UTC (rev 29283)
+++ libmicrohttpd/src/testcurl/https/test_tls_extensions.c      2013-09-15 
20:22:40 UTC (rev 29284)
@@ -193,6 +193,8 @@
   return ret;
 }
 
+GCRY_THREAD_OPTION_PTHREAD_IMPL
+
 int
 main (int argc, char *const *argv)
 {
@@ -208,6 +210,12 @@
     -1
   };
 
+
+  gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
+  gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#ifdef GCRYCTL_INITIALIZATION_FINISHED
+  gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+#endif
   MHD_gtls_global_set_log_level (11);
 
   if ((test_fd = setup_test_file ()) == NULL)

Modified: libmicrohttpd/src/testcurl/https/test_tls_options.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_tls_options.c 2013-09-15 20:04:29 UTC 
(rev 29283)
+++ libmicrohttpd/src/testcurl/https/test_tls_options.c 2013-09-15 20:22:40 UTC 
(rev 29284)
@@ -75,6 +75,8 @@
   return 0;
 }
 
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+
 /* setup a temporary transfer test file */
 int
 main (int argc, char *const *argv)
@@ -85,7 +87,11 @@
     MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | MHD_USE_DEBUG;
   gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
   gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
-  if (curl_check_version (MHD_REQ_CURL_VERSION))
+  gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#ifdef GCRYCTL_INITIALIZATION_FINISHED
+  gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+#endif
+ if (curl_check_version (MHD_REQ_CURL_VERSION))
     {
       return 0;
     }

Modified: libmicrohttpd/src/testcurl/https/tls_test_common.c
===================================================================
--- libmicrohttpd/src/testcurl/https/tls_test_common.c  2013-09-15 20:04:29 UTC 
(rev 29283)
+++ libmicrohttpd/src/testcurl/https/tls_test_common.c  2013-09-15 20:22:40 UTC 
(rev 29284)
@@ -63,7 +63,8 @@
  * test HTTPS transfer
  */
 int
-test_daemon_get (void *cls, char *cipher_suite, int proto_version,
+test_daemon_get (void *cls,
+                const char *cipher_suite, int proto_version,
                 int port,
                 int ver_peer)
 {

Modified: libmicrohttpd/src/testcurl/https/tls_test_common.h
===================================================================
--- libmicrohttpd/src/testcurl/https/tls_test_common.h  2013-09-15 20:04:29 UTC 
(rev 29283)
+++ libmicrohttpd/src/testcurl/https/tls_test_common.h  2013-09-15 20:22:40 UTC 
(rev 29284)
@@ -80,7 +80,8 @@
  * perform cURL request for file
  */
 int
-test_daemon_get (void * cls, char *cipher_suite, int proto_version,
+test_daemon_get (void * cls,
+                const char *cipher_suite, int proto_version,
                  int port, int ver_peer);
 
 void print_test_result (int test_outcome, char *test_name);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]