diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-03-18 08:39:58 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-03-18 08:39:58 +0000 |
commit | aaaec1add30ecd996a170ee8199b73e32aa3aeb9 (patch) | |
tree | 32536cd6285f9948593e14a441cb9dd819ec8a69 /lib | |
parent | 110eca8f0fa955a532354cd94d672390b6d65718 (diff) | |
download | gnutls-aaaec1add30ecd996a170ee8199b73e32aa3aeb9.tar.gz |
more cleanups
Diffstat (limited to 'lib')
-rw-r--r-- | lib/debug.h | 1 | ||||
-rw-r--r-- | lib/gnutls.c | 4 | ||||
-rw-r--r-- | lib/gnutls_algorithms.c | 18 | ||||
-rw-r--r-- | lib/gnutls_handshake.c | 4 |
4 files changed, 17 insertions, 10 deletions
diff --git a/lib/debug.h b/lib/debug.h index f34cf31710..b793c1a106 100644 --- a/lib/debug.h +++ b/lib/debug.h @@ -27,4 +27,5 @@ 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); +char* _gnutls_handshake2str( int handshake); #endif diff --git a/lib/gnutls.c b/lib/gnutls.c index c6b5e4af7d..5b4b2c6cdd 100644 --- a/lib/gnutls.c +++ b/lib/gnutls.c @@ -510,7 +510,7 @@ ssize_t _gnutls_send_change_cipher_spec(int cd, GNUTLS_STATE state) headers[2] = _gnutls_version_get_minor(state->connection_state.version); #ifdef HANDSHAKE_DEBUG - fprintf(stderr, "Send Change Cipher Spec\n"); + fprintf(stderr, "ChangeCipherSpec was sent\n"); #endif #ifdef WORDS_BIGENDIAN @@ -687,7 +687,7 @@ ssize_t gnutls_recv_int(int cd, GNUTLS_STATE state, ContentType type, char *data if (type == GNUTLS_CHANGE_CIPHER_SPEC && recv_type == GNUTLS_CHANGE_CIPHER_SPEC) { #ifdef HARD_DEBUG - fprintf(stderr, "Received Change Cipher Spec Packet\n"); + fprintf(stderr, "ChangeCipherSpec Packet was received\n"); #endif if (length!=1) { gnutls_assert(); diff --git a/lib/gnutls_algorithms.c b/lib/gnutls_algorithms.c index 133b75dd7f..5ec47a6b0c 100644 --- a/lib/gnutls_algorithms.c +++ b/lib/gnutls_algorithms.c @@ -27,6 +27,12 @@ #include "auth_anon.h" #include "auth_dhe_dss.h" +#define MAX_CIPHER 256 +#define MAX_MAC 256 +#define MAX_KX 256 +#define MAX_CIPHERSUITE 256 +#define MAX_COMPRESSION 256 + /* TLS Versions */ typedef struct { @@ -349,7 +355,7 @@ char *_gnutls_mac_get_name(MACAlgorithm algorithm) int _gnutls_mac_count() { uint8 i, counter = 0; - for (i = 0; i < 256; i++) { + for (i = 0; i < MAX_MAC; i++) { if (_gnutls_mac_is_ok(i) == 0) counter++; } @@ -410,7 +416,7 @@ char *_gnutls_compression_get_name(CompressionMethod algorithm) int _gnutls_compression_count() { uint8 i, counter = 0; - for (i = 0; i < 256; i++) { + for (i = 0; i < MAX_COMPRESSION; i++) { if (_gnutls_compression_is_ok(i) == 0) counter++; } @@ -506,7 +512,7 @@ char *_gnutls_cipher_get_name(BulkCipherAlgorithm algorithm) int _gnutls_cipher_count() { uint8 i, counter = 0; - for (i = 0; i < 256; i++) { + for (i = 0; i < MAX_CIPHER; i++) { if (_gnutls_cipher_is_ok(i) == 0) counter++; } @@ -613,7 +619,7 @@ char *_gnutls_kx_get_name(KXAlgorithm algorithm) int _gnutls_kx_count() { uint8 i, counter = 0; - for (i = 0; i < 256; i++) { + for (i = 0; i < MAX_KX; i++) { if (_gnutls_kx_is_ok(i) == 0) counter++; } @@ -744,11 +750,11 @@ int _gnutls_cipher_suite_count() GNUTLS_CipherSuite suite; int i, counter = 0, j; - for (j = 0; j < 256; j++) { + for (j = 0; j < MAX_CIPHERSUITE; j++) { suite.CipherSuite[0] = j; if (j!=0x00 && j!=0xFF) continue; - for (i = 0; i < 256; i++) { + for (i = 0; i < MAX_CIPHERSUITE; i++) { suite.CipherSuite[1] = i; if (_gnutls_cipher_suite_is_ok(suite) == 0) counter++; diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c index 36166188e8..c30d46476e 100644 --- a/lib/gnutls_handshake.c +++ b/lib/gnutls_handshake.c @@ -300,7 +300,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, "%s was send [%ld bytes]\n", _gnutls_handshake2str(type), i_datasize); + fprintf(stderr, "Handshake: %s was send [%ld bytes]\n", _gnutls_handshake2str(type), i_datasize); #endif /* Here we keep the handshake messages in order to hash them later! @@ -370,7 +370,7 @@ int _gnutls_recv_handshake(int cd, GNUTLS_STATE state, uint8 **data, length32 = byteswap32(length32); #endif #ifdef HANDSHAKE_DEBUG - fprintf(stderr, "%s was received [%ld bytes]\n", _gnutls_handshake2str(dataptr[0]), length32+HANDSHAKE_HEADERS_SIZE); + fprintf(stderr, "Handshake: %s was received [%ld bytes]\n", _gnutls_handshake2str(dataptr[0]), length32+HANDSHAKE_HEADERS_SIZE); #endif dataptr = gnutls_realloc( dataptr, length32+HANDSHAKE_HEADERS_SIZE); |