1 From 2215332bff6034d0e22e92e8fda0993f2579a740 Mon Sep 17 00:00:00 2001
2 From: Yashpal Dutta <yashpal.dutta@freescale.com>
3 Date: Thu, 17 Apr 2014 07:08:47 +0545
4 Subject: [[Patch][fsl 16/16] Fixed compilation error of openssl with fsl
7 Upstream-status: Pending
9 Signed-off-by: Yashpal Dutta <yashpal.dutta@freescale.com>
10 Tested-by: Cristian Stoica <cristian.stoica@freescale.com>
13 crypto/cryptodev.h | 9 ++++++++-
14 cryptodev_int.h | 2 +-
16 4 files changed, 17 insertions(+), 6 deletions(-)
18 diff --git a/cryptlib.c b/cryptlib.c
19 index 89af77a..1fc03e5 100644
22 @@ -129,7 +129,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
23 if (alg->max_keysize > 0 &&
24 unlikely((keylen < alg->min_keysize) ||
25 (keylen > alg->max_keysize))) {
26 - ddebug(1, "Wrong keylen '%zu' for algorithm '%s'. Use %u to %u.",
27 + ddebug(1, "Wrong keylen '%u' for algorithm '%s'. Use %u to %u.",
28 keylen, alg_name, alg->min_keysize, alg->max_keysize);
31 @@ -156,7 +156,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
35 - ddebug(1, "Setting key failed for %s-%zu.", alg_name, keylen*8);
36 + ddebug(1, "Setting key failed for %s-%u.", alg_name, keylen*8);
40 @@ -323,7 +323,7 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
42 ret = crypto_ahash_setkey(hdata->async.s, mackey, mackeylen);
44 - ddebug(1, "Setting hmac key failed for %s-%zu.",
45 + ddebug(1, "Setting hmac key failed for %s-%u.",
46 alg_name, mackeylen*8);
49 diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h
50 index 7990f27..77bffc9 100644
51 --- a/crypto/cryptodev.h
52 +++ b/crypto/cryptodev.h
53 @@ -235,6 +235,13 @@ struct crypt_auth_op {
54 #define CRYPTO_ALG_FLAG_RNG_ENABLE 2
55 #define CRYPTO_ALG_FLAG_DSA_SHA 4
67 @@ -250,7 +257,7 @@ struct crypt_kop {
70 struct crparam crk_param[CRK_MAXPARAM];
71 - enum curve_t curve_type; /* 0 == Discrete Log,
72 + enum ec_curve_t curve_type; /* 0 == Discrete Log,
73 1 = EC_PRIME, 2 = EC_BINARY */
76 diff --git a/cryptodev_int.h b/cryptodev_int.h
77 index 7ea6976..e379eaf 100644
80 @@ -88,7 +88,7 @@ struct compat_crypt_kop {
83 struct compat_crparam crk_param[CRK_MAXPARAM];
84 - enum curve_t curve_type; /* 0 == Discrete Log, 1 = EC_PRIME,
85 + enum ec_curve_t curve_type; /* 0 == Discrete Log, 1 = EC_PRIME,
89 diff --git a/ioctl.c b/ioctl.c
90 index 0344c0c..66cb05a 100644
93 @@ -498,6 +498,7 @@ cryptodev_open(struct inode *inode, struct file *filp)
94 INIT_LIST_HEAD(&pcr->done.list);
95 INIT_LIST_HEAD(&pcr->asym_completed_list);
96 spin_lock_init(&pcr->completion_lock);
98 INIT_WORK(&pcr->cryptask, cryptask_routine);
100 init_waitqueue_head(&pcr->user_waiter);
101 @@ -777,8 +778,11 @@ static int fill_kcop_from_cop(struct kernel_crypt_op *kcop, struct fcrypt *fcr)
104 rc = copy_from_user(kcop->iv, cop->iv, kcop->ivlen);
106 + if (unlikely(rc)) {
107 + derr(1, "error copying IV (%d bytes), copy_from_user returned %d for address %p",
108 + kcop->ivlen, rc, cop->iv);