Add test vectors for XTEA CBC

Generate using an independent implementation found at:
https://code.google.com/p/zzt-code-base/source/browse/trunk/src/python/xtea.py
diff --git a/tests/suites/test_suite_xtea.data b/tests/suites/test_suite_xtea.data
index 37d065c..109e6b6 100644
--- a/tests/suites/test_suite_xtea.data
+++ b/tests/suites/test_suite_xtea.data
@@ -34,6 +34,43 @@
 XTEA Decrypt_ecb #6
 xtea_decrypt_ecb:"00000000000000000000000000000000":"4141414141414141":"70e1225d6e4e7655"
 
+XTEA Encrypt CBC #1
+xtea_encrypt_cbc:"000102030405060708090a0b0c0d0e0f":"6162636465666768":"4142434445464748":"6b982bec15a7b558"
+
+XTEA Encrypt CBC #2
+xtea_encrypt_cbc:"000102030405060708090a0b0c0d0e0f":"4142434445464748":"41414141414141414141414141414141":"2c6aeb799561c8e973b0927f072e3801"
+
+XTEA Encrypt CBC #3
+xtea_encrypt_cbc:"000102030405060708090a0b0c0d0e0f":"0000000000000000":"5a5b6e278948d77f70e1225d6e4e7655e78f2d13744341d8":"41414141414141415fee100fe2c030025d8a557f2677cb33"
+
+XTEA Encrypt CBC #4
+xtea_encrypt_cbc:"00000000000000000000000000000000":"6162636465666768":"4142434445464748":"5b0c065a3803900d"
+
+XTEA Encrypt CBC #5
+xtea_encrypt_cbc:"00000000000000000000000000000000":"4142434445464748":"41414141414141414141414141414141":"bdae508aa320aa5caa7cd79dbc9c38aa"
+
+XTEA Encrypt CBC #6
+xtea_encrypt_cbc:"00000000000000000000000000000000":"0000000000000000":"5a5b6e278948d77f70e1225d6e4e7655e78f2d13744341d8":"61f5082a2c996f632da3ea16ff8e06558b69f069d8637b31"
+
+XTEA Decrypt CBC #1
+xtea_decrypt_cbc:"000102030405060708090a0b0c0d0e0f":"6162636465666768":"4142434445464748":"359def46515c71b2"
+
+XTEA Decrypt CBC #2
+xtea_decrypt_cbc:"000102030405060708090a0b0c0d0e0f":"4142434445464748":"41414141414141414141414141414141":"1b192d63cc0e90371b1a2f66c809963e"
+
+XTEA Decrypt CBC #3
+xtea_decrypt_cbc:"000102030405060708090a0b0c0d0e0f":"0000000000000000":"5a5b6e278948d77f70e1225d6e4e7655e78f2d13744341d8":"2e76e5cc03543cdc40ca03358a5764c331a0631c2f0f3714"
+
+XTEA Decrypt CBC #4
+xtea_decrypt_cbc:"00000000000000000000000000000000":"6162636465666768":"4142434445464748":"81476a15138174dc"
+
+XTEA Decrypt CBC #5
+xtea_decrypt_cbc:"00000000000000000000000000000000":"4142434445464748":"41414141414141414141414141414141":"31a361192b08311d31a0631c2f0f3714"
+
+XTEA Decrypt CBC #6
+xtea_decrypt_cbc:"00000000000000000000000000000000":"0000000000000000":"5a5b6e278948d77f70e1225d6e4e7655e78f2d13744341d8":"c1e2dbbf67ee786e29e051bea18c6abc66f1de5c2daefc2a"
+
 XTEA Selftest
 depends_on:POLARSSL_SELF_TEST
 xtea_selftest:
+
diff --git a/tests/suites/test_suite_xtea.function b/tests/suites/test_suite_xtea.function
index 091752f..74ca678 100644
--- a/tests/suites/test_suite_xtea.function
+++ b/tests/suites/test_suite_xtea.function
@@ -59,6 +59,68 @@
 }
 /* END_CASE */
 
+/* BEGIN_CASE */
+void xtea_encrypt_cbc( char *hex_key_string, char *hex_iv_string,
+                       char *hex_src_string, char *hex_dst_string )
+{
+    unsigned char key_str[100];
+    unsigned char src_str[100];
+    unsigned char dst_str[100];
+    unsigned char iv_str[100];
+    unsigned char output[100];
+    size_t len;
+    xtea_context ctx;
+
+    memset(key_str, 0x00, 100);
+    memset(src_str, 0x00, 100);
+    memset(dst_str, 0x00, 100);
+    memset(iv_str, 0x00, 100);
+    memset(output, 0x00, 100);
+
+    unhexify( key_str, hex_key_string );
+    unhexify( iv_str, hex_iv_string );
+    len = unhexify( src_str, hex_src_string );
+
+    xtea_setup( &ctx, key_str );
+    TEST_ASSERT( xtea_crypt_cbc( &ctx, XTEA_ENCRYPT, len, iv_str,
+                                 src_str, output ) == 0 );
+    hexify( dst_str, output, len );
+
+    TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 );
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
+void xtea_decrypt_cbc( char *hex_key_string, char *hex_iv_string,
+                       char *hex_src_string, char *hex_dst_string )
+{
+    unsigned char key_str[100];
+    unsigned char src_str[100];
+    unsigned char dst_str[100];
+    unsigned char iv_str[100];
+    unsigned char output[100];
+    size_t len;
+    xtea_context ctx;
+
+    memset(key_str, 0x00, 100);
+    memset(src_str, 0x00, 100);
+    memset(dst_str, 0x00, 100);
+    memset(iv_str, 0x00, 100);
+    memset(output, 0x00, 100);
+
+    unhexify( key_str, hex_key_string );
+    unhexify( iv_str, hex_iv_string );
+    len = unhexify( src_str, hex_src_string );
+
+    xtea_setup( &ctx, key_str );
+    TEST_ASSERT( xtea_crypt_cbc( &ctx, XTEA_DECRYPT, len, iv_str,
+                                 src_str, output ) == 0 );
+    hexify( dst_str, output, len );
+
+    TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 );
+}
+/* END_CASE */
+
 /* BEGIN_CASE depends_on:POLARSSL_SELF_TEST */
 void xtea_selftest()
 {