It seems that 
   crypto_cipher_encrypt_iv(); and decrypt_iv(); 

BUG_ON() if the cit_mode is MODE_ECB. Okay, that's reasonable.

The problem is that the OCF cryptosoft interface for OCF sets the mode=0,
now. Since it's a NULL cipher, it doesn't matter what mode, so I've
changed it to CBC mode, and fixed the code in crypto.c to deal with a
cipher that has a 1-byte block size.

commit 940e136dd89fd58d0b02e540167f2d29c68bdbb6
Author: Michael Richardson <[EMAIL PROTECTED]>
Date:   Sat Jun 10 11:28:15 2006 -0400

    include support for null cipher --- block size of "1"

diff --git a/crypto/cipher.c b/crypto/cipher.c
index 65bcea0..bb27b14 100644
--- a/crypto/cipher.c
+++ b/crypto/cipher.c
@@ -23,6 +23,11 @@ #include <asm/scatterlist.h>
 #include "internal.h"
 #include "scatterwalk.h"
 
+static inline void xor_1(u8 *a, const u8 *b)
+{
+       a[0] ^= b[0];
+}
+
 static inline void xor_64(u8 *a, const u8 *b)
 {
        ((u32 *)a)[0] ^= ((u32 *)b)[0];
@@ -431,6 +436,11 @@ int crypto_init_cipher_ops(struct crypto
                unsigned long addr;
                
                switch (crypto_tfm_alg_blocksize(tfm)) {
+               case 1:
+                       /* some ciphers (e.g. null) have no restrictions. */
+                       ops->cit_xor_block = xor_1;
+                       break;
+                       
                case 8:
                        ops->cit_xor_block = xor_64;
                        break;





-- 
]       ON HUMILITY: to err is human. To moo, bovine.           |  firewalls  [
]   Michael Richardson,    Xelerance Corporation, Ottawa, ON    |net architect[
] [EMAIL PROTECTED]      http://www.sandelman.ottawa.on.ca/mcr/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [

    "The Microsoft _Get the Facts CD_ does not work on Linux." - orospakr


Attachment: pgptjx2YYoHCe.pgp
Description: PGP signature

Reply via email to