]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Cleanups
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 4 Jan 2002 11:19:52 +0000 (11:19 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 4 Jan 2002 11:19:52 +0000 (11:19 +0000)
configure.in
lib/auth_rsa.c
lib/gnutls_auth.c
lib/gnutls_handshake.c
lib/gnutls_int.h
lib/gnutls_kx.c
lib/gnutls_priority.c
lib/gnutls_record.c
lib/gnutls_record.h

index c96e7bbd05828de8be381230220d6a7dc4453483..704402e4f8ab1ddceb2b820a0c8b03e8cd800525 100644 (file)
@@ -11,7 +11,7 @@ AC_DEFINE_UNQUOTED(T_OS, "$target_os")
 
 GNUTLS_MAJOR_VERSION=0
 GNUTLS_MINOR_VERSION=3
-GNUTLS_MICRO_VERSION=1
+GNUTLS_MICRO_VERSION=2
 GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION
 
 AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION")
index 27cd1ce63a8da32cba20d3a0f6753d7bfc7fa755..d155a48d70e4bfaefab5bf24efb6b25b7b50ae19 100644 (file)
@@ -160,10 +160,6 @@ int gen_rsa_client_kx(GNUTLS_STATE state, opaque ** data)
        RANDOMIZE_KEY(state->gnutls_key->key, gnutls_secure_malloc);
 
        ver = _gnutls_get_adv_version( state);
-       /* Some implementations do not interoperate if we send the
-        * latest version (the one send in the client hello). They'd
-        * rather use the one in the client hello record header.
-        */
 
        state->gnutls_key->key.data[0] = _gnutls_version_get_major(ver);
        state->gnutls_key->key.data[1] = _gnutls_version_get_minor(ver);
index e2be2b9b4e67b1054aa2277e83feac5d84121067..75225048678fdea5d118bdf448dc693d7d525c9f 100644 (file)
@@ -24,6 +24,7 @@
 #include "gnutls_auth_int.h"
 #include "gnutls_algorithms.h"
 #include "auth_x509.h"
+#include <gnutls_datum.h>
 
 #include "auth_anon.h"
 /* The functions here are used in order for authentication algorithms
index 2e4774de2fcb08c3112d741309003c4365785a0f..6d8bb7dde520f66ce300a4739f9366dd9023e5eb 100644 (file)
@@ -1369,9 +1369,18 @@ static int _gnutls_send_client_hello(GNUTLS_STATE state, int again)
                /* Set the version we advertized as maximum 
                 * (RSA uses it).
                 */
-               _gnutls_set_current_version(state, hver);
                _gnutls_set_adv_version( state, hver);
 
+               /* Some implementations do not interoperate if we send a
+                * different version in the record layer.
+                * It seems they prefer to read the record's version
+                * as the one we actually requested.
+                *  The proper behaviour is to use the one in the client hello 
+                * handshake packet and ignore the one in the packet's record 
+                * header.
+                */
+               _gnutls_set_current_version(state, hver);
+
                /* In order to know when this session was initiated.
                 */
                state->security_parameters.timestamp = time(NULL);
index 41b6dc3f935adaba6995e4d8d605fa86a2a7236c..e68f6799c5f4abe159eba57e72073ad28821788c 100644 (file)
@@ -491,7 +491,6 @@ typedef struct GNUTLS_STATE_INT *GNUTLS_STATE;
 
 
 /* functions */
-int gnutls_send_alert( GNUTLS_STATE state, AlertLevel level, AlertDescription desc);
 int gnutls_PRF( opaque * secret, int secret_size, uint8 * label,
                  int label_size, opaque * seed, int seed_size,
                  int total_bytes, void* ret);
index b4e57b09356594ab5c9d01258aed40ee18ac870a..4dc8031e0e7b83ab34032b91bc4abc8c171844cf 100644 (file)
@@ -28,6 +28,7 @@
 #include "gnutls_gcry.h"
 #include <gnutls_record.h>
 #include <gnutls_datum.h>
+#include <gnutls_alert.h>
 
 /* This file contains important thing for the TLS handshake procedure.
  */
index f3183728f5794f184f612c6f1a9c02adc021b5d0..9412e3bdd77cf3b1637e087ce636d60cd3476796 100644 (file)
@@ -182,7 +182,6 @@ int num=0, i;
 int gnutls_protocol_set_priority( GNUTLS_STATE state, GNUTLS_LIST list) {
 GNUTLS_LIST _list = list;
 int num=0, i;
-GNUTLS_Version ver;
 
        while( *_list != 0) {
                num++;
@@ -205,13 +204,11 @@ GNUTLS_Version ver;
                state->gnutls_internals.ProtocolPriority.algorithm_priority[i] = list[i];
        }
 
-       /* set the current version to the latest supported
+       /* set the current version to the first in the chain.
+        * This will be overriden later.
         */
-       ver = _gnutls_version_max( state);
-       if (ver < 0) {
-               gnutls_assert();
-               return GNUTLS_E_UNKNOWN_ERROR;
-       }
-       _gnutls_set_current_version( state, ver);
+       if (num > 0)
+               _gnutls_set_current_version( state, state->gnutls_internals.ProtocolPriority.algorithm_priority[0]);
+
        return 0;
 }
index b34b9cb805de2257853343882aa7303a9a3217f1..3f846f2a0857346018c7916d2ffd81bdfa8bece8 100644 (file)
@@ -387,94 +387,6 @@ int gnutls_PRF( opaque * secret, int secret_size, uint8 * label, int label_size,
 
 }
 
-/**
-  * gnutls_alert_send - This function sends an alert message to the peer
-  * @state: is a &GNUTLS_STATE structure.
-  * @level: is the level of the alert
-  * @desc: is the alert description
-  *
-  * This function will send an alert to the peer in order to inform
-  * him of something important (eg. his Certificate could not be verified).
-  * If the alert level is Fatal then the peer is expected to close the
-  * connection, otherwise he may ignore the alert and continue.
-  * Returns 0 on success.
-  *
-  **/
-int gnutls_alert_send( GNUTLS_STATE state, AlertLevel level, AlertDescription desc)
-{
-       uint8 data[2];
-       int ret;
-       
-       data[0] = (uint8) level;
-       data[1] = (uint8) desc;
-
-#ifdef RECORD_DEBUG
-       _gnutls_log( "Record: Sending Alert[%d|%d] - %s\n", data[0], data[1], _gnutls_alert2str((int)data[1]));
-#endif
-
-       if ( (ret = gnutls_send_int( state, GNUTLS_ALERT, -1, data, 2)) >= 0)
-               return 0;
-       else
-               return ret;
-}
-
-/* Sends the appropriate alert, depending
- * on the error message.
- */
-/**
-  * gnutls_alert_send_appropriate - This function sends an alert to the peer depending on the error code
-  * @state: is a &GNUTLS_STATE structure.
-  * @err: is an integer
-  *
-  * Sends an alert to the peer depending on the error code returned by a gnutls
-  * function. All alerts sent by this function are fatal, so connection should
-  * be considered terminated after calling this function. The only exception
-  * is when err == GNUTLS_E_REHANDSHAKE, then a warning alert is sent to
-  * the peer indicating the no renegotiation will be performed.
-  *
-  * This function may also return GNUTLS_E_AGAIN, or GNUTLS_E_INTERRUPTED.
-  *
-  * If the return value is GNUTLS_E_UNIMPLEMENTED_FEATURE, then no alert has
-  * been sent to the peer.
-  *
-  **/
-int gnutls_alert_send_appropriate( GNUTLS_STATE state, int err) {
-int ret = GNUTLS_E_UNIMPLEMENTED_FEATURE;
-       switch (err) { /* send appropriate alert */
-               case GNUTLS_E_MAC_FAILED:
-                       ret = gnutls_alert_send( state, GNUTLS_AL_FATAL, GNUTLS_A_BAD_RECORD_MAC);
-                       break;
-               case GNUTLS_E_DECRYPTION_FAILED:
-                       ret = gnutls_alert_send( state, GNUTLS_AL_FATAL, GNUTLS_A_DECRYPTION_FAILED);
-                       break;
-               case GNUTLS_E_DECOMPRESSION_FAILED:
-                       ret = gnutls_alert_send( state, GNUTLS_AL_FATAL, GNUTLS_A_DECOMPRESSION_FAILURE);
-                       break;
-               case GNUTLS_E_ILLEGAL_PARAMETER:
-                        ret = gnutls_alert_send( state, GNUTLS_AL_FATAL, GNUTLS_A_ILLEGAL_PARAMETER);
-                        break;
-               case GNUTLS_E_ASN1_PARSING_ERROR:
-               case GNUTLS_E_NO_CERTIFICATE_FOUND:
-                        ret = gnutls_alert_send( state, GNUTLS_AL_FATAL, GNUTLS_A_BAD_CERTIFICATE);
-                        break;
-               case GNUTLS_E_UNKNOWN_CIPHER_SUITE:
-                        ret = gnutls_alert_send( state, GNUTLS_AL_FATAL, GNUTLS_A_HANDSHAKE_FAILURE);
-                        break;
-               case GNUTLS_E_UNEXPECTED_PACKET:
-                        ret = gnutls_alert_send( state, GNUTLS_AL_FATAL, GNUTLS_A_UNEXPECTED_MESSAGE);
-                        break;
-               case GNUTLS_E_REHANDSHAKE:
-                        ret = gnutls_alert_send( state, GNUTLS_AL_WARNING, GNUTLS_A_NO_RENEGOTIATION);
-                        break;
-               case GNUTLS_E_UNSUPPORTED_VERSION_PACKET:
-                        ret = gnutls_alert_send( state, GNUTLS_AL_WARNING, GNUTLS_A_PROTOCOL_VERSION);
-                       break;
-               case GNUTLS_E_UNEXPECTED_PACKET_LENGTH:
-                       ret = gnutls_alert_send( state, GNUTLS_AL_FATAL, GNUTLS_A_RECORD_OVERFLOW);
-                       break;
-       }
-       return ret;
-}
 
 /**
   * gnutls_bye - This function terminates the current TLS/SSL connection.
@@ -1116,19 +1028,6 @@ gnutls_check_version( const char *req_version )
     return NULL;
 }
 
-/**
-  * gnutls_alert_get_last - Returns the last alert number received.
-  * @state: is a &GNUTLS_STATE structure.
-  *
-  * Returns the last alert number received. This function
-  * should be called if GNUTLS_E_WARNING_ALERT_RECEIVED or
-  * GNUTLS_E_FATAL_ALERT_RECEIVED has been returned by a gnutls function.
-  * The peer may send alerts if he thinks some things were not 
-  * right. Check gnutls.h for the available alert descriptions.
-  **/
-AlertDescription gnutls_alert_get_last( GNUTLS_STATE state) {
-       return state->gnutls_internals.last_alert;
-}
 
 /**
   * gnutls_write - sends to the peer the specified data
index 0bbfd20da2a03d537e39360758f85ed61e3468fa..d602267ebed77110cb31b5e44dfbfb754623351d 100644 (file)
@@ -1,4 +1,3 @@
-AlertDescription gnutls_alert_get_last( GNUTLS_STATE state);
 KXAlgorithm gnutls_kx_get_algo( GNUTLS_STATE state);
 ssize_t gnutls_send_int( GNUTLS_STATE state, ContentType type, HandshakeType htype, const void* data, size_t sizeofdata);
 ssize_t gnutls_recv_int( GNUTLS_STATE state, ContentType type, HandshakeType, char* data, size_t sizeofdata);