[baremetal] Avoid narrow loop counters etc

Use `uint_fast8_t` instead of `unsigned char` in various loop-type
situations. This avoids the need for a 16 or 32-bit system to insert
explicit narrow-to-8-bit instructions.

Not the result of an exhaustive source analysis, rather inspecting
the disassembly output for a cut-down Cortex-M0+ build looking for
UXTB etc instructions, so there could well be more in the complete
configuration.

Signed-off-by: Kevin Bracey <kevin.bracey@arm.com>
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 24dbb7d..5f88fef 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -35,6 +35,8 @@
 
 #if defined(MBEDTLS_SSL_TLS_C)
 
+#include <stdint.h>
+
 #if defined(MBEDTLS_PLATFORM_C)
 #include "mbedtls/platform.h"
 #else
@@ -2932,7 +2934,7 @@
         else if( transform->ivlen == 12 && transform->fixed_ivlen == 12 )
         {
             /* ChachaPoly: fixed XOR sequence number */
-            unsigned char i;
+            uint_fast8_t i;
 
             mbedtls_platform_memcpy( iv, transform->iv_enc, transform->fixed_ivlen );
 
@@ -3317,7 +3319,7 @@
         if( transform->ivlen == 12 && transform->fixed_ivlen == 12 )
         {
             /* ChachaPoly: fixed XOR sequence number */
-            unsigned char i;
+            uint_fast8_t i;
 
             mbedtls_platform_memcpy( iv, transform->iv_dec, transform->fixed_ivlen );
 
@@ -4021,7 +4023,7 @@
         uint32_t ratio =
             mbedtls_ssl_conf_get_hs_timeout_max( ssl->conf ) /
             mbedtls_ssl_conf_get_hs_timeout_min( ssl->conf ) + 1;
-        unsigned char doublings = 1;
+        int_fast8_t doublings = 1;
 
         while( ratio != 0 )
         {
@@ -8604,7 +8606,7 @@
 #if defined(MBEDTLS_SSL_PROTO_DTLS)
     if( MBEDTLS_SSL_TRANSPORT_IS_DTLS( ssl->conf->transport ) )
     {
-        unsigned char i;
+        uint_fast8_t i;
 
         /* Remember current epoch settings for resending */
         ssl->handshake->alt_transform_out = ssl->transform_out;