mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-29 04:09:31 +03:00
proper gcrypt thread initialization in tests
This commit is contained in:
1 parent
4c1b251d75
commit
a2425da6f9
10 files changed
+82
-10
No files matched your search
@@ -95,6 +95,9 @@ test_secure_get (FILE * test_fd,
|
||||
}
|
||||
|
||||
|
||||
GCRY_THREAD_OPTION_PTHREAD_IMPL;
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *const *argv)
|
||||
{
|
||||
@@ -106,6 +109,11 @@ main (int argc, char *const *argv)
|
||||
|
||||
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));
|
||||
|
||||
@@ -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 @@ test_parallel_clients (void *cls, const char *cipher_suite,
|
||||
}
|
||||
|
||||
|
||||
|
||||
GCRY_THREAD_OPTION_PTHREAD_IMPL;
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *const *argv)
|
||||
{
|
||||
@@ -130,6 +135,13 @@ main (int argc, char *const *argv)
|
||||
|
||||
/* 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)
|
||||
|
||||
@@ -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 @@ extern const char srv_self_signed_cert_pem[];
|
||||
* 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 @@ test_concurent_daemon_pair (void * cls, char *cipher_suite,
|
||||
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 @@ main (int argc, char *const *argv)
|
||||
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";
|
||||
|
||||
@@ -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 @@ test_query_session ()
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
@@ -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 @@ test_tls_session_time_out (gnutls_session_t session)
|
||||
return 0;
|
||||
}
|
||||
|
||||
GCRY_THREAD_OPTION_PTHREAD_IMPL;
|
||||
|
||||
int
|
||||
main (int argc, char *const *argv)
|
||||
{
|
||||
@@ -99,6 +102,12 @@ main (int argc, char *const *argv)
|
||||
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);
|
||||
|
||||
|
||||
@@ -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 @@ test_secure_get (void * cls, char *cipher_suite, int proto_version)
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
@@ -193,6 +193,8 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
GCRY_THREAD_OPTION_PTHREAD_IMPL
|
||||
|
||||
int
|
||||
main (int argc, char *const *argv)
|
||||
{
|
||||
@@ -208,6 +210,12 @@ main (int argc, char *const *argv)
|
||||
-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)
|
||||
|
||||
@@ -75,6 +75,8 @@ test_unmatching_ssl_version (void * cls, const char *cipher_suite,
|
||||
return 0;
|
||||
}
|
||||
|
||||
GCRY_THREAD_OPTION_PTHREAD_IMPL;
|
||||
|
||||
/* setup a temporary transfer test file */
|
||||
int
|
||||
main (int argc, char *const *argv)
|
||||
@@ -85,7 +87,11 @@ main (int argc, char *const *argv)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ setup_ca_cert ()
|
||||
* 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)
|
||||
{
|
||||
|
||||
@@ -80,7 +80,8 @@ setup_ca_cert ();
|
||||
* 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);
|
||||
|
||||
Reference in new issue
Block a user