|
|
@ -19,7 +19,7 @@ |
|
|
|
|
|
|
|
diff -pruN linux-2.6.9_orig/drivers/block/Kconfig linux-2.6.9/drivers/block/Kconfig
|
|
|
|
--- linux-2.6.9_orig/drivers/block/Kconfig 2004-10-18 23:53:43.000000000 +0200
|
|
|
|
+++ linux-2.6.9/drivers/block/Kconfig 2004-10-25 14:26:31.839233872 +0200
|
|
|
|
+++ linux-2.6.9/drivers/block/Kconfig 2005-01-11 09:27:53.485820920 +0100
|
|
|
|
@@ -235,14 +235,6 @@ config BLK_DEV_LOOP
|
|
|
|
bits of, say, a sound file). This is also safe if the file resides |
|
|
|
on a remote file server. |
|
|
@ -73,7 +73,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/Kconfig linux-2.6.9/drivers/block/Kcon |
|
|
|
tristate "Network block device support" |
|
|
|
diff -pruN linux-2.6.9_orig/drivers/block/Makefile linux-2.6.9/drivers/block/Makefile
|
|
|
|
--- linux-2.6.9_orig/drivers/block/Makefile 2004-10-18 23:54:55.000000000 +0200
|
|
|
|
+++ linux-2.6.9/drivers/block/Makefile 2004-10-25 14:26:31.840233720 +0200
|
|
|
|
+++ linux-2.6.9/drivers/block/Makefile 2005-01-11 09:27:53.486820768 +0100
|
|
|
|
@@ -1,6 +1,9 @@
|
|
|
|
# |
|
|
|
# Makefile for the kernel block device drivers. |
|
|
@ -86,7 +86,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/Makefile linux-2.6.9/drivers/block/Mak |
|
|
|
# |
|
|
|
diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop.c
|
|
|
|
--- linux-2.6.9_orig/drivers/block/loop.c 2004-10-18 23:54:32.000000000 +0200
|
|
|
|
+++ linux-2.6.9/drivers/block/loop.c 2004-10-25 14:26:31.845232960 +0200
|
|
|
|
+++ linux-2.6.9/drivers/block/loop.c 2005-01-11 09:27:53.491820008 +0100
|
|
|
|
@@ -39,18 +39,46 @@
|
|
|
|
* Support up to 256 loop devices |
|
|
|
* Heinz Mauelshagen <mge@sistina.com>, Feb 2002 |
|
|
@ -236,7 +236,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
{ |
|
|
|
if (info->lo_encrypt_key_size <= 0) |
|
|
|
return -EINVAL; |
|
|
|
@@ -135,337 +174,1207 @@ static int xor_init(struct loop_device *
|
|
|
|
@@ -135,337 +174,1264 @@ static int xor_init(struct loop_device *
|
|
|
|
static struct loop_func_table none_funcs = { |
|
|
|
.number = LO_CRYPT_NONE, |
|
|
|
.transfer = transfer_none, |
|
|
@ -268,10 +268,14 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+ aes_context *keyPtr[KEY_ALLOC_COUNT];
|
|
|
|
+ unsigned keyMask;
|
|
|
|
+#if CONFIG_BLK_DEV_LOOP_KEYSCRUB
|
|
|
|
+ u_int32_t *partialMD5;
|
|
|
|
+ u_int32_t partialMD5buf[8];
|
|
|
|
+ rwlock_t rwlock;
|
|
|
|
+ unsigned reversed;
|
|
|
|
+ unsigned blocked;
|
|
|
|
+ struct timer_list timer;
|
|
|
|
+#else
|
|
|
|
+ u_int32_t partialMD5[4];
|
|
|
|
+#endif
|
|
|
|
+} AESmultiKey;
|
|
|
|
+
|
|
|
@ -298,7 +302,17 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+ y--;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ m->reversed ^= 1;
|
|
|
|
+
|
|
|
|
+ x = m->reversed; /* x is 0 or 4 */
|
|
|
|
+ m->reversed ^= 4;
|
|
|
|
+ y = m->reversed; /* y is 4 or 0 */
|
|
|
|
+ p = &m->partialMD5buf[x];
|
|
|
|
+ memcpy(&m->partialMD5buf[y], p, 16);
|
|
|
|
+ m->partialMD5 = &m->partialMD5buf[y];
|
|
|
|
+ p[0] ^= 0xFFFFFFFF;
|
|
|
|
+ p[1] ^= 0xFFFFFFFF;
|
|
|
|
+ p[2] ^= 0xFFFFFFFF;
|
|
|
|
+ p[3] ^= 0xFFFFFFFF;
|
|
|
|
+
|
|
|
|
+ /* try to flush dirty cache data to RAM */
|
|
|
|
+#if defined(CONFIG_X86_64) || (defined(CONFIG_X86) && !defined(CONFIG_M386) && !defined(CONFIG_CPU_386))
|
|
|
@ -373,6 +387,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+ if(!m) return 0;
|
|
|
|
+ memset(m, 0, sizeof(AESmultiKey));
|
|
|
|
+#if CONFIG_BLK_DEV_LOOP_KEYSCRUB
|
|
|
|
+ m->partialMD5 = &m->partialMD5buf[0];
|
|
|
|
+ rwlock_init(&m->rwlock);
|
|
|
|
+ init_timer(&m->timer);
|
|
|
|
+ again:
|
|
|
@ -433,17 +448,18 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+ x += n;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ memset(m, 0, sizeof(AESmultiKey));
|
|
|
|
+ kfree(m);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int multiKeySetup(struct loop_device *lo, unsigned char *k)
|
|
|
|
+static int multiKeySetup(struct loop_device *lo, unsigned char *k, int version3)
|
|
|
|
+{
|
|
|
|
+ AESmultiKey *m;
|
|
|
|
+ aes_context *a;
|
|
|
|
+ int x, y, n, err = 0;
|
|
|
|
+ union {
|
|
|
|
+ u_int32_t w[8]; /* needed for 4 byte alignment for b[] */
|
|
|
|
+ unsigned char b[32];
|
|
|
|
+ u_int32_t w[16];
|
|
|
|
+ unsigned char b[64];
|
|
|
|
+ } un;
|
|
|
|
+
|
|
|
|
+ if(lo->lo_key_owner != current->uid && !capable(CAP_SYS_ADMIN))
|
|
|
@ -492,6 +508,28 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+ k += 32;
|
|
|
|
+ x++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ m->partialMD5[0] = 0x67452301;
|
|
|
|
+ m->partialMD5[1] = 0xefcdab89;
|
|
|
|
+ m->partialMD5[2] = 0x98badcfe;
|
|
|
|
+ m->partialMD5[3] = 0x10325476;
|
|
|
|
+ if(version3) {
|
|
|
|
+ /* only first 128 bits of iv-key is used */
|
|
|
|
+ if(copy_from_user(&un.b[0], k, 16)) {
|
|
|
|
+ err = -EFAULT;
|
|
|
|
+ goto error_out;
|
|
|
|
+ }
|
|
|
|
+#if defined(__BIG_ENDIAN)
|
|
|
|
+ un.w[0] = cpu_to_le32(un.w[0]);
|
|
|
|
+ un.w[1] = cpu_to_le32(un.w[1]);
|
|
|
|
+ un.w[2] = cpu_to_le32(un.w[2]);
|
|
|
|
+ un.w[3] = cpu_to_le32(un.w[3]);
|
|
|
|
+#endif
|
|
|
|
+ memset(&un.b[16], 0, 48);
|
|
|
|
+ md5_transform_CPUbyteorder(&m->partialMD5[0], &un.w[0]);
|
|
|
|
+ lo->lo_flags |= 0x080000; /* multi-key-v3 (info exported to user space) */
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ m->keyMask = 0x3F; /* range 0...63 */
|
|
|
|
+ lo->lo_flags |= 0x100000; /* multi-key (info exported to user space) */
|
|
|
|
+ memset(&un.b[0], 0, 32);
|
|
|
@ -579,7 +617,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
- up(&mapping->host->i_sem);
|
|
|
|
-out:
|
|
|
|
- return ret;
|
|
|
|
+void loop_compute_md5_iv(sector_t devSect, u_int32_t *ivout, u_int32_t *data)
|
|
|
|
+void loop_compute_md5_iv_v3(sector_t devSect, u_int32_t *ivout, u_int32_t *data)
|
|
|
|
+{
|
|
|
|
+ int x;
|
|
|
|
+#if defined(__BIG_ENDIAN)
|
|
|
@ -594,11 +632,6 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
- up(&mapping->host->i_sem);
|
|
|
|
- ret = -1;
|
|
|
|
- goto out;
|
|
|
|
+ ivout[0] = 0x67452301;
|
|
|
|
+ ivout[1] = 0xefcdab89;
|
|
|
|
+ ivout[2] = 0x98badcfe;
|
|
|
|
+ ivout[3] = 0x10325476;
|
|
|
|
+
|
|
|
|
+#if defined(__BIG_ENDIAN)
|
|
|
|
+ y = 7;
|
|
|
|
+ e = 16;
|
|
|
@ -662,11 +695,28 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
|
|
|
|
-static int
|
|
|
|
-lo_send(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos)
|
|
|
|
+static int transfer_aes(struct loop_device *lo, int cmd, char *raw_buf,
|
|
|
|
+ char *loop_buf, int size, sector_t devSect)
|
|
|
|
+/* this function exists for compatibility with old external cipher modules */
|
|
|
|
+void loop_compute_md5_iv(sector_t devSect, u_int32_t *ivout, u_int32_t *data)
|
|
|
|
{ |
|
|
|
- struct bio_vec *bvec;
|
|
|
|
- int i, ret = 0;
|
|
|
|
+ ivout[0] = 0x67452301;
|
|
|
|
+ ivout[1] = 0xefcdab89;
|
|
|
|
+ ivout[2] = 0x98badcfe;
|
|
|
|
+ ivout[3] = 0x10325476;
|
|
|
|
+ loop_compute_md5_iv_v3(devSect, ivout, data);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* Some external modules do not know if md5_transform_CPUbyteorder() */
|
|
|
|
+/* is asmlinkage or not, so here is C language wrapper for them. */
|
|
|
|
+void md5_transform_CPUbyteorder_C(u_int32_t *hash, u_int32_t const *in)
|
|
|
|
+{
|
|
|
|
+ md5_transform_CPUbyteorder(hash, in);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int transfer_aes(struct loop_device *lo, int cmd, char *raw_buf,
|
|
|
|
+ char *loop_buf, int size, sector_t devSect)
|
|
|
|
+{
|
|
|
|
+ aes_context *a;
|
|
|
|
+ AESmultiKey *m;
|
|
|
|
+ int x;
|
|
|
@ -702,7 +752,8 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+ if(y && !x) {
|
|
|
|
+ raw_buf -= 496;
|
|
|
|
+ loop_buf -= 496;
|
|
|
|
+ loop_compute_md5_iv(devSect, &iv[4], (u_int32_t *)(&loop_buf[16]));
|
|
|
|
+ memcpy(&iv[4], &m->partialMD5[0], 16);
|
|
|
|
+ loop_compute_md5_iv_v3(devSect, &iv[4], (u_int32_t *)(&loop_buf[16]));
|
|
|
|
+ } else {
|
|
|
|
+ raw_buf += 16;
|
|
|
|
+ loop_buf += 16;
|
|
|
@ -738,7 +789,8 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+ /* on 2.4 and later kernels, real raw_buf is not doing */
|
|
|
|
+ /* any writes now so it can be used as temp buffer */
|
|
|
|
+ memcpy(raw_buf, loop_buf, 512);
|
|
|
|
+ loop_compute_md5_iv(devSect, &iv[0], (u_int32_t *)(&raw_buf[16]));
|
|
|
|
+ memcpy(&iv[0], &m->partialMD5[0], 16);
|
|
|
|
+ loop_compute_md5_iv_v3(devSect, &iv[0], (u_int32_t *)(&raw_buf[16]));
|
|
|
|
+ x = 15;
|
|
|
|
+ do {
|
|
|
|
+ iv[0] ^= *((u_int32_t *)(&raw_buf[ 0]));
|
|
|
@ -809,7 +861,10 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+#endif
|
|
|
|
+ return(0);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
|
|
- bio_for_each_segment(bvec, bio, i) {
|
|
|
|
- ret = do_lo_send(lo, bvec, bsize, pos);
|
|
|
|
- if (ret < 0)
|
|
|
|
+static int keyClean_aes(struct loop_device *lo)
|
|
|
|
+{
|
|
|
|
+ if(lo->key_data) {
|
|
|
@ -818,17 +873,17 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+ }
|
|
|
|
+ return(0);
|
|
|
|
+}
|
|
|
|
|
|
|
|
- bio_for_each_segment(bvec, bio, i) {
|
|
|
|
- ret = do_lo_send(lo, bvec, bsize, pos);
|
|
|
|
- if (ret < 0)
|
|
|
|
+
|
|
|
|
+static int handleIoctl_aes(struct loop_device *lo, int cmd, unsigned long arg)
|
|
|
|
+{
|
|
|
|
+ int err;
|
|
|
|
+
|
|
|
|
+ switch (cmd) {
|
|
|
|
+ case LOOP_MULTI_KEY_SETUP:
|
|
|
|
+ err = multiKeySetup(lo, (unsigned char *)arg);
|
|
|
|
+ err = multiKeySetup(lo, (unsigned char *)arg, 0);
|
|
|
|
+ break;
|
|
|
|
+ case LOOP_MULTI_KEY_SETUP_V3:
|
|
|
|
+ err = multiKeySetup(lo, (unsigned char *)arg, 1);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ err = -EINVAL;
|
|
|
@ -845,7 +900,9 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+};
|
|
|
|
+
|
|
|
|
+EXPORT_SYMBOL(loop_compute_sector_iv);
|
|
|
|
+EXPORT_SYMBOL(loop_compute_md5_iv_v3);
|
|
|
|
+EXPORT_SYMBOL(loop_compute_md5_iv);
|
|
|
|
+EXPORT_SYMBOL(md5_transform_CPUbyteorder_C);
|
|
|
|
+#endif /* CONFIG_BLK_DEV_LOOP_AES */
|
|
|
|
+
|
|
|
|
+/* xfer_funcs[0] is special - its release function is never called */
|
|
|
@ -968,15 +1025,14 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+ atomic_set(&bio->bi_cnt, 1);
|
|
|
|
+ bio->bi_next = NULL;
|
|
|
|
+ bio_put(bio);
|
|
|
|
} |
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int loop_prealloc_init(struct loop_device *lo, int y)
|
|
|
|
+{
|
|
|
|
+ struct bio *bio;
|
|
|
|
+ int x;
|
|
|
|
|
|
|
|
- flush_dcache_page(p->page);
|
|
|
|
+
|
|
|
|
+ if(!y) {
|
|
|
|
+ y = lo_prealloc[0];
|
|
|
|
+ for (x = 1; x < (sizeof(lo_prealloc) / sizeof(int)); x += 2) {
|
|
|
@ -987,11 +1043,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ lo->lo_bio_flsh = (y * 3) / 4;
|
|
|
|
|
|
|
|
- desc->count = count - size;
|
|
|
|
- desc->written += size;
|
|
|
|
- p->offset += size;
|
|
|
|
- return size;
|
|
|
|
+
|
|
|
|
+ for (x = 0; x < y; x++) {
|
|
|
|
+ bio = bio_alloc(GFP_KERNEL, 1);
|
|
|
|
+ if (!bio) {
|
|
|
@ -1019,14 +1071,37 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+ bio->bi_vcnt = 1;
|
|
|
|
+ bio->bi_next = lo->lo_bio_free1;
|
|
|
|
+ lo->lo_bio_free1 = bio;
|
|
|
|
+ }
|
|
|
|
} |
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
|
|
|
|
- flush_dcache_page(p->page);
|
|
|
|
+static void loop_add_queue_last(struct loop_device *lo, struct bio *bio, struct bio **q)
|
|
|
|
+{
|
|
|
|
+ unsigned long flags;
|
|
|
|
|
|
|
|
- desc->count = count - size;
|
|
|
|
- desc->written += size;
|
|
|
|
- p->offset += size;
|
|
|
|
- return size;
|
|
|
|
+ spin_lock_irqsave(&lo->lo_lock, flags);
|
|
|
|
+ if (*q) {
|
|
|
|
+ bio->bi_next = (*q)->bi_next;
|
|
|
|
+ (*q)->bi_next = bio;
|
|
|
|
+ } else {
|
|
|
|
+ bio->bi_next = bio;
|
|
|
|
+ }
|
|
|
|
+ *q = bio;
|
|
|
|
+ spin_unlock_irqrestore(&lo->lo_lock, flags);
|
|
|
|
+
|
|
|
|
+ if (waitqueue_active(&lo->lo_bio_wait))
|
|
|
|
+ wake_up_interruptible(&lo->lo_bio_wait);
|
|
|
|
} |
|
|
|
|
|
|
|
-static int
|
|
|
|
-do_lo_receive(struct loop_device *lo,
|
|
|
|
- struct bio_vec *bvec, int bsize, loff_t pos)
|
|
|
|
+static void loop_add_queue_last(struct loop_device *lo, struct bio *bio, struct bio **q)
|
|
|
|
+static void loop_add_queue_first(struct loop_device *lo, struct bio *bio, struct bio **q)
|
|
|
|
{ |
|
|
|
- struct lo_read_data cookie;
|
|
|
|
- struct file *file;
|
|
|
@ -1040,48 +1115,30 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
- retval = file->f_op->sendfile(file, &pos, bvec->bv_len,
|
|
|
|
- lo_read_actor, &cookie);
|
|
|
|
- return (retval < 0)? retval: 0;
|
|
|
|
+ unsigned long flags;
|
|
|
|
+
|
|
|
|
+ spin_lock_irqsave(&lo->lo_lock, flags);
|
|
|
|
+ spin_lock_irq(&lo->lo_lock);
|
|
|
|
+ if (*q) {
|
|
|
|
+ bio->bi_next = (*q)->bi_next;
|
|
|
|
+ (*q)->bi_next = bio;
|
|
|
|
+ } else {
|
|
|
|
+ bio->bi_next = bio;
|
|
|
|
+ *q = bio;
|
|
|
|
+ }
|
|
|
|
+ *q = bio;
|
|
|
|
+ spin_unlock_irqrestore(&lo->lo_lock, flags);
|
|
|
|
+
|
|
|
|
+ if (waitqueue_active(&lo->lo_bio_wait))
|
|
|
|
+ wake_up_interruptible(&lo->lo_bio_wait);
|
|
|
|
+ spin_unlock_irq(&lo->lo_lock);
|
|
|
|
} |
|
|
|
|
|
|
|
-static int
|
|
|
|
-lo_receive(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos)
|
|
|
|
+static void loop_add_queue_first(struct loop_device *lo, struct bio *bio, struct bio **q)
|
|
|
|
+static struct bio *loop_get_bio(struct loop_device *lo, int *list_nr)
|
|
|
|
{ |
|
|
|
- struct bio_vec *bvec;
|
|
|
|
- int i, ret = 0;
|
|
|
|
+ spin_lock_irq(&lo->lo_lock);
|
|
|
|
+ if (*q) {
|
|
|
|
+ bio->bi_next = (*q)->bi_next;
|
|
|
|
+ (*q)->bi_next = bio;
|
|
|
|
+ } else {
|
|
|
|
+ bio->bi_next = bio;
|
|
|
|
+ *q = bio;
|
|
|
|
+ }
|
|
|
|
+ spin_unlock_irq(&lo->lo_lock);
|
|
|
|
+}
|
|
|
|
+ struct bio *bio = NULL, *last;
|
|
|
|
|
|
|
|
- bio_for_each_segment(bvec, bio, i) {
|
|
|
|
- ret = do_lo_receive(lo, bvec, bsize, pos);
|
|
|
|
- if (ret < 0)
|
|
|
|
- break;
|
|
|
|
- pos += bvec->bv_len;
|
|
|
|
+static struct bio *loop_get_bio(struct loop_device *lo, int *list_nr)
|
|
|
|
+{
|
|
|
|
+ struct bio *bio = NULL, *last;
|
|
|
|
+
|
|
|
|
+ spin_lock_irq(&lo->lo_lock);
|
|
|
|
+ if ((last = lo->lo_bio_que0)) {
|
|
|
|
+ bio = last->bi_next;
|
|
|
@ -1687,7 +1744,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
|
|
|
|
/* |
|
|
|
* worker thread that handles reads/writes to file backed loop devices, |
|
|
|
@@ -476,20 +1385,45 @@ static inline void loop_handle_bio(struc
|
|
|
|
@@ -476,20 +1442,45 @@ static inline void loop_handle_bio(struc
|
|
|
|
static int loop_thread(void *data) |
|
|
|
{ |
|
|
|
struct loop_device *lo = data; |
|
|
@ -1737,7 +1794,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
atomic_inc(&lo->lo_pending); |
|
|
|
|
|
|
|
/* |
|
|
|
@@ -498,23 +1432,152 @@ static int loop_thread(void *data)
|
|
|
|
@@ -498,23 +1489,152 @@ static int loop_thread(void *data)
|
|
|
|
up(&lo->lo_sem); |
|
|
|
|
|
|
|
for (;;) { |
|
|
@ -1897,7 +1954,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
* will hit zero then |
|
|
|
*/ |
|
|
|
if (atomic_dec_and_test(&lo->lo_pending)) |
|
|
|
@@ -525,101 +1588,26 @@ static int loop_thread(void *data)
|
|
|
|
@@ -525,101 +1645,26 @@ static int loop_thread(void *data)
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
@ -2017,7 +2074,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
} |
|
|
|
|
|
|
|
static int loop_set_fd(struct loop_device *lo, struct file *lo_file, |
|
|
|
@@ -627,124 +1615,189 @@ static int loop_set_fd(struct loop_devic
|
|
|
|
@@ -627,124 +1672,189 @@ static int loop_set_fd(struct loop_devic
|
|
|
|
{ |
|
|
|
struct file *file; |
|
|
|
struct inode *inode; |
|
|
@ -2259,7 +2316,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
return -EINVAL; |
|
|
|
if (xfer->init) |
|
|
|
err = xfer->init(lo, i); |
|
|
|
@@ -761,59 +1814,54 @@ static int loop_clr_fd(struct loop_devic
|
|
|
|
@@ -761,59 +1871,54 @@ static int loop_clr_fd(struct loop_devic
|
|
|
|
struct file *filp = lo->lo_backing_file; |
|
|
|
int gfp = lo->old_gfp_mask; |
|
|
|
|
|
|
@ -2337,7 +2394,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
if ((unsigned int) info->lo_encrypt_key_size > LO_KEY_SIZE) |
|
|
|
return -EINVAL; |
|
|
|
|
|
|
|
@@ -821,6 +1869,22 @@ loop_set_status(struct loop_device *lo,
|
|
|
|
@@ -821,6 +1926,22 @@ loop_set_status(struct loop_device *lo,
|
|
|
|
if (err) |
|
|
|
return err; |
|
|
|
|
|
|
@ -2360,7 +2417,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
if (info->lo_encrypt_type) { |
|
|
|
unsigned int type = info->lo_encrypt_type; |
|
|
|
|
|
|
|
@@ -829,31 +1893,20 @@ loop_set_status(struct loop_device *lo,
|
|
|
|
@@ -829,31 +1950,20 @@ loop_set_status(struct loop_device *lo,
|
|
|
|
xfer = xfer_funcs[type]; |
|
|
|
if (xfer == NULL) |
|
|
|
return -EINVAL; |
|
|
@ -2398,7 +2455,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
lo->lo_encrypt_key_size = info->lo_encrypt_key_size; |
|
|
|
lo->lo_init[0] = info->lo_init[0]; |
|
|
|
lo->lo_init[1] = info->lo_init[1]; |
|
|
|
@@ -863,18 +1916,16 @@ loop_set_status(struct loop_device *lo,
|
|
|
|
@@ -863,18 +1973,16 @@ loop_set_status(struct loop_device *lo,
|
|
|
|
lo->lo_key_owner = current->uid; |
|
|
|
} |
|
|
|
|
|
|
@ -2419,7 +2476,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
error = vfs_getattr(file->f_vfsmnt, file->f_dentry, &stat); |
|
|
|
if (error) |
|
|
|
return error; |
|
|
|
@@ -883,17 +1934,18 @@ loop_get_status(struct loop_device *lo,
|
|
|
|
@@ -883,17 +1991,18 @@ loop_get_status(struct loop_device *lo,
|
|
|
|
info->lo_device = huge_encode_dev(stat.dev); |
|
|
|
info->lo_inode = stat.ino; |
|
|
|
info->lo_rdevice = huge_encode_dev(lo->lo_device ? stat.rdev : stat.dev); |
|
|
@ -2441,7 +2498,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
@@ -907,7 +1959,6 @@ loop_info64_from_old(const struct loop_i
|
|
|
|
@@ -907,7 +2016,6 @@ loop_info64_from_old(const struct loop_i
|
|
|
|
info64->lo_inode = info->lo_inode; |
|
|
|
info64->lo_rdevice = info->lo_rdevice; |
|
|
|
info64->lo_offset = info->lo_offset; |
|
|
@ -2449,7 +2506,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
info64->lo_encrypt_type = info->lo_encrypt_type; |
|
|
|
info64->lo_encrypt_key_size = info->lo_encrypt_key_size; |
|
|
|
info64->lo_flags = info->lo_flags; |
|
|
|
@@ -921,7 +1972,7 @@ loop_info64_from_old(const struct loop_i
|
|
|
|
@@ -921,7 +2029,7 @@ loop_info64_from_old(const struct loop_i
|
|
|
|
} |
|
|
|
|
|
|
|
static int |
|
|
@ -2458,7 +2515,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
{ |
|
|
|
memset(info, 0, sizeof(*info)); |
|
|
|
info->lo_number = info64->lo_number; |
|
|
|
@@ -944,14 +1995,15 @@ loop_info64_to_old(const struct loop_inf
|
|
|
|
@@ -944,14 +2052,15 @@ loop_info64_to_old(const struct loop_inf
|
|
|
|
if (info->lo_device != info64->lo_device || |
|
|
|
info->lo_rdevice != info64->lo_rdevice || |
|
|
|
info->lo_inode != info64->lo_inode || |
|
|
@ -2476,7 +2533,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
{ |
|
|
|
struct loop_info info; |
|
|
|
struct loop_info64 info64; |
|
|
|
@@ -959,21 +2011,22 @@ loop_set_status_old(struct loop_device *
|
|
|
|
@@ -959,21 +2068,22 @@ loop_set_status_old(struct loop_device *
|
|
|
|
if (copy_from_user(&info, arg, sizeof (struct loop_info))) |
|
|
|
return -EFAULT; |
|
|
|
loop_info64_from_old(&info, &info64); |
|
|
@ -2503,7 +2560,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
struct loop_info info; |
|
|
|
struct loop_info64 info64; |
|
|
|
int err = 0; |
|
|
|
@@ -991,7 +2044,7 @@ loop_get_status_old(struct loop_device *
|
|
|
|
@@ -991,7 +2101,7 @@ loop_get_status_old(struct loop_device *
|
|
|
|
} |
|
|
|
|
|
|
|
static int |
|
|
@ -2512,7 +2569,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
struct loop_info64 info64; |
|
|
|
int err = 0; |
|
|
|
|
|
|
|
@@ -1005,61 +2058,65 @@ loop_get_status64(struct loop_device *lo
|
|
|
|
@@ -1005,61 +2115,65 @@ loop_get_status64(struct loop_device *lo
|
|
|
|
return err; |
|
|
|
} |
|
|
|
|
|
|
@ -2604,7 +2661,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -1073,8 +2130,6 @@ static struct block_device_operations lo
|
|
|
|
@@ -1073,8 +2187,6 @@ static struct block_device_operations lo
|
|
|
|
/* |
|
|
|
* And now the modules code and kernel interface. |
|
|
|
*/ |
|
|
@ -2613,7 +2670,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
MODULE_LICENSE("GPL"); |
|
|
|
MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR); |
|
|
|
|
|
|
|
@@ -1093,21 +2148,18 @@ int loop_unregister_transfer(int number)
|
|
|
|
@@ -1093,21 +2205,18 @@ int loop_unregister_transfer(int number)
|
|
|
|
unsigned int n = number; |
|
|
|
struct loop_device *lo; |
|
|
|
struct loop_func_table *xfer; |
|
|
@ -2640,7 +2697,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -1118,7 +2170,7 @@ int __init loop_init(void)
|
|
|
|
@@ -1118,7 +2227,7 @@ int __init loop_init(void)
|
|
|
|
{ |
|
|
|
int i; |
|
|
|
|
|
|
@ -2649,7 +2706,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
printk(KERN_WARNING "loop: invalid max_loop (must be between" |
|
|
|
" 1 and 256), using default (8)\n"); |
|
|
|
max_loop = 8; |
|
|
|
@@ -1127,62 +2179,86 @@ int __init loop_init(void)
|
|
|
|
@@ -1127,62 +2236,87 @@ int __init loop_init(void)
|
|
|
|
if (register_blkdev(LOOP_MAJOR, "loop")) |
|
|
|
return -EIO; |
|
|
|
|
|
|
@ -2696,6 +2753,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
|
|
|
|
+#if defined(IOCTL32_COMPATIBLE_PTR)
|
|
|
|
+ register_ioctl32_conversion(LOOP_MULTI_KEY_SETUP, IOCTL32_COMPATIBLE_PTR);
|
|
|
|
+ register_ioctl32_conversion(LOOP_MULTI_KEY_SETUP_V3, IOCTL32_COMPATIBLE_PTR);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
devfs_mk_dir("loop"); |
|
|
@ -2758,7 +2816,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
out_mem1: |
|
|
|
unregister_blkdev(LOOP_MAJOR, "loop"); |
|
|
|
printk(KERN_ERR "loop: ran out of memory\n"); |
|
|
|
@@ -1195,26 +2271,30 @@ void loop_exit(void)
|
|
|
|
@@ -1195,26 +2329,31 @@ void loop_exit(void)
|
|
|
|
|
|
|
|
for (i = 0; i < max_loop; i++) { |
|
|
|
del_gendisk(disks[i]); |
|
|
@ -2778,6 +2836,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
+
|
|
|
|
+#if defined(IOCTL32_COMPATIBLE_PTR)
|
|
|
|
+ unregister_ioctl32_conversion(LOOP_MULTI_KEY_SETUP);
|
|
|
|
+ unregister_ioctl32_conversion(LOOP_MULTI_KEY_SETUP_V3);
|
|
|
|
+#endif
|
|
|
|
} |
|
|
|
|
|
|
@ -2802,7 +2861,7 @@ diff -pruN linux-2.6.9_orig/drivers/block/loop.c linux-2.6.9/drivers/block/loop. |
|
|
|
#endif |
|
|
|
diff -pruN linux-2.6.9_orig/drivers/misc/Makefile linux-2.6.9/drivers/misc/Makefile
|
|
|
|
--- linux-2.6.9_orig/drivers/misc/Makefile 2004-10-18 23:55:24.000000000 +0200
|
|
|
|
+++ linux-2.6.9/drivers/misc/Makefile 2004-10-25 14:26:31.845232960 +0200
|
|
|
|
+++ linux-2.6.9/drivers/misc/Makefile 2005-01-11 09:27:53.491820008 +0100
|
|
|
|
@@ -4,3 +4,24 @@
|
|
|
|
obj- := misc.o # Dummy rule to force built-in.o to be made |
|
|
|
|
|
|
@ -2830,7 +2889,7 @@ diff -pruN linux-2.6.9_orig/drivers/misc/Makefile linux-2.6.9/drivers/misc/Makef |
|
|
|
+endif
|
|
|
|
diff -pruN linux-2.6.9_orig/drivers/misc/aes-amd64.S linux-2.6.9/drivers/misc/aes-amd64.S
|
|
|
|
--- linux-2.6.9_orig/drivers/misc/aes-amd64.S 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ linux-2.6.9/drivers/misc/aes-amd64.S 2004-10-25 14:26:31.848232504 +0200
|
|
|
|
+++ linux-2.6.9/drivers/misc/aes-amd64.S 2005-01-11 09:27:53.493819704 +0100
|
|
|
|
@@ -0,0 +1,893 @@
|
|
|
|
+//
|
|
|
|
+// Copyright (c) 2001, Dr Brian Gladman <brg@gladman.uk.net>, Worcester, UK.
|
|
|
@ -3727,7 +3786,7 @@ diff -pruN linux-2.6.9_orig/drivers/misc/aes-amd64.S linux-2.6.9/drivers/misc/ae |
|
|
|
+ im_data7(v3)
|
|
|
|
diff -pruN linux-2.6.9_orig/drivers/misc/aes-x86.S linux-2.6.9/drivers/misc/aes-x86.S
|
|
|
|
--- linux-2.6.9_orig/drivers/misc/aes-x86.S 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ linux-2.6.9/drivers/misc/aes-x86.S 2004-10-25 14:26:31.850232200 +0200
|
|
|
|
+++ linux-2.6.9/drivers/misc/aes-x86.S 2005-01-11 09:27:53.496819248 +0100
|
|
|
|
@@ -0,0 +1,922 @@
|
|
|
|
+//
|
|
|
|
+// Copyright (c) 2001, Dr Brian Gladman <brg@gladman.uk.net>, Worcester, UK.
|
|
|
@ -4653,7 +4712,7 @@ diff -pruN linux-2.6.9_orig/drivers/misc/aes-x86.S linux-2.6.9/drivers/misc/aes- |
|
|
|
+ im_data7(v3)
|
|
|
|
diff -pruN linux-2.6.9_orig/drivers/misc/aes.c linux-2.6.9/drivers/misc/aes.c
|
|
|
|
--- linux-2.6.9_orig/drivers/misc/aes.c 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ linux-2.6.9/drivers/misc/aes.c 2004-10-25 14:26:31.882227336 +0200
|
|
|
|
+++ linux-2.6.9/drivers/misc/aes.c 2005-01-11 09:27:53.499818792 +0100
|
|
|
|
@@ -0,0 +1,1479 @@
|
|
|
|
+// I retain copyright in this code but I encourage its free use provided
|
|
|
|
+// that I don't carry any responsibility for the results. I am especially
|
|
|
@ -6136,7 +6195,7 @@ diff -pruN linux-2.6.9_orig/drivers/misc/aes.c linux-2.6.9/drivers/misc/aes.c |
|
|
|
+}
|
|
|
|
diff -pruN linux-2.6.9_orig/drivers/misc/aes.h linux-2.6.9/drivers/misc/aes.h
|
|
|
|
--- linux-2.6.9_orig/drivers/misc/aes.h 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ linux-2.6.9/drivers/misc/aes.h 2004-10-25 14:26:31.883227184 +0200
|
|
|
|
+++ linux-2.6.9/drivers/misc/aes.h 2005-01-11 09:27:53.500818640 +0100
|
|
|
|
@@ -0,0 +1,113 @@
|
|
|
|
+// I retain copyright in this code but I encourage its free use provided
|
|
|
|
+// that I don't carry any responsibility for the results. I am especially
|
|
|
@ -6253,7 +6312,7 @@ diff -pruN linux-2.6.9_orig/drivers/misc/aes.h linux-2.6.9/drivers/misc/aes.h |
|
|
|
+#endif // _AES_H
|
|
|
|
diff -pruN linux-2.6.9_orig/drivers/misc/crypto-ksym.c linux-2.6.9/drivers/misc/crypto-ksym.c
|
|
|
|
--- linux-2.6.9_orig/drivers/misc/crypto-ksym.c 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ linux-2.6.9/drivers/misc/crypto-ksym.c 2004-10-25 14:26:31.883227184 +0200
|
|
|
|
+++ linux-2.6.9/drivers/misc/crypto-ksym.c 2005-01-11 09:27:53.500818640 +0100
|
|
|
|
@@ -0,0 +1,7 @@
|
|
|
|
+#include <linux/module.h>
|
|
|
|
+#include "aes.h"
|
|
|
@ -6264,7 +6323,7 @@ diff -pruN linux-2.6.9_orig/drivers/misc/crypto-ksym.c linux-2.6.9/drivers/misc/ |
|
|
|
+EXPORT_SYMBOL(md5_transform_CPUbyteorder);
|
|
|
|
diff -pruN linux-2.6.9_orig/drivers/misc/md5-amd64.S linux-2.6.9/drivers/misc/md5-amd64.S
|
|
|
|
--- linux-2.6.9_orig/drivers/misc/md5-amd64.S 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ linux-2.6.9/drivers/misc/md5-amd64.S 2004-10-25 14:26:31.884227032 +0200
|
|
|
|
+++ linux-2.6.9/drivers/misc/md5-amd64.S 2005-01-11 09:27:53.501818488 +0100
|
|
|
|
@@ -0,0 +1,200 @@
|
|
|
|
+//
|
|
|
|
+// md5-amd64.S
|
|
|
@ -6468,7 +6527,7 @@ diff -pruN linux-2.6.9_orig/drivers/misc/md5-amd64.S linux-2.6.9/drivers/misc/md |
|
|
|
+ ret
|
|
|
|
diff -pruN linux-2.6.9_orig/drivers/misc/md5-x86.S linux-2.6.9/drivers/misc/md5-x86.S
|
|
|
|
--- linux-2.6.9_orig/drivers/misc/md5-x86.S 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ linux-2.6.9/drivers/misc/md5-x86.S 2004-10-25 14:26:31.885226880 +0200
|
|
|
|
+++ linux-2.6.9/drivers/misc/md5-x86.S 2005-01-11 09:27:53.502818336 +0100
|
|
|
|
@@ -0,0 +1,207 @@
|
|
|
|
+//
|
|
|
|
+// md5-x86.S
|
|
|
@ -6679,7 +6738,7 @@ diff -pruN linux-2.6.9_orig/drivers/misc/md5-x86.S linux-2.6.9/drivers/misc/md5- |
|
|
|
+ ret
|
|
|
|
diff -pruN linux-2.6.9_orig/drivers/misc/md5.c linux-2.6.9/drivers/misc/md5.c
|
|
|
|
--- linux-2.6.9_orig/drivers/misc/md5.c 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ linux-2.6.9/drivers/misc/md5.c 2004-10-25 14:26:31.885226880 +0200
|
|
|
|
+++ linux-2.6.9/drivers/misc/md5.c 2005-01-11 09:27:53.502818336 +0100
|
|
|
|
@@ -0,0 +1,106 @@
|
|
|
|
+/*
|
|
|
|
+ * MD5 Message Digest Algorithm (RFC1321).
|
|
|
@ -6789,7 +6848,7 @@ diff -pruN linux-2.6.9_orig/drivers/misc/md5.c linux-2.6.9/drivers/misc/md5.c |
|
|
|
+}
|
|
|
|
diff -pruN linux-2.6.9_orig/drivers/misc/md5.h linux-2.6.9/drivers/misc/md5.h
|
|
|
|
--- linux-2.6.9_orig/drivers/misc/md5.h 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ linux-2.6.9/drivers/misc/md5.h 2004-10-25 14:26:31.898224904 +0200
|
|
|
|
+++ linux-2.6.9/drivers/misc/md5.h 2005-01-11 09:27:53.502818336 +0100
|
|
|
|
@@ -0,0 +1,11 @@
|
|
|
|
+/* md5.h */
|
|
|
|
+
|
|
|
@ -6804,7 +6863,7 @@ diff -pruN linux-2.6.9_orig/drivers/misc/md5.h linux-2.6.9/drivers/misc/md5.h |
|
|
|
+extern void md5_transform_CPUbyteorder(u_int32_t *, u_int32_t const *);
|
|
|
|
diff -pruN linux-2.6.9_orig/include/linux/loop.h linux-2.6.9/include/linux/loop.h
|
|
|
|
--- linux-2.6.9_orig/include/linux/loop.h 2004-10-18 23:55:36.000000000 +0200
|
|
|
|
+++ linux-2.6.9/include/linux/loop.h 2004-10-25 14:26:31.898224904 +0200
|
|
|
|
+++ linux-2.6.9/include/linux/loop.h 2005-01-11 09:27:53.503818184 +0100
|
|
|
|
@@ -16,54 +16,57 @@
|
|
|
|
#ifdef __KERNEL__ |
|
|
|
#include <linux/bio.h> |
|
|
@ -6931,9 +6990,10 @@ diff -pruN linux-2.6.9_orig/include/linux/loop.h linux-2.6.9/include/linux/loop. |
|
|
|
|
|
|
|
#endif |
|
|
|
/* |
|
|
|
@@ -155,4 +158,5 @@ int loop_unregister_transfer(int number)
|
|
|
|
@@ -155,4 +158,6 @@ int loop_unregister_transfer(int number)
|
|
|
|
#define LOOP_GET_STATUS64 0x4C05 |
|
|
|
#define LOOP_CHANGE_FD 0x4C06 |
|
|
|
|
|
|
|
+#define LOOP_MULTI_KEY_SETUP 0x4C4D
|
|
|
|
+#define LOOP_MULTI_KEY_SETUP 0x4C4D
|
|
|
|
+#define LOOP_MULTI_KEY_SETUP_V3 0x4C4E
|
|
|
|
#endif |