Skip to contentSkip to conversation

ocf-linux: remove extension and build out of tree

PATCH New Gustavo Zacarias 2 participants 7 messages Apr 27, 2013 – May 5, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 ocf-linux: remove extension and build out of tree

Remove the OCF linux kernel extension instead opting to build ocf-linux modules out of tree.
This is easier for users since no kernel config tweaking is required. On the downside the OCF drivers can't be used, but then all of the kernel crypto drivers are available to users via cryptosoft which is preferred.
Also remove it from the menu to utilize a virtual.

---
 linux/Config.ext.in                                | 12 -------
 linux/linux-ext-ocf-linux.mk                       | 25 -------------
 package/Config.in                                  |  1 -
 package/ocf-linux/Config.in                        | 12 -------
 package/ocf-linux/ocf-linux-01-modules-cross.patch | 42 ++++++++++++++++++++++
 package/ocf-linux/ocf-linux.mk                     | 14 +++++---
 6 files changed, 52 insertions(+), 54 deletions(-)
 delete mode 100644 linux/linux-ext-ocf-linux.mk
 delete mode 100644 package/ocf-linux/Config.in
 create mode 100644 package/ocf-linux/ocf-linux-01-modules-cross.patch
linux/Config.ext.in +0 -12
index a68cbe9..172fa76 100644
@@ -23,18 +23,6 @@ config BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH
 	  Download it at http://download.gna.org/adeos/patches/v2.6/$(ARCH)/
 	  and verify that your kernel version in buildroot matches.
 
-# ocf-linux
-config BR2_LINUX_KERNEL_EXT_OCF_LINUX
-	bool "Open Cryptographic Framework (OCF)"
-	select BR2_PACKAGE_OCF_LINUX
-	help
-	  OCF-Linux Kernel part.
-
-	  Select this option to patch your kernel with OCF for
-	  hardware-accelerated crypto support for available drivers.
-	  Some libraries need to also have OCF enabled for them,
-	  for example OpenSSL.
-
 # RTAI
 config BR2_LINUX_KERNEL_EXT_RTAI
        bool "RTAI Real-time patch"
linux/linux-ext-ocf-linux.mk deleted +0 -25
deleted file mode 100644
index 1a601d5..0000000
@@ -1,25 +0,0 @@
-##################################################
-# Linux OCF extension
-#
-# Patch the linux kernel with OCF
-##################################################
-
-ifeq ($(BR2_LINUX_KERNEL_EXT_OCF_LINUX),y)
-LINUX_DEPENDENCIES += ocf-linux
-
-# Prepare kernel patch
-# The linux-3.2.1.patch is just the main inclusion, most of the code
-# resides in the ocf/ subdir.
-# It works for older kernel versions.
-# Run tested from 2.6.38+ and build tested from 2.6.35+
-define OCF_LINUX_PREPARE_KERNEL
-	support/scripts/apply-patches.sh $(LINUX_DIR) \
-		$(OCF_LINUX_DIR)/patches/ linux-3.2.1-ocf.patch ; \
-	grep -q __mix_pool_bytes $(LINUX_DIR)/drivers/char/random.c && \
-	$(SED) 's:wordcount\*4:&, NULL:' $(LINUX_DIR)/drivers/char/random.c ; \
-	cp -rf $(OCF_LINUX_DIR)/ocf $(LINUX_DIR)/crypto/ocf ;
-endef
-
-LINUX_PRE_PATCH_HOOKS += OCF_LINUX_PREPARE_KERNEL
-
-endif #BR2_LINUX_EXT_OCF_LINUX
package/Config.in +0 -1
index a2ccae7..c8badad 100644
@@ -392,7 +392,6 @@ source "package/libmhash/Config.in"
 source "package/libnss/Config.in"
 source "package/libsha1/Config.in"
 source "package/nettle/Config.in"
-source "package/ocf-linux/Config.in"
 source "package/openssl/Config.in"
 source "package/polarssl/Config.in"
 endmenu
