Skip to contentSkip to conversation

Support fsl-dcp crypto coprocessor

PATCH New Christoph G. Baumann 3 participants 8 messages Apr 23, 2013 – Apr 28, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Support fsl-dcp crypto coprocessor

From: "Christoph G. Baumann" <[email protected]>

The following patch is a port of the original driver from Freescale to the current mainline. The patch was tested under 3.7.

---
 drivers/staging/crypto/Kconfig               |   15 +
 drivers/staging/crypto/Makefile              |    1 +
 drivers/staging/crypto/fsl-dcp.c             | 1817 ++++++++++++++++++++++++++
 drivers/staging/crypto/fsl-dcp.h             |  739 +++++++++++
 include/linux/fsl/fsl-dcp_bootstream_ioctl.h |   32 +
 5 files changed, 2604 insertions(+)
 create mode 100644 drivers/staging/crypto/Kconfig
 create mode 100644 drivers/staging/crypto/Makefile
 create mode 100644 drivers/staging/crypto/fsl-dcp.c
 create mode 100644 drivers/staging/crypto/fsl-dcp.h
 create mode 100644 include/linux/fsl/fsl-dcp_bootstream_ioctl.h
drivers/staging/crypto/Kconfig new file +15 -0
new file mode 100644
index 0000000..acf2cf9
@@ -0,0 +1,15 @@
+config CRYPTO_DEV_FSL_DCP
+	tristate "Support for the DCP engine"
+	depends on SOC_IMX23 || SOC_IMX28 || SOC_IMX50
+  select CRYPTO_HW
+	select CRYPTO_ALGAPI
+  select CRYPTO_SHA256
+	select CRYPTO_AES
+	select CRYPTO_BLKCIPHER
+	help
+	  Say 'Y' here to use the DCP AES and SHA
+	  engine for the CryptoAPI algorithms.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called fsl-dcp.
+
drivers/staging/crypto/Makefile new file +1 -0
new file mode 100644
index 0000000..06eabdf
@@ -0,0 +1 @@
+obj-$(CONFIG_CRYPTO_DEV_FSL_DCP) += fsl-dcp.o
drivers/staging/crypto/fsl-dcp.c new file +1817 -0

1,817 lines not on this page · raw message

drivers/staging/crypto/fsl-dcp.h new file +739 -0

739 lines not on this page · raw message

include/linux/fsl/fsl-dcp_bootstream_ioctl.h new file +32 -0
new file mode 100644
index 0000000..2859a8d
@@ -0,0 +1,32 @@
+/*
+ * Freescale DCP driver for bootstream update. Only handles the OTP KEY
+ * case and can only encrypt/decrypt.
+ *
+ * Author: Pantelis Antoniou <[email protected]>
+ *
+ * Copyright (C) 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
+ */
+
+/*
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+#ifndef DCP_BOOTSTREAM_IOCTL_H
+#define DCP_BOOTSTREAM_IOCTL_H
+
+/* remember to have included the proper _IO definition
+ * file before hand.
+ * For user space it's <sys/ioctl.h>
+ */
+
+#define DBS_IOCTL_BASE   'd'
+
+#define DBS_ENC _IOW(DBS_IOCTL_BASE, 0x00, uint8_t[16])
+#define DBS_DEC _IOW(DBS_IOCTL_BASE, 0x01, uint8_t[16])
+
+#endif
Signature · 1 line
1.7.9.5
#1 lore raw

cover Support fsl-dcp crypto coprocessor

From: "Christoph G. Baumann" <[email protected]>

Forgot some changed files in the first try...

The following patch is a port of the original driver from Freescale to the current mainline. The patch was tested under 3.7.

Christoph G. Baumann (2):
Support fsl-dcp crypto coprocessor
Support fsl-dcp crypto coprocessor

 arch/arm/boot/dts/imx28.dtsi                 |    2 +-
 drivers/staging/Kconfig                      |    2 +
 drivers/staging/Makefile                     |    1 +
 drivers/staging/crypto/Kconfig               |   15 +
 drivers/staging/crypto/Makefile              |    1 +
 drivers/staging/crypto/fsl-dcp.c             | 1817 ++++++++++++++++++++++++++
 drivers/staging/crypto/fsl-dcp.h             |  739 +++++++++++
 include/linux/fsl/fsl-dcp_bootstream_ioctl.h |   32 +
 8 files changed, 2608 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/crypto/Kconfig
 create mode 100644 drivers/staging/crypto/Makefile
 create mode 100644 drivers/staging/crypto/fsl-dcp.c
 create mode 100644 drivers/staging/crypto/fsl-dcp.h
 create mode 100644 include/linux/fsl/fsl-dcp_bootstream_ioctl.h
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/2 Support fsl-dcp crypto coprocessor

From: "Christoph G. Baumann" <[email protected]>

