diff options
Diffstat (limited to 'src/testcurl/https/tls_test_common.h')
-rw-r--r-- | src/testcurl/https/tls_test_common.h | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/testcurl/https/tls_test_common.h b/src/testcurl/https/tls_test_common.h index 784ab173..074f5345 100644 --- a/src/testcurl/https/tls_test_common.h +++ b/src/testcurl/https/tls_test_common.h | |||
@@ -28,6 +28,14 @@ | |||
28 | #include <limits.h> | 28 | #include <limits.h> |
29 | #include <gnutls/gnutls.h> | 29 | #include <gnutls/gnutls.h> |
30 | 30 | ||
31 | #ifndef CURL_VERSION_BITS | ||
32 | #define CURL_VERSION_BITS(x,y,z) ((x) << 16 | (y) << 8 | (z)) | ||
33 | #endif /* ! CURL_VERSION_BITS */ | ||
34 | #ifndef CURL_AT_LEAST_VERSION | ||
35 | #define CURL_AT_LEAST_VERSION(x,y,z) \ | ||
36 | (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS (x, y, z)) | ||
37 | #endif /* ! CURL_AT_LEAST_VERSION */ | ||
38 | |||
31 | #define test_data "Hello World\n" | 39 | #define test_data "Hello World\n" |
32 | #define ca_cert_file_name SRCDIR "/test-ca.crt" | 40 | #define ca_cert_file_name SRCDIR "/test-ca.crt" |
33 | 41 | ||
@@ -44,6 +52,13 @@ | |||
44 | #define MHD_E_FAILED_TO_CONNECT \ | 52 | #define MHD_E_FAILED_TO_CONNECT \ |
45 | "Error: server connection could not be established\n" | 53 | "Error: server connection could not be established\n" |
46 | 54 | ||
55 | #ifndef MHD_STATICSTR_LEN_ | ||
56 | /** | ||
57 | * Determine length of static string / macro strings at compile time. | ||
58 | */ | ||
59 | #define MHD_STATICSTR_LEN_(macro) (sizeof(macro) / sizeof(char) - 1) | ||
60 | #endif /* ! MHD_STATICSTR_LEN_ */ | ||
61 | |||
47 | 62 | ||
48 | /* The local copy if GnuTLS IDs to avoid long #ifdefs list with various | 63 | /* The local copy if GnuTLS IDs to avoid long #ifdefs list with various |
49 | * GnuTLS versions */ | 64 | * GnuTLS versions */ |
@@ -63,15 +78,29 @@ enum know_gnutls_tls_id | |||
63 | KNOWN_TLS_MAX = KNOWN_TLS_V1_3 /**< Maximum valid value */ | 78 | KNOWN_TLS_MAX = KNOWN_TLS_V1_3 /**< Maximum valid value */ |
64 | }; | 79 | }; |
65 | 80 | ||
81 | #define KNOW_TLS_IDS_COUNT 6 /* KNOWN_TLS_MAX + 1 */ | ||
66 | /** | 82 | /** |
67 | * Map @a know_gnutls_tls_ids values to printable names. | 83 | * Map @a know_gnutls_tls_ids values to printable names. |
68 | */ | 84 | */ |
69 | extern const char *tls_names[6]; | 85 | extern const char *tls_names[KNOW_TLS_IDS_COUNT]; |
70 | 86 | ||
71 | /** | 87 | /** |
72 | * Map @a know_gnutls_tls_ids values to GnuTLS priorities strings. | 88 | * Map @a know_gnutls_tls_ids values to GnuTLS priorities strings. |
73 | */ | 89 | */ |
74 | extern const char *priorities_map[6]; | 90 | extern const char *priorities_map[KNOW_TLS_IDS_COUNT]; |
91 | |||
92 | /** | ||
93 | * Map @a know_gnutls_tls_ids values to libcurl @a CURLOPT_SSLVERSION value. | ||
94 | */ | ||
95 | extern const long libcurl_tls_vers_map[KNOW_TLS_IDS_COUNT]; | ||
96 | |||
97 | #if CURL_AT_LEAST_VERSION (7,54,0) | ||
98 | /** | ||
99 | * Map @a know_gnutls_tls_ids values to libcurl @a CURLOPT_SSLVERSION value | ||
100 | * for maximum supported TLS version. | ||
101 | */ | ||
102 | extern const long libcurl_tls_max_vers_map[KNOW_TLS_IDS_COUNT]; | ||
103 | #endif /* CURL_AT_LEAST_VERSION(7,54,0) */ | ||
75 | 104 | ||
76 | struct https_test_data | 105 | struct https_test_data |
77 | { | 106 | { |