package/ocf-linux/Config.in deleted +0 -12
deleted file mode 100644
index 9dc5766..0000000
@@ -1,12 +0,0 @@
-config BR2_PACKAGE_OCF_LINUX
-	bool "ocf-linux"
-	help
-	  OCF-Linux is a Linux port of the OpenBSD/FreeBSD Cryptographic
-	  Framework (OCF). This port aims to bring full asynchronous HW/SW
-	  crypto acceleration to the Linux kernel and applications
-	  running under Linux.
-
-	  You need to enable the OCF linux kernel extension or provide
-	  a prepatched kernel to make this option useful.
-
-	  http://ocf-linux.sourceforge.net/
package/ocf-linux/ocf-linux-01-modules-cross.patch new file +42 -0

42 lines not on this page · raw message

package/ocf-linux/ocf-linux.mk +10 -4
index fb5f7e8..1be3a3f 100644
@@ -6,16 +6,22 @@
 
 OCF_LINUX_VERSION = 20120127
 OCF_LINUX_SITE = http://downloads.sourceforge.net/project/ocf-linux/ocf-linux/$(OCF_LINUX_VERSION)
+OCF_LINUX_DEPENDENCIES = linux
 OCF_LINUX_INSTALL_STAGING = YES
 
-define OCF_LINUX_INSTALL_STAGING_CMDS
-	$(INSTALL) -D -m 644 $(@D)/ocf/cryptodev.h \
-		$(STAGING_DIR)/usr/include/crypto/cryptodev.h
+define OCF_LINUX_BUILD_CMDS
+	$(MAKE) -C $(@D)/ocf $(LINUX_MAKE_FLAGS) KDIR=$(LINUX_DIR) \
+		ocf_modules
 endef
 
 define OCF_LINUX_INSTALL_TARGET_CMDS
+	$(MAKE) -C $(@D)/ocf $(LINUX_MAKE_FLAGS) KDIR=$(LINUX_DIR) \
+		ocf_install
+endef
+
+define OCF_LINUX_INSTALL_STAGING_CMDS
 	$(INSTALL) -D -m 644 $(@D)/ocf/cryptodev.h \
-		$(TARGET_DIR)/usr/include/crypto/cryptodev.h
+		$(STAGING_DIR)/usr/include/crypto/cryptodev.h
 endef
 
 $(eval $(generic-package))
Signature · 1 line
1.8.1.5
#1 lore raw

PATCH 2/6 cryptodev-linux: new package

cryptodev-linux is an alternative implementation to ocf-linux.

---
 package/cryptodev-linux/cryptodev-linux.mk | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 package/cryptodev-linux/cryptodev-linux.mk
package/cryptodev-linux/cryptodev-linux.mk new file +28 -0
new file mode 100644
index 0000000..1a78228
@@ -0,0 +1,28 @@
+#############################################################
+#
+# cryptodev-linux
+#
+#############################################################
+
+CRYPTODEV_LINUX_VERSION = 1.6
+CRYPTODEV_LINUX_SITE = http://download.gna.org/cryptodev-linux
+CRYPTODEV_LINUX_DEPENDENCIES = linux
+CRYPTODEV_LINUX_INSTALL_STAGING = YES
+CRYPTODEV_LICENSE = GPLv2+
+CRYPTODEV_LICENSE_FILES = COPYING
+
+define CRYPTODEV_LINUX_BUILD_CMDS
+	$(MAKE) -C $(@D) $(LINUX_MAKE_FLAGS) KERNEL_DIR=$(LINUX_DIR)
+endef
+
+define CRYPTODEV_LINUX_INSTALL_TARGET_CMDS
+	$(MAKE) -C $(@D) $(LINUX_MAKE_FLAGS) KERNEL_DIR=$(LINUX_DIR) \
+		PREFIX=$(TARGET_DIR) modules_install
+endef
+
+define CRYPTODEV_LINUX_INSTALL_STAGING_CMDS
+	$(INSTALL) -D -m 644 $(@D)/crypto/cryptodev.h \
+		$(STAGING_DIR)/usr/include/crypto/cryptodev.h
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH 3/6 cryptodev: add new virtual