Forgot some changed files in the first try...

The following patch is a port of the original driver from Freescale to the current mainline. The patch was tested under 3.7.

---
 drivers/staging/crypto/Kconfig   |   15 +
 drivers/staging/crypto/Makefile  |    1 +
 drivers/staging/crypto/fsl-dcp.c | 1817 ++++++++++++++++++++++++++++++++++++++
 drivers/staging/crypto/fsl-dcp.h |  739 ++++++++++++++++
 4 files changed, 2572 insertions(+)
 create mode 100644 drivers/staging/crypto/Kconfig
 create mode 100644 drivers/staging/crypto/Makefile
 create mode 100644 drivers/staging/crypto/fsl-dcp.c
 create mode 100644 drivers/staging/crypto/fsl-dcp.h
drivers/staging/crypto/Kconfig new file +15 -0
new file mode 100644
index 0000000..acf2cf9
@@ -0,0 +1,15 @@
+config CRYPTO_DEV_FSL_DCP
+	tristate "Support for the DCP engine"
+	depends on SOC_IMX23 || SOC_IMX28 || SOC_IMX50
+  select CRYPTO_HW
+	select CRYPTO_ALGAPI
+  select CRYPTO_SHA256
+	select CRYPTO_AES
+	select CRYPTO_BLKCIPHER
+	help
+	  Say 'Y' here to use the DCP AES and SHA
+	  engine for the CryptoAPI algorithms.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called fsl-dcp.
+
drivers/staging/crypto/Makefile new file +1 -0
new file mode 100644
index 0000000..06eabdf
@@ -0,0 +1 @@
+obj-$(CONFIG_CRYPTO_DEV_FSL_DCP) += fsl-dcp.o
drivers/staging/crypto/fsl-dcp.c new file +1817 -0

1,817 lines not on this page · raw message

drivers/staging/crypto/fsl-dcp.h new file +739 -0

739 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 2/2 Support fsl-dcp crypto coprocessor

In reply to Christoph G. Baumann

From: "Christoph G. Baumann" <[email protected]>

Forgot some changed files in the first try...

The following patch is a port of the original driver from Freescale to the current mainline. The patch was tested under 3.7.

---
 arch/arm/boot/dts/imx28.dtsi                 |    2 +-
 drivers/staging/Kconfig                      |    2 ++
 drivers/staging/Makefile                     |    1 +
 include/linux/fsl/fsl-dcp_bootstream_ioctl.h |   32 ++++++++++++++++++++++++++
 4 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 include/linux/fsl/fsl-dcp_bootstream_ioctl.h
