Re: [PATCH] crypto: mxs-dcp: Fix platform_get_irq() error handling

2014-02-14 Thread Marek Vasut
On Friday, February 14, 2014 at 04:04:44 AM, Fabio Estevam wrote:
 From: Fabio Estevam fabio.este...@freescale.com
 
 We should test the error case for each platform_get_irq() assignment and
 propagate the error accordingly.
 
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com

Acked-by: Marek Vasut ma...@denx.de

Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/9 v6] ARM: dts: exynos5250/5420: add dt node for sss module

2014-02-14 Thread Tomasz Figa

Hi Kukjin,

On 14.02.2014 00:28, Kukjin Kim wrote:

On 02/07/14 14:24, Naveen Krishna Chatradhi wrote:

This patch adds the device tree node for SSS module
found on Exynos5420 and Exynos5250

Signed-off-by: Naveen Krishna Chatradhich.nav...@samsung.com
Reviewed-by: Tomasz Figat.f...@samsung.com
TO:linux-samsung-...@vger.kernel.org
CC: Kukjin Kimkgene@samsung.com
CC:linux-crypto@vger.kernel.org
---
changes since v5:
1. Added Reviewed-by: Tomasz Figat.f...@samsung.com

  arch/arm/boot/dts/exynos5250.dtsi |8 
  arch/arm/boot/dts/exynos5420.dtsi |   10 ++
  2 files changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi
b/arch/arm/boot/dts/exynos5250.dtsi
index b7dec41..46b04e8 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -706,4 +706,12 @@
  io-channel-ranges;
  status = disabled;
  };
+
+sss@1083 {
+compatible = samsung,exynos4210-secss;
+reg =0x1083 0x1;
+interrupts =0 112 0;
+clocks =clock 348;
+clock-names = secss;
+};
  };
diff --git a/arch/arm/boot/dts/exynos5420.dtsi
b/arch/arm/boot/dts/exynos5420.dtsi
index 8db792b..b503e96 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -652,4 +652,14 @@
  clocks =clock 319,clock 318;
  clock-names = tmu_apbif, tmu_triminfo_apbif;
  };
+
+sss@1083 {
+compatible = samsung,exynos4210-secss;
+reg =0x1083 0x1;
+interrupts =0 112 0;
+clocks =clock 471;
+clock-names = secss;
+samsung,power-domain =g2d_pd;
+};
+
  };


Applied, thanks.

BTW, I think the numbering is strange...maybe I missed something?
[PATCH 5/5], [PATCH 5/6 V2], [PATCH 6/8 V3] and this [PATCH 6/9 V6]


I would wait with applying any patches from this series until they are 
acked by crypto subsystem maintainer and DT bindings by DT maintainers.


I'd like Naveen to resend this series in separate thread, with proper 
message threading, so we can make sure that we are not missing anything. 
Naveen, please also add


David S. Miller da...@davemloft.net

to Cc list, as he is also listed as crypto maintainer in MAINTAINERS file.

Best regards,
Tomasz
--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] crypto: omap-des: Add omap-des driver for OMAP4/AM43xx

2014-02-14 Thread Joel Fernandes
Add omap-des driver with platform data for OMAP4/AM43xx. Support added for DES
ECB and CBC modes. Also add support for 3DES operation where 3 64-bit keys are
used to perform a DES encrypt-decrypt-encrypt (des3_ede) operation on a buffer.

Tests have been conducted with the CRYPTO test manager, and functionality is
verified at different page length alignments.

Signed-off-by: Joel Fernandes jo...@ti.com
---
v2 changes:
Address review comments from Rajendra at: https://lkml.org/lkml/2013/8/30/116

 drivers/crypto/omap-des.c | 1218 +
 1 file changed, 1218 insertions(+)
 create mode 100644 drivers/crypto/omap-des.c

diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
new file mode 100644
index 000..006d914
--- /dev/null
+++ b/drivers/crypto/omap-des.c
@@ -0,0 +1,1218 @@
+/*
+ * Support for OMAP DES and Triple DES HW acceleration.
+ *
+ * Copyright (c) 2013 Texas Instruments Incorporated
+ * Author: Joel Fernandes jo...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ */
+
+#define pr_fmt(fmt) %s:  fmt, __func__
+
+#ifdef DEBUG
+#define prn(num) printk(#num =%d\n, num)
+#define prx(num) printk(#num =%x\n, num)
+#else
+#define prn(num) do { } while (0)
+#define prx(num)  do { } while (0)
+#endif
+
+#include linux/err.h
+#include linux/module.h
+#include linux/init.h
+#include linux/errno.h
+#include linux/kernel.h
+#include linux/platform_device.h
+#include linux/scatterlist.h
+#include linux/dma-mapping.h
+#include linux/dmaengine.h
+#include linux/omap-dma.h
+#include linux/pm_runtime.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/of_address.h
+#include linux/io.h
+#include linux/crypto.h
+#include linux/interrupt.h
+#include crypto/scatterwalk.h
+#include crypto/des.h
+
+#define DST_MAXBURST   2
+
+#define DES_BLOCK_WORDS(DES_BLOCK_SIZE  2)
+
+#define _calc_walked(inout) (dd-inout##_walk.offset - dd-inout##_sg-offset)
+
+#define DES_REG_KEY(dd, x) ((dd)-pdata-key_ofs - \
+   ((x ^ 0x01) * 0x04))
+
+#define DES_REG_IV(dd, x)  ((dd)-pdata-iv_ofs + ((x) * 0x04))
+
+#define DES_REG_CTRL(dd)   ((dd)-pdata-ctrl_ofs)
+#define DES_REG_CTRL_CBC   BIT(4)
+#define DES_REG_CTRL_TDES  BIT(3)
+#define DES_REG_CTRL_DIRECTION BIT(2)
+#define DES_REG_CTRL_INPUT_READY   BIT(1)
+#define DES_REG_CTRL_OUTPUT_READY  BIT(0)
+
+#define DES_REG_DATA_N(dd, x)  ((dd)-pdata-data_ofs + ((x) * 0x04))
+
+#define DES_REG_REV(dd)((dd)-pdata-rev_ofs)
+
+#define DES_REG_MASK(dd)   ((dd)-pdata-mask_ofs)
+
+#define DES_REG_LENGTH_N(x)(0x24 + ((x) * 0x04))
+
+#define DES_REG_IRQ_STATUS(dd) ((dd)-pdata-irq_status_ofs)
+#define DES_REG_IRQ_ENABLE(dd) ((dd)-pdata-irq_enable_ofs)
+#define DES_REG_IRQ_DATA_INBIT(1)
+#define DES_REG_IRQ_DATA_OUT   BIT(2)
+
+#define FLAGS_MODE_MASK0x000f
+#define FLAGS_ENCRYPT  BIT(0)
+#define FLAGS_CBC  BIT(1)
+#define FLAGS_INIT BIT(4)
+#define FLAGS_BUSY BIT(6)
+
+struct omap_des_ctx {
+   struct omap_des_dev *dd;
+
+   int keylen;
+   u32 key[(3 * DES_KEY_SIZE) / sizeof(u32)];
+   unsigned long   flags;
+};
+
+struct omap_des_reqctx {
+   unsigned long mode;
+};
+
+#define OMAP_DES_QUEUE_LENGTH  1
+#define OMAP_DES_CACHE_SIZE0
+
+struct omap_des_algs_info {
+   struct crypto_alg   *algs_list;
+   unsigned intsize;
+   unsigned intregistered;
+};
+
+struct omap_des_pdata {
+   struct omap_des_algs_info   *algs_info;
+   unsigned intalgs_info_size;
+
+   void(*trigger)(struct omap_des_dev *dd, int length);
+
+   u32 key_ofs;
+   u32 iv_ofs;
+   u32 ctrl_ofs;
+   u32 data_ofs;
+   u32 rev_ofs;
+   u32 mask_ofs;
+   u32 irq_enable_ofs;
+   u32 irq_status_ofs;
+
+   u32 dma_enable_in;
+   u32 dma_enable_out;
+   u32 dma_start;
+
+   u32 major_mask;
+   u32 major_shift;
+   u32 minor_mask;
+   u32 minor_shift;
+};
+
+struct omap_des_dev {
+   struct list_headlist;
+   unsigned long   phys_base;
+   void __iomem*io_base;
+   struct omap_des_ctx *ctx;
+   struct device   *dev;
+   unsigned long   flags;
+   int err;
+
+   /* spinlock used for queues */
+   spinlock_t  lock;
+   struct crypto_queue queue;
+
+   

[PATCH v2 2/2] crypto: omap-des: Add config and build options

2014-02-14 Thread Joel Fernandes
Add config and build options for the omap-des driver.

Signed-off-by: Joel Fernandes jo...@ti.com
---
 drivers/crypto/Kconfig  |   11 +++
 drivers/crypto/Makefile |1 +
 2 files changed, 12 insertions(+)

diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 13857f5..8e38000 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -262,6 +262,17 @@ config CRYPTO_DEV_OMAP_AES
  OMAP processors have AES module accelerator. Select this if you
  want to use the OMAP module for AES algorithms.
 
+config CRYPTO_DEV_OMAP_DES
+   tristate Support for OMAP DES3DES hw engine
+   depends on ARCH_OMAP2PLUS
+   select CRYPTO_DES
+   select CRYPTO_BLKCIPHER2
+   help
+ OMAP processors have DES/3DES module accelerator. Select this if you
+ want to use the OMAP module for DES and 3DES algorithms. Currently
+ the ECB and CBC modes of operation supported by the driver. Also
+ accesses made on unaligned boundaries are also supported.
+
 config CRYPTO_DEV_PICOXCELL
tristate Support for picoXcell IPSEC and Layer2 crypto engines
depends on ARCH_PICOXCELL  HAVE_CLK
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index 0bc6aa0..9a53fb8 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_CRYPTO_DEV_NIAGARA2) += n2_crypto.o
 n2_crypto-y := n2_core.o n2_asm.o
 obj-$(CONFIG_CRYPTO_DEV_NX) += nx/
 obj-$(CONFIG_CRYPTO_DEV_OMAP_AES) += omap-aes.o