In reply to Gustavo Zacarias
---
 package/Config.in              |  1 +
 package/cryptodev/Config.in    | 37 +++++++++++++++++++++++++++++++++++++
 package/cryptodev/cryptodev.mk | 24 ++++++++++++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 package/cryptodev/Config.in
 create mode 100644 package/cryptodev/cryptodev.mk
package/Config.in +1 -0
index c8badad..c0cca5b 100644
@@ -384,6 +384,7 @@ endmenu
 
 menu "Crypto"
 source "package/beecrypt/Config.in"
+source "package/cryptodev/Config.in"
 source "package/gnutls/Config.in"
 source "package/libgcrypt/Config.in"
 source "package/libgpg-error/Config.in"
package/cryptodev/Config.in new file +37 -0
new file mode 100644
index 0000000..3f08e9e
@@ -0,0 +1,37 @@
+config BR2_PACKAGE_CRYPTODEV
+	bool "cryptodev support"
+	depends on BR2_LINUX_KERNEL
+	help
+	  Select the desired cryptodev implementation.
+
+if BR2_PACKAGE_CRYPTODEV
+
+choice
+	prompt "cryptodev variant"
+	default BR2_PACKAGE_CRYPTODEV_LINUX if !BR2_microblaze
+	help
+	  Select the cryptodev implementation.
+
+config BR2_PACKAGE_CRYPTODEV_LINUX
+	bool "cryptodev-linux"
+	depends on !BR2_microblaze
+	help
+	  Cryptodev-linux is a device that allows access to Linux kernel
+	  cryptographic drivers; thus allowing userspace applications
+	  to take advantage of hardware accelerators.
+
+	  http://cryptodev-linux.org/index.html
+
+config BR2_PACKAGE_OCF_LINUX
+	bool "ocf-linux"
+	help
+	  OCF-Linux is a Linux port of the OpenBSD/FreeBSD Cryptographic
+	  Framework (OCF). This port aims to bring full asynchronous HW/SW
+	  crypto acceleration to the Linux kernel and applications
+	  running under Linux.
+
+	  http://ocf-linux.sourceforge.net/
+
+endchoice
+
+endif
package/cryptodev/cryptodev.mk new file +24 -0
new file mode 100644
index 0000000..b6f4a42
@@ -0,0 +1,24 @@
+#############################################################
+#
+# Virtual cryptodev package
+#
+#############################################################
+
+CRYPTODEV_SOURCE =
+
+ifeq ($(BR2_PACKAGE_CRYPTODEV_LINUX),y)
+CRYPTODEV_DEPENDENCIES += cryptodev-linux
+endif
+
+ifeq ($(BR2_PACKAGE_OCF_LINUX),y)
+CRYPTODEV_DEPENDENCIES += ocf-linux
+endif
+
+ifeq ($(CRYPTODEV_DEPENDENCIES),)
+define CRYPTODEV_CONFIGURE_CMDS
+	echo "No CRYPTODEV implementation defined. Configuration error"
+	exit 1
+endef
+endif
+
+$(eval $(generic-package))
Signature · 1 line
1.8.1.5
#3 lore raw

PATCH 4/6 openssl: integrate variable cryptodev support

In reply to Gustavo Zacarias

Allow openssl to use cryptodev-linux hardware crypto support besides OCF.
To do this we remove the OCF option from openssl and automatically use any of the available implementations when available.

---
 package/openssl/Config.in  | 15 ---------------
 package/openssl/openssl.mk |  7 ++++++-
 2 files changed, 6 insertions(+), 16 deletions(-)
package/openssl/Config.in +0 -15
index 2187023..d1ed520 100644
@@ -23,18 +23,3 @@ config BR2_PACKAGE_OPENSSL_ENGINES
 	depends on BR2_PACKAGE_OPENSSL
 	help
 	  Install additional encryption engine libraries.
