Use fewer bits for iv_size

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
diff --git a/include/mbedtls/cipher.h b/include/mbedtls/cipher.h
index 1a0f3ff..a133ed9 100644
--- a/include/mbedtls/cipher.h
+++ b/include/mbedtls/cipher.h
@@ -296,7 +296,7 @@
      * For ciphers that accept variable IV sizes,
      * this is the recommended size.
      */
-    uint16_t MBEDTLS_PRIVATE(iv_size);
+    uint8_t MBEDTLS_PRIVATE(iv_size) : 3;
 
     /** Bitflag comprised of MBEDTLS_CIPHER_VARIABLE_IV_LEN and
      *  MBEDTLS_CIPHER_VARIABLE_KEY_LEN indicating whether the
@@ -309,8 +309,10 @@
 
 } mbedtls_cipher_info_t;
 
-/* This is used to more compactly represent the key_bitlen field above. It is for internal use only. */
+/* For internal use only.
+ * These are used to more compactly represent the key_bitlen and iv_size fields above. */
 #define MBEDTLS_KEY_BITLEN_SHIFT 6
+#define MBEDTLS_IV_SIZE_SHIFT    2
 
 /**
  * Generic cipher context.
@@ -524,7 +526,7 @@
         return 0;
     }
 
-    return (size_t) info->MBEDTLS_PRIVATE(iv_size);
+    return ((size_t) info->MBEDTLS_PRIVATE(iv_size)) << MBEDTLS_IV_SIZE_SHIFT;
 }
 
 /**
@@ -730,7 +732,7 @@
         return (int) ctx->MBEDTLS_PRIVATE(iv_size);
     }
 
-    return (int) ctx->MBEDTLS_PRIVATE(cipher_info)->MBEDTLS_PRIVATE(iv_size);
+    return (int) (((int)ctx->MBEDTLS_PRIVATE(cipher_info)->MBEDTLS_PRIVATE(iv_size)) << MBEDTLS_IV_SIZE_SHIFT);
 }
 
 /**