+obj-$(CONFIG_CRYPTO_DEV_OMAP_DES) += omap-des.o
 obj-$(CONFIG_CRYPTO_DEV_OMAP_SHAM) += omap-sham.o
 obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o
 obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/2] Introduce omap-des driver for OMAP SoCs

2014-02-14 Thread Joel Fernandes
Here are revised patches for omap-des driver addressing review comments at:
https://lkml.org/lkml/2013/8/30/116

Joel Fernandes (2):
  crypto: omap-des: Add omap-des driver for OMAP4/AM43xx
  crypto: omap-des: Add config and build options

 drivers/crypto/Kconfig|   11 +
 drivers/crypto/Makefile   |1 +
 drivers/crypto/omap-des.c | 1218 +
 3 files changed, 1230 insertions(+)
 create mode 100644 drivers/crypto/omap-des.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] crypto: remove a duplicate checks in __cbc_decrypt()

2014-02-14 Thread Jussi Kivilinna
On 13.02.2014 16:58, Dan Carpenter wrote:
 We checked nbytes  bsize before so it can't happen here.
 
 Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

Acked-by: Jussi Kivilinna jussi.kivili...@iki.fi

 ---
 This doesn't change how the code works, but maybe their is a bug in the
 original code.  Please review?
 
 diff --git a/arch/x86/crypto/cast5_avx_glue.c 
 b/arch/x86/crypto/cast5_avx_glue.c
 index e6a3700489b9..e57e20ab5e0b 100644
 --- a/arch/x86/crypto/cast5_avx_glue.c
 +++ b/arch/x86/crypto/cast5_avx_glue.c
 @@ -203,9 +203,6 @@ static unsigned int __cbc_decrypt(struct blkcipher_desc 
 *desc,
   src -= 1;
   dst -= 1;
   } while (nbytes = bsize * CAST5_PARALLEL_BLOCKS);
 -
 - if (nbytes  bsize)
 - goto done;
   }
  
   /* Handle leftovers */
 diff --git a/arch/x86/crypto/blowfish_glue.c b/arch/x86/crypto/blowfish_glue.c
 index 50ec333b70e6..8af519ed73d1 100644
 --- a/arch/x86/crypto/blowfish_glue.c
 +++ b/arch/x86/crypto/blowfish_glue.c
 @@ -223,9 +223,6 @@ static unsigned int __cbc_decrypt(struct blkcipher_desc 
 *desc,
   src -= 1;
   dst -= 1;
   } while (nbytes = bsize * 4);
 -
 - if (nbytes  bsize)
 - goto done;
   }
  
   /* Handle leftovers */
 --
 To unsubscribe from this list: send the line unsubscribe linux-crypto in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] crypto: remove a duplicate checks in __cbc_decrypt()

