Style fixes
diff --git a/tests/scripts/check-python-files.sh b/tests/scripts/check-python-files.sh
index e987945..009ba4c 100755
--- a/tests/scripts/check-python-files.sh
+++ b/tests/scripts/check-python-files.sh
@@ -1,10 +1,10 @@
 #! /usr/bin/env sh
 
-# This file is part of mbed TLS (https://tls.mbed.org)
+# This file is part of Mbed TLS (https://tls.mbed.org)
 #
-# Copyright (c) 2018, ARM Limited, All Rights Reserved
+# Copyright (c) 2018, Arm Limited, All Rights Reserved
 #
-# Purpose
+# Purpose:
 #
 # Run 'pylint' on Python files for programming errors and helps enforcing
 # PEP8 coding standards.
diff --git a/tests/scripts/generate_test_code.py b/tests/scripts/generate_test_code.py
index 77e235d..26d1c29 100755
--- a/tests/scripts/generate_test_code.py
+++ b/tests/scripts/generate_test_code.py
@@ -57,10 +57,9 @@
 string and integer constants specified as integer, macro or
 as an expression. Following is an example test definition:
 
-X509 CRL Unsupported critical extension (issuingDistributionPoint)
-depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C
-mbedtls_x509_crl_parse:"data_files/crl-idp.pem":\
- MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
+ AES 128 GCM Encrypt and decrypt 8 bytes
+ depends_on:MBEDTLS_AES_C:MBEDTLS_GCM_C
+ enc_dec_buf:MBEDTLS_CIPHER_AES_128_GCM:"AES-128-GCM":128:8:-1
 
 Test functions:
 ---------------
