[gnutls-devel] [PATCH] Removed the invariant htype parameter of _gnutls_recv_int()

Jaak Ristioja jaak.ristioja at cyber.ee
Fri Feb 12 15:59:31 CET 2016


All uses of _gnutls_recv_int() passed -1 as the htype argument of type
gnutls_handshake_description_t, which had been used for SSLv2 client
hellos. Introduced in 2001 with dc1122e7b6.
---
 lib/ext/heartbeat.c |  2 +-
 lib/handshake.c     |  2 +-
 lib/record.c        | 13 +++++--------
 lib/record.h        |  1 -
 4 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/lib/ext/heartbeat.c b/lib/ext/heartbeat.c
index c867025..cc13508 100644
--- a/lib/ext/heartbeat.c
+++ b/lib/ext/heartbeat.c
@@ -229,7 +229,7 @@ gnutls_heartbeat_ping(gnutls_session_t session, size_t data_size,
 
 	case SHB_RECV:
 		ret =
-		    _gnutls_recv_int(session, GNUTLS_HEARTBEAT, -1, NULL,
+		    _gnutls_recv_int(session, GNUTLS_HEARTBEAT, NULL,
 				     NULL, 0, NULL,
 				     session->internals.
 				     hb_actual_retrans_timeout_ms);
diff --git a/lib/handshake.c b/lib/handshake.c
index a46d2b5..3d7a153 100644
--- a/lib/handshake.c
+++ b/lib/handshake.c
@@ -3104,7 +3104,7 @@ static int recv_handshake_final(gnutls_session_t session, int init)
 
 		ret =
 		    _gnutls_recv_int(session, GNUTLS_CHANGE_CIPHER_SPEC,
-				     -1, NULL, ccs, ccs_len, NULL, tleft);
+				     NULL, ccs, ccs_len, NULL, tleft);
 		if (ret <= 0) {
 			ERR("recv ChangeCipherSpec", ret);
 			gnutls_assert();
diff --git a/lib/record.c b/lib/record.c
index 2ae3ca9..a2f8637 100644
--- a/lib/record.c
+++ b/lib/record.c
@@ -301,7 +301,7 @@ int gnutls_bye(gnutls_session_t session, gnutls_close_request_t how)
 			do {
 				ret =
 				    _gnutls_recv_int(session, GNUTLS_ALERT,
-						     -1, NULL, NULL, 0, NULL,
+						     NULL, NULL, 0, NULL,
 						     session->internals.
 						     record_timeout_ms);
 			}
@@ -1360,12 +1360,9 @@ _gnutls_recv_in_buffers(gnutls_session_t session, content_type_t type,
  * that it accepts the gnutls_session_t and the content_type_t of data to
  * receive (if called by the user the Content is Userdata only)
  * It is intended to receive data, under the current session.
- *
- * The gnutls_handshake_description_t was introduced to support SSL V2.0 client hellos.
  */
 ssize_t
 _gnutls_recv_int(gnutls_session_t session, content_type_t type,
-		 gnutls_handshake_description_t htype,
 		 gnutls_packet_t *packet,
 		 uint8_t * data, size_t data_size, void *seq,
 		 unsigned int ms)
@@ -1405,7 +1402,7 @@ _gnutls_recv_int(gnutls_session_t session, content_type_t type,
 			if (ret != 0)
 				return ret;
 
-			ret = _gnutls_recv_in_buffers(session, type, htype, ms);
+			ret = _gnutls_recv_in_buffers(session, type, -1, ms);
 			if (ret < 0 && ret != GNUTLS_E_SESSION_EOF)
 				return gnutls_assert_val(ret);
 
@@ -1514,7 +1511,7 @@ ssize_t
 gnutls_record_recv_packet(gnutls_session_t session, 
 		   	  gnutls_packet_t *packet)
 {
-	return _gnutls_recv_int(session, GNUTLS_APPLICATION_DATA, -1, packet,
+	return _gnutls_recv_int(session, GNUTLS_APPLICATION_DATA, packet,
 				NULL, 0, NULL,
 				session->internals.record_timeout_ms);
 }
@@ -1697,7 +1694,7 @@ int gnutls_record_uncork(gnutls_session_t session, unsigned int flags)
 ssize_t
 gnutls_record_recv(gnutls_session_t session, void *data, size_t data_size)
 {
-	return _gnutls_recv_int(session, GNUTLS_APPLICATION_DATA, -1, NULL,
+	return _gnutls_recv_int(session, GNUTLS_APPLICATION_DATA, NULL,
 				data, data_size, NULL,
 				session->internals.record_timeout_ms);
 }
@@ -1726,7 +1723,7 @@ ssize_t
 gnutls_record_recv_seq(gnutls_session_t session, void *data,
 		       size_t data_size, unsigned char *seq)
 {
-	return _gnutls_recv_int(session, GNUTLS_APPLICATION_DATA, -1, NULL,
+	return _gnutls_recv_int(session, GNUTLS_APPLICATION_DATA, NULL,
 				data, data_size, seq,
 				session->internals.record_timeout_ms);
 }
diff --git a/lib/record.h b/lib/record.h
index 7da8d30..d029586 100644
--- a/lib/record.h
+++ b/lib/record.h
@@ -45,7 +45,6 @@ _gnutls_send_int(gnutls_session_t session, content_type_t type,
 }
 
 ssize_t _gnutls_recv_int(gnutls_session_t session, content_type_t type,
-			 gnutls_handshake_description_t, 
 			 gnutls_packet_t *packet,
 			 uint8_t * data,
 			 size_t sizeofdata, void *seq, unsigned int ms);
-- 
2.7.1




More information about the Gnutls-devel mailing list