- Fixed cipher interface for encrypt/decrypt functions

diff --git a/include/polarssl/aes.h b/include/polarssl/aes.h
index 11abc90..61ad457 100644
--- a/include/polarssl/aes.h
+++ b/include/polarssl/aes.h
@@ -27,6 +27,7 @@
 #define AES_DECRYPT     0
 
 #define POLARSSL_ERR_AES_INVALID_KEY_LENGTH                 -0x0800
+#define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH               -0x0810
 
 /**
  * \brief          AES context structure
@@ -72,8 +73,10 @@
  * \param mode     AES_ENCRYPT or AES_DECRYPT
  * \param input    16-byte input block
  * \param output   16-byte output block
+ *
+ * \return         0
  */
-void aes_crypt_ecb( aes_context *ctx,
+int aes_crypt_ecb( aes_context *ctx,
                     int mode,
                     const unsigned char input[16],
                     unsigned char output[16] );
@@ -89,8 +92,10 @@
  * \param iv       initialization vector (updated after use)
  * \param input    buffer holding the input data
  * \param output   buffer holding the output data
+ *
+ * \return         0 if successful, or POLARSSL_ERR_AES_INVALID_INPUT_LENGTH
  */
-void aes_crypt_cbc( aes_context *ctx,
+int aes_crypt_cbc( aes_context *ctx,
                     int mode,
                     int length,
                     unsigned char iv[16],
@@ -107,8 +112,10 @@
  * \param iv       initialization vector (updated after use)
  * \param input    buffer holding the input data
  * \param output   buffer holding the output data
+ *
+ * \return         0
  */
-void aes_crypt_cfb128( aes_context *ctx,
+int aes_crypt_cfb128( aes_context *ctx,
                        int mode,
                        int length,
                        int *iv_off,
diff --git a/include/polarssl/arc4.h b/include/polarssl/arc4.h
index 20f142a..76e7e0a 100644
--- a/include/polarssl/arc4.h
+++ b/include/polarssl/arc4.h
@@ -53,8 +53,10 @@
  * \param ctx      ARC4 context
  * \param buf      buffer to be processed
  * \param buflen   amount of data in buf
+ *
+ * \return         0
  */
-void arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen );
+int arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen );
 
 /*
  * \brief          Checkup routine
diff --git a/include/polarssl/camellia.h b/include/polarssl/camellia.h
index d03495a..e9ded15 100644
--- a/include/polarssl/camellia.h
+++ b/include/polarssl/camellia.h
@@ -32,6 +32,7 @@
 #define CAMELLIA_DECRYPT     0
 
 #define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH            -0x0a00
+#define POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH          -0x0a10
 
 /**
  * \brief          CAMELLIA context structure
@@ -76,8 +77,10 @@
  * \param mode     CAMELLIA_ENCRYPT or CAMELLIA_DECRYPT
  * \param input    16-byte input block
  * \param output   16-byte output block
+ * 
+ * \return         0
  */
-void camellia_crypt_ecb( camellia_context *ctx,
+int camellia_crypt_ecb( camellia_context *ctx,
                     int mode,
                     const unsigned char input[16],
                     unsigned char output[16] );
@@ -93,8 +96,10 @@
  * \param iv       initialization vector (updated after use)
  * \param input    buffer holding the input data
  * \param output   buffer holding the output data
+ * 
+ * \return         0 if successful, or POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH
  */
-void camellia_crypt_cbc( camellia_context *ctx,
+int camellia_crypt_cbc( camellia_context *ctx,
                     int mode,
                     int length,
                     unsigned char iv[16],
@@ -111,8 +116,10 @@
  * \param iv       initialization vector (updated after use)
  * \param input    buffer holding the input data
  * \param output   buffer holding the output data
+ * 
+ * \return         0 if successful, or POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH
  */
-void camellia_crypt_cfb128( camellia_context *ctx,
+int camellia_crypt_cfb128( camellia_context *ctx,
                        int mode,
                        int length,
                        int *iv_off,
diff --git a/include/polarssl/des.h b/include/polarssl/des.h
index 1a09ad1..a655a15 100644
--- a/include/polarssl/des.h
+++ b/include/polarssl/des.h
@@ -26,6 +26,8 @@
 #define DES_ENCRYPT     1
 #define DES_DECRYPT     0
 
+#define POLARSSL_ERR_DES_INVALID_INPUT_LENGTH               -0x0C00
+
 /**
  * \brief          DES context structure
  */
@@ -104,8 +106,10 @@
  * \param ctx      DES context
  * \param input    64-bit input block
  * \param output   64-bit output block
+ *
+ * \return         0
  */
-void des_crypt_ecb( des_context *ctx,
+int des_crypt_ecb( des_context *ctx,
                     const unsigned char input[8],
                     unsigned char output[8] );
 
@@ -119,7 +123,7 @@
  * \param input    buffer holding the input data
  * \param output   buffer holding the output data
  */
-void des_crypt_cbc( des_context *ctx,
+int des_crypt_cbc( des_context *ctx,
                     int mode,
                     int length,
                     unsigned char iv[8],
@@ -132,8 +136,10 @@
  * \param ctx      3DES context
  * \param input    64-bit input block
  * \param output   64-bit output block
+ *
+ * \return         0
  */
-void des3_crypt_ecb( des3_context *ctx,
+int des3_crypt_ecb( des3_context *ctx,
                      const unsigned char input[8],
                      unsigned char output[8] );
 
@@ -146,8 +152,10 @@
  * \param iv       initialization vector (updated after use)
  * \param input    buffer holding the input data
  * \param output   buffer holding the output data
+ *
+ * \return         0 if successful, or POLARSSL_ERR_DES_INVALID_INPUT_LENGTH
  */
-void des3_crypt_cbc( des3_context *ctx,
+int des3_crypt_cbc( des3_context *ctx,
                      int mode,
                      int length,
                      unsigned char iv[8],
diff --git a/include/polarssl/padlock.h b/include/polarssl/padlock.h
index cde76ae..cccc55d 100644
--- a/include/polarssl/padlock.h
+++ b/include/polarssl/padlock.h
@@ -38,6 +38,8 @@
 
 #define PADLOCK_ALIGN16(x) (unsigned long *) (16 + ((long) x & ~15))
 
+#define POLARSSL_ERR_PADLOCK_DATA_MISALIGNED                    -0x08E0
+
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/include/polarssl/xtea.h b/include/polarssl/xtea.h
index 9d3dadd..12a9455 100644
--- a/include/polarssl/xtea.h
+++ b/include/polarssl/xtea.h
@@ -60,8 +60,10 @@
  * \param mode     XTEA_ENCRYPT or XTEA_DECRYPT
  * \param input    8-byte input block
  * \param output   8-byte output block
+ *
+ * \return         0
  */
-void xtea_crypt_ecb( xtea_context *ctx,
+int xtea_crypt_ecb( xtea_context *ctx,
 		 int mode,
 		 unsigned char input[8],
 		 unsigned char output[8] );