aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/tls/gnutls_algorithms.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/https/tls/gnutls_algorithms.c')
-rw-r--r--src/daemon/https/tls/gnutls_algorithms.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/daemon/https/tls/gnutls_algorithms.c b/src/daemon/https/tls/gnutls_algorithms.c
index d6e12f48..18ba0457 100644
--- a/src/daemon/https/tls/gnutls_algorithms.c
+++ b/src/daemon/https/tls/gnutls_algorithms.c
@@ -352,7 +352,8 @@ const int MHD__gnutls_comp_algorithms_size = MAX_COMP_METHODS;
352 352
353/* the compression entry is defined in MHD_gnutls_algorithms.h */ 353/* the compression entry is defined in MHD_gnutls_algorithms.h */
354 354
355MHD_gnutls_compression_entry MHD__gnutls_compression_algorithms[MAX_COMP_METHODS] = 355MHD_gnutls_compression_entry
356 MHD__gnutls_compression_algorithms[MAX_COMP_METHODS] =
356 { GNUTLS_COMPRESSION_ENTRY (MHD_GNUTLS_COMP_NULL, 0x00, 0, 0, 0), 357 { GNUTLS_COMPRESSION_ENTRY (MHD_GNUTLS_COMP_NULL, 0x00, 0, 0, 0),
357#ifdef HAVE_LIBZ 358#ifdef HAVE_LIBZ
358 /* draft-ietf-tls-compression-02 */ 359 /* draft-ietf-tls-compression-02 */
@@ -1310,7 +1311,7 @@ MHD_gtls_version_lowest (MHD_gtls_session_t session)
1310 } 1311 }
1311 1312
1312 if (min == 0xff) 1313 if (min == 0xff)
1313 return MHD_GNUTLS_PROTOCOL_VERSION_UNKNOWN; /* unknown version */ 1314 return MHD_GNUTLS_PROTOCOL_VERSION_UNKNOWN; /* unknown version */
1314 1315
1315 return min; 1316 return min;
1316} 1317}
@@ -1333,7 +1334,7 @@ MHD_gtls_version_max (MHD_gtls_session_t session)
1333 } 1334 }
1334 1335
1335 if (max == 0x00) 1336 if (max == 0x00)
1336 return MHD_GNUTLS_PROTOCOL_VERSION_UNKNOWN; /* unknown version */ 1337 return MHD_GNUTLS_PROTOCOL_VERSION_UNKNOWN; /* unknown version */
1337 1338
1338 return max; 1339 return max;
1339} 1340}
@@ -1542,11 +1543,11 @@ MHD__gnutls_cipher_suite_is_ok (cipher_suite_st * suite)
1542#define MAX_ELEM_SIZE 4 1543#define MAX_ELEM_SIZE 4
1543static inline int 1544static inline int
1544MHD__gnutls_partition (MHD_gtls_session_t session, 1545MHD__gnutls_partition (MHD_gtls_session_t session,
1545 void *_base, 1546 void *_base,
1546 size_t nmemb, 1547 size_t nmemb,
1547 size_t size, 1548 size_t size,
1548 int (*compar) (MHD_gtls_session_t, 1549 int (*compar) (MHD_gtls_session_t,
1549 const void *, const void *)) 1550 const void *, const void *))
1550{ 1551{
1551 uint8_t *base = _base; 1552 uint8_t *base = _base;
1552 uint8_t tmp[MAX_ELEM_SIZE]; 1553 uint8_t tmp[MAX_ELEM_SIZE];
@@ -1590,10 +1591,11 @@ MHD__gnutls_partition (MHD_gtls_session_t session,
1590 1591
1591static void 1592static void
1592MHD__gnutls_qsort (MHD_gtls_session_t session, 1593MHD__gnutls_qsort (MHD_gtls_session_t session,
1593 void *_base, 1594 void *_base,
1594 size_t nmemb, 1595 size_t nmemb,
1595 size_t size, 1596 size_t size,
1596 int (*compar) (MHD_gtls_session_t, const void *, const void *)) 1597 int (*compar) (MHD_gtls_session_t, const void *,
1598 const void *))
1597{ 1599{
1598 unsigned int pivot; 1600 unsigned int pivot;
1599 char *base = _base; 1601 char *base = _base;
@@ -1613,9 +1615,9 @@ MHD__gnutls_qsort (MHD_gtls_session_t session,
1613 pivot = MHD__gnutls_partition (session, _base, nmemb, size, compar); 1615 pivot = MHD__gnutls_partition (session, _base, nmemb, size, compar);
1614 1616
1615 MHD__gnutls_qsort (session, base, pivot < nmemb ? pivot + 1 1617 MHD__gnutls_qsort (session, base, pivot < nmemb ? pivot + 1
1616 : pivot, size, compar); 1618 : pivot, size, compar);
1617 MHD__gnutls_qsort (session, &base[(pivot + 1) * size], nmemb - pivot - 1, size, 1619 MHD__gnutls_qsort (session, &base[(pivot + 1) * size], nmemb - pivot - 1,
1618 compar); 1620 size, compar);
1619} 1621}
1620 1622
1621/* a compare function for KX algorithms (using priorities). 1623/* a compare function for KX algorithms (using priorities).
@@ -1623,7 +1625,7 @@ MHD__gnutls_qsort (MHD_gtls_session_t session,
1623 */ 1625 */
1624static int 1626static int
1625MHD__gnutls_compare_algo (MHD_gtls_session_t session, 1627MHD__gnutls_compare_algo (MHD_gtls_session_t session,
1626 const void *i_A1, const void *i_A2) 1628 const void *i_A1, const void *i_A2)
1627{ 1629{
1628 enum MHD_GNUTLS_KeyExchangeAlgorithm kA1 = 1630 enum MHD_GNUTLS_KeyExchangeAlgorithm kA1 =
1629 MHD_gtls_cipher_suite_get_kx_algo ((const cipher_suite_st *) i_A1); 1631 MHD_gtls_cipher_suite_get_kx_algo ((const cipher_suite_st *) i_A1);
@@ -1662,8 +1664,8 @@ MHD__gnutls_compare_algo (MHD_gtls_session_t session,
1662#ifdef SORT_DEBUG 1664#ifdef SORT_DEBUG
1663static void 1665static void
1664MHD__gnutls_bsort (MHD_gtls_session_t session, void *_base, size_t nmemb, 1666MHD__gnutls_bsort (MHD_gtls_session_t session, void *_base, size_t nmemb,
1665 size_t size, int (*compar) (MHD_gtls_session_t, const void *, 1667 size_t size, int (*compar) (MHD_gtls_session_t,
1666 const void *)) 1668 const void *, const void *))
1667{ 1669{
1668 unsigned int i, j; 1670 unsigned int i, j;
1669 int full = nmemb * size; 1671 int full = nmemb * size;
@@ -1704,17 +1706,17 @@ MHD_gtls_supported_ciphersuites_sorted (MHD_gtls_session_t session,
1704 MHD__gnutls_debug_log ("Unsorted: \n"); 1706 MHD__gnutls_debug_log ("Unsorted: \n");
1705 for (i = 0; i < count; i++) 1707 for (i = 0; i < count; i++)
1706 MHD__gnutls_debug_log ("\t%d: %s\n", i, 1708 MHD__gnutls_debug_log ("\t%d: %s\n", i,
1707 MHD_gtls_cipher_suite_get_name ((*ciphers)[i])); 1709 MHD_gtls_cipher_suite_get_name ((*ciphers)[i]));
1708#endif 1710#endif
1709 1711
1710 MHD__gnutls_qsort (session, *ciphers, count, sizeof (cipher_suite_st), 1712 MHD__gnutls_qsort (session, *ciphers, count, sizeof (cipher_suite_st),
1711 MHD__gnutls_compare_algo); 1713 MHD__gnutls_compare_algo);
1712 1714
1713#ifdef SORT_DEBUG 1715#ifdef SORT_DEBUG
1714 MHD__gnutls_debug_log ("Sorted: \n"); 1716 MHD__gnutls_debug_log ("Sorted: \n");
1715 for (i = 0; i < count; i++) 1717 for (i = 0; i < count; i++)
1716 MHD__gnutls_debug_log ("\t%d: %s\n", i, 1718 MHD__gnutls_debug_log ("\t%d: %s\n", i,
1717 MHD_gtls_cipher_suite_get_name ((*ciphers)[i])); 1719 MHD_gtls_cipher_suite_get_name ((*ciphers)[i]));
1718#endif 1720#endif
1719 1721
1720 return count; 1722 return count;
@@ -1832,15 +1834,16 @@ MHD_gtls_supported_compression_methods (MHD_gtls_session_t session,
1832{ 1834{
1833 unsigned int i, j; 1835 unsigned int i, j;
1834 1836
1835 *comp = MHD_gnutls_malloc (sizeof (uint8_t) * SUPPORTED_COMPRESSION_METHODS); 1837 *comp =
1838 MHD_gnutls_malloc (sizeof (uint8_t) * SUPPORTED_COMPRESSION_METHODS);
1836 if (*comp == NULL) 1839 if (*comp == NULL)
1837 return GNUTLS_E_MEMORY_ERROR; 1840 return GNUTLS_E_MEMORY_ERROR;
1838 1841
1839 for (i = j = 0; i < SUPPORTED_COMPRESSION_METHODS; i++) 1842 for (i = j = 0; i < SUPPORTED_COMPRESSION_METHODS; i++)
1840 { 1843 {
1841 int tmp = 1844 int tmp =
1842 MHD_gtls_compression_get_num (session->internals.priorities. 1845 MHD_gtls_compression_get_num (session->internals.
1843 compression.priority[i]); 1846 priorities.compression.priority[i]);
1844 1847
1845 /* remove private compression algorithms, if requested. 1848 /* remove private compression algorithms, if requested.
1846 */ 1849 */