Rename time and index parameter to avoid name conflict.

As noted in #557, several functions use 'index' resp. 'time'
as parameter names in their declaration and/or definition, causing name
conflicts with the functions in the C standard library of the same
name some compilers warn about.

This commit renames the arguments accordingly.
diff --git a/include/polarssl/ecp.h b/include/polarssl/ecp.h
index 094a840..9bea64e 100644
--- a/include/polarssl/ecp.h
+++ b/include/polarssl/ecp.h
@@ -460,7 +460,7 @@
  * \brief           Set a group using well-known domain parameters
  *
  * \param grp       Destination group
- * \param index     Index in the list of well-known domain parameters
+ * \param id        Index in the list of well-known domain parameters
  *
  * \return          0 if successful,
  *                  POLARSSL_ERR_MPI_XXX if initialization failed
@@ -469,7 +469,7 @@
  * \note            Index should be a value of RFC 4492's enum NamdeCurve,
  *                  possibly in the form of a POLARSSL_ECP_DP_XXX macro.
  */
-int ecp_use_known_dp( ecp_group *grp, ecp_group_id index );
+int ecp_use_known_dp( ecp_group *grp, ecp_group_id id );
 
 /**
  * \brief           Set a group from a TLS ECParameters record
diff --git a/include/polarssl/x509.h b/include/polarssl/x509.h
index de487ce..5a49a58 100644
--- a/include/polarssl/x509.h
+++ b/include/polarssl/x509.h
@@ -272,23 +272,23 @@
  * \brief          Check a given x509_time against the system time and check
  *                 if it is not expired.
  *
- * \param time     x509_time to check
+ * \param tm       x509_time to check
  *
  * \return         0 if the x509_time is still valid,
  *                 1 otherwise.
  */
-int x509_time_expired( const x509_time *time );
+int x509_time_expired( const x509_time *tm );
 
 /**
  * \brief          Check a given x509_time against the system time and check
  *                 if it is not from the future.
  *
- * \param time     x509_time to check
+ * \param tm       x509_time to check
  *
  * \return         0 if the x509_time is already valid,
  *                 1 otherwise.
  */
-int x509_time_future( const x509_time *time );
+int x509_time_future( const x509_time *tm );
 
 /**
  * \brief          Checkup routine
@@ -317,7 +317,7 @@
                       md_type_t *md_alg, pk_type_t *pk_alg,
                       void **sig_opts );
 int x509_get_time( unsigned char **p, const unsigned char *end,
-                   x509_time *time );
+                   x509_time *t );
 int x509_get_serial( unsigned char **p, const unsigned char *end,
                      x509_buf *serial );
 int x509_get_ext( unsigned char **p, const unsigned char *end,
diff --git a/library/entropy.c b/library/entropy.c
index 540a27c..c6f44df 100644
--- a/library/entropy.c
+++ b/library/entropy.c
@@ -104,23 +104,23 @@
                         f_source_ptr f_source, void *p_source,
                         size_t threshold )
 {
-    int index, ret = 0;
+    int idx, ret = 0;
 
 #if defined(POLARSSL_THREADING_C)
     if( ( ret = polarssl_mutex_lock( &ctx->mutex ) ) != 0 )
         return( ret );
 #endif
 
-    index = ctx->source_count;
-    if( index >= ENTROPY_MAX_SOURCES )
+    idx = ctx->source_count;
+    if( idx >= ENTROPY_MAX_SOURCES )
     {
         ret = POLARSSL_ERR_ENTROPY_MAX_SOURCES;
         goto exit;
     }
 
-    ctx->source[index].f_source = f_source;
-    ctx->source[index].p_source = p_source;
-    ctx->source[index].threshold = threshold;
+    ctx->source[idx].f_source  = f_source;
+    ctx->source[idx].p_source  = p_source;
+    ctx->source[idx].threshold = threshold;
 
     ctx->source_count++;
 
diff --git a/library/x509.c b/library/x509.c
index 5466ca5..5e6062b 100644
--- a/library/x509.c
+++ b/library/x509.c
@@ -490,25 +490,25 @@
     return 0;
 }
 
-static int x509_date_is_valid(const x509_time *time)
+static int x509_date_is_valid(const x509_time *t)
 {
     int ret = POLARSSL_ERR_X509_INVALID_DATE;
 
-    CHECK_RANGE( 0, 9999, time->year );
-    CHECK_RANGE( 0, 23,   time->hour );
-    CHECK_RANGE( 0, 59,   time->min  );
-    CHECK_RANGE( 0, 59,   time->sec  );
+    CHECK_RANGE( 0, 9999, t->year );
+    CHECK_RANGE( 0, 23,   t->hour );
+    CHECK_RANGE( 0, 59,   t->min  );
+    CHECK_RANGE( 0, 59,   t->sec  );
 
-    switch( time->mon )
+    switch( t->mon )
     {
         case 1: case 3: case 5: case 7: case 8: case 10: case 12:
-            CHECK_RANGE( 1, 31, time->day );
+            CHECK_RANGE( 1, 31, t->day );
             break;
         case 4: case 6: case 9: case 11:
-            CHECK_RANGE( 1, 30, time->day );
+            CHECK_RANGE( 1, 30, t->day );
             break;
         case 2:
-            CHECK_RANGE( 1, 28 + (time->year % 4 == 0), time->day );
+            CHECK_RANGE( 1, 28 + (t->year % 4 == 0), t->day );
             break;
         default:
             return( ret );
@@ -520,7 +520,8 @@
 /*
  * Parse an ASN1_UTC_TIME (yearlen=2) or ASN1_GENERALIZED_TIME (yearlen=4) field.
  */
