diff options
| author | Robert Yang <liezhi.yang@windriver.com> | 2017-07-12 03:15:27 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-21 22:51:37 +0100 |
| commit | bfd831a8695e6b4e2095deb286014172a6bf5051 (patch) | |
| tree | e677308dd5cfef33a4f6ebca74a25fa4f28220d2 /meta/recipes-kernel/cryptodev | |
| parent | d2990a2da61b6a6078728cfa3715b3f4144398f7 (diff) | |
| download | poky-bfd831a8695e6b4e2095deb286014172a6bf5051.tar.gz | |
cryptodev: 1.8 -> 1.9
* Remove backported patch:
- 0001-Adjust-to-another-change-in-the-user-page-API.patch
- 06d6b560c6e45dc317dae47c74706fa43f4a31d8.patch
- cb186f682679383e8b5806240927903730ce85d9.patch
- kernel-4-10-changes.patch
* Update patch:
- 0001-Disable-installing-header-file-provided-by-another-p.patch
* Update FILES_${PN} since there are files in bindir:
/usr/bin/hmac_comp
/usr/bin/cipher_comp
/usr/bin/async_hmac
/usr/bin/cipher-aead-srtp
/usr/bin/hash_comp
/usr/bin/async_speed
/usr/bin/async_cipher
/usr/bin/sha_speed
/usr/bin/hashcrypt_speed
/usr/bin/hmac
/usr/bin/cipher-gcm
/usr/bin/cipher
/usr/bin/fullspeed
/usr/bin/speed
/usr/bin/cipher-aead
(From OE-Core rev: 27202954ce7abda22f7e81c2d72a80f0fa7006d8)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel/cryptodev')
| -rw-r--r-- | meta/recipes-kernel/cryptodev/cryptodev-linux_1.9.bb (renamed from meta/recipes-kernel/cryptodev/cryptodev-linux_1.8.bb) | 0 | ||||
| -rw-r--r-- | meta/recipes-kernel/cryptodev/cryptodev-module_1.9.bb (renamed from meta/recipes-kernel/cryptodev/cryptodev-module_1.8.bb) | 0 | ||||
| -rw-r--r-- | meta/recipes-kernel/cryptodev/cryptodev-tests_1.9.bb (renamed from meta/recipes-kernel/cryptodev/cryptodev-tests_1.8.bb) | 2 | ||||
| -rw-r--r-- | meta/recipes-kernel/cryptodev/cryptodev.inc | 10 | ||||
| -rw-r--r-- | meta/recipes-kernel/cryptodev/files/0001-Adjust-to-another-change-in-the-user-page-API.patch | 40 | ||||
| -rw-r--r-- | meta/recipes-kernel/cryptodev/files/0001-Disable-installing-header-file-provided-by-another-p.patch | 18 | ||||
| -rw-r--r-- | meta/recipes-kernel/cryptodev/files/06d6b560c6e45dc317dae47c74706fa43f4a31d8.patch | 54 | ||||
| -rw-r--r-- | meta/recipes-kernel/cryptodev/files/cb186f682679383e8b5806240927903730ce85d9.patch | 279 | ||||
| -rw-r--r-- | meta/recipes-kernel/cryptodev/files/kernel-4-10-changes.patch | 57 |
9 files changed, 11 insertions, 449 deletions
diff --git a/meta/recipes-kernel/cryptodev/cryptodev-linux_1.8.bb b/meta/recipes-kernel/cryptodev/cryptodev-linux_1.9.bb index c55577c661..c55577c661 100644 --- a/meta/recipes-kernel/cryptodev/cryptodev-linux_1.8.bb +++ b/meta/recipes-kernel/cryptodev/cryptodev-linux_1.9.bb | |||
diff --git a/meta/recipes-kernel/cryptodev/cryptodev-module_1.8.bb b/meta/recipes-kernel/cryptodev/cryptodev-module_1.9.bb index 552eb6abaa..552eb6abaa 100644 --- a/meta/recipes-kernel/cryptodev/cryptodev-module_1.8.bb +++ b/meta/recipes-kernel/cryptodev/cryptodev-module_1.9.bb | |||
diff --git a/meta/recipes-kernel/cryptodev/cryptodev-tests_1.8.bb b/meta/recipes-kernel/cryptodev/cryptodev-tests_1.9.bb index c4005242a7..9cb5dcb94f 100644 --- a/meta/recipes-kernel/cryptodev/cryptodev-tests_1.8.bb +++ b/meta/recipes-kernel/cryptodev/cryptodev-tests_1.9.bb | |||
| @@ -18,4 +18,4 @@ do_install() { | |||
| 18 | oe_runmake install_tests | 18 | oe_runmake install_tests |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | FILES_${PN} = "${bindir}/tests_cryptodev/*" | 21 | FILES_${PN} = "${bindir}/*" |
diff --git a/meta/recipes-kernel/cryptodev/cryptodev.inc b/meta/recipes-kernel/cryptodev/cryptodev.inc index 4ae0a2b490..50366e7202 100644 --- a/meta/recipes-kernel/cryptodev/cryptodev.inc +++ b/meta/recipes-kernel/cryptodev/cryptodev.inc | |||
| @@ -3,14 +3,10 @@ HOMEPAGE = "http://cryptodev-linux.org/" | |||
| 3 | LICENSE = "GPLv2" | 3 | LICENSE = "GPLv2" |
| 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" | 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" |
| 5 | 5 | ||
| 6 | SRC_URI = "http://nwl.cc/pub/cryptodev-linux/cryptodev-linux-${PV}.tar.gz \ | 6 | SRC_URI = "http://nwl.cc/pub/cryptodev-linux/cryptodev-linux-${PV}.tar.gz" |
| 7 | file://06d6b560c6e45dc317dae47c74706fa43f4a31d8.patch \ | ||
| 8 | file://cb186f682679383e8b5806240927903730ce85d9.patch \ | ||
| 9 | file://0001-Adjust-to-another-change-in-the-user-page-API.patch \ | ||
| 10 | file://kernel-4-10-changes.patch" | ||
| 11 | 7 | ||
| 12 | SRC_URI[md5sum] = "02644cc4cd02301e0b503a332eb2f0b5" | 8 | SRC_URI[md5sum] = "cb4e0ed9e5937716c7c8a7be84895b6d" |
| 13 | SRC_URI[sha256sum] = "67fabde9fb67b286a96c4f45b594b0eccd0f761b495705c18f2ae9461b831376" | 9 | SRC_URI[sha256sum] = "9f4c0b49b30e267d776f79455d09c70cc9c12c86eee400a0d0a0cd1d8e467950" |
| 14 | 10 | ||
| 15 | S = "${WORKDIR}/cryptodev-linux-${PV}" | 11 | S = "${WORKDIR}/cryptodev-linux-${PV}" |
| 16 | 12 | ||
diff --git a/meta/recipes-kernel/cryptodev/files/0001-Adjust-to-another-change-in-the-user-page-API.patch b/meta/recipes-kernel/cryptodev/files/0001-Adjust-to-another-change-in-the-user-page-API.patch deleted file mode 100644 index fb75278b5e..0000000000 --- a/meta/recipes-kernel/cryptodev/files/0001-Adjust-to-another-change-in-the-user-page-API.patch +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | From f126e4837e6334d0464540995df7426fedf6b175 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Michael Weiser <michael.weiser@gmx.de> | ||
| 3 | Date: Fri, 11 Nov 2016 18:09:32 +0100 | ||
| 4 | Subject: [PATCH] Adjust to another change in the user page API | ||
| 5 | |||
| 6 | 4.9.0 will replace the write and force flags of get_user_pages_remote() | ||
| 7 | with a gup_flags parameter[1]. Distinguish the two APIs based on kernel | ||
| 8 | version we're compiling for. | ||
| 9 | |||
| 10 | [1] https://github.com/torvalds/linux/commit/9beae1ea89305a9667ceaab6d0bf46a045ad71e7 | ||
| 11 | |||
| 12 | Upstream-Status: Backport | ||
| 13 | |||
| 14 | Signed-off-by: Daniel Schultz <d.schultz@phytec.de> | ||
| 15 | --- | ||
| 16 | zc.c | 8 +++++++- | ||
| 17 | 1 file changed, 7 insertions(+), 1 deletion(-) | ||
| 18 | |||
| 19 | diff --git a/zc.c b/zc.c | ||
| 20 | index a97b49f..e766ee3 100644 | ||
| 21 | --- a/zc.c | ||
| 22 | +++ b/zc.c | ||
| 23 | @@ -65,7 +65,13 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, | ||
| 24 | ret = get_user_pages( | ||
| 25 | #endif | ||
| 26 | task, mm, | ||
| 27 | - (unsigned long)addr, pgcount, write, 0, pg, NULL); | ||
| 28 | + (unsigned long)addr, pgcount, | ||
| 29 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) | ||
| 30 | + write ? FOLL_WRITE : 0, | ||
| 31 | +#else | ||
| 32 | + write, 0, | ||
| 33 | +#endif | ||
| 34 | + pg, NULL); | ||
| 35 | up_read(&mm->mmap_sem); | ||
| 36 | if (ret != pgcount) | ||
| 37 | return -EINVAL; | ||
| 38 | -- | ||
| 39 | 1.9.1 | ||
| 40 | |||
diff --git a/meta/recipes-kernel/cryptodev/files/0001-Disable-installing-header-file-provided-by-another-p.patch b/meta/recipes-kernel/cryptodev/files/0001-Disable-installing-header-file-provided-by-another-p.patch index a580fc68e1..885b5823e4 100644 --- a/meta/recipes-kernel/cryptodev/files/0001-Disable-installing-header-file-provided-by-another-p.patch +++ b/meta/recipes-kernel/cryptodev/files/0001-Disable-installing-header-file-provided-by-another-p.patch | |||
| @@ -7,22 +7,18 @@ Signed-off-by: Denys Dmytriyenko <denys@ti.com> | |||
| 7 | 7 | ||
| 8 | Upstream-Status: Inappropriate [ OE specific ] | 8 | Upstream-Status: Inappropriate [ OE specific ] |
| 9 | --- | 9 | --- |
| 10 | Makefile | 2 -- | 10 | Makefile | 1 - |
| 11 | 1 file changed, 2 deletions(-) | 11 | 1 file changed, 1 deletion(-) |
| 12 | 12 | ||
| 13 | diff --git a/Makefile b/Makefile | 13 | diff --git a/Makefile b/Makefile |
| 14 | index d66ef26..8e97c6a 100644 | 14 | index 5a080e0..bf02396 100644 |
| 15 | --- a/Makefile | 15 | --- a/Makefile |
| 16 | +++ b/Makefile | 16 | +++ b/Makefile |
| 17 | @@ -23,8 +23,6 @@ install: modules_install | 17 | @@ -33,7 +33,6 @@ install: modules_install |
| 18 | 18 | ||
| 19 | modules_install: | 19 | modules_install: |
| 20 | make -C $(KERNEL_DIR) SUBDIRS=`pwd` modules_install | 20 | $(MAKE) $(KERNEL_MAKE_OPTS) modules_install |
| 21 | - @echo "Installing cryptodev.h in $(PREFIX)/usr/include/crypto ..." | 21 | - install -m 644 -D crypto/cryptodev.h $(DESTDIR)/$(includedir)/crypto/cryptodev.h |
| 22 | - @install -D crypto/cryptodev.h $(PREFIX)/usr/include/crypto/cryptodev.h | ||
| 23 | 22 | ||
| 24 | clean: | 23 | clean: |
| 25 | make -C $(KERNEL_DIR) SUBDIRS=`pwd` clean | 24 | $(MAKE) $(KERNEL_MAKE_OPTS) clean |
| 26 | -- | ||
| 27 | 1.9.1 | ||
| 28 | |||
diff --git a/meta/recipes-kernel/cryptodev/files/06d6b560c6e45dc317dae47c74706fa43f4a31d8.patch b/meta/recipes-kernel/cryptodev/files/06d6b560c6e45dc317dae47c74706fa43f4a31d8.patch deleted file mode 100644 index cb556e1e24..0000000000 --- a/meta/recipes-kernel/cryptodev/files/06d6b560c6e45dc317dae47c74706fa43f4a31d8.patch +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | From f14b4706b0d04988e7e5bc8c4d2aefef9f029d9d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Michael Weiser <michael.weiser@gmx.de> | ||
| 3 | Date: Fri, 5 Aug 2016 18:43:55 +0200 | ||
| 4 | Subject: [PATCH] Adjust to recent user page API changes | ||
| 5 | |||
| 6 | 4.6.0 basically renamed get_user_pages() to get_user_pages_remote() and | ||
| 7 | introduced a new get_user_pages() that always works on the current | ||
| 8 | task.[1] Distinguish the two APIs based on kernel version we're | ||
| 9 | compiling for. | ||
| 10 | |||
| 11 | Also, there seems to have been a massive cleansing of | ||
| 12 | page_cache_release(page) in favour of put_page(page)[2] which was an | ||
| 13 | alias for put_page(page)[3] since 2.6.0. Before that beginning with | ||
| 14 | 2.4.0 both page_cache_release(page) and put_page(page) have been aliases | ||
| 15 | for __free_page(page). So using put_page() instead of | ||
| 16 | page_cache_release(page) will produce identical code for anything after | ||
| 17 | 2.4.0. | ||
| 18 | |||
| 19 | [1] https://lkml.org/lkml/2016/2/10/555 | ||
| 20 | [2] https://www.spinics.net/lists/linux-fsdevel/msg95923.html | ||
| 21 | [3] https://www.spinics.net/lists/linux-fsdevel/msg95922.html | ||
| 22 | --- | ||
| 23 | zc.c | 9 +++++++-- | ||
| 24 | 1 file changed, 7 insertions(+), 2 deletions(-) | ||
| 25 | |||
| 26 | Upstream-Status: Backport [from master for 4.8 kernels] | ||
| 27 | |||
| 28 | Index: cryptodev-linux-1.8/zc.c | ||
| 29 | =================================================================== | ||
| 30 | --- cryptodev-linux-1.8.orig/zc.c | ||
| 31 | +++ cryptodev-linux-1.8/zc.c | ||
| 32 | @@ -59,7 +59,12 @@ int __get_userbuf(uint8_t __user *addr, | ||
| 33 | } | ||
| 34 | |||
| 35 | down_read(&mm->mmap_sem); | ||
| 36 | - ret = get_user_pages(task, mm, | ||
| 37 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)) | ||
| 38 | + ret = get_user_pages_remote( | ||
| 39 | +#else | ||
| 40 | + ret = get_user_pages( | ||
| 41 | +#endif | ||
| 42 | + task, mm, | ||
| 43 | (unsigned long)addr, pgcount, write, 0, pg, NULL); | ||
| 44 | up_read(&mm->mmap_sem); | ||
| 45 | if (ret != pgcount) | ||
| 46 | @@ -119,7 +124,7 @@ void release_user_pages(struct csession | ||
| 47 | else | ||
| 48 | ses->readonly_pages--; | ||
| 49 | |||
| 50 | - page_cache_release(ses->pages[i]); | ||
| 51 | + put_page(ses->pages[i]); | ||
| 52 | } | ||
| 53 | ses->used_pages = 0; | ||
| 54 | } | ||
diff --git a/meta/recipes-kernel/cryptodev/files/cb186f682679383e8b5806240927903730ce85d9.patch b/meta/recipes-kernel/cryptodev/files/cb186f682679383e8b5806240927903730ce85d9.patch deleted file mode 100644 index eb0eab63bd..0000000000 --- a/meta/recipes-kernel/cryptodev/files/cb186f682679383e8b5806240927903730ce85d9.patch +++ /dev/null | |||
| @@ -1,279 +0,0 @@ | |||
| 1 | From cb186f682679383e8b5806240927903730ce85d9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Michael Weiser <michael.weiser@gmx.de> | ||
| 3 | Date: Fri, 5 Aug 2016 17:26:27 +0200 | ||
| 4 | Subject: [PATCH] Support skcipher in addition to ablkcipher API | ||
| 5 | |||
| 6 | The ablkcipher API is being phased out[1]. The unified skcipher API | ||
| 7 | seems to have made its entry with 4.3.[3, 4] By what can be seen from | ||
| 8 | migration patches[1.ff.], it's a drop-in replacement. | ||
| 9 | |||
| 10 | Also, deallocators such as crypto_free_skcipher() are NULL-safe now[2]. | ||
| 11 | |||
| 12 | Add a new header cipherapi.h to aid migration from ablkcipher to skcipher and | ||
| 13 | retain support for old kernels. Make it decide which API to use and provide | ||
| 14 | appropriate function calls and type definitions. Since the ablkcipher and | ||
| 15 | skcipher APIs are so similar, those are mainly defines for corresponding | ||
| 16 | pseudo-functions in namespace cryptodev_ derived directly from their API | ||
| 17 | counterparts. | ||
| 18 | |||
| 19 | Compiles and works (i.e. checks pass) with Debian testing 4.6.4 kernel | ||
| 20 | as well as 4.8-rc2+ Linus git tree as of today. (Both require a fix for | ||
| 21 | changed page access API[5].) | ||
| 22 | |||
| 23 | [1] https://www.spinics.net/lists/linux-crypto/msg18133.html | ||
| 24 | [2] https://www.spinics.net/lists/linux-crypto/msg18154.html, line 120 | ||
| 25 | [3] https://www.spinics.net/lists/linux-crypto/msg16373.html | ||
| 26 | [4] https://www.spinics.net/lists/linux-crypto/msg16294.html | ||
| 27 | [5] https://github.com/cryptodev-linux/cryptodev-linux/pull/14 | ||
| 28 | --- | ||
| 29 | cipherapi.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 30 | cryptlib.c | 40 ++++++++++++++++++---------------------- | ||
| 31 | cryptlib.h | 6 ++++-- | ||
| 32 | ioctl.c | 4 ++-- | ||
| 33 | 4 files changed, 84 insertions(+), 26 deletions(-) | ||
| 34 | create mode 100644 cipherapi.h | ||
| 35 | |||
| 36 | Upstream-Status: Backport [from master for 4.8 kernels] | ||
| 37 | |||
| 38 | Index: cryptodev-linux-1.8/cipherapi.h | ||
| 39 | =================================================================== | ||
| 40 | --- /dev/null | ||
| 41 | +++ cryptodev-linux-1.8/cipherapi.h | ||
| 42 | @@ -0,0 +1,60 @@ | ||
| 43 | +#ifndef CIPHERAPI_H | ||
| 44 | +# define CIPHERAPI_H | ||
| 45 | + | ||
| 46 | +#include <linux/version.h> | ||
| 47 | + | ||
| 48 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) | ||
| 49 | +# include <linux/crypto.h> | ||
| 50 | + | ||
| 51 | +typedef struct ablkcipher_alg cryptodev_blkcipher_alg_t; | ||
| 52 | +typedef struct crypto_ablkcipher cryptodev_crypto_blkcipher_t; | ||
| 53 | +typedef struct ablkcipher_request cryptodev_blkcipher_request_t; | ||
| 54 | + | ||
| 55 | +# define cryptodev_crypto_alloc_blkcipher crypto_alloc_ablkcipher | ||
| 56 | +# define cryptodev_crypto_blkcipher_alg crypto_ablkcipher_alg | ||
| 57 | +# define cryptodev_crypto_blkcipher_blocksize crypto_ablkcipher_blocksize | ||
| 58 | +# define cryptodev_crypto_blkcipher_ivsize crypto_ablkcipher_ivsize | ||
| 59 | +# define cryptodev_crypto_blkcipher_alignmask crypto_ablkcipher_alignmask | ||
| 60 | +# define cryptodev_crypto_blkcipher_setkey crypto_ablkcipher_setkey | ||
| 61 | + | ||
| 62 | +static inline void cryptodev_crypto_free_blkcipher(cryptodev_crypto_blkcipher_t *c) { | ||
| 63 | + if (c) | ||
| 64 | + crypto_free_ablkcipher(c); | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +# define cryptodev_blkcipher_request_alloc ablkcipher_request_alloc | ||
| 68 | +# define cryptodev_blkcipher_request_set_callback ablkcipher_request_set_callback | ||
| 69 | + | ||
| 70 | +static inline void cryptodev_blkcipher_request_free(cryptodev_blkcipher_request_t *r) { | ||
| 71 | + if (r) | ||
| 72 | + ablkcipher_request_free(r); | ||
| 73 | +} | ||
| 74 | + | ||
| 75 | +# define cryptodev_blkcipher_request_set_crypt ablkcipher_request_set_crypt | ||
| 76 | +# define cryptodev_crypto_blkcipher_encrypt crypto_ablkcipher_encrypt | ||
| 77 | +# define cryptodev_crypto_blkcipher_decrypt crypto_ablkcipher_decrypt | ||
| 78 | +# define cryptodev_crypto_blkcipher_tfm crypto_ablkcipher_tfm | ||
| 79 | +#else | ||
| 80 | +#include <crypto/skcipher.h> | ||
| 81 | + | ||
| 82 | +typedef struct skcipher_alg cryptodev_blkcipher_alg_t; | ||
| 83 | +typedef struct crypto_skcipher cryptodev_crypto_blkcipher_t; | ||
| 84 | +typedef struct skcipher_request cryptodev_blkcipher_request_t; | ||
| 85 | + | ||
| 86 | +# define cryptodev_crypto_alloc_blkcipher crypto_alloc_skcipher | ||
| 87 | +# define cryptodev_crypto_blkcipher_alg crypto_skcipher_alg | ||
| 88 | +# define cryptodev_crypto_blkcipher_blocksize crypto_skcipher_blocksize | ||
| 89 | +# define cryptodev_crypto_blkcipher_ivsize crypto_skcipher_ivsize | ||
| 90 | +# define cryptodev_crypto_blkcipher_alignmask crypto_skcipher_alignmask | ||
| 91 | +# define cryptodev_crypto_blkcipher_setkey crypto_skcipher_setkey | ||
| 92 | +# define cryptodev_crypto_free_blkcipher crypto_free_skcipher | ||
| 93 | +# define cryptodev_blkcipher_request_alloc skcipher_request_alloc | ||
| 94 | +# define cryptodev_blkcipher_request_set_callback skcipher_request_set_callback | ||
| 95 | +# define cryptodev_blkcipher_request_free skcipher_request_free | ||
| 96 | +# define cryptodev_blkcipher_request_set_crypt skcipher_request_set_crypt | ||
| 97 | +# define cryptodev_crypto_blkcipher_encrypt crypto_skcipher_encrypt | ||
| 98 | +# define cryptodev_crypto_blkcipher_decrypt crypto_skcipher_decrypt | ||
| 99 | +# define cryptodev_crypto_blkcipher_tfm crypto_skcipher_tfm | ||
| 100 | +#endif | ||
| 101 | + | ||
| 102 | +#endif | ||
| 103 | Index: cryptodev-linux-1.8/cryptlib.c | ||
| 104 | =================================================================== | ||
| 105 | --- cryptodev-linux-1.8.orig/cryptlib.c | ||
| 106 | +++ cryptodev-linux-1.8/cryptlib.c | ||
| 107 | @@ -23,7 +23,6 @@ | ||
| 108 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| 109 | */ | ||
| 110 | |||
| 111 | -#include <linux/crypto.h> | ||
| 112 | #include <linux/mm.h> | ||
| 113 | #include <linux/highmem.h> | ||
| 114 | #include <linux/ioctl.h> | ||
| 115 | @@ -37,6 +36,7 @@ | ||
| 116 | #include <linux/rtnetlink.h> | ||
| 117 | #include <crypto/authenc.h> | ||
| 118 | #include "cryptodev_int.h" | ||
| 119 | +#include "cipherapi.h" | ||
| 120 | |||
| 121 | |||
| 122 | struct cryptodev_result { | ||
| 123 | @@ -133,15 +133,15 @@ int cryptodev_cipher_init(struct cipher_ | ||
| 124 | int ret; | ||
| 125 | |||
| 126 | if (aead == 0) { | ||
| 127 | - struct ablkcipher_alg *alg; | ||
| 128 | + cryptodev_blkcipher_alg_t *alg; | ||
| 129 | |||
| 130 | - out->async.s = crypto_alloc_ablkcipher(alg_name, 0, 0); | ||
| 131 | + out->async.s = cryptodev_crypto_alloc_blkcipher(alg_name, 0, 0); | ||
| 132 | if (unlikely(IS_ERR(out->async.s))) { | ||
| 133 | ddebug(1, "Failed to load cipher %s", alg_name); | ||
| 134 | return -EINVAL; | ||
| 135 | } | ||
| 136 | |||
| 137 | - alg = crypto_ablkcipher_alg(out->async.s); | ||
| 138 | + alg = cryptodev_crypto_blkcipher_alg(out->async.s); | ||
| 139 | if (alg != NULL) { | ||
| 140 | /* Was correct key length supplied? */ | ||
| 141 | if (alg->max_keysize > 0 && | ||
| 142 | @@ -154,11 +154,11 @@ int cryptodev_cipher_init(struct cipher_ | ||
| 143 | } | ||
| 144 | } | ||
| 145 | |||
| 146 | - out->blocksize = crypto_ablkcipher_blocksize(out->async.s); | ||
| 147 | - out->ivsize = crypto_ablkcipher_ivsize(out->async.s); | ||
| 148 | - out->alignmask = crypto_ablkcipher_alignmask(out->async.s); | ||
| 149 | + out->blocksize = cryptodev_crypto_blkcipher_blocksize(out->async.s); | ||
| 150 | + out->ivsize = cryptodev_crypto_blkcipher_ivsize(out->async.s); | ||
| 151 | + out->alignmask = cryptodev_crypto_blkcipher_alignmask(out->async.s); | ||
| 152 | |||
| 153 | - ret = crypto_ablkcipher_setkey(out->async.s, keyp, keylen); | ||
| 154 | + ret = cryptodev_crypto_blkcipher_setkey(out->async.s, keyp, keylen); | ||
| 155 | } else { | ||
| 156 | out->async.as = crypto_alloc_aead(alg_name, 0, 0); | ||
| 157 | if (unlikely(IS_ERR(out->async.as))) { | ||
| 158 | @@ -191,14 +191,14 @@ int cryptodev_cipher_init(struct cipher_ | ||
| 159 | init_completion(&out->async.result->completion); | ||
| 160 | |||
| 161 | if (aead == 0) { | ||
| 162 | - out->async.request = ablkcipher_request_alloc(out->async.s, GFP_KERNEL); | ||
| 163 | + out->async.request = cryptodev_blkcipher_request_alloc(out->async.s, GFP_KERNEL); | ||
| 164 | if (unlikely(!out->async.request)) { | ||
| 165 | derr(1, "error allocating async crypto request"); | ||
| 166 | ret = -ENOMEM; | ||
| 167 | goto error; | ||
| 168 | } | ||
| 169 | |||
| 170 | - ablkcipher_request_set_callback(out->async.request, | ||
| 171 | + cryptodev_blkcipher_request_set_callback(out->async.request, | ||
| 172 | CRYPTO_TFM_REQ_MAY_BACKLOG, | ||
| 173 | cryptodev_complete, out->async.result); | ||
| 174 | } else { | ||
| 175 | @@ -218,10 +218,8 @@ int cryptodev_cipher_init(struct cipher_ | ||
| 176 | return 0; | ||
| 177 | error: | ||
| 178 | if (aead == 0) { | ||
| 179 | - if (out->async.request) | ||
| 180 | - ablkcipher_request_free(out->async.request); | ||
| 181 | - if (out->async.s) | ||
| 182 | - crypto_free_ablkcipher(out->async.s); | ||
| 183 | + cryptodev_blkcipher_request_free(out->async.request); | ||
| 184 | + cryptodev_crypto_free_blkcipher(out->async.s); | ||
| 185 | } else { | ||
| 186 | if (out->async.arequest) | ||
| 187 | aead_request_free(out->async.arequest); | ||
| 188 | @@ -237,10 +235,8 @@ void cryptodev_cipher_deinit(struct ciph | ||
| 189 | { | ||
| 190 | if (cdata->init) { | ||
| 191 | if (cdata->aead == 0) { | ||
| 192 | - if (cdata->async.request) | ||
| 193 | - ablkcipher_request_free(cdata->async.request); | ||
| 194 | - if (cdata->async.s) | ||
| 195 | - crypto_free_ablkcipher(cdata->async.s); | ||
| 196 | + cryptodev_blkcipher_request_free(cdata->async.request); | ||
| 197 | + cryptodev_crypto_free_blkcipher(cdata->async.s); | ||
| 198 | } else { | ||
| 199 | if (cdata->async.arequest) | ||
| 200 | aead_request_free(cdata->async.arequest); | ||
| 201 | @@ -289,10 +285,10 @@ ssize_t cryptodev_cipher_encrypt(struct | ||
| 202 | reinit_completion(&cdata->async.result->completion); | ||
| 203 | |||
| 204 | if (cdata->aead == 0) { | ||
| 205 | - ablkcipher_request_set_crypt(cdata->async.request, | ||
| 206 | + cryptodev_blkcipher_request_set_crypt(cdata->async.request, | ||
| 207 | (struct scatterlist *)src, dst, | ||
| 208 | len, cdata->async.iv); | ||
| 209 | - ret = crypto_ablkcipher_encrypt(cdata->async.request); | ||
| 210 | + ret = cryptodev_crypto_blkcipher_encrypt(cdata->async.request); | ||
| 211 | } else { | ||
| 212 | aead_request_set_crypt(cdata->async.arequest, | ||
| 213 | (struct scatterlist *)src, dst, | ||
| 214 | @@ -311,10 +307,10 @@ ssize_t cryptodev_cipher_decrypt(struct | ||
| 215 | |||
| 216 | reinit_completion(&cdata->async.result->completion); | ||
| 217 | if (cdata->aead == 0) { | ||
| 218 | - ablkcipher_request_set_crypt(cdata->async.request, | ||
| 219 | + cryptodev_blkcipher_request_set_crypt(cdata->async.request, | ||
| 220 | (struct scatterlist *)src, dst, | ||
| 221 | len, cdata->async.iv); | ||
| 222 | - ret = crypto_ablkcipher_decrypt(cdata->async.request); | ||
| 223 | + ret = cryptodev_crypto_blkcipher_decrypt(cdata->async.request); | ||
| 224 | } else { | ||
| 225 | aead_request_set_crypt(cdata->async.arequest, | ||
| 226 | (struct scatterlist *)src, dst, | ||
| 227 | Index: cryptodev-linux-1.8/cryptlib.h | ||
| 228 | =================================================================== | ||
| 229 | --- cryptodev-linux-1.8.orig/cryptlib.h | ||
| 230 | +++ cryptodev-linux-1.8/cryptlib.h | ||
| 231 | @@ -3,6 +3,8 @@ | ||
| 232 | |||
| 233 | #include <linux/version.h> | ||
| 234 | |||
| 235 | +#include "cipherapi.h" | ||
| 236 | + | ||
| 237 | struct cipher_data { | ||
| 238 | int init; /* 0 uninitialized */ | ||
| 239 | int blocksize; | ||
| 240 | @@ -12,8 +14,8 @@ struct cipher_data { | ||
| 241 | int alignmask; | ||
| 242 | struct { | ||
| 243 | /* block ciphers */ | ||
| 244 | - struct crypto_ablkcipher *s; | ||
| 245 | - struct ablkcipher_request *request; | ||
| 246 | + cryptodev_crypto_blkcipher_t *s; | ||
| 247 | + cryptodev_blkcipher_request_t *request; | ||
| 248 | |||
| 249 | /* AEAD ciphers */ | ||
| 250 | struct crypto_aead *as; | ||
| 251 | Index: cryptodev-linux-1.8/ioctl.c | ||
| 252 | =================================================================== | ||
| 253 | --- cryptodev-linux-1.8.orig/ioctl.c | ||
| 254 | +++ cryptodev-linux-1.8/ioctl.c | ||
| 255 | @@ -34,7 +34,6 @@ | ||
| 256 | */ | ||
| 257 | |||
| 258 | #include <crypto/hash.h> | ||
| 259 | -#include <linux/crypto.h> | ||
| 260 | #include <linux/mm.h> | ||
| 261 | #include <linux/highmem.h> | ||
| 262 | #include <linux/ioctl.h> | ||
| 263 | @@ -53,6 +52,7 @@ | ||
| 264 | #include "cryptodev_int.h" | ||
| 265 | #include "zc.h" | ||
| 266 | #include "version.h" | ||
| 267 | +#include "cipherapi.h" | ||
| 268 | |||
| 269 | MODULE_AUTHOR("Nikos Mavrogiannopoulos <nmav@gnutls.org>"); | ||
| 270 | MODULE_DESCRIPTION("CryptoDev driver"); | ||
| 271 | @@ -765,7 +765,7 @@ static int get_session_info(struct fcryp | ||
| 272 | |||
| 273 | if (ses_ptr->cdata.init) { | ||
| 274 | if (ses_ptr->cdata.aead == 0) | ||
| 275 | - tfm = crypto_ablkcipher_tfm(ses_ptr->cdata.async.s); | ||
| 276 | + tfm = cryptodev_crypto_blkcipher_tfm(ses_ptr->cdata.async.s); | ||
| 277 | else | ||
| 278 | tfm = crypto_aead_tfm(ses_ptr->cdata.async.as); | ||
| 279 | tfm_info_to_alg_info(&siop->cipher_info, tfm); | ||
diff --git a/meta/recipes-kernel/cryptodev/files/kernel-4-10-changes.patch b/meta/recipes-kernel/cryptodev/files/kernel-4-10-changes.patch deleted file mode 100644 index 93d608b81d..0000000000 --- a/meta/recipes-kernel/cryptodev/files/kernel-4-10-changes.patch +++ /dev/null | |||
| @@ -1,57 +0,0 @@ | |||
| 1 | Upstream-Status: Backport | ||
| 2 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
| 3 | |||
| 4 | From 2b29be8ac41414ed19cb4f5d5626d9bd0d7b11a8 Mon Sep 17 00:00:00 2001 | ||
| 5 | From: Cristian Stoica <cristian.stoica@nxp.com> | ||
| 6 | Date: Wed, 8 Feb 2017 12:11:04 +0200 | ||
| 7 | Subject: [PATCH] adjust to API changes in kernel >=4.10 | ||
| 8 | |||
| 9 | There are many changes related to get_user_pages and the code is rewritten | ||
| 10 | for clarity. | ||
| 11 | |||
| 12 | Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com> | ||
| 13 | --- | ||
| 14 | zc.c | 28 +++++++++++++++++----------- | ||
| 15 | 1 file changed, 17 insertions(+), 11 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/zc.c b/zc.c | ||
| 18 | index e766ee3..2f4ea99 100644 | ||
| 19 | --- a/zc.c | ||
| 20 | +++ b/zc.c | ||
| 21 | @@ -59,19 +59,25 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, | ||
| 22 | } | ||
| 23 | |||
| 24 | down_read(&mm->mmap_sem); | ||
| 25 | -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)) | ||
| 26 | - ret = get_user_pages_remote( | ||
| 27 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)) | ||
| 28 | + ret = get_user_pages(task, mm, | ||
| 29 | + (unsigned long)addr, pgcount, write, 0, pg, NULL); | ||
| 30 | #else | ||
| 31 | - ret = get_user_pages( | ||
| 32 | -#endif | ||
| 33 | - task, mm, | ||
| 34 | - (unsigned long)addr, pgcount, | ||
| 35 | -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) | ||
| 36 | - write ? FOLL_WRITE : 0, | ||
| 37 | -#else | ||
| 38 | - write, 0, | ||
| 39 | -#endif | ||
| 40 | +# if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)) | ||
| 41 | + ret = get_user_pages_remote(task, mm, | ||
| 42 | + (unsigned long)addr, pgcount, write, 0, pg, NULL); | ||
| 43 | +# else | ||
| 44 | +# if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)) | ||
| 45 | + ret = get_user_pages_remote(task, mm, | ||
| 46 | + (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, | ||
| 47 | pg, NULL); | ||
| 48 | +# else | ||
| 49 | + ret = get_user_pages_remote(task, mm, | ||
| 50 | + (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, | ||
| 51 | + pg, NULL, NULL); | ||
| 52 | +# endif | ||
| 53 | +# endif | ||
| 54 | +#endif | ||
| 55 | up_read(&mm->mmap_sem); | ||
| 56 | if (ret != pgcount) | ||
| 57 | return -EINVAL; | ||