2014-02-14 Thread Johannes Götzfried
On Thu, Feb 13, 2014 at 05:58:32PM +0300, Dan Carpenter wrote:
 Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

Acked-by: Johannes Götzfried johannes.goetzfr...@cs.fau.de

 ---
 This doesn't change how the code works, but maybe their is a bug in the
 original code.  Please review?

 diff --git a/arch/x86/crypto/cast5_avx_glue.c 
 b/arch/x86/crypto/cast5_avx_glue.c
 index e6a3700489b9..e57e20ab5e0b 100644
 --- a/arch/x86/crypto/cast5_avx_glue.c
 +++ b/arch/x86/crypto/cast5_avx_glue.c
 @@ -203,9 +203,6 @@ static unsigned int __cbc_decrypt(struct blkcipher_desc 
 *desc,
   src -= 1;
   dst -= 1;
   } while (nbytes = bsize * CAST5_PARALLEL_BLOCKS);
 -
 - if (nbytes  bsize)
 - goto done;
   }

   /* Handle leftovers */
 diff --git a/arch/x86/crypto/blowfish_glue.c b/arch/x86/crypto/blowfish_glue.c
 index 50ec333b70e6..8af519ed73d1 100644
 --- a/arch/x86/crypto/blowfish_glue.c
 +++ b/arch/x86/crypto/blowfish_glue.c
 @@ -223,9 +223,6 @@ static unsigned int __cbc_decrypt(struct blkcipher_desc 
 *desc,
   src -= 1;
   dst -= 1;
   } while (nbytes = bsize * 4);
 -
 - if (nbytes  bsize)
 - goto done;
   }

   /* Handle leftovers */

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] crypto: omap-sham: Map SG pages if they are HIGHMEM before accessing

2014-02-14 Thread Joel Fernandes
Gentle ping for this fix patch. Could it be accepted for -rc? Thanks.

-Joel

