From 40b344028b6b043b73512f036be7b3e963f85c88 Mon Sep 17 00:00:00 2001 From: jow Date: Tue, 4 May 2010 20:59:19 +0000 Subject: [generic-2.6] update OCF framework to version 20100325 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21356 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../970-ocf_kbuild_integration.patch | 19 +- .../patches-2.6.34/971-ocf_20080917.patch | 152 ---------------- .../patches-2.6.34/971-ocf_20100325.patch | 170 ++++++++++++++++++ .../patches-2.6.34/972-ocf_compile_fix.patch | 11 -- .../patches-2.6.34/973-ocf_2.6.27_fix.patch | 197 --------------------- 5 files changed, 177 insertions(+), 372 deletions(-) delete mode 100644 target/linux/generic-2.6/patches-2.6.34/971-ocf_20080917.patch create mode 100644 target/linux/generic-2.6/patches-2.6.34/971-ocf_20100325.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.34/972-ocf_compile_fix.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.34/973-ocf_2.6.27_fix.patch (limited to 'target/linux/generic-2.6/patches-2.6.34') diff --git a/target/linux/generic-2.6/patches-2.6.34/970-ocf_kbuild_integration.patch b/target/linux/generic-2.6/patches-2.6.34/970-ocf_kbuild_integration.patch index 3a285deba..76413e9ce 100644 --- a/target/linux/generic-2.6/patches-2.6.34/970-ocf_kbuild_integration.patch +++ b/target/linux/generic-2.6/patches-2.6.34/970-ocf_kbuild_integration.patch @@ -1,25 +1,20 @@ --- a/crypto/Kconfig +++ b/crypto/Kconfig -@@ -833,6 +833,8 @@ config CRYPTO_ANSI_CPRNG - ANSI X9.31 A.2.4. Note that this option must be enabled if - CRYPTO_FIPS is selected - -+source "crypto/ocf/Kconfig" -+ +@@ -836,3 +836,6 @@ config CRYPTO_ANSI_CPRNG source "drivers/crypto/Kconfig" endif # if CRYPTO ++ ++source "crypto/ocf/Kconfig" ++ --- a/crypto/Makefile +++ b/crypto/Makefile -@@ -87,6 +87,11 @@ obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o +@@ -86,6 +86,8 @@ obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_ + obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o obj-$(CONFIG_CRYPTO_GHASH) += ghash-generic.o - # -+# OCF -+# +obj-$(CONFIG_OCF_OCF) += ocf/ + -+# + # # generic algorithms and the async_tx api # - obj-$(CONFIG_XOR_BLOCKS) += xor.o diff --git a/target/linux/generic-2.6/patches-2.6.34/971-ocf_20080917.patch b/target/linux/generic-2.6/patches-2.6.34/971-ocf_20080917.patch deleted file mode 100644 index 575e36911..000000000 --- a/target/linux/generic-2.6/patches-2.6.34/971-ocf_20080917.patch +++ /dev/null @@ -1,152 +0,0 @@ ---- a/drivers/char/random.c -+++ b/drivers/char/random.c -@@ -129,6 +129,9 @@ - * unsigned int value); - * void add_interrupt_randomness(int irq); - * -+ * void random_input_words(__u32 *buf, size_t wordcount, int ent_count) -+ * int random_input_wait(void); -+ * - * add_input_randomness() uses the input layer interrupt timing, as well as - * the event type information from the hardware. - * -@@ -140,6 +143,13 @@ - * a better measure, since the timing of the disk interrupts are more - * unpredictable. - * -+ * random_input_words() just provides a raw block of entropy to the input -+ * pool, such as from a hardware entropy generator. -+ * -+ * random_input_wait() suspends the caller until such time as the -+ * entropy pool falls below the write threshold, and returns a count of how -+ * much entropy (in bits) is needed to sustain the pool. -+ * - * All of these routines try to estimate how many bits of randomness a - * particular randomness source. They do this by keeping track of the - * first and second order deltas of the event timings. -@@ -714,6 +724,61 @@ void add_disk_randomness(struct gendisk - } - #endif - -+/* -+ * random_input_words - add bulk entropy to pool -+ * -+ * @buf: buffer to add -+ * @wordcount: number of __u32 words to add -+ * @ent_count: total amount of entropy (in bits) to credit -+ * -+ * this provides bulk input of entropy to the input pool -+ * -+ */ -+void random_input_words(__u32 *buf, size_t wordcount, int ent_count) -+{ -+ mix_pool_bytes(&input_pool, buf, wordcount*4); -+ -+ credit_entropy_bits(&input_pool, ent_count); -+ -+ DEBUG_ENT("crediting %d bits => %d\n", -+ ent_count, input_pool.entropy_count); -+ /* -+ * Wake up waiting processes if we have enough -+ * entropy. -+ */ -+ if (input_pool.entropy_count >= random_read_wakeup_thresh) -+ wake_up_interruptible(&random_read_wait); -+} -+EXPORT_SYMBOL(random_input_words); -+ -+/* -+ * random_input_wait - wait until random needs entropy -+ * -+ * this function sleeps until the /dev/random subsystem actually -+ * needs more entropy, and then return the amount of entropy -+ * that it would be nice to have added to the system. -+ */ -+int random_input_wait(void) -+{ -+ int count; -+ -+ wait_event_interruptible(random_write_wait, -+ input_pool.entropy_count < random_write_wakeup_thresh); -+ -+ count = random_write_wakeup_thresh - input_pool.entropy_count; -+ -+ /* likely we got woken up due to a signal */ -+ if (count <= 0) count = random_read_wakeup_thresh; -+ -+ DEBUG_ENT("requesting %d bits from input_wait()er %d<%d\n", -+ count, -+ input_pool.entropy_count, random_write_wakeup_thresh); -+ -+ return count; -+} -+EXPORT_SYMBOL(random_input_wait); -+ -+ - #define EXTRACT_SIZE 10 - - /********************************************************************* ---- a/fs/fcntl.c -+++ b/fs/fcntl.c -@@ -141,6 +141,7 @@ SYSCALL_DEFINE1(dup, unsigned int, filde - } - return ret; - } -+EXPORT_SYMBOL(sys_dup); - - #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME) - ---- a/include/linux/miscdevice.h -+++ b/include/linux/miscdevice.h -@@ -12,6 +12,7 @@ - #define APOLLO_MOUSE_MINOR 7 - #define PC110PAD_MINOR 9 - /*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */ -+#define CRYPTODEV_MINOR 70 /* /dev/crypto */ - #define WATCHDOG_MINOR 130 /* Watchdog timer */ - #define TEMP_MINOR 131 /* Temperature Sensor */ - #define RTC_MINOR 135 ---- a/include/linux/random.h -+++ b/include/linux/random.h -@@ -34,6 +34,30 @@ - /* Clear the entropy pool and associated counters. (Superuser only.) */ - #define RNDCLEARPOOL _IO( 'R', 0x06 ) - -+#ifdef CONFIG_FIPS_RNG -+ -+/* Size of seed value - equal to AES blocksize */ -+#define AES_BLOCK_SIZE_BYTES 16 -+#define SEED_SIZE_BYTES AES_BLOCK_SIZE_BYTES -+/* Size of AES key */ -+#define KEY_SIZE_BYTES 16 -+ -+/* ioctl() structure used by FIPS 140-2 Tests */ -+struct rand_fips_test { -+ unsigned char key[KEY_SIZE_BYTES]; /* Input */ -+ unsigned char datetime[SEED_SIZE_BYTES]; /* Input */ -+ unsigned char seed[SEED_SIZE_BYTES]; /* Input */ -+ unsigned char result[SEED_SIZE_BYTES]; /* Output */ -+}; -+ -+/* FIPS 140-2 RNG Variable Seed Test. (Superuser only.) */ -+#define RNDFIPSVST _IOWR('R', 0x10, struct rand_fips_test) -+ -+/* FIPS 140-2 RNG Monte Carlo Test. (Superuser only.) */ -+#define RNDFIPSMCT _IOWR('R', 0x11, struct rand_fips_test) -+ -+#endif /* #ifdef CONFIG_FIPS_RNG */ -+ - struct rand_pool_info { - int entropy_count; - int buf_size; -@@ -50,6 +74,10 @@ extern void add_input_randomness(unsigne - unsigned int value); - extern void add_interrupt_randomness(int irq); - -+extern void random_input_words(__u32 *buf, size_t wordcount, int ent_count); -+extern int random_input_wait(void); -+#define HAS_RANDOM_INPUT_WAIT 1 -+ - extern void get_random_bytes(void *buf, int nbytes); - void generate_random_uuid(unsigned char uuid_out[16]); - diff --git a/target/linux/generic-2.6/patches-2.6.34/971-ocf_20100325.patch b/target/linux/generic-2.6/patches-2.6.34/971-ocf_20100325.patch new file mode 100644 index 000000000..d88434823 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.34/971-ocf_20100325.patch @@ -0,0 +1,170 @@ +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -129,6 +129,9 @@ + * unsigned int value); + * void add_interrupt_randomness(int irq); + * ++ * void random_input_words(__u32 *buf, size_t wordcount, int ent_count) ++ * int random_input_wait(void); ++ * + * add_input_randomness() uses the input layer interrupt timing, as well as + * the event type information from the hardware. + * +@@ -140,6 +143,13 @@ + * a better measure, since the timing of the disk interrupts are more + * unpredictable. + * ++ * random_input_words() just provides a raw block of entropy to the input ++ * pool, such as from a hardware entropy generator. ++ * ++ * random_input_wait() suspends the caller until such time as the ++ * entropy pool falls below the write threshold, and returns a count of how ++ * much entropy (in bits) is needed to sustain the pool. ++ * + * All of these routines try to estimate how many bits of randomness a + * particular randomness source. They do this by keeping track of the + * first and second order deltas of the event timings. +@@ -714,6 +724,61 @@ void add_disk_randomness(struct gendisk + } + #endif + ++/* ++ * random_input_words - add bulk entropy to pool ++ * ++ * @buf: buffer to add ++ * @wordcount: number of __u32 words to add ++ * @ent_count: total amount of entropy (in bits) to credit ++ * ++ * this provides bulk input of entropy to the input pool ++ * ++ */ ++void random_input_words(__u32 *buf, size_t wordcount, int ent_count) ++{ ++ mix_pool_bytes(&input_pool, buf, wordcount*4); ++ ++ credit_entropy_bits(&input_pool, ent_count); ++ ++ DEBUG_ENT("crediting %d bits => %d\n", ++ ent_count, input_pool.entropy_count); ++ /* ++ * Wake up waiting processes if we have enough ++ * entropy. ++ */ ++ if (input_pool.entropy_count >= random_read_wakeup_thresh) ++ wake_up_interruptible(&random_read_wait); ++} ++EXPORT_SYMBOL(random_input_words); ++ ++/* ++ * random_input_wait - wait until random needs entropy ++ * ++ * this function sleeps until the /dev/random subsystem actually ++ * needs more entropy, and then return the amount of entropy ++ * that it would be nice to have added to the system. ++ */ ++int random_input_wait(void) ++{ ++ int count; ++ ++ wait_event_interruptible(random_write_wait, ++ input_pool.entropy_count < random_write_wakeup_thresh); ++ ++ count = random_write_wakeup_thresh - input_pool.entropy_count; ++ ++ /* likely we got woken up due to a signal */ ++ if (count <= 0) count = random_read_wakeup_thresh; ++ ++ DEBUG_ENT("requesting %d bits from input_wait()er %d<%d\n", ++ count, ++ input_pool.entropy_count, random_write_wakeup_thresh); ++ ++ return count; ++} ++EXPORT_SYMBOL(random_input_wait); ++ ++ + #define EXTRACT_SIZE 10 + + /********************************************************************* +--- a/fs/fcntl.c ++++ b/fs/fcntl.c +@@ -141,6 +141,7 @@ SYSCALL_DEFINE1(dup, unsigned int, filde + } + return ret; + } ++EXPORT_SYMBOL(sys_dup); + + #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME) + +--- a/include/linux/miscdevice.h ++++ b/include/linux/miscdevice.h +@@ -12,6 +12,7 @@ + #define APOLLO_MOUSE_MINOR 7 + #define PC110PAD_MINOR 9 + /*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */ ++#define CRYPTODEV_MINOR 70 /* /dev/crypto */ + #define WATCHDOG_MINOR 130 /* Watchdog timer */ + #define TEMP_MINOR 131 /* Temperature Sensor */ + #define RTC_MINOR 135 +--- a/include/linux/random.h ++++ b/include/linux/random.h +@@ -9,6 +9,7 @@ + + #include + #include ++#include /* for __u32 in user space */ + #include + + /* ioctl()'s for the random number generator */ +@@ -34,6 +35,30 @@ + /* Clear the entropy pool and associated counters. (Superuser only.) */ + #define RNDCLEARPOOL _IO( 'R', 0x06 ) + ++#ifdef CONFIG_FIPS_RNG ++ ++/* Size of seed value - equal to AES blocksize */ ++#define AES_BLOCK_SIZE_BYTES 16 ++#define SEED_SIZE_BYTES AES_BLOCK_SIZE_BYTES ++/* Size of AES key */ ++#define KEY_SIZE_BYTES 16 ++ ++/* ioctl() structure used by FIPS 140-2 Tests */ ++struct rand_fips_test { ++ unsigned char key[KEY_SIZE_BYTES]; /* Input */ ++ unsigned char datetime[SEED_SIZE_BYTES]; /* Input */ ++ unsigned char seed[SEED_SIZE_BYTES]; /* Input */ ++ unsigned char result[SEED_SIZE_BYTES]; /* Output */ ++}; ++ ++/* FIPS 140-2 RNG Variable Seed Test. (Superuser only.) */ ++#define RNDFIPSVST _IOWR('R', 0x10, struct rand_fips_test) ++ ++/* FIPS 140-2 RNG Monte Carlo Test. (Superuser only.) */ ++#define RNDFIPSMCT _IOWR('R', 0x11, struct rand_fips_test) ++ ++#endif /* #ifdef CONFIG_FIPS_RNG */ ++ + struct rand_pool_info { + int entropy_count; + int buf_size; +@@ -50,6 +75,10 @@ extern void add_input_randomness(unsigne + unsigned int value); + extern void add_interrupt_randomness(int irq); + ++extern void random_input_words(__u32 *buf, size_t wordcount, int ent_count); ++extern int random_input_wait(void); ++#define HAS_RANDOM_INPUT_WAIT 1 ++ + extern void get_random_bytes(void *buf, int nbytes); + void generate_random_uuid(unsigned char uuid_out[16]); + +--- a/kernel/pid.c ++++ b/kernel/pid.c +@@ -389,6 +389,7 @@ struct task_struct *find_task_by_vpid(pi + { + return find_task_by_pid_ns(vnr, current->nsproxy->pid_ns); + } ++EXPORT_SYMBOL(find_task_by_vpid); + + struct pid *get_task_pid(struct task_struct *task, enum pid_type type) + { diff --git a/target/linux/generic-2.6/patches-2.6.34/972-ocf_compile_fix.patch b/target/linux/generic-2.6/patches-2.6.34/972-ocf_compile_fix.patch deleted file mode 100644 index a3fa22681..000000000 --- a/target/linux/generic-2.6/patches-2.6.34/972-ocf_compile_fix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/crypto/ocf/cryptosoft.c -+++ b/crypto/ocf/cryptosoft.c -@@ -47,7 +47,7 @@ - #include - #include - #include --#include -+#include - - #include - #include diff --git a/target/linux/generic-2.6/patches-2.6.34/973-ocf_2.6.27_fix.patch b/target/linux/generic-2.6/patches-2.6.34/973-ocf_2.6.27_fix.patch deleted file mode 100644 index ecb9bef51..000000000 --- a/target/linux/generic-2.6/patches-2.6.34/973-ocf_2.6.27_fix.patch +++ /dev/null @@ -1,197 +0,0 @@ ---- a/crypto/ocf/random.c -+++ b/crypto/ocf/random.c -@@ -49,6 +49,7 @@ - #include - #include - #include -+#include - #include - - #ifdef CONFIG_OCF_FIPS -@@ -81,7 +82,7 @@ struct random_op { - - static int random_proc(void *arg); - --static pid_t randomproc = (pid_t) -1; -+static struct task_struct *random_task; - static spinlock_t random_lock; - - /* -@@ -141,13 +142,18 @@ crypto_rregister( - spin_lock_irqsave(&random_lock, flags); - list_add_tail(&rops->random_list, &random_ops); - if (!started) { -- randomproc = kernel_thread(random_proc, NULL, CLONE_FS|CLONE_FILES); -- if (randomproc < 0) { -- ret = randomproc; -+ struct task_struct *t; -+ -+ t = kthread_create(random_proc, NULL, "ocf-random"); -+ if (IS_ERR(t)) { -+ ret = PTR_ERR(t); - printk("crypto: crypto_rregister cannot start random thread; " - "error %d", ret); -- } else -+ } else { -+ random_task = t; -+ wake_up_process(t); - started = 1; -+ } - } - spin_unlock_irqrestore(&random_lock, flags); - -@@ -172,7 +178,7 @@ crypto_runregister_all(u_int32_t driveri - - spin_lock_irqsave(&random_lock, flags); - if (list_empty(&random_ops) && started) -- kill_proc(randomproc, SIGKILL, 1); -+ send_sig(SIGKILL, random_task, 1); - spin_unlock_irqrestore(&random_lock, flags); - return(0); - } -@@ -308,7 +314,7 @@ random_proc(void *arg) - - bad_alloc: - spin_lock_irq(&random_lock); -- randomproc = (pid_t) -1; -+ random_task = NULL; - started = 0; - spin_unlock_irq(&random_lock); - ---- a/crypto/ocf/crypto.c -+++ b/crypto/ocf/crypto.c -@@ -74,6 +74,7 @@ __FBSDID("$FreeBSD: src/sys/opencrypto/c - #include - #include - #include -+#include - #include - - /* -@@ -255,10 +256,10 @@ module_param(crypto_devallowsoft, int, 0 - MODULE_PARM_DESC(crypto_devallowsoft, - "Enable/disable use of software crypto support"); - --static pid_t cryptoproc = (pid_t) -1; -+static struct task_struct *crypto_task; - static struct completion cryptoproc_exited; - static DECLARE_WAIT_QUEUE_HEAD(cryptoproc_wait); --static pid_t cryptoretproc = (pid_t) -1; -+static struct task_struct *cryptoret_task; - static struct completion cryptoretproc_exited; - static DECLARE_WAIT_QUEUE_HEAD(cryptoretproc_wait); - -@@ -1401,7 +1402,7 @@ crypto_proc(void *arg) - wait_event_interruptible(cryptoproc_wait, - !(list_empty(&crp_q) || crypto_all_qblocked) || - !(list_empty(&crp_kq) || crypto_all_kqblocked) || -- cryptoproc == (pid_t) -1); -+ crypto_task == NULL); - crp_sleep = 0; - if (signal_pending (current)) { - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -@@ -1414,7 +1415,7 @@ crypto_proc(void *arg) - } - CRYPTO_Q_LOCK(); - dprintk("%s - awake\n", __FUNCTION__); -- if (cryptoproc == (pid_t) -1) -+ if (crypto_task == NULL) - break; - cryptostats.cs_intrs++; - } -@@ -1470,7 +1471,7 @@ crypto_ret_proc(void *arg) - dprintk("%s - sleeping\n", __FUNCTION__); - CRYPTO_RETQ_UNLOCK(); - wait_event_interruptible(cryptoretproc_wait, -- cryptoretproc == (pid_t) -1 || -+ cryptoret_task == NULL || - !list_empty(&crp_ret_q) || - !list_empty(&crp_ret_kq)); - if (signal_pending (current)) { -@@ -1484,7 +1485,7 @@ crypto_ret_proc(void *arg) - } - CRYPTO_RETQ_LOCK(); - dprintk("%s - awake\n", __FUNCTION__); -- if (cryptoretproc == (pid_t) -1) { -+ if (cryptoret_task == NULL) { - dprintk("%s - EXITING!\n", __FUNCTION__); - break; - } -@@ -1597,6 +1598,7 @@ DB_SHOW_COMMAND(kcrypto, db_show_kcrypto - static int - crypto_init(void) - { -+ struct task_struct *t; - int error; - - dprintk("%s(0x%x)\n", __FUNCTION__, (int) crypto_init); -@@ -1643,23 +1645,27 @@ crypto_init(void) - init_completion(&cryptoproc_exited); - init_completion(&cryptoretproc_exited); - -- cryptoproc = 0; /* to avoid race condition where proc runs first */ -- cryptoproc = kernel_thread(crypto_proc, NULL, CLONE_FS|CLONE_FILES); -- if (cryptoproc < 0) { -- error = cryptoproc; -+ crypto_task = NULL; /* to avoid race condition where proc runs first */ -+ t = kthread_create(crypto_proc, NULL, "ocf-crypto"); -+ if (IS_ERR(t)) { -+ error = PTR_ERR(t); - printk("crypto: crypto_init cannot start crypto thread; error %d", - error); - goto bad; - } -+ wake_up_process(t); -+ crypto_task = t; - -- cryptoretproc = 0; /* to avoid race condition where proc runs first */ -- cryptoretproc = kernel_thread(crypto_ret_proc, NULL, CLONE_FS|CLONE_FILES); -- if (cryptoretproc < 0) { -- error = cryptoretproc; -+ cryptoret_task = NULL; /* to avoid race condition where proc runs first */ -+ t = kthread_create(crypto_ret_proc, NULL, "ocf-cryptoret"); -+ if (IS_ERR(t)) { -+ error = PTR_ERR(t); - printk("crypto: crypto_init cannot start cryptoret thread; error %d", - error); - goto bad; - } -+ wake_up_process(t); -+ cryptoret_task = t; - - return 0; - bad: -@@ -1671,7 +1677,7 @@ bad: - static void - crypto_exit(void) - { -- pid_t p; -+ struct task_struct *t; - unsigned long d_flags; - - dprintk("%s()\n", __FUNCTION__); -@@ -1681,18 +1687,18 @@ crypto_exit(void) - */ - - CRYPTO_DRIVER_LOCK(); -- p = cryptoproc; -- cryptoproc = (pid_t) -1; -- kill_proc(p, SIGTERM, 1); -+ t = crypto_task; -+ crypto_task = NULL; -+ send_sig(SIGTERM, t, 1); - wake_up_interruptible(&cryptoproc_wait); - CRYPTO_DRIVER_UNLOCK(); - - wait_for_completion(&cryptoproc_exited); - - CRYPTO_DRIVER_LOCK(); -- p = cryptoretproc; -- cryptoretproc = (pid_t) -1; -- kill_proc(p, SIGTERM, 1); -+ t = cryptoret_task; -+ cryptoret_task = NULL; -+ send_sig(SIGTERM, t, 1); - wake_up_interruptible(&cryptoretproc_wait); - CRYPTO_DRIVER_UNLOCK(); - -- cgit v1.2.3