aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/https')
-rw-r--r--src/daemon/https/Makefile.am11
-rw-r--r--src/daemon/https/errcodes131
-rw-r--r--src/daemon/https/errcodes.c24
-rw-r--r--src/daemon/https/includes/extra.h8
-rw-r--r--src/daemon/https/includes/gnutls.h102
-rw-r--r--src/daemon/https/lgl/Makefile.am1
-rw-r--r--src/daemon/https/minitasn1/Makefile.am3
-rw-r--r--src/daemon/https/opencdk/Makefile.am4
-rw-r--r--src/daemon/https/openpgp/Makefile.am3
-rw-r--r--src/daemon/https/tls/Makefile.am5
-rw-r--r--src/daemon/https/tls/defines.h2
-rw-r--r--src/daemon/https/tls/gnutls_global.c41
-rw-r--r--src/daemon/https/tls/gnutls_global.h5
-rw-r--r--src/daemon/https/tls/gnutls_int.h27
-rw-r--r--src/daemon/https/tls/gnutls_str.h4
-rw-r--r--src/daemon/https/x509/Makefile.am3
-rw-r--r--src/daemon/https/x509/x509.h6
17 files changed, 65 insertions, 315 deletions
diff --git a/src/daemon/https/Makefile.am b/src/daemon/https/Makefile.am
index ec37f95b..4725c405 100644
--- a/src/daemon/https/Makefile.am
+++ b/src/daemon/https/Makefile.am
@@ -1,19 +1,18 @@
1SUBDIRS = minitasn1 opencdk openpgp lgl x509 tls . 1SUBDIRS = minitasn1 opencdk openpgp lgl x509 tls .
2 2
3AM_CPPFLAGS = -I./includes \ 3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/include \
5-I$(top_srcdir)/src/daemon/https/tls \
4-I$(top_srcdir)/src/daemon/https/lgl \ 6-I$(top_srcdir)/src/daemon/https/lgl \
5-I$(top_srcdir)/src/daemon/https/x509 \ 7-I$(top_srcdir)/src/daemon/https/x509 \
6-I$(top_srcdir)/src/daemon/https/openpgp \ 8-I$(top_srcdir)/src/daemon/https/openpgp \
7-I$(top_srcdir)/src/daemon/https/opencdk \ 9-I$(top_srcdir)/src/daemon/https/opencdk \
8-I$(top_srcdir)/src/daemon/https/tls \ 10-I$(top_srcdir)/src/daemon/https/includes
9-I$(top_srcdir)/src/daemon/https/includes \
10-I$(top_srcdir)/src/daemon/https/cfg
11 11
12noinst_LTLIBRARIES = libhttps.la 12noinst_LTLIBRARIES = libhttps.la
13 13
14libhttps_la_SOURCES = \ 14libhttps_la_SOURCES = \
15https_common.c \ 15https_common.c
16errcodes.c
17 16
18libhttps_la_LIBADD = \ 17libhttps_la_LIBADD = \
19opencdk/libopencdk.la \ 18opencdk/libopencdk.la \
diff --git a/src/daemon/https/errcodes b/src/daemon/https/errcodes
deleted file mode 100644
index 65774f43..00000000
--- a/src/daemon/https/errcodes
+++ /dev/null
@@ -1,131 +0,0 @@
1#! /bin/sh
2
3# errcodes - temporary wrapper script for .libs/errcodes
4# Generated by ltmain.sh - GNU libtool 1.5.26 Debian 1.5.26-3 (1.1220.2.493 2008/02/01 16:58:18)
5#
6# The errcodes program cannot be directly executed until all the libtool
7# libraries that it depends on are installed.
8#
9# This wrapper script should never be moved out of the build directory.
10# If it is, it will not operate correctly.
11
12# Sed substitution that helps us do robust quoting. It backslashifies
13# metacharacters that are still active within double-quoted strings.
14Xsed='/bin/sed -e 1s/^X//'
15sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
16
17# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
18if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
19 emulate sh
20 NULLCMD=:
21 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
22 # is contrary to our usage. Disable this feature.
23 alias -g '${1+"$@"}'='"$@"'
24 setopt NO_GLOB_SUBST
25else
26 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
27fi
28BIN_SH=xpg4; export BIN_SH # for Tru64
29DUALCASE=1; export DUALCASE # for MKS sh
30
31# The HP-UX ksh and POSIX shell print the target directory to stdout
32# if CDPATH is set.
33(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
34
35relink_command="(cd /home/lama/workbench/programming/c/gnunet/gnutls-2.2.3/src; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z \"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=\"/usr/lib/distcc:/usr/local/bin:/usr/bin:/bin:/usr/games\"; export PATH; gcc -std=gnu99 -g -O2 -D_REENTRANT -D_THREAD_SAFE -pipe -g -O2 -D_REENTRANT -D_THREAD_SAFE -Wno-pointer-sign -o \$progdir/\$file errcodes.o ../lib/.libs/libgnutls.so /usr/lib/libgcrypt.so -L/usr/lib /usr/lib/libtasn1.so -Wl,--rpath -Wl,/home/lama/workbench/programming/c/gnunet/gnutls-2.2.3/lib/.libs -Wl,--rpath -Wl,/home/lama/workbench/programming/c/gnunet/gnutls-2.2.3/build/lib ) "
36
37# This environment variable determines our operation mode.
38if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
39 # install mode needs the following variable:
40 notinst_deplibs=' ../lib/libgnutls.la'
41else
42 # When we are sourced in execute mode, $file and $echo are already set.
43 if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
44 echo="echo"
45 file="$0"
46 # Make sure echo works.
47 if test "X$1" = X--no-reexec; then
48 # Discard the --no-reexec flag, and continue.
49 shift
50 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
51 # Yippee, $echo works!
52 :
53 else
54 # Restart under the correct shell, and then maybe $echo will work.
55 exec /bin/sh "$0" --no-reexec ${1+"$@"}
56 fi
57 fi
58
59 # Find the directory that this script lives in.
60 thisdir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
61 test "x$thisdir" = "x$file" && thisdir=.
62
63 # Follow symbolic links until we get to the real thisdir.
64 file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'`
65 while test -n "$file"; do
66 destdir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
67
68 # If there was a directory component, then change thisdir.
69 if test "x$destdir" != "x$file"; then
70 case "$destdir" in
71 [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
72 *) thisdir="$thisdir/$destdir" ;;
73 esac
74 fi
75
76 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
77 file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'`
78 done
79
80 # Try to get the absolute directory name.
81 absdir=`cd "$thisdir" && pwd`
82 test -n "$absdir" && thisdir="$absdir"
83
84 program=lt-'errcodes'
85 progdir="$thisdir/.libs"
86
87 if test ! -f "$progdir/$program" || \
88 { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \
89 test "X$file" != "X$progdir/$program"; }; then
90
91 file="$$-$program"
92
93 if test ! -d "$progdir"; then
94 mkdir "$progdir"
95 else
96 rm -f "$progdir/$file"
97 fi
98
99 # relink executable if necessary
100 if test -n "$relink_command"; then
101 if relink_command_output=`eval $relink_command 2>&1`; then :
102 else
103 echo "$relink_command_output" >&2
104 rm -f "$progdir/$file"
105 exit 1
106 fi
107 fi
108
109 mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null ||
110 { rm -f "$progdir/$program";
111 mv -f "$progdir/$file" "$progdir/$program"; }
112 rm -f "$progdir/$file"
113 fi
114
115 if test -f "$progdir/$program"; then
116 if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
117 # Run the actual program with our arguments.
118
119 exec "$progdir/$program" ${1+"$@"}
120
121 $echo "$0: cannot exec $program $*"
122 exit 1
123 fi
124 else
125 # The program doesn't exist.
126 $echo "$0: error: \`$progdir/$program' does not exist" 1>&2
127 $echo "This script is just a wrapper for $program." 1>&2
128 echo "See the libtool documentation for more information." 1>&2
129 exit 1
130 fi
131fi
diff --git a/src/daemon/https/errcodes.c b/src/daemon/https/errcodes.c
deleted file mode 100644
index 0177eccc..00000000
--- a/src/daemon/https/errcodes.c
+++ /dev/null
@@ -1,24 +0,0 @@
1#if HAVE_CONFIG_H
2#include "config.h"
3#endif
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <string.h>
8#include <gnutls.h>
9
10const char *_gnutls_strerror (int);
11
12typedef struct
13{
14 char name[128];
15 int error_index;
16} error_name;
17
18static int
19compar (const void *_n1, const void *_n2)
20{
21 const error_name *n1 = (const error_name *) _n1,
22 *n2 = (const error_name *) _n2;
23 return strcmp (n1->name, n2->name);
24}
diff --git a/src/daemon/https/includes/extra.h b/src/daemon/https/includes/extra.h
index ca0cb5b4..0c363259 100644
--- a/src/daemon/https/includes/extra.h
+++ b/src/daemon/https/includes/extra.h
@@ -27,9 +27,9 @@
27 */ 27 */
28 28
29#ifndef GNUTLS_EXTRA_H 29#ifndef GNUTLS_EXTRA_H
30# define GNUTLS_EXTRA_H 30#define GNUTLS_EXTRA_H
31 31
32#include <gnutls.h> 32#include "gnutls.h"
33 33
34#ifdef __cplusplus 34#ifdef __cplusplus
35extern "C" 35extern "C"
@@ -38,7 +38,7 @@ extern "C"
38 38
39#define LIBGNUTLS_EXTRA_VERSION LIBGNUTLS_VERSION 39#define LIBGNUTLS_EXTRA_VERSION LIBGNUTLS_VERSION
40 40
41/* Openpgp certificate stuff 41/* Openpgp certificate stuff
42 */ 42 */
43 43
44 typedef enum gnutls_openpgp_crt_fmt 44 typedef enum gnutls_openpgp_crt_fmt
@@ -175,7 +175,7 @@ extern "C"
175 175
176 int gnutls_global_init_extra (void); 176 int gnutls_global_init_extra (void);
177 177
178/* returns libgnutls-extra version (call it with a NULL argument) 178/* returns libgnutls-extra version (call it with a NULL argument)
179 */ 179 */
180 const char *gnutls_extra_check_version (const char *req_version); 180 const char *gnutls_extra_check_version (const char *req_version);
181 181
diff --git a/src/daemon/https/includes/gnutls.h b/src/daemon/https/includes/gnutls.h
index 5178609b..df34e72c 100644
--- a/src/daemon/https/includes/gnutls.h
+++ b/src/daemon/https/includes/gnutls.h
@@ -32,9 +32,8 @@
32 * gcrypt.h 32 * gcrypt.h
33 */ 33 */
34 34
35
36#ifndef GNUTLS_H 35#ifndef GNUTLS_H
37# define GNUTLS_H 36#define GNUTLS_H
38 37
39#ifdef __cplusplus 38#ifdef __cplusplus
40extern "C" 39extern "C"
@@ -49,8 +48,6 @@ extern "C"
49 48
50#define LIBGNUTLS_VERSION_NUMBER 0x020203 49#define LIBGNUTLS_VERSION_NUMBER 0x020203
51 50
52
53
54/* Get size_t. */ 51/* Get size_t. */
55#include <stddef.h> 52#include <stddef.h>
56/* Get ssize_t. */ 53/* Get ssize_t. */
@@ -67,33 +64,7 @@ extern "C"
67#define GNUTLS_CIPHER_RIJNDAEL_CBC GNUTLS_CIPHER_AES_128_CBC 64#define GNUTLS_CIPHER_RIJNDAEL_CBC GNUTLS_CIPHER_AES_128_CBC
68#define GNUTLS_CIPHER_ARCFOUR GNUTLS_CIPHER_ARCFOUR_128 65#define GNUTLS_CIPHER_ARCFOUR GNUTLS_CIPHER_ARCFOUR_128
69 66
70 typedef enum gnutls_cipher_algorithm 67#include "microhttpsd.h"
71 {
72 GNUTLS_CIPHER_UNKNOWN = 0,
73 GNUTLS_CIPHER_NULL = 1,
74 GNUTLS_CIPHER_ARCFOUR_128,
75 GNUTLS_CIPHER_3DES_CBC,
76 GNUTLS_CIPHER_AES_128_CBC,
77 GNUTLS_CIPHER_AES_256_CBC,
78 GNUTLS_CIPHER_ARCFOUR_40,
79 GNUTLS_CIPHER_CAMELLIA_128_CBC,
80 GNUTLS_CIPHER_CAMELLIA_256_CBC,
81 GNUTLS_CIPHER_RC2_40_CBC = 90,
82 GNUTLS_CIPHER_DES_CBC
83 } gnutls_cipher_algorithm_t;
84
85 typedef enum
86 {
87 GNUTLS_KX_UNKNOWN = 0,
88 GNUTLS_KX_RSA = 1,
89 GNUTLS_KX_DHE_DSS,
90 GNUTLS_KX_DHE_RSA,
91 GNUTLS_KX_ANON_DH,
92 GNUTLS_KX_SRP,
93 GNUTLS_KX_RSA_EXPORT,
94 GNUTLS_KX_SRP_RSA,
95 GNUTLS_KX_SRP_DSS,
96 } gnutls_kx_algorithm_t;
97 68
98 typedef enum 69 typedef enum
99 { 70 {
@@ -101,57 +72,16 @@ extern "C"
101 GNUTLS_PARAMS_DH 72 GNUTLS_PARAMS_DH
102 } gnutls_params_type_t; 73 } gnutls_params_type_t;
103 74
104 typedef enum 75/* TODO clean
105 {
106 GNUTLS_CRD_CERTIFICATE = 1,
107 GNUTLS_CRD_ANON,
108 GNUTLS_CRD_SRP,
109 GNUTLS_CRD_PSK,
110 GNUTLS_CRD_IA
111 } gnutls_credentials_type_t;
112
113#define GNUTLS_MAC_SHA GNUTLS_MAC_SHA1 76#define GNUTLS_MAC_SHA GNUTLS_MAC_SHA1
114#define GNUTLS_DIG_SHA GNUTLS_DIG_SHA1 77#define GNUTLS_DIG_SHA GNUTLS_DIG_SHA1
115 78*/
116 typedef enum
117 {
118 GNUTLS_MAC_UNKNOWN = 0,
119 GNUTLS_MAC_NULL = 1,
120 GNUTLS_MAC_MD5,
121 GNUTLS_MAC_SHA1,
122 //GNUTLS_MAC_RMD160,
123 //GNUTLS_MAC_MD2,
124 GNUTLS_MAC_SHA256,
125 //GNUTLS_MAC_SHA384,
126 //GNUTLS_MAC_SHA512
127 } gnutls_mac_algorithm_t;
128
129 /* The enumerations here should have the same value with
130 gnutls_mac_algorithm_t.
131 */
132 typedef enum
133 {
134 GNUTLS_DIG_NULL = GNUTLS_MAC_NULL,
135 GNUTLS_DIG_MD5 = GNUTLS_MAC_MD5,
136 GNUTLS_DIG_SHA1 = GNUTLS_MAC_SHA1,
137 GNUTLS_DIG_SHA256 = GNUTLS_MAC_SHA256,
138 } gnutls_digest_algorithm_t;
139 79
140 /* exported for other gnutls headers. This is the maximum number of 80 /* exported for other gnutls headers. This is the maximum number of
141 * algorithms (ciphers, kx or macs). 81 * algorithms (ciphers, kx or macs).
142 */ 82 */
143#define GNUTLS_MAX_ALGORITHM_NUM 16 83#define GNUTLS_MAX_ALGORITHM_NUM 16
144
145#define GNUTLS_COMP_ZLIB GNUTLS_COMP_DEFLATE 84#define GNUTLS_COMP_ZLIB GNUTLS_COMP_DEFLATE
146 typedef enum
147 {
148 GNUTLS_COMP_UNKNOWN = 0,
149 GNUTLS_COMP_NULL = 1,
150 GNUTLS_COMP_DEFLATE,
151 GNUTLS_COMP_LZO /* only available if gnutls-extra has
152 been initialized
153 */
154 } gnutls_compression_method_t;
155 85
156 typedef enum 86 typedef enum
157 { 87 {
@@ -251,36 +181,12 @@ extern "C"
251 GNUTLS_SHUT_WR = 1 181 GNUTLS_SHUT_WR = 1
252 } gnutls_close_request_t; 182 } gnutls_close_request_t;
253 183
254#define GNUTLS_TLS1 GNUTLS_TLS1_0
255 typedef enum
256 {
257 GNUTLS_SSL3 = 1,
258 GNUTLS_TLS1_0,
259 GNUTLS_TLS1_1,
260 GNUTLS_TLS1_2,
261 GNUTLS_VERSION_UNKNOWN = 0xff
262 } gnutls_protocol_t;
263
264 typedef enum
265 {
266 GNUTLS_CRT_UNKNOWN = 0,
267 GNUTLS_CRT_X509 = 1,
268 GNUTLS_CRT_OPENPGP
269 } gnutls_certificate_type_t;
270
271 typedef enum 184 typedef enum
272 { 185 {
273 GNUTLS_X509_FMT_DER, 186 GNUTLS_X509_FMT_DER,
274 GNUTLS_X509_FMT_PEM 187 GNUTLS_X509_FMT_PEM
275 } gnutls_x509_crt_fmt_t; 188 } gnutls_x509_crt_fmt_t;
276 189
277 typedef enum
278 {
279 GNUTLS_PK_UNKNOWN = 0,
280 GNUTLS_PK_RSA = 1,
281 //GNUTLS_PK_DSA
282 } gnutls_pk_algorithm_t;
283
284 const char *gnutls_pk_algorithm_get_name (gnutls_pk_algorithm_t algorithm); 190 const char *gnutls_pk_algorithm_get_name (gnutls_pk_algorithm_t algorithm);
285 191
286#define GNUTLS_SIGN_RSA_SHA GNUTLS_SIGN_RSA_SHA1 192#define GNUTLS_SIGN_RSA_SHA GNUTLS_SIGN_RSA_SHA1
diff --git a/src/daemon/https/lgl/Makefile.am b/src/daemon/https/lgl/Makefile.am
index 1edb75ae..ff8d1856 100644
--- a/src/daemon/https/lgl/Makefile.am
+++ b/src/daemon/https/lgl/Makefile.am
@@ -1,6 +1,7 @@
1SUBDIRS = . 1SUBDIRS = .
2 2
3AM_CPPFLAGS = -std=c99 \ 3AM_CPPFLAGS = -std=c99 \
4-I$(top_srcdir)/src/include \
4-I$(GCRYPT_CPPFLAGS) 5-I$(GCRYPT_CPPFLAGS)
5 6
6# gc-gnulib.c 7# gc-gnulib.c
diff --git a/src/daemon/https/minitasn1/Makefile.am b/src/daemon/https/minitasn1/Makefile.am
index fc924cc4..6c58730d 100644
--- a/src/daemon/https/minitasn1/Makefile.am
+++ b/src/daemon/https/minitasn1/Makefile.am
@@ -1,5 +1,6 @@
1 1
2AM_CPPFLAGS = -I./includes \ 2AM_CPPFLAGS = \
3-I$(top_srcdir)/src/include \
3-I$(top_srcdir)/src/daemon/https/lgl \ 4-I$(top_srcdir)/src/daemon/https/lgl \
4-I$(top_srcdir)/src/daemon/https/tls \ 5-I$(top_srcdir)/src/daemon/https/tls \
5-I$(top_srcdir)/src/daemon/https/includes 6-I$(top_srcdir)/src/daemon/https/includes
diff --git a/src/daemon/https/opencdk/Makefile.am b/src/daemon/https/opencdk/Makefile.am
index b69a151f..b6e67470 100644
--- a/src/daemon/https/opencdk/Makefile.am
+++ b/src/daemon/https/opencdk/Makefile.am
@@ -1,4 +1,6 @@
1AM_CPPFLAGS = -I$(top_srcdir)/lib \ 1AM_CPPFLAGS = \
2-I$(top_srcdir)/src/include \
3-I$(top_srcdir)/lib \
2-I$(top_srcdir)/lgl \ 4-I$(top_srcdir)/lgl \
3-I$(GCRYPT_CPPFLAGS) 5-I$(GCRYPT_CPPFLAGS)
4 6
diff --git a/src/daemon/https/openpgp/Makefile.am b/src/daemon/https/openpgp/Makefile.am
index 94c27ac1..66380444 100644
--- a/src/daemon/https/openpgp/Makefile.am
+++ b/src/daemon/https/openpgp/Makefile.am
@@ -1,6 +1,7 @@
1SUBDIRS = . 1SUBDIRS = .
2 2
3AM_CPPFLAGS = -I./includes \ 3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/include \
4-I$(top_srcdir)/src/daemon/https/includes \ 5-I$(top_srcdir)/src/daemon/https/includes \
5-I$(top_srcdir)/src/daemon/https/lgl \ 6-I$(top_srcdir)/src/daemon/https/lgl \
6-I$(top_srcdir)/src/daemon/https/x509 \ 7-I$(top_srcdir)/src/daemon/https/x509 \
diff --git a/src/daemon/https/tls/Makefile.am b/src/daemon/https/tls/Makefile.am
index ca847aa2..ceecb1ba 100644
--- a/src/daemon/https/tls/Makefile.am
+++ b/src/daemon/https/tls/Makefile.am
@@ -1,12 +1,13 @@
1SUBDIRS = . 1SUBDIRS = .
2 2
3AM_CPPFLAGS = \ 3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/daemon/https/includes \ 4-I$(top_srcdir)/src/include \
5-I$(top_srcdir)/src/daemon/https/tls \
5-I$(top_srcdir)/src/daemon/https/lgl \ 6-I$(top_srcdir)/src/daemon/https/lgl \
6-I$(top_srcdir)/src/daemon/https/x509 \ 7-I$(top_srcdir)/src/daemon/https/x509 \
7-I$(top_srcdir)/src/daemon/https/tls \
8-I$(top_srcdir)/src/daemon/https/openpgp \ 8-I$(top_srcdir)/src/daemon/https/openpgp \
9-I$(top_srcdir)/src/daemon/https/opencdk \ 9-I$(top_srcdir)/src/daemon/https/opencdk \
10-I$(top_srcdir)/src/daemon/https/includes \
10-I$(GCRYPT_CPPFLAGS) 11-I$(GCRYPT_CPPFLAGS)
11 12
12noinst_LTLIBRARIES = libtls.la 13noinst_LTLIBRARIES = libtls.la
diff --git a/src/daemon/https/tls/defines.h b/src/daemon/https/tls/defines.h
index a53ce2e4..43e96766 100644
--- a/src/daemon/https/tls/defines.h
+++ b/src/daemon/https/tls/defines.h
@@ -48,7 +48,7 @@ typedef int ssize_t;
48#include <sys/socket.h> 48#include <sys/socket.h>
49#include <time.h> 49#include <time.h>
50 50
51// TODO check if these should go into config.h 51/* TODO check if these should go into config.h */
52#define SIZEOF_UNSIGNED_INT 4 52#define SIZEOF_UNSIGNED_INT 4
53#define SIZEOF_UNSIGNED_LONG 8 53#define SIZEOF_UNSIGNED_LONG 8
54#define SIZEOF_UNSIGNED_LONG_INT SIZEOF_UNSIGNED_LONG 54#define SIZEOF_UNSIGNED_LONG_INT SIZEOF_UNSIGNED_LONG
diff --git a/src/daemon/https/tls/gnutls_global.c b/src/daemon/https/tls/gnutls_global.c
index 822293ac..d244213e 100644
--- a/src/daemon/https/tls/gnutls_global.c
+++ b/src/daemon/https/tls/gnutls_global.c
@@ -60,10 +60,10 @@ ASN1_TYPE _gnutls_gnutls_asn;
60 * 60 *
61 * This is the function where you set the logging function gnutls 61 * This is the function where you set the logging function gnutls
62 * is going to use. This function only accepts a character array. 62 * is going to use. This function only accepts a character array.
63 * Normally you may not use this function since it is only used 63 * Normally you may not use this function since it is only used
64 * for debugging purposes. 64 * for debugging purposes.
65 * 65 *
66 * gnutls_log_func is of the form, 66 * gnutls_log_func is of the form,
67 * void (*gnutls_log_func)( int level, const char*); 67 * void (*gnutls_log_func)( int level, const char*);
68 **/ 68 **/
69void 69void
@@ -74,7 +74,7 @@ gnutls_global_set_log_function (gnutls_log_func log_func)
74 74
75/** 75/**
76 * gnutls_global_set_log_level - This function sets the logging level 76 * gnutls_global_set_log_level - This function sets the logging level
77 * @level: it's an integer from 0 to 9. 77 * @level: it's an integer from 0 to 9.
78 * 78 *
79 * This is the function that allows you to set the log level. 79 * This is the function that allows you to set the log level.
80 * The level is an integer between 0 and 9. Higher values mean 80 * The level is an integer between 0 and 9. Higher values mean
@@ -90,15 +90,6 @@ gnutls_global_set_log_level (int level)
90 _gnutls_log_level = level; 90 _gnutls_log_level = level;
91} 91}
92 92
93#ifdef DEBUG
94/* default logging function */
95static void
96dlog (int level, const char *str)
97{
98 fputs (str, stderr);
99}
100#endif
101
102extern gnutls_alloc_function gnutls_secure_malloc; 93extern gnutls_alloc_function gnutls_secure_malloc;
103extern gnutls_alloc_function gnutls_malloc; 94extern gnutls_alloc_function gnutls_malloc;
104extern gnutls_free_function gnutls_free; 95extern gnutls_free_function gnutls_free;
@@ -121,7 +112,7 @@ int _gnutls_is_secure_mem_null (const void *);
121 * is going to use. By default the libc's allocation functions (malloc(), free()), 112 * is going to use. By default the libc's allocation functions (malloc(), free()),
122 * are used by gnutls, to allocate both sensitive and not sensitive data. 113 * are used by gnutls, to allocate both sensitive and not sensitive data.
123 * This function is provided to set the memory allocation functions to 114 * This function is provided to set the memory allocation functions to
124 * something other than the defaults (ie the gcrypt allocation functions). 115 * something other than the defaults (ie the gcrypt allocation functions).
125 * 116 *
126 * This function must be called before gnutls_global_init() is called. 117 * This function must be called before gnutls_global_init() is called.
127 * 118 *
@@ -182,7 +173,7 @@ static int _gnutls_init = 0;
182 * 173 *
183 * Note that this function will also initialize libgcrypt, if it has not 174 * Note that this function will also initialize libgcrypt, if it has not
184 * been initialized before. Thus if you want to manually initialize libgcrypt 175 * been initialized before. Thus if you want to manually initialize libgcrypt
185 * you must do it before calling this function. This is useful in cases you 176 * you must do it before calling this function. This is useful in cases you
186 * want to disable libgcrypt's internal lockings etc. 177 * want to disable libgcrypt's internal lockings etc.
187 * 178 *
188 * This function increment a global counter, so that 179 * This function increment a global counter, so that
@@ -209,7 +200,7 @@ gnutls_global_init (void)
209 char c; 200 char c;
210 201
211 if (_gnutls_init++) 202 if (_gnutls_init++)
212 return; 203 return 0;
213 204
214#if HAVE_WINSOCK 205#if HAVE_WINSOCK
215 { 206 {
@@ -235,7 +226,6 @@ gnutls_global_init (void)
235 } 226 }
236#endif 227#endif
237 228
238
239 // bindtextdomain("mhd", "./"); 229 // bindtextdomain("mhd", "./");
240 230
241 if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P) == 0) 231 if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P) == 0)
@@ -285,14 +275,13 @@ gnutls_global_init (void)
285 } 275 }
286 276
287#ifdef DEBUG 277#ifdef DEBUG
288 gnutls_global_set_log_function (dlog); 278 gnutls_global_set_log_function (MHD_tls_log_func());
289#endif 279#endif
290 280
291 /* initialize parser 281 /* initialize parser
292 * This should not deal with files in the final 282 * This should not deal with files in the final
293 * version. 283 * version.
294 */ 284 */
295
296 res = asn1_array2tree(pkix_asn1_tab, &_gnutls_pkix1_asn, NULL); 285 res = asn1_array2tree(pkix_asn1_tab, &_gnutls_pkix1_asn, NULL);
297 if (res != ASN1_SUCCESS) 286 if (res != ASN1_SUCCESS)
298 { 287 {
@@ -315,7 +304,7 @@ gnutls_global_init (void)
315} 304}
316 305
317/** 306/**
318 * gnutls_global_deinit - This function deinitializes the global data 307 * gnutls_global_deinit - This function deinitializes the global data
319 * 308 *
320 * This function deinitializes the global data, that were initialized 309 * This function deinitializes the global data, that were initialized
321 * using gnutls_global_init(). 310 * using gnutls_global_init().
@@ -339,7 +328,7 @@ gnutls_global_deinit (void)
339 _gnutls_init--; 328 _gnutls_init--;
340} 329}
341 330
342/* These functions should be elsewere. Kept here for 331/* These functions should be elsewere. Kept here for
343 * historical reasons. 332 * historical reasons.
344 */ 333 */
345 334
@@ -348,12 +337,12 @@ gnutls_global_deinit (void)
348 * @pull_func: a callback function similar to read() 337 * @pull_func: a callback function similar to read()
349 * @session: gnutls session 338 * @session: gnutls session
350 * 339 *
351 * This is the function where you set a function for gnutls 340 * This is the function where you set a function for gnutls
352 * to receive data. Normally, if you use berkeley style sockets, 341 * to receive data. Normally, if you use berkeley style sockets,
353 * do not need to use this function since the default (recv(2)) will 342 * do not need to use this function since the default (recv(2)) will
354 * probably be ok. 343 * probably be ok.
355 * 344 *
356 * PULL_FUNC is of the form, 345 * PULL_FUNC is of the form,
357 * ssize_t (*gnutls_pull_func)(gnutls_transport_ptr_t, void*, size_t); 346 * ssize_t (*gnutls_pull_func)(gnutls_transport_ptr_t, void*, size_t);
358 **/ 347 **/
359void 348void
@@ -373,8 +362,8 @@ gnutls_transport_set_pull_function (gnutls_session_t session,
373 * sockets, you do not need to use this function since 362 * sockets, you do not need to use this function since
374 * the default (send(2)) will probably be ok. Otherwise you should 363 * the default (send(2)) will probably be ok. Otherwise you should
375 * specify this function for gnutls to be able to send data. 364 * specify this function for gnutls to be able to send data.
376 * 365 *
377 * PUSH_FUNC is of the form, 366 * PUSH_FUNC is of the form,
378 * ssize_t (*gnutls_push_func)(gnutls_transport_ptr_t, const void*, size_t); 367 * ssize_t (*gnutls_push_func)(gnutls_transport_ptr_t, const void*, size_t);
379 **/ 368 **/
380void 369void
diff --git a/src/daemon/https/tls/gnutls_global.h b/src/daemon/https/tls/gnutls_global.h
index 3305ebad..05026a70 100644
--- a/src/daemon/https/tls/gnutls_global.h
+++ b/src/daemon/https/tls/gnutls_global.h
@@ -27,12 +27,15 @@
27 27
28#include <libtasn1.h> 28#include <libtasn1.h>
29 29
30/* this mutex is used to synchronize threads attemting call gnutls_global_init / gnutls_global_deinit */
31pthread_mutex_t gnutls_init_mutex;
32
30int gnutls_is_secure_memory (const void *mem); 33int gnutls_is_secure_memory (const void *mem);
31 34
32extern ASN1_TYPE _gnutls_pkix1_asn; 35extern ASN1_TYPE _gnutls_pkix1_asn;
33extern ASN1_TYPE _gnutls_gnutls_asn; 36extern ASN1_TYPE _gnutls_gnutls_asn;
34 37
35/* removed const from node_asn* to 38/* removed const from node_asn* to
36 * prevent warnings, since libtasn1 doesn't 39 * prevent warnings, since libtasn1 doesn't
37 * use the const keywork in its functions. 40 * use the const keywork in its functions.
38 */ 41 */
diff --git a/src/daemon/https/tls/gnutls_int.h b/src/daemon/https/tls/gnutls_int.h
index c1e501a0..1bd6205d 100644
--- a/src/daemon/https/tls/gnutls_int.h
+++ b/src/daemon/https/tls/gnutls_int.h
@@ -23,12 +23,13 @@
23 */ 23 */
24 24
25#ifndef GNUTLS_INT_H 25#ifndef GNUTLS_INT_H
26
27#define GNUTLS_INT_H 26#define GNUTLS_INT_H
28 27
29#include <defines.h> 28#include <defines.h>
30 29
31#include "gnutls.h" 30#include "gnutls.h"
31#include "microhttpsd.h"
32
32#include "extra.h" 33#include "extra.h"
33#include "gnutls_mem.h" 34#include "gnutls_mem.h"
34 35
@@ -36,6 +37,8 @@
36 */ 37 */
37#define KEYRING_HACK 38#define KEYRING_HACK
38 39
40#define MAX(X,Y) ((X) > (Y) ? (X) : (Y));
41
39#define MAX32 4294967295 42#define MAX32 4294967295
40#define MAX24 16777215 43#define MAX24 16777215
41#define MAX16 65535 44#define MAX16 65535
@@ -49,7 +52,7 @@
49#define TLS_MAX_SESSION_ID_SIZE 32 52#define TLS_MAX_SESSION_ID_SIZE 32
50#define TLS_MASTER_SIZE 48 53#define TLS_MASTER_SIZE 48
51 54
52/* The maximum digest size of hash algorithms. 55/* The maximum digest size of hash algorithms.
53 */ 56 */
54#define MAX_HASH_SIZE 64 57#define MAX_HASH_SIZE 64
55 58
@@ -112,7 +115,7 @@ typedef struct
112#include <gnutls_mpi.h> 115#include <gnutls_mpi.h>
113 116
114typedef enum change_cipher_spec_t 117typedef enum change_cipher_spec_t
115 { 118 {
116 GNUTLS_TYPE_CHANGE_CIPHER_SPEC = 1 119 GNUTLS_TYPE_CHANGE_CIPHER_SPEC = 1
117 } change_cipher_spec_t; 120 } change_cipher_spec_t;
118 121
@@ -176,7 +179,7 @@ typedef struct auth_cred_st
176 { 179 {
177 gnutls_credentials_type_t algorithm; 180 gnutls_credentials_type_t algorithm;
178 181
179 /* the type of credentials depends on algorithm 182 /* the type of credentials depends on algorithm
180 */ 183 */
181 void *credentials; 184 void *credentials;
182 struct auth_cred_st *next; 185 struct auth_cred_st *next;
@@ -202,9 +205,9 @@ struct gnutls_key_st
202 */ 205 */
203 mpi_t rsa[2]; 206 mpi_t rsa[2];
204 207
205 /* this is used to hold the peers authentication data 208 /* this is used to hold the peers authentication data
206 */ 209 */
207 /* auth_info_t structures SHOULD NOT contain malloced 210 /* auth_info_t structures SHOULD NOT contain malloced
208 * elements. Check gnutls_session_pack.c, and gnutls_auth.c. 211 * elements. Check gnutls_session_pack.c, and gnutls_auth.c.
209 * Rememember that this should be calloced! 212 * Rememember that this should be calloced!
210 */ 213 */
@@ -287,13 +290,13 @@ typedef enum tls_ext_parse_type_t
287 EXTENSION_TLS 290 EXTENSION_TLS
288 } tls_ext_parse_type_t; 291 } tls_ext_parse_type_t;
289 292
290/* auth_info_t structures now MAY contain malloced 293/* auth_info_t structures now MAY contain malloced
291 * elements. 294 * elements.
292 */ 295 */
293 296
294/* This structure and auth_info_t, are stored in the resume database, 297/* This structure and auth_info_t, are stored in the resume database,
295 * and are restored, in case of resume. 298 * and are restored, in case of resume.
296 * Holds all the required parameters to resume the current 299 * Holds all the required parameters to resume the current
297 * session. 300 * session.
298 */ 301 */
299 302
@@ -321,7 +324,7 @@ typedef struct
321 gnutls_mac_algorithm_t write_mac_algorithm; 324 gnutls_mac_algorithm_t write_mac_algorithm;
322 gnutls_compression_method_t write_compression_algorithm; 325 gnutls_compression_method_t write_compression_algorithm;
323 326
324 /* this is the ciphersuite we are going to use 327 /* this is the ciphersuite we are going to use
325 * moved here from internals in order to be restored 328 * moved here from internals in order to be restored
326 * on resume; 329 * on resume;
327 */ 330 */
@@ -511,7 +514,7 @@ typedef struct
511 514
512 /* this is the highest version available 515 /* this is the highest version available
513 * to the peer. (advertized version). 516 * to the peer. (advertized version).
514 * This is obtained by the Handshake Client Hello 517 * This is obtained by the Handshake Client Hello
515 * message. (some implementations read the Record version) 518 * message. (some implementations read the Record version)
516 */ 519 */
517 uint8_t adv_version_major; 520 uint8_t adv_version_major;
@@ -523,8 +526,8 @@ typedef struct
523 */ 526 */
524 int send_cert_req; 527 int send_cert_req;
525 528
526 /* bits to use for DHE and DHA 529 /* bits to use for DHE and DHA
527 * use _gnutls_dh_get_prime_bits() and gnutls_dh_set_prime_bits() 530 * use _gnutls_dh_get_prime_bits() and gnutls_dh_set_prime_bits()
528 * to access it. 531 * to access it.
529 */ 532 */
530 uint16_t dh_prime_bits; 533 uint16_t dh_prime_bits;
diff --git a/src/daemon/https/tls/gnutls_str.h b/src/daemon/https/tls/gnutls_str.h
index c805d70f..62415557 100644
--- a/src/daemon/https/tls/gnutls_str.h
+++ b/src/daemon/https/tls/gnutls_str.h
@@ -23,12 +23,10 @@
23 */ 23 */
24 24
25#ifndef GNUTLS_STR_H 25#ifndef GNUTLS_STR_H
26# define GNUTLS_STR_H 26#define GNUTLS_STR_H
27 27
28#include <gnutls_int.h> 28#include <gnutls_int.h>
29 29
30#define MAX(X,Y) ((X) > (Y) ? (X) : (Y));
31
32void _gnutls_str_cpy (char *dest, size_t dest_tot_size, const char *src); 30void _gnutls_str_cpy (char *dest, size_t dest_tot_size, const char *src);
33void _gnutls_mem_cpy (char *dest, size_t dest_tot_size, const char *src, 31void _gnutls_mem_cpy (char *dest, size_t dest_tot_size, const char *src,
34 size_t src_size); 32 size_t src_size);
diff --git a/src/daemon/https/x509/Makefile.am b/src/daemon/https/x509/Makefile.am
index c3a30f03..6121dd51 100644
--- a/src/daemon/https/x509/Makefile.am
+++ b/src/daemon/https/x509/Makefile.am
@@ -1,5 +1,6 @@
1 1
2AM_CPPFLAGS = -I./includes \ 2AM_CPPFLAGS = \
3-I$(top_srcdir)/src/include \
3-I$(top_srcdir)/src/daemon/https/includes \ 4-I$(top_srcdir)/src/daemon/https/includes \
4-I$(top_srcdir)/src/daemon/https/minitasn1 \ 5-I$(top_srcdir)/src/daemon/https/minitasn1 \
5-I$(top_srcdir)/src/daemon/https/lgl \ 6-I$(top_srcdir)/src/daemon/https/lgl \
diff --git a/src/daemon/https/x509/x509.h b/src/daemon/https/x509/x509.h
index c9bb22ef..8cef1d30 100644
--- a/src/daemon/https/x509/x509.h
+++ b/src/daemon/https/x509/x509.h
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#ifndef X509_H 25#ifndef X509_H
26# define X509_H 26#define X509_H
27 27
28#define MIN(X,Y) ((X) > (Y) ? (Y) : (X)); 28#define MIN(X,Y) ((X) > (Y) ? (Y) : (X));
29 29
@@ -781,8 +781,8 @@ typedef struct gnutls_x509_crt_int
781 781
782typedef struct gnutls_x509_privkey_int 782typedef struct gnutls_x509_privkey_int
783 { 783 {
784 mpi_t params[MAX_PRIV_PARAMS_SIZE]; /* the size of params depends on the public 784 mpi_t params[MAX_PRIV_PARAMS_SIZE]; /* the size of params depends on the public
785 * key algorithm 785 * key algorithm
786 */ 786 */
787 /* 787 /*
788 * RSA: [0] is modulus 788 * RSA: [0] is modulus