about summary refs log tree commit diff stats
path: root/WWW/Library
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2008-04-27 23:12:06 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2008-04-27 23:12:06 -0400
commit55e20c790925b61bc9ac0e37ce15950287b813cb (patch)
tree969622be9fe875c82294152e862885d59c9ee1d6 /WWW/Library
parent2390cc3bb37823e05c0c8ef94d601acdfa5ffc50 (diff)
downloadlynx-snapshots-55e20c790925b61bc9ac0e37ce15950287b813cb.tar.gz
snapshot of project "lynx", label v2-8-7dev_8c
Diffstat (limited to 'WWW/Library')
-rw-r--r--WWW/Library/Implementation/HTGopher.c6
-rw-r--r--WWW/Library/Implementation/HTTP.c6
-rw-r--r--WWW/Library/Implementation/HTUtils.h7
-rw-r--r--WWW/Library/Implementation/tidy_tls.h138
4 files changed, 151 insertions, 6 deletions
diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c
index b9bdeb48..0b284be8 100644
--- a/WWW/Library/Implementation/HTGopher.c
+++ b/WWW/Library/Implementation/HTGopher.c
@@ -1,4 +1,7 @@
-/*			GOPHER ACCESS				HTGopher.c
+/*
+ * $LynxId: HTGopher.c,v 1.43 2008/03/17 00:03:23 tom Exp $
+ *
+ *			GOPHER ACCESS				HTGopher.c
  *			=============
  *
  *  History:
@@ -244,6 +247,7 @@ static void parse_menu(const char *arg GCC_UNUSED,
     END(HTML_H1);
     PUTC('\n');
     START(HTML_PRE);
+    PUTC('\n');			/* newline after HTML_PRE forces split-line */
     while ((ich = NEXT_CHAR) != EOF) {
 
 	if (interrupted_in_htgetcharacter) {
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index 1dee86c5..8fb37a13 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTP.c,v 1.91 2008/02/17 19:36:08 Zdenek.Prikryl Exp $
+ * $LynxId: HTTP.c,v 1.94 2008/04/27 17:05:55 tom Exp $
  *
  * HyperText Tranfer Protocol	- Client implementation		HTTP.c
  * ==========================
@@ -452,7 +452,7 @@ static BOOL acceptEncoding(int code)
 #ifdef USE_SSL
 static void show_cert_issuer(X509 * peer_cert GCC_UNUSED)
 {
-#if defined(USE_OPENSSL_INCL)
+#if defined(USE_OPENSSL_INCL) || defined(USE_GNUTLS_FUNCS)
     char ssl_dn[1024];
     char *msg = NULL;
 
@@ -461,7 +461,7 @@ static void show_cert_issuer(X509 * peer_cert GCC_UNUSED)
     _HTProgress(msg);
     FREE(msg);
 #elif defined(USE_GNUTLS_INCL)
-    /* the OpenSSL code compiles but dumps core with GNU TLS */
+    /* the OpenSSL "compat" code compiles but dumps core with GNU TLS */
 #endif
 }
 #endif
diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h
index b30dac2d..3d8b0dd6 100644
--- a/WWW/Library/Implementation/HTUtils.h
+++ b/WWW/Library/Implementation/HTUtils.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTUtils.h,v 1.78 2008/02/17 19:36:08 Zdenek.Prikryl Exp $
+ * $LynxId: HTUtils.h,v 1.79 2008/04/13 14:43:32 tom Exp $
  *
  * Utility macros for the W3 code library
  * MACROS FOR GENERAL USE
@@ -613,7 +613,10 @@ extern int WWW_TraceMask;
 
 #else
 
-#ifdef USE_GNUTLS_INCL
+#if defined(USE_GNUTLS_FUNCS)
+#include <tidy_tls.h>
+#define USE_GNUTLS_INCL 1		/* do this for the ".c" ifdef's */
+#elif defined(USE_GNUTLS_INCL)
 #include <gnutls/openssl.h>
 /*
  * GNUTLS's implementation of OpenSSL is very incomplete and rudimentary.
diff --git a/WWW/Library/Implementation/tidy_tls.h b/WWW/Library/Implementation/tidy_tls.h
new file mode 100644
index 00000000..04d3f681
--- /dev/null
+++ b/WWW/Library/Implementation/tidy_tls.h
@@ -0,0 +1,138 @@
+/*
+ * $LynxId: tidy_tls.h,v 1.1 2008/04/27 22:50:39 tom Exp $
+ * Copyright 2008, Thomas E. Dickey
+ */
+#ifndef TIDY_TLS_H
+#define TIDY_TLS_H
+
+#include <gnutls/gnutls.h>
+
+#define OPENSSL_VERSION_NUMBER (0x0090604F)
+#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
+
+#define SSLeay_add_ssl_algorithms()   SSL_library_init()
+
+#define SSL_ST_OK       (1)
+
+#define SSL_OP_ALL      (0x000FFFFF)
+#define SSL_OP_NO_SSLv2 (0x00100000)
+#define SSL_OP_NO_SSLv3 (0x00200000)
+#define SSL_OP_NO_TLSv1 (0x00400000)
+
+#define SSL_get_cipher_name(ssl)    SSL_CIPHER_get_name(SSL_get_current_cipher(ssl))
+#define SSL_get_cipher(ssl)         SSL_get_cipher_name(ssl)
+#define SSL_get_cipher_bits(ssl,bp) SSL_CIPHER_get_bits(SSL_get_current_cipher(ssl),(bp))
+#define SSL_get_cipher_version(ssl) SSL_CIPHER_get_version(SSL_get_current_cipher(ssl))
+
+#define TIDY_TLS_BUFSIZE 256
+
+typedef struct {
+    char common_name[TIDY_TLS_BUFSIZE];
+    char country[TIDY_TLS_BUFSIZE];
+    char email[TIDY_TLS_BUFSIZE];
+    char locality_name[TIDY_TLS_BUFSIZE];
+    char organization[TIDY_TLS_BUFSIZE];
+    char organizational_unit_name[TIDY_TLS_BUFSIZE];
+    char state_or_province_name[TIDY_TLS_BUFSIZE];
+} X509_NAME;
+
+typedef struct _SSL SSL;
+
+typedef gnutls_datum_t X509;
+
+typedef struct {
+    gnutls_connection_end_t connend;
+    struct {
+	int protocol[GNUTLS_MAX_ALGORITHM_NUM];
+	int encrypts[GNUTLS_MAX_ALGORITHM_NUM];
+	int compress[GNUTLS_MAX_ALGORITHM_NUM];
+	int key_xchg[GNUTLS_MAX_ALGORITHM_NUM];
+	int msg_code[GNUTLS_MAX_ALGORITHM_NUM];
+    } priority;
+} SSL_METHOD;
+
+typedef struct {
+    SSL *ssl;
+    int error;
+    const gnutls_datum_t *cert_list;
+#define current_cert cert_list
+} X509_STORE_CTX;
+
+typedef struct {
+    gnutls_certificate_type_t cert;
+    gnutls_cipher_algorithm_t encrypts;
+    gnutls_compression_method_t compress;
+    gnutls_kx_algorithm_t key_xchg;
+    gnutls_mac_algorithm_t msg_code;
+    gnutls_protocol_t protocol;
+} SSL_CIPHER;
+
+typedef struct _SSL_CTX {
+    SSL_METHOD *method;
+    char *certfile;
+    int certfile_type;
+    char *keyfile;
+    int keyfile_type;
+    unsigned long options;
+
+    int (*verify_callback) (int, X509_STORE_CTX *);
+    int verify_mode;
+
+} SSL_CTX;
+
+struct _SSL {
+    gnutls_session_t gnutls_state;
+
+    gnutls_certificate_client_credentials gnutls_cred;
+
+    SSL_CTX *ctx;
+    SSL_CIPHER ciphersuite;
+
+    int last_error;
+    int shutdown;
+    int state;
+    unsigned long options;
+
+    int (*verify_callback) (int, X509_STORE_CTX *);
+    int verify_mode;
+
+    gnutls_transport_ptr_t rfd;
+    gnutls_transport_ptr_t wfd;
+};
+
+/* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options
+ * are 'ored' with SSL_VERIFY_PEER if they are desired */
+#define SSL_VERIFY_PEER			0x01
+
+extern SSL *SSL_new(SSL_CTX * ctx);
+extern SSL_CIPHER *SSL_get_current_cipher(SSL * ssl);
+extern SSL_CTX *SSL_CTX_new(SSL_METHOD * method);
+extern SSL_METHOD *SSLv23_client_method(void);
+extern X509 *SSL_get_peer_certificate(SSL * ssl);
+extern X509_NAME *X509_get_issuer_name(const X509 * cert);
+extern X509_NAME *X509_get_subject_name(const X509 * cert);
+extern char *X509_NAME_oneline(X509_NAME * name, char *buf, int len);
+extern const char *ERR_error_string(unsigned long e, char *buf);
+extern const char *RAND_file_name(char *buf, size_t len);
+extern const char *SSL_CIPHER_get_name(SSL_CIPHER * cipher);
+extern const char *SSL_CIPHER_get_version(SSL_CIPHER * cipher);
+extern int RAND_bytes(unsigned char *buf, int num);
+extern int RAND_load_file(const char *name, long maxbytes);
+extern int RAND_status(void);
+extern int RAND_write_file(const char *name);
+extern int SSL_CIPHER_get_bits(SSL_CIPHER * cipher, int *bits);
+extern int SSL_CTX_set_default_verify_paths(SSL_CTX * ctx);
+extern int SSL_connect(SSL * ssl);
+extern int SSL_library_init(void);
+extern int SSL_read(SSL * ssl, void *buf, int len);
+extern int SSL_set_fd(SSL * ssl, int fd);
+extern int SSL_write(SSL * ssl, const void *buf, int len);
+extern unsigned long ERR_get_error(void);
+extern unsigned long SSL_CTX_set_options(SSL_CTX * ctx, unsigned long options);
+extern void RAND_seed(const void *buf, int num);
+extern void SSL_CTX_free(SSL_CTX * ctx);
+extern void SSL_CTX_set_verify(SSL_CTX * ctx, int verify_mode, int (*verify_callback) (int, X509_STORE_CTX *));
+extern void SSL_free(SSL * ssl);
+extern void SSL_load_error_strings(void);
+
+#endif /* TIDY_TLS_H */