@@ -965,13 +964,11 @@
     :return:
     """
     with open(template_file, 'r') as template_f, open(c_file, 'w') as c_f:
-        line_no = 1
-        for line in template_f.readlines():
+        for line_no, line in enumerate(template_f.readlines(), 1):
             # Update line number. +1 as #line directive sets next line number
             snippets['line_no'] = line_no + 1
             code = line.format(**snippets)
             c_f.write(code)
-            line_no += 1
 
 
 def parse_function_file(funcs_file, snippets):
diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function
index 56ae629..32b1b79 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -455,13 +455,13 @@
     test_info.filename = filename;
 }
 
-int hexcmp( uint8_t * a, uint8_t * b, uint32_t a_len, uint32_t b_len)
+int hexcmp( uint8_t * a, uint8_t * b, uint32_t a_len, uint32_t b_len )
 {
     int ret = 0;
     uint32_t i = 0;
 
     if ( a_len != b_len )
-        return( a_len - b_len );
+        return( -1 );
 
     for( i = 0; i < a_len; i++ )
     {
diff --git a/tests/suites/host_test.function b/tests/suites/host_test.function
index f03f40c..b354af4 100644
--- a/tests/suites/host_test.function
+++ b/tests/suites/host_test.function
@@ -10,8 +10,8 @@
  */
 int verify_string( char **str )
 {
-    if( (*str)[0] != '"' ||
-        (*str)[strlen( *str ) - 1] != '"' )
+    if( ( *str )[0] != '"' ||
+        ( *str )[strlen( *str ) - 1] != '"' )
     {
         mbedtls_fprintf( stderr,
             "Expected string (with \"\") for parameter and got: %s\n", *str );
@@ -49,7 +49,7 @@
         }
 
         if( ( ( minus && i == 2 ) || ( !minus && i == 1 ) ) &&
-            str[i - 1] == '0' && str[i] == 'x' )
+            str[i - 1] == '0' && ( str[i] == 'x' || str[i] == 'X' ) )
         {
             hex = 1;
             continue;
@@ -87,8 +87,9 @@
 #define USAGE \
     "Usage: %s [OPTIONS] files...\n\n" \
     "   Command line arguments:\n" \
-    "     files...          One or more test data file. If no file is specified\n" \
-    "                       the followimg default test case is used:\n" \
+    "     files...          One or more test data files. If no file is\n" \
+    "                       specified the following default test case\n" \
+    "                       file is used:\n" \
     "                           %s\n\n" \
     "   Options:\n" \
     "     -v | --verbose    Display full information about each test\n" \
@@ -165,7 +166,7 @@
 
     params[cnt++] = cur;
 
-    while( *p != '\0' && p < buf + len )
+    while( *p != '\0' && p < ( buf + len ) )
     {
         if( *p == '\\' )
         {
@@ -195,23 +196,23 @@
 
         while( *p != '\0' )
         {
-            if( *p == '\\' && *(p + 1) == 'n' )
+            if( *p == '\\' && *( p + 1 ) == 'n' )
             {
                 p += 2;
-                *(q++) = '\n';
+                *( q++ ) = '\n';
             }
-            else if( *p == '\\' && *(p + 1) == ':' )
+            else if( *p == '\\' && *( p + 1 ) == ':' )
             {
                 p += 2;
-                *(q++) = ':';
+                *( q++ ) = ':';
             }
-            else if( *p == '\\' && *(p + 1) == '?' )
+            else if( *p == '\\' && *( p + 1 ) == '?' )
             {
                 p += 2;
-                *(q++) = '?';
+                *( q++ ) = '?';
             }
             else
-                *(q++) = *(p++);
+                *( q++ ) = *( p++ );
         }
         *q = '\0';
     }
@@ -231,8 +232,8 @@
  *                               }
  *
  *
- * \param cnt               Input string.
- * \param params            Out array of found strings.
+ * \param cnt               Parameter array count.
+ * \param params            Out array of found parameters.
  * \param int_params_store  Memory for storing processed integer parameters.
  *
  * \return      0 for success else 1
@@ -241,7 +242,7 @@
 {
     char ** cur = params;
     char ** out = params;
-    int ret = ( DISPATCH_TEST_SUCCESS );
+    int ret = DISPATCH_TEST_SUCCESS;
 
     while ( cur < params + cnt )
     {
@@ -262,7 +263,7 @@
         }
         else if ( strcmp( type, "int" ) == 0 )
         {
-            if ( verify_int ( val, int_params_store ) == 0 )
+            if ( verify_int( val, int_params_store ) == 0 )
             {
               *out++ = (char *) int_params_store++;
             }
@@ -276,12 +277,7 @@
         {
             if ( verify_string( &val ) == 0 )
             {
-                int j;
                 *int_params_store = unhexify( (unsigned char *) val, val );
-                printf ("\n");
-                for (j = 0; j < *int_params_store; j++)
-                    printf ("%02x ", (uint8_t)val[j]);
-                printf ("\n len %d\n", *int_params_store);
                 *out++ = val;
                 *out++ = (char *)(int_params_store++);
             }
@@ -401,7 +397,8 @@
     FILE *file;
     char buf[5000];
     char *params[50];
-    int int_params[50]; // Store for proccessed integer params.
+    /* Store for proccessed integer params. */
+    int int_params[50];
     void *pointer;
 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
     int stdout_fd = -1;
@@ -436,10 +433,10 @@
 
     while( arg_index < argc )
     {
-        next_arg = argv[ arg_index ];
+        next_arg = argv[arg_index];
 
-        if( strcmp(next_arg, "--verbose" ) == 0 ||
-                 strcmp(next_arg, "-v" ) == 0 )
+        if( strcmp( next_arg, "--verbose" ) == 0 ||
+                 strcmp( next_arg, "-v" ) == 0 )
         {
             option_verbose = 1;
         }
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index fa8a0af..9b37782 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -16,7 +16,7 @@
  *      Test suite data     : {test_case_data_file}
  *
  *
- *  This file is part of mbed TLS (https://tls.mbed.org)
+ *  This file is part of Mbed TLS (https://tls.mbed.org)
  */
 
 #if !defined(MBEDTLS_CONFIG_FILE)
@@ -149,7 +149,7 @@
     int ret = DISPATCH_TEST_SUCCESS;
     TestWrapper_t fp = NULL;
 
-    if ( func_idx < (int)( sizeof(test_funcs)/sizeof( TestWrapper_t ) ) )
+    if ( func_idx < (int)( sizeof( test_funcs ) / sizeof( TestWrapper_t ) ) )
     {{
         fp = test_funcs[func_idx];
         if ( fp )
diff --git a/tests/suites/target_test.function b/tests/suites/target_test.function
index f662eee..56abf29 100644
--- a/tests/suites/target_test.function
+++ b/tests/suites/target_test.function
@@ -31,11 +31,11 @@
  * \param len   Length of byte array
  *
  */
-#define ALIGN_32BIT(p, start, len) do           \
-{                                               \
-    uint32_t align = ( - (uintptr_t)( p ) ) % 4;\
-    INCR_ASSERT( ( p ), ( start ), ( len ), align);\
-}                                               \
+#define ALIGN_32BIT(p, start, len) do               \
+{                                                   \
+    uint32_t align = ( - (uintptr_t)( p ) ) % 4;    \
+    INCR_ASSERT( ( p ), ( start ), ( len ), align );\
+}                                                   \
 while( 0 )
 
 
@@ -210,7 +210,7 @@
  *                    the memory after use.
  */
 void ** parse_parameters( uint8_t count, uint8_t * data, uint32_t data_len,
-                            int * error )
+                          int * error )
 {
     uint32_t i = 0, hex_count = 0;
     char c;
@@ -393,7 +393,7 @@
 
         if ( data )
         {
-            free(data);
+            free( data );
             data = NULL;
         }