arch/arm/boot/dts/imx28.dtsi +1 -1
index 7ba4966..07c80cd 100644
@@ -664,9 +664,9 @@
 			};
 
 			dcp at 80028000 {
+				compatible = "fsl,fsl-dcp";
 				reg = <0x80028000 0x2000>;
 				interrupts = <52 53 54>;
-				status = "disabled";
 			};
 
 			pxp at 8002a000 {
drivers/staging/Kconfig +2 -0
index 093f10c..b3cf08b 100644
@@ -140,4 +140,6 @@ source "drivers/staging/zcache/Kconfig"
 
 source "drivers/staging/goldfish/Kconfig"
 
+source "drivers/staging/crypto/Kconfig"
+
 endif # STAGING
drivers/staging/Makefile +1 -0
index fa41b04..6875e3e 100644
@@ -62,3 +62,4 @@ obj-$(CONFIG_SB105X)		+= sb105x/
 obj-$(CONFIG_FIREWIRE_SERIAL)	+= fwserial/
 obj-$(CONFIG_ZCACHE)		+= zcache/
 obj-$(CONFIG_GOLDFISH)		+= goldfish/
+obj-$(CONFIG_CRYPTO_HW)		+= crypto/
include/linux/fsl/fsl-dcp_bootstream_ioctl.h new file +32 -0
new file mode 100644
index 0000000..2859a8d
@@ -0,0 +1,32 @@
+/*
+ * Freescale DCP driver for bootstream update. Only handles the OTP KEY
+ * case and can only encrypt/decrypt.
+ *
+ * Author: Pantelis Antoniou <[email protected]>
+ *
+ * Copyright (C) 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
+ */
+
+/*
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+#ifndef DCP_BOOTSTREAM_IOCTL_H
+#define DCP_BOOTSTREAM_IOCTL_H
+
+/* remember to have included the proper _IO definition
+ * file before hand.
+ * For user space it's <sys/ioctl.h>
+ */
+
+#define DBS_IOCTL_BASE   'd'
+
+#define DBS_ENC _IOW(DBS_IOCTL_BASE, 0x00, uint8_t[16])
+#define DBS_DEC _IOW(DBS_IOCTL_BASE, 0x01, uint8_t[16])
+
+#endif
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 1/1 Support fsl-dcp crypto coprocessor

In reply to Christoph G. Baumann
Quoted 6 lines · Christoph G. Baumann

From: "Christoph G. Baumann" <[email protected]>

The following patch is a port of the original driver from Freescale to the current mainline. The patch was tested under 3.7.

Quoted 12 lines
---
 drivers/staging/crypto/Kconfig               |   15 +
 drivers/staging/crypto/Makefile              |    1 +
 drivers/staging/crypto/fsl-dcp.c             | 1817 ++++++++++++++++++++++++++
 drivers/staging/crypto/fsl-dcp.h             |  739 +++++++++++
 include/linux/fsl/fsl-dcp_bootstream_ioctl.h |   32 +
 5 files changed, 2604 insertions(+)
 create mode 100644 drivers/staging/crypto/Kconfig
 create mode 100644 drivers/staging/crypto/Makefile
 create mode 100644 drivers/staging/crypto/fsl-dcp.c
 create mode 100644 drivers/staging/crypto/fsl-dcp.h
 create mode 100644 include/linux/fsl/fsl-dcp_bootstream_ioctl.h

IMHO it doesn't make any sense to push this into staging. The Freescale kernel is full of drivers which are not ready for mainline yet.

Until now, it was a good strategy to wait until some code is needed, then clean it up, adapt it to the right kernel APIs and push it into non-staging mainline.

rsc

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#5 lore raw

PATCH 1/1 Support fsl-dcp crypto coprocessor

Quoted 3 lines

IMHO it doesn't make any sense to push this into staging. The Freescale kernel is full of drivers which are not ready for mainline yet.

Indeed the Freescale kernel is a heap of <censored>.

Quoted 3 lines

Until now, it was a good strategy to wait until some code is needed, then clean it up, adapt it to the right kernel APIs and push it into non-staging mainline.

Well, that's what I'm trying to do. I picked a particular driver and adapted it to the current mainline.
So if there are concrete proposals or criticism about this patch, please tell me. As I stated the code is from Freescale and I won't be offended.

Christoph

#6 lore raw

PATCH 1/1 Support fsl-dcp crypto coprocessor

Quoted 7 lines · Christoph G. Baumann
Quoted 3 lines

IMHO it doesn't make any sense to push this into staging. The Freescale kernel is full of drivers which are not ready for mainline yet.

Indeed the Freescale kernel is a heap of <censored>.

Quoted 6 lines
Quoted 3 lines

Until now, it was a good strategy to wait until some code is needed, then clean it up, adapt it to the right kernel APIs and push it into non-staging mainline.

Well, that's what I'm trying to do. I picked a particular driver and adapted it to the current mainline.

Then why not put them into drivers/crypto/ rather than drivers/staging/crypto/?

Shawn

Quoted 2 lines

So if there are concrete proposals or criticism about this patch, please tell me. As I stated the code is from Freescale and I won't be offended.

#7 lore raw

PATCH 1/1 Support fsl-dcp crypto coprocessor

In reply to Christoph G. Baumann

Hi Christoph,

You need to check MAINTAINERS to get the mailing list and maintainers of crypto subsystem.

CRYPTO API

M:      Herbert Xu <[email protected]>
M:      "David S. Miller" <[email protected]>
L:      linux-crypto at vger.kernel.org
T:      git git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git
S:      Maintained
F:      Documentation/crypto/
F:      arch/*/crypto/
F:      crypto/
F:      drivers/crypto/
F:      include/crypto/

It's nice to have linux-arm-kernel on Cc, but the patch should really be sent to people and mailing list above. After all, Herbert will eventually pick up the patch after it gets reviewed on linux-crypto list.

Quoted 4 lines · Christoph G. Baumann

From: "Christoph G. Baumann" <[email protected]>

The following patch is a port of the original driver from Freescale to the current mainline. The patch was tested under 3.7.

The patch should be developed and tested against the latest kernel version, saying v3.9.

Will look into the patch in another day.

Shawn

Quoted 14 lines
---
 drivers/staging/crypto/Kconfig               |   15 +
 drivers/staging/crypto/Makefile              |    1 +
 drivers/staging/crypto/fsl-dcp.c             | 1817 ++++++++++++++++++++++++++
 drivers/staging/crypto/fsl-dcp.h             |  739 +++++++++++
 include/linux/fsl/fsl-dcp_bootstream_ioctl.h |   32 +
 5 files changed, 2604 insertions(+)
 create mode 100644 drivers/staging/crypto/Kconfig
 create mode 100644 drivers/staging/crypto/Makefile
 create mode 100644 drivers/staging/crypto/fsl-dcp.c
 create mode 100644 drivers/staging/crypto/fsl-dcp.h
 create mode 100644 include/linux/fsl/fsl-dcp_bootstream_ioctl.h