]> code.ossystems Code Review - meta-freescale.git/blob
d5cc7f042e985b2b1772fcd6bcef4c70af1ff958
[meta-freescale.git] /
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
5  cryptodev
6
7 Upstream-status: Pending
8
9 Signed-off-by: Yashpal Dutta <yashpal.dutta@freescale.com>
10 Tested-by: Cristian Stoica <cristian.stoica@freescale.com>
11 ---
12  cryptlib.c         |    6 +++---
13  crypto/cryptodev.h |    9 ++++++++-
14  cryptodev_int.h    |    2 +-
15  ioctl.c            |    6 +++++-
16  4 files changed, 17 insertions(+), 6 deletions(-)
17
18 diff --git a/cryptlib.c b/cryptlib.c
19 index 89af77a..1fc03e5 100644
20 --- a/cryptlib.c
21 +++ b/cryptlib.c
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);
29                                 ret = -EINVAL;
30                                 goto error;
31 @@ -156,7 +156,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
32         }
33  
34         if (unlikely(ret)) {
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);
37                 ret = -EINVAL;
38                 goto error;
39         }
40 @@ -323,7 +323,7 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
41         if (hmac_mode != 0) {
42                 ret = crypto_ahash_setkey(hdata->async.s, mackey, mackeylen);
43                 if (unlikely(ret)) {
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);
47                         ret = -EINVAL;
48                         goto error;
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
56  
57 +enum ec_curve_t {
58 +       EC_DISCRETE_LOG,
59 +       EC_PRIME,
60 +       EC_BINARY,
61 +       MAX_EC_TYPE
62 +};
63 +
64  struct crparam {
65         __u8    *crp_p;
66         __u32   crp_nbits;
67 @@ -250,7 +257,7 @@ struct crypt_kop {
68         __u16   crk_oparams;
69         __u32   crk_pad1;
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 */
74         void *cookie;
75  };
76 diff --git a/cryptodev_int.h b/cryptodev_int.h
77 index 7ea6976..e379eaf 100644
78 --- a/cryptodev_int.h
79 +++ b/cryptodev_int.h
80 @@ -88,7 +88,7 @@ struct compat_crypt_kop {
81         uint16_t        crk_oparams;
82         uint32_t        crk_pad1;
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,
86                                  2 = EC_BINARY */
87         compat_uptr_t cookie;
88  };
89 diff --git a/ioctl.c b/ioctl.c
90 index 0344c0c..66cb05a 100644
91 --- a/ioctl.c
92 +++ b/ioctl.c
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);
97 +
98         INIT_WORK(&pcr->cryptask, cryptask_routine);
99  
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)
102  
103         if (cop->iv) {
104                 rc = copy_from_user(kcop->iv, cop->iv, kcop->ivlen);
105 -               if (unlikely(rc))
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);
109                         return -EFAULT;
110 +               }
111         }
112  
113         return 0;
114 -- 
115 1.7.9.7
116