Adapt programs / test suites
diff --git a/tests/suites/test_suite_cipher.function b/tests/suites/test_suite_cipher.function
index 7c9c76d..3afdff6 100644
--- a/tests/suites/test_suite_cipher.function
+++ b/tests/suites/test_suite_cipher.function
@@ -29,7 +29,7 @@
     unsigned char buf[1] = { 0 };
     size_t olen;
 
-    memset( &ctx, 0, sizeof( cipher_context_t ) );
+    cipher_init( &ctx );
 
     TEST_ASSERT( cipher_get_block_size( NULL ) == 0 );
     TEST_ASSERT( cipher_get_block_size( &ctx ) == 0 );
@@ -111,8 +111,8 @@
     /*
      * Prepare contexts
      */
-    memset( &ctx_dec, 0, sizeof( ctx_dec ) );
-    memset( &ctx_enc, 0, sizeof( ctx_enc ) );
+    cipher_init( &ctx_dec );
+    cipher_init( &ctx_enc );
 
     memset( key, 0x2a, sizeof( key ) );
 
@@ -207,8 +207,8 @@
     /*
      * Done
      */
-    TEST_ASSERT( 0 == cipher_free_ctx( &ctx_dec ) );
-    TEST_ASSERT( 0 == cipher_free_ctx( &ctx_enc ) );
+    cipher_free( &ctx_dec );
+    cipher_free( &ctx_enc );
 }
 /* END_CASE */
 
@@ -231,7 +231,7 @@
     memset( key, 0, 32 );
     memset( iv , 0, 16 );
 
-    memset( &ctx, 0, sizeof( ctx ) );
+    cipher_init( &ctx );
 
     memset( inbuf, 5, 64 );
     memset( encbuf, 0, 64 );
@@ -259,7 +259,7 @@
     TEST_ASSERT( ret == cipher_finish( &ctx, encbuf + outlen, &outlen ) );
 
     /* done */
-    TEST_ASSERT( 0 == cipher_free_ctx( &ctx ) );
+    cipher_free( &ctx );
 }
 /* END_CASE */
 
@@ -279,16 +279,16 @@
 
     memset( key, 0, 32 );
     memset( iv , 0, 16 );
-    
-    memset( &ctx_dec, 0, sizeof( ctx_dec ) );
-    
+
+    cipher_init( &ctx_dec );
+
     memset( encbuf, 0, 64 );
     memset( decbuf, 0, 64 );
 
     /* Initialise context */
     cipher_info = cipher_info_from_type( POLARSSL_CIPHER_AES_128_CBC );
     TEST_ASSERT( NULL != cipher_info);
-    
+
     TEST_ASSERT( 0 == cipher_init_ctx( &ctx_dec, cipher_info ) );
 
     TEST_ASSERT( 0 == cipher_setkey( &ctx_dec, key, 128, POLARSSL_DECRYPT ) );
@@ -308,7 +308,7 @@
                  &ctx_dec, decbuf + outlen, &outlen ) );
     TEST_ASSERT( 0 == outlen );
 
-    TEST_ASSERT( 0 == cipher_free_ctx( &ctx_dec ) );
+    cipher_free( &ctx_dec );
 }
 /* END_CASE */
 
@@ -335,10 +335,10 @@
 
     memset( key, 0, 32 );
     memset( iv , 0, 16 );
-    
-    memset( &ctx_dec, 0, sizeof( ctx_dec ) );
-    memset( &ctx_enc, 0, sizeof( ctx_enc ) );
-        
+
+    cipher_init( &ctx_dec );
+    cipher_init( &ctx_enc );
+
     memset( inbuf, 5, 64 );
     memset( encbuf, 0, 64 );
     memset( decbuf, 0, 64 );
@@ -346,10 +346,10 @@
     /* Initialise enc and dec contexts */
     cipher_info = cipher_info_from_type( cipher_id );
     TEST_ASSERT( NULL != cipher_info);
-    
+
     TEST_ASSERT( 0 == cipher_init_ctx( &ctx_dec, cipher_info ) );
     TEST_ASSERT( 0 == cipher_init_ctx( &ctx_enc, cipher_info ) );
-    
+
     TEST_ASSERT( 0 == cipher_setkey( &ctx_dec, key, key_len, POLARSSL_DECRYPT ) );
     TEST_ASSERT( 0 == cipher_setkey( &ctx_enc, key, key_len, POLARSSL_ENCRYPT ) );
 
@@ -397,8 +397,8 @@
 
     TEST_ASSERT( 0 == memcmp(inbuf, decbuf, length) );
 
-    TEST_ASSERT( 0 == cipher_free_ctx( &ctx_dec ) );
-    TEST_ASSERT( 0 == cipher_free_ctx( &ctx_enc ) );
+    cipher_free( &ctx_dec );
+    cipher_free( &ctx_enc );
 }
 /* END_CASE */
 
@@ -423,6 +423,8 @@
     unsigned char output[200];
     size_t outlen, total_len;
 
+    cipher_init( &ctx );
+
     memset( key, 0x00, sizeof( key ) );
     memset( iv, 0x00, sizeof( iv ) );
     memset( cipher, 0x00, sizeof( cipher ) );
@@ -477,7 +479,7 @@
         TEST_ASSERT( 0 == memcmp( output, clear, clear_len ) );
     }
 
-    cipher_free_ctx( &ctx );
+    cipher_free( &ctx );
 }
 /* END_CASE */
 
@@ -499,6 +501,8 @@
     unsigned char output[200];
     size_t outlen;
 
+    cipher_init( &ctx );
+
     memset( key,    0x00, sizeof( key    ) );
     memset( iv,     0x00, sizeof( iv     ) );
     memset( cipher, 0x00, sizeof( cipher ) );
@@ -563,7 +567,7 @@
 
 
 cleanup:
-    cipher_free_ctx( &ctx );
+    cipher_free( &ctx );
 }
 /* END_CASE */
 
@@ -580,6 +584,8 @@
     unsigned char output[32];
     size_t outlen;
 
+    cipher_init( &ctx );
+
     memset( key, 0x00, sizeof( key ) );
     memset( input, 0x00, sizeof( input ) );
     memset( result, 0x00, sizeof( result ) );
@@ -610,7 +616,7 @@
         TEST_ASSERT( 0 == memcmp( output, result,
                                   cipher_get_block_size( &ctx ) ) );
 
-    cipher_free_ctx( &ctx );
+    cipher_free( &ctx );
 }
 /* END_CASE */
 
@@ -620,13 +626,15 @@
     const cipher_info_t *cipher_info;
     cipher_context_t ctx;
 
+    cipher_init( &ctx );
+
     cipher_info = cipher_info_from_type( cipher_id );
     TEST_ASSERT( NULL != cipher_info );
     TEST_ASSERT( 0 == cipher_init_ctx( &ctx, cipher_info ) );
 
     TEST_ASSERT( ret == cipher_set_padding_mode( &ctx, pad_mode ) );
 
-    TEST_ASSERT( 0 == cipher_free_ctx( &ctx ) );
+    cipher_free( &ctx );
 }
 /* END_CASE */
 
@@ -639,7 +647,7 @@
     size_t ilen, dlen;
 
     /* build a fake context just for getting access to get_padding */
-    memset( &ctx, 0, sizeof( ctx ) );
+    cipher_init( &ctx );
     cipher_info.mode = POLARSSL_MODE_CBC;
     ctx.cipher_info = &cipher_info;