sshd, with OCF under the ssl covers, abruptly closes incoming connections with:

cipher_init: EVP_CipherInit: set key failed for aes128-cbc

and

cryptodev_digest_init: Can't get Dev

type messages.  AFAIKT, this is architecture independent and OCF crypto driver 
independent.

I found the problem lied in OCF-Linux' CRIOGET handling code.  Not being very 
familiar with linux fs code, I stumbled upon Michal Ludvig's implementation, 
which seems to work well with a minor adjustment.  Thanks to Michal.

Kim


--- cryptodev-orig.c    2006-02-07 18:43:44.000000000 -0600
+++ cryptodev.c 2006-02-07 18:46:57.000000000 -0600
@@ -544,6 +544,22 @@
 }

 static int
+clonefd(struct file *filp)
+{
+       struct files_struct * files = current->files;
+       int fd;
+
+       fd = get_unused_fd();
+       if (fd >= 0) {
+               get_file(filp);
+               FD_SET(fd, files_fdtable(files)->open_fds);
+               fd_install(fd, filp);
+       }
+
+       return fd;
+}
+
+static int
 cryptodev_ioctl(
        struct inode *inode,
        struct file *filp,
@@ -567,10 +583,7 @@
        switch (cmd) {
        case CRIOGET:
                dprintk("%s(CRIOGET)\n", __FUNCTION__);
-               fs = get_fs();
-               set_fs(get_ds());
-
-               fd = open("/dev/crypto", O_RDWR, 0);
+               fd = clonefd(filp);
                put_user(fd, (int *) arg);
                return(fd == -1 ? -errno : 0);
-
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to