- Major type rewrite of int to size_t for most variables and arguments used for buffer lengths and loops
diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h
index 772bb55..15b595f 100644
--- a/include/polarssl/ssl.h
+++ b/include/polarssl/ssl.h
@@ -204,7 +204,7 @@
 {
     time_t start;               /*!< starting time      */
     int ciphersuite;            /*!< chosen ciphersuite */
-    int length;                 /*!< session id length  */
+    size_t length;              /*!< session id length  */
     unsigned char id[32];       /*!< session identifier */
     unsigned char master[48];   /*!< the master secret  */
     ssl_session *next;          /*!< next session entry */
@@ -228,8 +228,8 @@
      */
     int  (*f_rng)(void *);
     void (*f_dbg)(void *, int, const char *);
-    int (*f_recv)(void *, unsigned char *, int);
-    int (*f_send)(void *, unsigned char *, int);
+    int (*f_recv)(void *, unsigned char *, size_t);
+    int (*f_send)(void *, unsigned char *, size_t);
     int (*f_vrfy)(void *, x509_cert *, int, int);
 
     void *p_rng;                /*!< context for the RNG function     */
@@ -256,10 +256,10 @@
     unsigned char *in_offt;     /*!< read offset in application data  */
 
     int in_msgtype;             /*!< record header: message type      */
-    int in_msglen;              /*!< record header: message length    */
-    int in_left;                /*!< amount of data read so far       */
+    size_t in_msglen;           /*!< record header: message length    */
+    size_t in_left;             /*!< amount of data read so far       */
 
-    int in_hslen;               /*!< current handshake message length */
+    size_t in_hslen;            /*!< current handshake message length */
     int nb_zero;                /*!< # of 0-length encrypted messages */
 
     /*
@@ -270,8 +270,8 @@
     unsigned char *out_msg;     /*!< the message contents (out_hdr+5) */
 
     int out_msgtype;            /*!< record header: message type      */
-    int out_msglen;             /*!< record header: message length    */
-    int out_left;               /*!< amount of data not yet written   */
+    size_t out_msglen;          /*!< record header: message length    */
+    size_t out_left;            /*!< amount of data not yet written   */
 
     /*
      * PKI layer
@@ -300,11 +300,11 @@
 
     int do_crypt;                       /*!<  en(de)cryption flag     */
     int *ciphersuites;                  /*!<  allowed ciphersuites    */
-    int pmslen;                         /*!<  premaster length        */
-    int keylen;                         /*!<  symmetric key length    */
-    int minlen;                         /*!<  min. ciphertext length  */
-    int ivlen;                          /*!<  IV length               */
-    int maclen;                         /*!<  MAC length              */
+    size_t pmslen;                      /*!<  premaster length        */
+    unsigned int keylen;                /*!<  symmetric key length    */
+    size_t minlen;                      /*!<  min. ciphertext length  */
+    size_t ivlen;                       /*!<  IV length               */
+    size_t maclen;                      /*!<  MAC length              */
 
     unsigned char randbytes[64];        /*!<  random bytes            */
     unsigned char premaster[256];       /*!<  premaster secret        */
@@ -322,7 +322,7 @@
      * TLS extensions
      */
     unsigned char *hostname;
-    unsigned long  hostname_len;
+    size_t         hostname_len;
 };
 
 #ifdef __cplusplus
@@ -447,8 +447,8 @@
  * \param p_send   write parameter
  */
 void ssl_set_bio( ssl_context *ssl,
-        int (*f_recv)(void *, unsigned char *, int), void *p_recv,
-        int (*f_send)(void *, unsigned char *, int), void *p_send );
+        int (*f_recv)(void *, unsigned char *, size_t), void *p_recv,
+        int (*f_send)(void *, unsigned char *, size_t), void *p_send );
 
 /**
  * \brief          Set the session callbacks (server-side only)
@@ -556,7 +556,7 @@
  *
  * \return         how many bytes are available in the read buffer
  */
-int ssl_get_bytes_avail( const ssl_context *ssl );
+size_t ssl_get_bytes_avail( const ssl_context *ssl );
 
 /**
  * \brief          Return the result of the certificate verification
@@ -609,7 +609,7 @@
  * \return         This function returns the number of bytes read,
  *                 or a negative error code.
  */
-int ssl_read( ssl_context *ssl, unsigned char *buf, int len );
+int ssl_read( ssl_context *ssl, unsigned char *buf, size_t len );
 
 /**
  * \brief          Write exactly 'len' application data bytes
@@ -625,7 +625,7 @@
  *                 it must be called later with the *same* arguments,
  *                 until it returns a positive value.
  */
-int ssl_write( ssl_context *ssl, const unsigned char *buf, int len );
+int ssl_write( ssl_context *ssl, const unsigned char *buf, size_t len );
 
 /**
  * \brief          Notify the peer that the connection is being closed
@@ -651,7 +651,7 @@
 void ssl_calc_verify( ssl_context *ssl, unsigned char hash[36] );
 
 int ssl_read_record( ssl_context *ssl );
-int ssl_fetch_input( ssl_context *ssl, int nb_want );
+int ssl_fetch_input( ssl_context *ssl, size_t nb_want );
 
 int ssl_write_record( ssl_context *ssl );
 int ssl_flush_output( ssl_context *ssl );