Skip to contentSkip to conversation

Replace ocf-linux with cryptodev-linux

PATCH In review Kai Kang 5 participants 16 messages Mar 26, 2014 – Mar 31, 2014

lore
Share & tools
lore

Kai Kang

author
#0 lore raw

cover Replace ocf-linux with cryptodev-linux

Replace ocf-linux with cryptodev-linux because linux-yocto use cryptodev-linux to implement /dev/crypto.

Build for qemux86 and qemuarm. Test on qemux86.

Test steps:
1 set CONFIG_CRYPTODEV for linux-yocto by menuconfig
Cryptographic API ---> cryptodev module support

2 bitbake core-image-sato
3 test openssl on target:
3.1 load kernel module cryptodev first

root@qemux86:~# modprobe cryptodev

3.2 test openssl

root@qemux86:~# echo "test" > test.txt
root@qemux86:~# openssl aes-128-cbc -salt -engine cryptodev -in test.txt -out test.txt.aes
engine "cryptodev" set.
enter aes-128-cbc encryption password:
Verifying - enter aes-128-cbc encryption password:
root@qemux86:~# openssl aes-128-cbc -d -salt -engine cryptodev -in test.txt.aes -out test.txt.out
engine "cryptodev" set.
enter aes-128-cbc decryption password:		<-- input wrong password here
bad decrypt
3078080188:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:539:
root@qemux86:~# openssl aes-128-cbc -d -salt -engine cryptodev -in test.txt.aes -out test.txt.out
engine "cryptodev" set.
enter aes-128-cbc decryption password:
root@qemux86:~# ls -l
-rw-r--r--    1 root     root             5 Mar 26 10:07 test.txt
-rw-r--r--    1 root     root            32 Mar 26 10:08 test.txt.aes
-rw-r--r--    1 root     root             5 Mar 26 10:09 test.txt.out
root@qemux86:~# cat test.txt.aes
Salted__�0�c5'A�vU���`root@qemux86:~# 
root@qemux86:~# cat test.txt.out
test
root@qemux86:~# 

The following changes since commit 39846ddbce87d26eb68870914bf86a8ce5e86e5c:

