Skip to contentSkip to conversation

openssl: add ocf support

PATCH New Peter Korsgaard 4 participants 4 messages Jan 17, 2011 – Jan 27, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openssl: add ocf support

commit: http://git.buildroot.net/buildroot/commit/?id=7b9faa03ee7a9ec221b6c3d900d3f9783c4d27b5
branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Enable OCF (cryptodev) support for openssl as an option.

This requires a patched kernel to export hardware acceleration for openssl to use it.
If you lack a patched kernel or support it won't break anything, it will simply fall back to the default software engine from openssl, you'll just have a slightly bigger libssl/libcrypto.

Tested with 20100325 release + 20101223 patch from the mailing list.

[Peter: slightly tweaked .mk]
---
 package/openssl/Config.in                |   10 +
 package/openssl/ocf-cryptodev-20101223.h |  480 ++++++++++++++++++++++++++++++
 package/openssl/openssl.mk               |   14 +-
 3 files changed, 503 insertions(+), 1 deletions(-)
 create mode 100644 package/openssl/ocf-cryptodev-20101223.h
package/openssl/Config.in +10 -0
index 4685014..3e09d88 100644
@@ -21,3 +21,13 @@ 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
+	help
+	  Enable openssl cryptodev (OCF) hardware acceleration support.
+	  This requires kernel patches from the ocf-linux project otherwise
+	  you'll just have a bigger openssl library that works as usual.
+
+	  http://ocf-linux.sourceforge.net/
package/openssl/ocf-cryptodev-20101223.h new file +480 -0

480 lines not on this page · raw message

package/openssl/openssl.mk +13 -1
index ff807c9..866d4e5 100644
@@ -9,6 +9,18 @@ OPENSSL_SITE = http://www.openssl.org/source
 OPENSSL_INSTALL_STAGING = YES
 OPENSSL_DEPENDENCIES = zlib
 OPENSSL_TARGET_ARCH = generic32
+OPENSSL_CFLAGS = $(TARGET_CFLAGS)
+
+ifeq ($(BR2_PACKAGE_OPENSSL_OCF),y)
+OPENSSL_CFLAGS += -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS
+
+define OPENSSL_INSTALL_CRYPTODEV_H
+$(INSTALL) -D package/openssl/ocf-cryptodev-20101223.h \
+	$(STAGING_DIR)/usr/include/crypto/cryptodev.h
+endef
+
+OPENSSL_POST_EXTRACT_HOOKS += OPENSSL_INSTALL_CRYPTODEV_H
+endif
 
 # Some architectures are optimized in OpenSSL
 ifeq ($(ARCH),arm)
@@ -45,7 +57,7 @@ define OPENSSL_CONFIGURE_CMDS
 			zlib-dynamic \
 	)
 	$(SED) "s:-march=[-a-z0-9] ::" -e "s:-mcpu=[-a-z0-9] ::g" $(@D)/Makefile
-	$(SED) "s:-O[0-9]:$(TARGET_CFLAGS):" $(@D)/Makefile
+	$(SED) "s:-O[0-9]:$(OPENSSL_CFLAGS):" $(@D)/Makefile
 endef
 
 define OPENSSL_BUILD_CMDS
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/1 openssl: add ocf support

package/openssl/openssl.mk OPENSSL_SITE = http://www.openssl.org/source · line 23

Quoted 7 lines · On Mon, 17 Jan 2011 22:27:41 +0100 Peter Korsgaard <[email protected]> wrote:
package/openssl/openssl.mk +7 -0
+define OPENSSL_INSTALL_CRYPTODEV_H
+$(INSTALL) -D package/openssl/ocf-cryptodev-20101223.h \
+	$(STAGING_DIR)/usr/include/crypto/cryptodev.h
+endef
+
+OPENSSL_POST_EXTRACT_HOOKS += OPENSSL_INSTALL_CRYPTODEV_H
+endif

This is not a problem today, but it will break horribly when we'll try to merge the packaging work from Lionel, because here we are installing a file to the $(STAGING_DIR) outside of a package staging installation step.

Regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH 1/1 openssl: add ocf support

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 7 lines

package/openssl/openssl.mk OPENSSL_SITE = http://www.openssl.org/source · line 23

Quoted 7 lines
package/openssl/openssl.mk +7 -0
+define OPENSSL_INSTALL_CRYPTODEV_H
+$(INSTALL) -D package/openssl/ocf-cryptodev-20101223.h \
+	$(STAGING_DIR)/usr/include/crypto/cryptodev.h
+endef
+
+OPENSSL_POST_EXTRACT_HOOKS += OPENSSL_INSTALL_CRYPTODEV_H
+endif

Thomas> This is not a problem today, but it will break horribly when we'll try Thomas> to merge the packaging work from Lionel, because here we are installing Thomas> a file to the $(STAGING_DIR) outside of a package staging installation Thomas> step.

Ok, so we would either need to move this to a seperate package or play around with -I options to get openssl to find it somewhere else during compilation.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/1 openssl: add ocf support

Quoted 17 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 7 lines

package/openssl/openssl.mk OPENSSL_SITE = http://www.openssl.org/source · line 23

Quoted 7 lines
package/openssl/openssl.mk +7 -0
+define OPENSSL_INSTALL_CRYPTODEV_H
+$(INSTALL) -D package/openssl/ocf-cryptodev-20101223.h \
+	$(STAGING_DIR)/usr/include/crypto/cryptodev.h
+endef
+
+OPENSSL_POST_EXTRACT_HOOKS += OPENSSL_INSTALL_CRYPTODEV_H
+endif

Thomas> This is not a problem today, but it will break horribly when we'll try Thomas> to merge the packaging work from Lionel, because here we are installing Thomas> a file to the $(STAGING_DIR) outside of a package staging installation Thomas> step.

Quoted 3 lines

Ok, so we would either need to move this to a seperate package or play around with -I options to get openssl to find it somewhere else during compilation.

Better split it out, patches sent.
In the future we might want to build the kernel part as modules or something instead of needing a patched kernel.
Regards.