[linux-yocto] [PATCH 1/2] cryptodev: fix compile error when enable CONFIG_CRYPTODEV
Song liwei
liwei.song at windriver.com
Sun Nov 6 18:52:43 PST 2016
From: Liwei Song <liwei.song at windriver.com>
Fix the following compile error:
error: implicit declaration of function 'aead_request_set_assoc'
error: implicit declaration of function 'crypto_alloc_ablkcipher'
error: too many arguments to function ‘get_user_pages’
error: implicit declaration of function ‘page_cache_release’
error: implicit declaration of function ‘get_unused_fd’
This is due to the old function was used in cryptodev driver,
as the kernel updated, the function in cryptodev was not touched.
To fix this, use the new version of function instead of the
old ones.
Signed-off-by: Liwei Song <liwei.song at windriver.com>
---
drivers/staging/crypto/cryptodev/cryptlib.c | 5 ++++-
drivers/staging/crypto/cryptodev/cryptlib.h | 2 +-
drivers/staging/crypto/cryptodev/ioctl.c | 2 +-
drivers/staging/crypto/cryptodev/zc.c | 5 ++---
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/crypto/cryptodev/cryptlib.c b/drivers/staging/crypto/cryptodev/cryptlib.c
index 44ce763..b68f460 100644
--- a/drivers/staging/crypto/cryptodev/cryptlib.c
+++ b/drivers/staging/crypto/cryptodev/cryptlib.c
@@ -36,6 +36,7 @@
#include <crypto/aead.h>
#include <linux/rtnetlink.h>
#include <crypto/authenc.h>
+#include <crypto/skcipher.h>
#include "cryptodev_int.h"
@@ -131,11 +132,13 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
uint8_t *keyp, size_t keylen, int stream, int aead)
{
int ret;
+ struct crypto_skcipher *tfm;
if (aead == 0) {
struct ablkcipher_alg *alg;
- out->async.s = crypto_alloc_ablkcipher(alg_name, 0, 0);
+ tfm = crypto_alloc_skcipher(alg_name, 0, 0);
+ out->async.s->base = tfm->base;
if (unlikely(IS_ERR(out->async.s))) {
ddebug(1, "Failed to load cipher %s", alg_name);
return -EINVAL;
diff --git a/drivers/staging/crypto/cryptodev/cryptlib.h b/drivers/staging/crypto/cryptodev/cryptlib.h
index a0a8a63..0c20092 100644
--- a/drivers/staging/crypto/cryptodev/cryptlib.h
+++ b/drivers/staging/crypto/cryptodev/cryptlib.h
@@ -40,7 +40,7 @@ static inline void cryptodev_cipher_auth(struct cipher_data *cdata,
struct scatterlist *sg1, size_t len)
{
/* for some reason we _have_ to call that even for zero length sgs */
- aead_request_set_assoc(cdata->async.arequest, len ? sg1 : NULL, len);
+ aead_request_set_ad(cdata->async.arequest, len);
}
static inline void cryptodev_cipher_set_tag_size(struct cipher_data *cdata, int size)
diff --git a/drivers/staging/crypto/cryptodev/ioctl.c b/drivers/staging/crypto/cryptodev/ioctl.c
index 5a55a76..b23f5fd 100644
--- a/drivers/staging/crypto/cryptodev/ioctl.c
+++ b/drivers/staging/crypto/cryptodev/ioctl.c
@@ -546,7 +546,7 @@ static int
clonefd(struct file *filp)
{
int ret;
- ret = get_unused_fd();
+ ret = get_unused_fd_flags(0);
if (ret >= 0) {
get_file(filp);
fd_install(ret, filp);
diff --git a/drivers/staging/crypto/cryptodev/zc.c b/drivers/staging/crypto/cryptodev/zc.c
index 29b0501..3266e7d 100644
--- a/drivers/staging/crypto/cryptodev/zc.c
+++ b/drivers/staging/crypto/cryptodev/zc.c
@@ -59,8 +59,7 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write,
}
down_read(&mm->mmap_sem);
- ret = get_user_pages(task, mm,
- (unsigned long)addr, pgcount, write, 0, pg, NULL);
+ ret = get_user_pages((unsigned long)addr, pgcount, write, 0, pg, NULL);
up_read(&mm->mmap_sem);
if (ret != pgcount)
return -EINVAL;
@@ -119,7 +118,7 @@ void release_user_pages(struct csession *ses)
else
ses->readonly_pages--;
- page_cache_release(ses->pages[i]);
+ put_page(ses->pages[i]);
}
ses->used_pages = 0;
}
--
2.9.3
More information about the linux-yocto
mailing list