-
-config BR2_PACKAGE_OPENSSL_OCF
-	bool "openssl ocf support"
-	depends on BR2_PACKAGE_OPENSSL
-	select BR2_PACKAGE_OCF_LINUX
-	help
-	  Enable openssl cryptodev (OCF) hardware acceleration support.
-	  This requires the ocf linux kernel extension or you to provide a
-	  pre-patched kernel that includes it.
-	  If kernel support isn't available it'll just make the libraries
-	  a tiny bit larger with a small CPU overhead when starting up and
-	  checking for the required kernel-side support, and then falling
-	  back to regular builtin support.
-
-	  http://ocf-linux.sourceforge.net/
package/openssl/openssl.mk +6 -1
index 8486c44..2e04789 100644
@@ -22,7 +22,12 @@ endif
 
 OPENSSL_PRE_CONFIGURE_HOOKS += OPENSSL_DISABLE_APPS
 
-ifeq ($(BR2_PACKAGE_OPENSSL_OCF),y)
+ifeq ($(BR2_PACKAGE_CRYPTODEV_LINUX),y)
+	OPENSSL_CFLAGS += -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS
+	OPENSSL_DEPENDENCIES += cryptodev-linux
+endif
+
+ifeq ($(BR2_PACKAGE_OCF_LINUX),y)
 	OPENSSL_CFLAGS += -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS
 	OPENSSL_DEPENDENCIES += ocf-linux
 endif
Signature · 1 line
1.8.1.5
#4 lore raw

PATCH 5/6 gnutls: enable cryptodev-linux support

In reply to Gustavo Zacarias

Unfortunately because of header file differencies this can't be used for OCF.

---
 package/gnutls/gnutls.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/gnutls/gnutls.mk +5 -0
index 21ace1c..610a5a2 100644
@@ -24,6 +24,11 @@ GNUTLS_CONF_OPT += $(if $(BR2_TOOLCHAIN_HAS_THREADS),--with-libpthread-prefix=$(
 GNUTLS_CONF_OPT += $(if $(BR2_USE_MMU),,--disable-crywrap)
 GNUTLS_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBIDN),libidn)
 
+ifeq ($(BR2_PACKAGE_CRYPTODEV_LINUX),y)
+	GNUTLS_CONF_OPT += --enable-cryptodev
+	GNUTLS_DEPENDENCIES += cryptodev-linux
+endif
+
 # Some examples in doc/examples use wchar
 define GNUTLS_DISABLE_DOCS
 	$(SED) 's/ doc / /' $(@D)/Makefile.in
Signature · 1 line
1.8.1.5
#5 lore raw

PATCH 6/6 openswan: fix OCF support detection

In reply to Gustavo Zacarias

Now that the openssl OCFs option is gone we need to switch to the package option.

---
 package/openswan/openswan.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/openswan/openswan.mk +1 -1
index 153d659..6b7dc05 100644
@@ -22,7 +22,7 @@ endif
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 	OPENSWAN_DEPENDENCIES += openssl
 	OPENSWAN_MAKE_OPT += HAVE_OPENSSL=true
-ifeq ($(BR2_PACKAGE_OPENSSL_OCF),y)
+ifeq ($(BR2_PACKAGE_OCF_LINUX),y)
 	OPENSWAN_MAKE_OPT += HAVE_OCF=true
 endif
 endif
Signature · 1 line
1.8.1.5
#6 lore raw

PATCH 1/6 ocf-linux: remove extension and build out of tree

In reply to Gustavo Zacarias
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Gustavo" == Gustavo Zacarias <[email protected]> writes:

Gustavo> Remove the OCF linux kernel extension instead opting to build ocf-linux Gustavo> modules out of tree.
Gustavo> This is easier for users since no kernel config tweaking is required. Gustavo> On the downside the OCF drivers can't be used, but then all of the Gustavo> kernel crypto drivers are available to users via cryptosoft which is Gustavo> preferred.
Gustavo> Also remove it from the menu to utilize a virtual.

Committed series, thanks.

Signature · 1 line
Bye, Peter Korsgaard