On 01/28/2014 05:43 PM, Joel Fernandes wrote:
 HIGHMEM pages may not be mapped so we must kmap them before accessing.
 This resolves a random OOPs error that was showing up during OpenSSL SHA 
 tests.
 
 Signed-off-by: Joel Fernandes jo...@ti.com
 ---
  drivers/crypto/omap-sham.c |   12 +++-
  1 file changed, 11 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
 index 8bdde57..fcf6562 100644
 --- a/drivers/crypto/omap-sham.c
 +++ b/drivers/crypto/omap-sham.c
 @@ -636,11 +636,21 @@ static size_t omap_sham_append_buffer(struct 
 omap_sham_reqctx *ctx,
  static size_t omap_sham_append_sg(struct omap_sham_reqctx *ctx)
  {
   size_t count;
 + const u8 *vaddr;
  
   while (ctx-sg) {
 + if (PageHighMem(sg_page(ctx-sg)))
 + vaddr = kmap_atomic(sg_page(ctx-sg));
 + else
 + vaddr = sg_virt(ctx-sg);
 +
   count = omap_sham_append_buffer(ctx,
 - sg_virt(ctx-sg) + ctx-offset,
 + vaddr + ctx-offset,
   ctx-sg-length - ctx-offset);
 +
 + if (PageHighMem(sg_page(ctx-sg)))
 + kunmap_atomic((void *)vaddr);
 +
   if (!count)
   break;
   ctx-offset += count;
 

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] crypto: Add soft module dependency to load HW accelerated crypto modules

2014-02-14 Thread Neil Horman
On Fri, Feb 14, 2014 at 11:14:37AM -0800, Tim Chen wrote:
 We added the soft module dependency of various crypto algorithm's module alias
  to generic crypto algorithm's module. This loads hardware accelerated
  modules and uses them when available.
 
This is great, but have any of the module load utilties been modified to
recognize and handle soft dependencies in the modinfo section? Last I checked
they hadn't.  Do you plan to add that functionality?

Neil

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] crypto: Add soft module dependency to load HW accelerated crypto modules

2014-02-14 Thread Tim Chen
On Fri, 2014-02-14 at 15:28 -0500, Neil Horman wrote:
 On Fri, Feb 14, 2014 at 11:14:37AM -0800, Tim Chen wrote:
  We added the soft module dependency of various crypto algorithm's module 
  alias
   to generic crypto algorithm's module. This loads hardware accelerated
   modules and uses them when available.
  
 This is great, but have any of the module load utilties been modified to
 recognize and handle soft dependencies in the modinfo section? Last I checked
 they hadn't.  Do you plan to add that functionality?
 
 Neil
 

Rusty,

Do you know if the upstream modprobe has the fixes (or plan) to
recognize soft dependencies?  I was under the impression that it
is the case.

Thanks.

Tim

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] crypto: Add soft module dependency to load HW accelerated crypto modules

2014-02-14 Thread Herbert Xu
On Fri, Feb 14, 2014 at 11:14:37AM -0800, Tim Chen wrote:
 We added the soft module dependency of various crypto algorithm's module alias
  to generic crypto algorithm's module. This loads hardware accelerated
  modules and uses them when available.
 
 Signed-off-by: Tim Chen tim.c.c...@linux.intel.com

I don't see the point of this patch.  Any users of these modules
would be requesting for their alias and not their real name.  So
either it'll already load all the hardware modules or it won't load
the generic version either.

For example, if you request blowfish you'll get every module that
has the alias blowfish.  As the software version is called blowfish_generic
it will be treated no differently than any hardware accelerated
version.

Cheers,
-- 
Email: Herbert Xu herb...@gondor.apana.org.au
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] crypto: Add soft module dependency to load HW accelerated crypto modules

2014-02-14 Thread Tim Chen
On Sat, 2014-02-15 at 09:23 +0800, Herbert Xu wrote:
 On Fri, Feb 14, 2014 at 11:14:37AM -0800, Tim Chen wrote:
  We added the soft module dependency of various crypto algorithm's module 
  alias
   to generic crypto algorithm's module. This loads hardware accelerated
   modules and uses them when available.
  
  Signed-off-by: Tim Chen tim.c.c...@linux.intel.com
 
 I don't see the point of this patch.  Any users of these modules
 would be requesting for their alias and not their real name.  So
 either it'll already load all the hardware modules or it won't load
 the generic version either.
 
 For example, if you request blowfish you'll get every module that
 has the alias blowfish.  As the software version is called blowfish_generic
 it will be treated no differently than any hardware accelerated
 version.

If we issue an explicit modprobe of the module alias, I don't
think there is a problem.

I am under the impression we may have a scenario like this:

Module A selects CRYPTO_ALG_B in config, which causes the generic
ALG_B to get built and a module dependency to the generic
ALG_B to be established.  Then when module A loads,
we will load the generic ALG_B module.  So a soft dependency
in the generic ALG_B module is needed
to load all the other alias module along with the generic
module.  Otherwise only the generic module is loaded when
module A loads.

Tim


--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html