- Fixed cipher interface for encrypt/decrypt functions

diff --git a/library/des.c b/library/des.c
index 79ebd38..d2f7662 100644
--- a/library/des.c
+++ b/library/des.c
@@ -476,7 +476,7 @@
 /*
  * DES-ECB block encryption/decryption
  */
-void des_crypt_ecb( des_context *ctx,
+int des_crypt_ecb( des_context *ctx,
                     const unsigned char input[8],
                     unsigned char output[8] )
 {
@@ -500,12 +500,14 @@
 
     PUT_ULONG_BE( Y, output, 0 );
     PUT_ULONG_BE( X, output, 4 );
+
+    return( 0 );
 }
 
 /*
  * DES-CBC buffer encryption/decryption
  */
-void des_crypt_cbc( des_context *ctx,
+int des_crypt_cbc( des_context *ctx,
                     int mode,
                     int length,
                     unsigned char iv[8],
@@ -515,6 +517,9 @@
     int i;
     unsigned char temp[8];
 
+    if( length % 8 )
+        return( POLARSSL_ERR_DES_INVALID_INPUT_LENGTH );
+
     if( mode == DES_ENCRYPT )
     {
         while( length > 0 )
@@ -547,12 +552,14 @@
             length -= 8;
         }
     }
+
+    return( 0 );
 }
 
 /*
  * 3DES-ECB block encryption/decryption
  */
-void des3_crypt_ecb( des3_context *ctx,
+int des3_crypt_ecb( des3_context *ctx,
                      const unsigned char input[8],
                      unsigned char output[8] )
 {
@@ -588,12 +595,14 @@
 
     PUT_ULONG_BE( Y, output, 0 );
     PUT_ULONG_BE( X, output, 4 );
+
+    return( 0 );
 }
 
 /*
  * 3DES-CBC buffer encryption/decryption
  */
-void des3_crypt_cbc( des3_context *ctx,
+int des3_crypt_cbc( des3_context *ctx,
                      int mode,
                      int length,
                      unsigned char iv[8],
@@ -603,6 +612,9 @@
     int i;
     unsigned char temp[8];
 
+    if( length % 8 )
+        return( POLARSSL_ERR_DES_INVALID_INPUT_LENGTH );
+
     if( mode == DES_ENCRYPT )
     {
         while( length > 0 )
@@ -635,6 +647,8 @@
             length -= 8;
         }
     }
+
+    return( 0 );
 }
 
 #if defined(POLARSSL_SELF_TEST)