summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/debug.h2
-rw-r--r--lib/gnutls.c6
-rw-r--r--lib/gnutls_cipher.c8
-rw-r--r--lib/gnutls_cipher.h3
-rw-r--r--lib/gnutls_errors.h6
-rw-r--r--lib/gnutls_handshake.c11
-rw-r--r--lib/gnutls_handshake.h3
-rw-r--r--lib/gnutls_hash_int.c4
-rw-r--r--lib/gnutls_int.h4
-rw-r--r--lib/gnutls_kx.c2
-rw-r--r--src/cli.c1
-rw-r--r--src/serv.c4
14 files changed, 29 insertions, 29 deletions
diff --git a/NEWS b/NEWS
index 852ab90ea3..ade13c8cce 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
Version 0.x.y
- Added client side session resuming
+- Better documentation (check doc/API)
+- Better socket handling (gnutls can be used with select())
Version 0.0.5 (7/12/2000)
- Added Compression (using ZLIB)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 7f8db45db0..f04c9ab895 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -3,7 +3,7 @@ EXTRA_DIST = debug.h gnutls_compress.h defines.h gnutls_plaintext.h \
gnutls_cipher.h gnutls_buffers.h gnutls_errors.h gnutls_int.h \
gnutls_handshake.h gnutls_num.h gnutls_algorithms.h gnutls_dh.h \
gnutls_kx.h gnutls_hash_int.h gnutls_cipher_int.h gnutls_der.h \
- gnutls_cert.lex gnutls_compress_int.h gnutls_session.h
+ gnutls_cert.lex gnutls_compress_int.h gnutls_session.h gnutls_priority.h
lib_LTLIBRARIES = libgnutls.la
libgnutls_la_SOURCES = gnutls.c gnutls_compress.c debug.c gnutls_plaintext.c \
gnutls_cipher.c gnutls_buffers.c gnutls_handshake.c gnutls_num.c \
diff --git a/lib/debug.h b/lib/debug.h
index e55b3586be..912ca681b6 100644
--- a/lib/debug.h
+++ b/lib/debug.h
@@ -5,4 +5,6 @@ void _gnutls_print_TLSPlaintext(GNUTLSPlaintext * plaintext);
void _gnutls_print_TLSCiphertext( GNUTLSCiphertext *);
char * _gnutls_bin2hex(const unsigned char *old, const size_t oldlen);
void _gnutls_dump_mpi(char* prefix,MPI a);
+char* _gnutls_packet2str( int packet);
+char* _gnutls_alert2str( int alert);
#endif
diff --git a/lib/gnutls.c b/lib/gnutls.c
index cf97b21b91..88c467ac61 100644
--- a/lib/gnutls.c
+++ b/lib/gnutls.c
@@ -29,6 +29,8 @@
#include "gnutls_handshake.h"
#include "gnutls_hash_int.h"
#include "gnutls_cipher_int.h"
+#include "gnutls_priority.h"
+#include "gnutls_algorithms.h"
GNUTLS_Version gnutls_get_current_version(GNUTLS_STATE state) {
GNUTLS_Version ver;
@@ -362,7 +364,7 @@ int gnutls_close_nowait(int cd, GNUTLS_STATE state)
ssize_t gnutls_send_int(int cd, GNUTLS_STATE state, ContentType type, void *_data, size_t sizeofdata)
{
uint8 *cipher;
- int i, err, cipher_size;
+ int i, cipher_size;
int ret = 0;
int iterations;
uint16 length;
@@ -450,7 +452,7 @@ ssize_t gnutls_send_int(int cd, GNUTLS_STATE state, ContentType type, void *_dat
ssize_t _gnutls_send_change_cipher_spec(int cd, GNUTLS_STATE state)
{
uint16 length;
- int ret = 0, Size;
+ int ret = 0;
uint8 type=GNUTLS_CHANGE_CIPHER_SPEC;
char data[1] = { GNUTLS_TYPE_CHANGE_CIPHER_SPEC };
uint8 headers[5];
diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c
index 8672bf8b11..561aa38d88 100644
--- a/lib/gnutls_cipher.c
+++ b/lib/gnutls_cipher.c
@@ -26,6 +26,8 @@
#include "gnutls_algorithms.h"
#include "gnutls_hash_int.h"
#include "gnutls_cipher_int.h"
+#include "gnutls_plaintext.h"
+#include "debug.h"
int _gnutls_encrypt(GNUTLS_STATE state, char *data, size_t data_size,
uint8 ** ciphertext, ContentType type)
@@ -33,7 +35,7 @@ int _gnutls_encrypt(GNUTLS_STATE state, char *data, size_t data_size,
GNUTLSPlaintext *gtxt;
GNUTLSCompressed *gcomp;
GNUTLSCiphertext *gcipher;
- int total_length = 0, err, i;
+ int total_length = 0, err;
if (data_size == 0)
return 0;
@@ -81,9 +83,7 @@ int _gnutls_decrypt(GNUTLS_STATE state, char *ciphertext,
GNUTLSPlaintext *gtxt;
GNUTLSCompressed *gcomp;
GNUTLSCiphertext gcipher;
- int iterations, i;
- int err, ret;
- int total_length = 0;
+ int ret;
if (ciphertext_size == 0)
return 0;
diff --git a/lib/gnutls_cipher.h b/lib/gnutls_cipher.h
index b078f365ac..dc0ed1d445 100644
--- a/lib/gnutls_cipher.h
+++ b/lib/gnutls_cipher.h
@@ -1,4 +1,7 @@
int _gnutls_encrypt( GNUTLS_STATE state, char* data, size_t data_size, uint8** ciphertext, ContentType type);
+int _gnutls_decrypt(GNUTLS_STATE state, char *ciphertext,
+ size_t ciphertext_size, uint8 ** data,
+ ContentType type);
int _gnutls_TLSCompressed2TLSCiphertext(GNUTLS_STATE state,
GNUTLSCiphertext**
cipher,
diff --git a/lib/gnutls_errors.h b/lib/gnutls_errors.h
index a010cacb4e..b974e6a7e2 100644
--- a/lib/gnutls_errors.h
+++ b/lib/gnutls_errors.h
@@ -35,13 +35,13 @@
# ifdef __LINE__
# define gnutls_assert() fprintf(stderr, "GNUTLS_ASSERT: %s:%d\n", __FILE__,__LINE__);
# else
-# define gnutls_assert() 1
+# define gnutls_assert()
# endif
# else /* __FILE__ defined */
-# define gnutls_assert() 1
+# define gnutls_assert()
# endif
#else /* no debug */
-# define gnutls_assert() 1
+# define gnutls_assert()
#endif
char* gnutls_strerror(int error);
diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c
index d1ec32d2f1..44c5652984 100644
--- a/lib/gnutls_handshake.c
+++ b/lib/gnutls_handshake.c
@@ -163,7 +163,6 @@ int _gnutls_recv_finished(int cd, GNUTLS_STATE state)
{
uint8 *data, *vrfy;
int data_size;
- uint8* concat; /* md5+sha1 */
int ret;
int vrfysize;
@@ -300,7 +299,7 @@ int _gnutls_send_handshake(int cd, GNUTLS_STATE state, void *i_data,
memmove(&data[pos], i_data, i_datasize - 4);
#ifdef HANDSHAKE_DEBUG
- fprintf(stderr, "Send HANDSHAKE[%d] of %d bytes\n", type, i_datasize+4);
+ fprintf(stderr, "Send HANDSHAKE[%d] of %ld bytes\n", type, i_datasize+4);
#endif
/* Here we keep the handshake messages in order to hash them later!
@@ -370,7 +369,7 @@ int _gnutls_recv_handshake(int cd, GNUTLS_STATE state, uint8 **data,
length32 = byteswap32(length32);
#endif
#ifdef HANDSHAKE_DEBUG
- fprintf(stderr, "Received HANDSHAKE[%d] of %d bytes\n", dataptr[0], length32+4);
+ fprintf(stderr, "Received HANDSHAKE[%d] of %ld bytes\n", dataptr[0], length32+4);
#endif
dataptr = gnutls_realloc( dataptr, length32+HANDSHAKE_HEADERS_SIZE);
@@ -785,11 +784,9 @@ int _gnutls_recv_hello(int cd, GNUTLS_STATE state, char *data, int datalen)
int _gnutls_recv_certificate(int cd, GNUTLS_STATE state, char *data, int datalen)
{
- uint8 session_id_len = 0, z;
int pos = 0;
char* certificate_list;
- int i, ret=0;
- uint16 x;
+ int ret=0;
uint32 sizeOfCert;
uint24 num;
@@ -995,8 +992,6 @@ int ret=0;
int gnutls_handshake_finish(int cd, GNUTLS_STATE state)
{
int ret=0;
- char *session_id;
- uint8 session_id_size;
if (state->security_parameters.entity == GNUTLS_CLIENT) {
diff --git a/lib/gnutls_handshake.h b/lib/gnutls_handshake.h
index 751512de7f..cc00ce6628 100644
--- a/lib/gnutls_handshake.h
+++ b/lib/gnutls_handshake.h
@@ -5,3 +5,6 @@ int _gnutls_recv_hello(int cd, GNUTLS_STATE state, char* data, int datalen);
int gnutls_handshake(int cd, GNUTLS_STATE state);
int _gnutls_recv_handshake( int cd, GNUTLS_STATE state, uint8**, int*, HandshakeType);
int _gnutls_generate_session_id( char** session_id, uint8* len);
+int _gnutls_recv_certificate(int cd, GNUTLS_STATE state, char *data, int datalen);
+int gnutls_handshake_begin(int cd, GNUTLS_STATE state);
+int gnutls_handshake_finish(int cd, GNUTLS_STATE state);
diff --git a/lib/gnutls_hash_int.c b/lib/gnutls_hash_int.c
index 8fe6d06d15..7cd808d4c3 100644
--- a/lib/gnutls_hash_int.c
+++ b/lib/gnutls_hash_int.c
@@ -237,7 +237,6 @@ GNUTLS_MAC_HANDLE gnutls_mac_init_ssl3(MACAlgorithm algorithm, void *key,
{
GNUTLS_MAC_HANDLE ret;
char ipad[48];
- char *digest;
int padsize;
switch (algorithm) {
@@ -269,8 +268,6 @@ GNUTLS_MAC_HANDLE gnutls_mac_init_ssl3_handshake(MACAlgorithm algorithm, void *k
int keylen)
{
GNUTLS_MAC_HANDLE ret;
- char *digest;
- int padsize;
ret = gnutls_hash_init(algorithm);
if (ret!=GNUTLS_MAC_FAILED) {
@@ -382,7 +379,6 @@ static void *ssl3_sha(int i, char *secret, int secret_len, char *random,
static void *ssl3_md5(int i, char *secret, int secret_len, char *random,
int random_len)
{
- int j;
void *digest;
GNUTLS_MAC_HANDLE td;
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index 5e15bd8a31..e7973bd3ff 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -2,13 +2,13 @@
#define GNUTLS_INT_H
-/*
+
#define HANDSHAKE_DEBUG
#define HARD_DEBUG
#define READ_DEBUG
#define WRITE_DEBUG
#define DEBUG
-*/
+
#define MAX32 4294967295
#define MAX24 16777215
diff --git a/lib/gnutls_kx.c b/lib/gnutls_kx.c
index 6bc0977a23..c28fc36a97 100644
--- a/lib/gnutls_kx.c
+++ b/lib/gnutls_kx.c
@@ -280,8 +280,6 @@ int _gnutls_recv_server_kx_message(int cd, GNUTLS_STATE state)
uint8 *data_g;
uint8 *data_Y;
int ret = 0, i;
-unsigned char tmpy[2048];
-int ii;
#ifdef HARD_DEBUG
fprintf(stderr, "Receiving Server KX message\n");
diff --git a/src/cli.c b/src/cli.c
index 2bee8f1419..d2f1636142 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <errno.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/src/serv.c b/src/serv.c
index 5700ca33ff..814c87287b 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -39,11 +39,9 @@ int main()
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
- int client_len, i;
+ int client_len;
char topbuf[512];
GNUTLS_STATE state;
- char *str;
- char buf[4096];
char buffer[MAX_BUF];