bitbake: data_smart: Fix caching issue for double remove references (2014-03-25 22:28:42 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib kangkai/ocf-linux
http://git.yoctoproject.org/cgit.cgi//log/?h=kangkai/ocf-linux

Kai Kang (3):
cryptodev-linux: add recipe
openssl: replace dependency ocf-linux with cryptodev-linux
ocf-linux: remove recipe

 .../openssl/cryptodev-linux_1.6.bb                 | 22 ++++++++++++++++++++
 meta/recipes-connectivity/openssl/ocf-linux.inc    | 24 ----------------------
 .../openssl/ocf-linux_20120127.bb                  |  6 ------
 .../recipes-connectivity/openssl/openssl_1.0.1e.bb |  2 +-
 4 files changed, 23 insertions(+), 31 deletions(-)
 create mode 100644 meta/recipes-connectivity/openssl/cryptodev-linux_1.6.bb
 delete mode 100644 meta/recipes-connectivity/openssl/ocf-linux.inc
 delete mode 100644 meta/recipes-connectivity/openssl/ocf-linux_20120127.bb
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH 1/3 cryptodev-linux: add recipe

Yocto kernel linux-yocto uses cryptodev-linux to use device /dev/crypto. So add cryptodev-linux which is one alternative of ocf-linux and then remove ocf-linux later.

---
 .../openssl/cryptodev-linux_1.6.bb                 | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/recipes-connectivity/openssl/cryptodev-linux_1.6.bb
meta/recipes-connectivity/openssl/cryptodev-linux_1.6.bb new file +22 -0
new file mode 100644
index 0000000..320716d
@@ -0,0 +1,22 @@
+SUMMARY = "A /dev/crypto device driver"
+HOMEPAGE = "http://cryptodev-linux.org/"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+SRC_URI = "http://download.gna.org/cryptodev-linux/${BPN}-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "eade38998313c25fd7934719cdf8a2ea"
+SRC_URI[sha256sum] = "75f1425c8ea1f8cae523905a5a046a35092327a6152800b0b86efc4e56fb3e2f"
+
+do_compile() {
+	:
+}
+
+# Just install cryptodev.h which is the only header file needed to be exported
+do_install() {
+	install -D ${S}/crypto/cryptodev.h ${D}${includedir}/crypto/cryptodev.h
+}
+
+ALLOW_EMPTY_${PN} = "1"
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
1.8.1.2
author
#4 lore raw

PATCH 2/3 openssl: replace dependency ocf-linux with cryptodev-linux

In reply to Kai Kang

ocf-linux only provides header files but no implementation in kernel. And Yocto kernel linux-yocto use cryptodev-linux to implement /dev/crypto interface. So replace dependency ocf-linux with cryptodev-linux for openssl.

---
 meta/recipes-connectivity/openssl/openssl_1.0.1e.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-connectivity/openssl/openssl_1.0.1e.bb +1 -1
index a574e81..59e66ec 100644
@@ -2,7 +2,7 @@ require openssl.inc
 
 # For target side versions of openssl enable support for OCF Linux driver
 # if they are available.
-DEPENDS += "ocf-linux"
+DEPENDS += "cryptodev-linux"
 
 CFLAG += "-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS"
 
Signature · 1 line
1.8.1.2
author
#5 lore raw

PATCH 3/3 ocf-linux: remove recipe

In reply to Kai Kang

ocf-linux only provides header file and no kernel module is built. We can't use ocf-linux without its implementation. And linux-yocto uses an alternative project cryptodev-linux, so we remove ocf-linux and use cryptodev-linux instead.

---
 meta/recipes-connectivity/openssl/ocf-linux.inc    | 24 ----------------------
 .../openssl/ocf-linux_20120127.bb                  |  6 ------
 2 files changed, 30 deletions(-)
 delete mode 100644 meta/recipes-connectivity/openssl/ocf-linux.inc
 delete mode 100644 meta/recipes-connectivity/openssl/ocf-linux_20120127.bb
meta/recipes-connectivity/openssl/ocf-linux.inc deleted +0 -24
deleted file mode 100644
index d6cde9a..0000000
@@ -1,24 +0,0 @@
-SUMMARY = "Installs required headers for OCF-Linux crypto acceleration support"
-LICENSE = "BSD"
-
-LIC_FILES_CHKSUM = "file://README;md5=493ffe65655667614cf24567adf22f11"
- 
-INC_PR = "r3"
-
-SRC_URI = "http://sourceforge.net/projects/ocf-linux/files/ocf-linux/${PV}/ocf-linux-${PV}.tar.gz"
-
-S = "${WORKDIR}/ocf-linux-${PV}"
-
-# Need to unpack the the ocf-linux.tar.gz file contained inside the
-# downloaded tarball
-# Install the OCF Linux headers so that other packages such as openssl
-# can find them.  The headers must be in a crypto directory according to
-# the README file.
-do_install() {
-    cd ${S}
-    install -d ${D}${includedir}/crypto
-    install -m 0644 ${S}/ocf/*.h ${D}${includedir}/crypto/
-}
-
-ALLOW_EMPTY_${PN} = "1"
-BBCLASSEXTEND = "native nativesdk"
meta/recipes-connectivity/openssl/ocf-linux_20120127.bb deleted +0 -6
deleted file mode 100644
index 7f4d5b3..0000000
@@ -1,6 +0,0 @@
-require ocf-linux.inc
-
-PR = "${INC_PR}.0"
-
-SRC_URI[md5sum] = "3e68afaf6a76dfdab79540fbd6b0cbb3"
-SRC_URI[sha256sum] = "5113609d2c2c43fde962bec1238fe5a81211a751ebb0337b54a9804d40cfef53"
Signature · 1 line
1.8.1.2
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] cryptodev-linux: add recipe

In reply to Kai Kang
Quoted 5 lines · Kai Kang

Yocto kernel linux-yocto uses cryptodev-linux to use device /dev/crypto. So add cryptodev-linux which is one alternative of ocf-linux and then remove ocf-linux later.

Awesome Kai, I was about to send the same thing :-)

Lauren, adding you to Cc so you are aware of it.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#6 lore raw
In reply to Kai Kang

Hello Kai,

Quoted 1 line · Kai Kang

Replace ocf-linux with cryptodev-linux because linux-yocto use cryptodev-linux to implement /dev/crypto.

Thanks for handling it; I was going to address same issue this week so we could have it upstreamed and drop the Freescale bbappends for it. This indeed makes my life easier :-) So thank you :-)

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
author
#7 lore raw
Quoted 8 lines · Otavio Salvador

Hello Kai,

Quoted 1 line · Kai Kang

Replace ocf-linux with cryptodev-linux because linux-yocto use cryptodev-linux to implement /dev/crypto.

Thanks for handling it; I was going to address same issue this week so we could have it upstreamed and drop the Freescale bbappends for it. This indeed makes my life easier :-) So thank you :-)

Hi Otavio,

It is my pleasure if it could help. :)

Signature · 2 lines
Regards,
Neil | Kai Kang
#3 lore raw

Re: [PATCH 1/3] cryptodev-linux: add recipe

In reply to Kai Kang
Quoted 3 lines · Kai Kang

Yocto kernel linux-yocto uses cryptodev-linux to use device /dev/crypto. So add cryptodev-linux which is one alternative of ocf-linux and then remove ocf-linux later.

Quick question - is it native-only recipe? Does it expect cryptodev module to be patched into kernel? Is this what the above description implies - "linux-yocto uses cryptodev-linux"?

From the looks of it, the recipe only installs a header and doesn't even build the out-of-tree module for cryptodev, that cryptodev-linux provides...

Quoted 42 lines
---
 .../openssl/cryptodev-linux_1.6.bb                 | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/recipes-connectivity/openssl/cryptodev-linux_1.6.bb
meta/recipes-connectivity/openssl/cryptodev-linux_1.6.bb new file +22 -0
new file mode 100644
index 0000000..320716d
@@ -0,0 +1,22 @@
+SUMMARY = "A /dev/crypto device driver"
+HOMEPAGE = "http://cryptodev-linux.org/"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+SRC_URI = "http://download.gna.org/cryptodev-linux/${BPN}-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "eade38998313c25fd7934719cdf8a2ea"
+SRC_URI[sha256sum] = "75f1425c8ea1f8cae523905a5a046a35092327a6152800b0b86efc4e56fb3e2f"
+
+do_compile() {
+	:
+}
+
+# Just install cryptodev.h which is the only header file needed to be exported
+do_install() {
+	install -D ${S}/crypto/cryptodev.h ${D}${includedir}/crypto/cryptodev.h
+}
+
+ALLOW_EMPTY_${PN} = "1"
+BBCLASSEXTEND = "native nativesdk"
Signature · 7 lines
1.8.1.2

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
#8 lore raw
In reply to Otavio Salvador
Quoted 7 lines · Otavio Salvador

Hello Kai,

Quoted 1 line · Kai Kang

Replace ocf-linux with cryptodev-linux because linux-yocto use cryptodev-linux to implement /dev/crypto.

Thanks for handling it; I was going to address same issue this week so we could have it upstreamed and drop the Freescale bbappends for it.

So, we also have a recipe of cryptodev for TI builds. But it's not just a header file and we need the actual module to be built and packaged...

I'm rather surprised it was merged so quickly w/o further discussion... :(

Signature · 1 line
Denys
#9 lore raw
Quoted 11 lines · Denys Dmytriyenko
Quoted 7 lines · Otavio Salvador

Hello Kai,

Quoted 1 line · Kai Kang

Replace ocf-linux with cryptodev-linux because linux-yocto use cryptodev-linux to implement /dev/crypto.

Thanks for handling it; I was going to address same issue this week so we could have it upstreamed and drop the Freescale bbappends for it.

So, we also have a recipe of cryptodev for TI builds. But it's not just a header file and we need the actual module to be built and packaged...

As long as something out of tree can co-exist with in-tree implementations, I don't see a problem with an incremental update that builds the module as well.

Bruce

Quoted 10 lines

I'm rather surprised it was merged so quickly w/o further discussion... :(

--
Denys
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
#12 lore raw
In reply to Denys Dmytriyenko
Quoted 6 lines · Denys Dmytriyenko
Quoted 5 lines · Otavio Salvador

Hello Kai,

Quoted 1 line · Kai Kang

Replace ocf-linux with cryptodev-linux because linux-yocto use cryptodev-linux to implement /dev/crypto.

Quoted 7 lines
Quoted 2 lines

Thanks for handling it; I was going to address same issue this week so we could have it upstreamed and drop the Freescale bbappends for it.

So, we also have a recipe of cryptodev for TI builds. But it's not just a header file and we need the actual module to be built and packaged...

I'm rather surprised it was merged so quickly w/o further discussion... :(

From my perspective, the ocf version looked dead and I had several people saying this was the right thing to do with nobody saying otherwise, both here on list and in some conversations I had with people. With the release approaching, it was kind of late to do it equally, it did appear to be the right thing to switch to so I got on and tested and then merged it.

I don't consider things "set in stone", I think we can build upon this incrementally.

Cheers,

Richard

#10 lore raw
In reply to Bruce Ashfield
Quoted 10 lines · Bruce Ashfield
Quoted 9 lines · Denys Dmytriyenko
Quoted 7 lines · Otavio Salvador

Hello Kai,

Quoted 1 line · Kai Kang

Replace ocf-linux with cryptodev-linux because linux-yocto use cryptodev-linux to implement /dev/crypto.

Thanks for handling it; I was going to address same issue this week so we could have it upstreamed and drop the Freescale bbappends for it.

Quoted 6 lines
Quoted 2 lines

So, we also have a recipe of cryptodev for TI builds. But it's not just a header file and we need the actual module to be built and packaged...

As long as something out of tree can co-exist with in-tree implementations, I don't see a problem with an incremental update that builds the module as well.

Thanks. So, I already have cryptodev-tests as a separate recipe that builds some tests from the same source, as main cryptodev. I guess I can look into separating module part into cryptodev-module recipe, which can be optional for kernels like linux-yocto that have it already patched in. Will that work?

Signature · 1 line
Denys
#13 lore raw
In reply to Richard Purdie
Quoted 22 lines · Richard Purdie
Quoted 6 lines · Denys Dmytriyenko
Quoted 5 lines · Otavio Salvador

Hello Kai,

Quoted 1 line · Kai Kang

Replace ocf-linux with cryptodev-linux because linux-yocto use cryptodev-linux to implement /dev/crypto.

Quoted 7 lines
Quoted 2 lines

Thanks for handling it; I was going to address same issue this week so we could have it upstreamed and drop the Freescale bbappends for it.

So, we also have a recipe of cryptodev for TI builds. But it's not just a header file and we need the actual module to be built and packaged...

I'm rather surprised it was merged so quickly w/o further discussion... :(

From my perspective, the ocf version looked dead and I had several people saying this was the right thing to do with nobody saying otherwise, both here on list and in some conversations I had with people. With the release approaching, it was kind of late to do it equally, it did appear to be the right thing to switch to so I got on and tested and then merged it.

Quoted 2 lines

I don't consider things "set in stone", I think we can build upon this incrementally.

Thanks. I'll try to work an incremental solution, then, so it works for us and doesn't break other use cases - please see my reply to Bruce.

Signature · 1 line
Denys
#11 lore raw
In reply to Denys Dmytriyenko
Quoted 14 lines · Denys Dmytriyenko
Quoted 13 lines · Bruce Ashfield
Quoted 11 lines · Denys Dmytriyenko
Quoted 7 lines · Otavio Salvador

Hello Kai,

Quoted 1 line · Kai Kang

Replace ocf-linux with cryptodev-linux because linux-yocto use cryptodev-linux to implement /dev/crypto.

Thanks for handling it; I was going to address same issue this week so we could have it upstreamed and drop the Freescale bbappends for it.

So, we also have a recipe of cryptodev for TI builds. But it's not just a header file and we need the actual module to be built and packaged...

Quoted 8 lines
Quoted 3 lines

As long as something out of tree can co-exist with in-tree implementations, I don't see a problem with an incremental update that builds the module as well.

Thanks. So, I already have cryptodev-tests as a separate recipe that builds some tests from the same source, as main cryptodev. I guess I can look into separating module part into cryptodev-module recipe, which can be optional for kernels like linux-yocto that have it already patched in. Will that work?

Absolutely. It's the same dance we do with lttng-modules, so we are on solid ground.

Bruce

Quoted 3 lines

--
Denys

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
author
#15 lore raw
In reply to Richard Purdie
Quoted 9 lines · Richard Purdie
Quoted 3 lines · Kai Kang

Replace ocf-linux with cryptodev-linux because linux-yocto use cryptodev-linux to implement /dev/crypto.

Build for qemux86 and qemuarm. Test on qemux86.

This did break the build:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=8c3eb5ee4582b6f6d489549290937657f37fc19e

however I've fixed it.

Thanks, RP.

-- Kai

Quoted 7 lines

Cheers,

Richard

Signature · 2 lines
Regards,
Neil | Kai Kang