Rename len to bitlen in function parameters

Clarify a few comments too.
diff --git a/library/aes.c b/library/aes.c
index 5dbe910..5592138 100644
--- a/library/aes.c
+++ b/library/aes.c
@@ -483,7 +483,7 @@
  */
 #if !defined(MBEDTLS_AES_SETKEY_ENC_ALT)
 int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
-                    unsigned int keysize )
+                    unsigned int keybits )
 {
     unsigned int i;
     uint32_t *RK;
@@ -497,7 +497,7 @@
     }
 #endif
 
-    switch( keysize )
+    switch( keybits )
     {
         case 128: ctx->nr = 10; break;
         case 192: ctx->nr = 12; break;
@@ -517,10 +517,10 @@
 
 #if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64)
     if( mbedtls_aesni_has_support( MBEDTLS_AESNI_AES ) )
-        return( mbedtls_aesni_setkey_enc( (unsigned char *) ctx->rk, key, keysize ) );
+        return( mbedtls_aesni_setkey_enc( (unsigned char *) ctx->rk, key, keybits ) );
 #endif
 
-    for( i = 0; i < ( keysize >> 5 ); i++ )
+    for( i = 0; i < ( keybits >> 5 ); i++ )
     {
         GET_UINT32_LE( RK[i], key, i << 2 );
     }
@@ -597,7 +597,7 @@
  */
 #if !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
 int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
-                    unsigned int keysize )
+                    unsigned int keybits )
 {
     int i, j, ret;
     mbedtls_aes_context cty;
@@ -616,8 +616,8 @@
 #endif
     ctx->rk = RK = ctx->buf;
 
-    /* Also checks keysize */
-    if( ( ret = mbedtls_aes_setkey_enc( &cty, key, keysize ) ) != 0 )
+    /* Also checks keybits */
+    if( ( ret = mbedtls_aes_setkey_enc( &cty, key, keybits ) ) != 0 )
         goto exit;
 
     ctx->nr = cty.nr;
diff --git a/library/blowfish.c b/library/blowfish.c
index 84cf0d8..baa3393 100644
--- a/library/blowfish.c
+++ b/library/blowfish.c
@@ -173,18 +173,18 @@
  * Blowfish key schedule
  */
 int mbedtls_blowfish_setkey( mbedtls_blowfish_context *ctx, const unsigned char *key,
-                     unsigned int keysize )
+                     unsigned int keybits )
 {
     unsigned int i, j, k;
     uint32_t data, datal, datar;
 
-    if( keysize < MBEDTLS_BLOWFISH_MIN_KEY || keysize > MBEDTLS_BLOWFISH_MAX_KEY ||
-        ( keysize % 8 ) )
+    if( keybits < MBEDTLS_BLOWFISH_MIN_KEY || keybits > MBEDTLS_BLOWFISH_MAX_KEY ||
+        ( keybits % 8 ) )
     {
         return( MBEDTLS_ERR_BLOWFISH_INVALID_KEY_LENGTH );
     }
 
-    keysize >>= 3;
+    keybits >>= 3;
 
     for( i = 0; i < 4; i++ )
     {
@@ -199,7 +199,7 @@
         for( k = 0; k < 4; ++k )
         {
             data = ( data << 8 ) | key[j++];
-            if( j >= keysize )
+            if( j >= keybits )
                 j = 0;
         }
         ctx->P[i] = P[i] ^ data;
diff --git a/library/camellia.c b/library/camellia.c
index c9df94a..83e8e78 100644
--- a/library/camellia.c
+++ b/library/camellia.c
@@ -341,7 +341,7 @@
  * Camellia key schedule (encryption)
  */
 int mbedtls_camellia_setkey_enc( mbedtls_camellia_context *ctx, const unsigned char *key,
-                         unsigned int keysize )
+                         unsigned int keybits )
 {
     int idx;
     size_t i;
@@ -356,7 +356,7 @@
     memset( t, 0, 64 );
     memset( RK, 0, sizeof(ctx->rk) );
 
-    switch( keysize )
+    switch( keybits )
     {
         case 128: ctx->nr = 3; idx = 0; break;
         case 192:
@@ -364,10 +364,10 @@
         default : return( MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH );
     }
 
-    for( i = 0; i < keysize / 8; ++i )
+    for( i = 0; i < keybits / 8; ++i )
         t[i] = key[i];
 
-    if( keysize == 192 ) {
+    if( keybits == 192 ) {
         for( i = 0; i < 8; i++ )
             t[24 + i] = ~t[16 + i];
     }
@@ -403,7 +403,7 @@
     camellia_feistel( KC + 8, SIGMA[2], KC + 10 );
     camellia_feistel( KC + 10, SIGMA[3], KC + 8 );
 
-    if( keysize > 128 ) {
+    if( keybits > 128 ) {
         /* Generate KB */
         for( i = 0; i < 4; ++i )
             KC[12 + i] = KC[4 + i] ^ KC[8 + i];
@@ -420,7 +420,7 @@
     SHIFT_AND_PLACE( idx, 0 );
 
     /* Manipulating KR */
-    if( keysize > 128 ) {
+    if( keybits > 128 ) {
         SHIFT_AND_PLACE( idx, 1 );
     }
 
@@ -428,7 +428,7 @@
     SHIFT_AND_PLACE( idx, 2 );
 
     /* Manipulating KB */
-    if( keysize > 128 ) {
+    if( keybits > 128 ) {
         SHIFT_AND_PLACE( idx, 3 );
     }
 
@@ -446,7 +446,7 @@
  * Camellia key schedule (decryption)
  */
 int mbedtls_camellia_setkey_dec( mbedtls_camellia_context *ctx, const unsigned char *key,
-                         unsigned int keysize )
+                         unsigned int keybits )
 {
     int idx, ret;
     size_t i;
@@ -456,8 +456,8 @@
 
     mbedtls_camellia_init( &cty );
 
-    /* Also checks keysize */
-    if( ( ret = mbedtls_camellia_setkey_enc( &cty, key, keysize ) ) != 0 )
+    /* Also checks keybits */
+    if( ( ret = mbedtls_camellia_setkey_enc( &cty, key, keybits ) ) != 0 )
         goto exit;
 
     ctx->nr = cty.nr;
diff --git a/library/ccm.c b/library/ccm.c
index aa2d675..0727a17 100644
--- a/library/ccm.c
+++ b/library/ccm.c
@@ -69,12 +69,12 @@
 int mbedtls_ccm_setkey( mbedtls_ccm_context *ctx,
                         mbedtls_cipher_id_t cipher,
                         const unsigned char *key,
-                        unsigned int keysize )
+                        unsigned int keybits )
 {
     int ret;
     const mbedtls_cipher_info_t *cipher_info;
 
-    cipher_info = mbedtls_cipher_info_from_values( cipher, keysize, MBEDTLS_MODE_ECB );
+    cipher_info = mbedtls_cipher_info_from_values( cipher, keybits, MBEDTLS_MODE_ECB );
     if( cipher_info == NULL )
         return( MBEDTLS_ERR_CCM_BAD_INPUT );
 
@@ -86,7 +86,7 @@
     if( ( ret = mbedtls_cipher_setup( &ctx->cipher_ctx, cipher_info ) ) != 0 )
         return( ret );
 
-    if( ( ret = mbedtls_cipher_setkey( &ctx->cipher_ctx, key, keysize,
+    if( ( ret = mbedtls_cipher_setkey( &ctx->cipher_ctx, key, keybits,
                                MBEDTLS_ENCRYPT ) ) != 0 )
     {
         return( ret );
diff --git a/library/cipher.c b/library/cipher.c
index 43fec90..0d869cf 100644
--- a/library/cipher.c
+++ b/library/cipher.c
@@ -104,14 +104,14 @@
 }
 
 const mbedtls_cipher_info_t *mbedtls_cipher_info_from_values( const mbedtls_cipher_id_t cipher_id,
-                                              int key_length,
+                                              int key_bitlen,
                                               const mbedtls_cipher_mode_t mode )
 {
     const mbedtls_cipher_definition_t *def;
 
     for( def = mbedtls_cipher_definitions; def->info != NULL; def++ )
         if( def->info->base->cipher == cipher_id &&
-            def->info->key_length == (unsigned) key_length &&
+            def->info->key_length == (unsigned) key_bitlen &&
             def->info->mode == mode )
             return( def->info );
 
@@ -161,18 +161,18 @@
 }
 
 int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx, const unsigned char *key,
-        int key_length, const mbedtls_operation_t operation )
+        int key_bitlen, const mbedtls_operation_t operation )
 {
     if( NULL == ctx || NULL == ctx->cipher_info )
         return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
 
     if( ( ctx->cipher_info->flags & MBEDTLS_CIPHER_VARIABLE_KEY_LEN ) == 0 &&
-        (int) ctx->cipher_info->key_length != key_length )
+        (int) ctx->cipher_info->key_length != key_bitlen )
     {
         return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
     }
 
-    ctx->key_length = key_length;
+    ctx->key_length = key_bitlen;
     ctx->operation = operation;
 
     /*
diff --git a/library/gcm.c b/library/gcm.c
index f84511a..c165788 100644
--- a/library/gcm.c
+++ b/library/gcm.c
@@ -162,12 +162,12 @@
 int mbedtls_gcm_setkey( mbedtls_gcm_context *ctx,
                         mbedtls_cipher_id_t cipher,
                         const unsigned char *key,
-                        unsigned int keysize )
+                        unsigned int keybits )
 {
     int ret;
     const mbedtls_cipher_info_t *cipher_info;
 
-    cipher_info = mbedtls_cipher_info_from_values( cipher, keysize, MBEDTLS_MODE_ECB );
+    cipher_info = mbedtls_cipher_info_from_values( cipher, keybits, MBEDTLS_MODE_ECB );
     if( cipher_info == NULL )
         return( MBEDTLS_ERR_GCM_BAD_INPUT );
 
@@ -179,7 +179,7 @@
     if( ( ret = mbedtls_cipher_setup( &ctx->cipher_ctx, cipher_info ) ) != 0 )
         return( ret );
 
-    if( ( ret = mbedtls_cipher_setkey( &ctx->cipher_ctx, key, keysize,
+    if( ( ret = mbedtls_cipher_setkey( &ctx->cipher_ctx, key, keybits,
                                MBEDTLS_ENCRYPT ) ) != 0 )
     {
         return( ret );