-static int x509_parse_time( unsigned char **p, size_t len, unsigned int yearlen, x509_time *time )
+static int x509_parse_time( unsigned char **p, size_t len, size_t yearlen,
+                            x509_time *tm )
 {
     int ret;
 
@@ -534,26 +535,26 @@
     /*
      * parse year, month, day, hour, minute
      */
-    CHECK( x509_parse_int( p, yearlen, &time->year ) );
+    CHECK( x509_parse_int( p, yearlen, &tm->year ) );
     if ( 2 == yearlen )
     {
-        if ( time->year < 50 )
-            time->year += 100;
+        if ( tm->year < 50 )
+            tm->year += 100;
 
-        time->year += 1900;
+        tm->year += 1900;
     }
 
-    CHECK( x509_parse_int( p, 2, &time->mon ) );
-    CHECK( x509_parse_int( p, 2, &time->day ) );
-    CHECK( x509_parse_int( p, 2, &time->hour ) );
-    CHECK( x509_parse_int( p, 2, &time->min ) );
+    CHECK( x509_parse_int( p, 2, &tm->mon ) );
+    CHECK( x509_parse_int( p, 2, &tm->day ) );
+    CHECK( x509_parse_int( p, 2, &tm->hour ) );
+    CHECK( x509_parse_int( p, 2, &tm->min ) );
 
     /*
-     * parse seconds if present 
+     * parse seconds if present
      */
     if ( len >= 2 && **p >= '0' && **p <= '9' )
     {
-        CHECK( x509_parse_int( p, 2, &time->sec ) );
+        CHECK( x509_parse_int( p, 2, &tm->sec ) );
         len -= 2;
     }
     else
@@ -562,7 +563,7 @@
         /*
          * if relaxed mode, allow seconds to be absent
          */
-        time->sec = 0;
+        tm->sec = 0;
 #else
         return POLARSSL_ERR_X509_INVALID_DATE;
 #endif
@@ -605,7 +606,7 @@
  *       generalTime    GeneralizedTime }
  */
 int x509_get_time( unsigned char **p, const unsigned char *end,
-                   x509_time *time )
+                   x509_time *tm )
 {
     int ret;
     size_t len;
@@ -624,9 +625,9 @@
         if( ret != 0 )
             return( POLARSSL_ERR_X509_INVALID_DATE + ret );
 
-        CHECK( x509_parse_time( p, len, 2, time ) );
+        CHECK( x509_parse_time( p, len, 2, tm ) );
 
-        CHECK( x509_date_is_valid( time ) );
+        CHECK( x509_date_is_valid( tm ) );
 
         return( 0 );
     }
@@ -637,9 +638,9 @@
         if( ret != 0 )
             return( POLARSSL_ERR_X509_INVALID_DATE + ret );
 
-        CHECK( x509_parse_time( p, len, 4, time ) );
+        CHECK( x509_parse_time( p, len, 4, tm ) );
 
-        CHECK( x509_date_is_valid( time ) );
+        CHECK( x509_date_is_valid( tm ) );
 
         return( 0 );
     }
diff --git a/library/x509write_crt.c b/library/x509write_crt.c
index 23d46ee..446a8e9 100644
--- a/library/x509write_crt.c
+++ b/library/x509write_crt.c
@@ -259,7 +259,7 @@
 }
 
 static int x509_write_time( unsigned char **p, unsigned char *start,
-                            const char *time, size_t size )
+                            const char *t, size_t size )
 {
     int ret;
     size_t len = 0;
@@ -267,10 +267,10 @@
     /*
      * write ASN1_UTC_TIME if year < 2050 (2 bytes shorter)
      */
-    if( time[0] == '2' && time[1] == '0' && time [2] < '5' )
+    if( t[0] == '2' && t[1] == '0' && t[2] < '5' )
     {
         ASN1_CHK_ADD( len, asn1_write_raw_buffer( p, start,
-                                             (const unsigned char *) time + 2,
+                                             (const unsigned char *) t + 2,
                                              size - 2 ) );
         ASN1_CHK_ADD( len, asn1_write_len( p, start, len ) );
         ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_UTC_TIME ) );
@@ -278,7 +278,7 @@
     else
     {
         ASN1_CHK_ADD( len, asn1_write_raw_buffer( p, start,
-                                                  (const unsigned char *) time,
+                                                  (const unsigned char *) t,
                                                   size ) );
         ASN1_CHK_ADD( len, asn1_write_len( p, start, len ) );
         ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_GENERALIZED_TIME ) );