1 From e791b55b03d295ee11476382a7bd93ab131e2e52 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 9/9] Fixed compilation error of openssl with fsl cryptodev
 
   6 Upstream-status: Pending
 
   8 Signed-off-by: Yashpal Dutta <yashpal.dutta@freescale.com>
 
   9 Tested-by: Cristian Stoica <cristian.stoica@freescale.com>
 
  12  cryptlib.c         | 9 ++++-----
 
  13  crypto/cryptodev.h | 9 ++++++++-
 
  14  cryptodev_int.h    | 2 +-
 
  17  6 files changed, 21 insertions(+), 9 deletions(-)
 
  19 diff --git a/authenc.c b/authenc.c
 
  20 index ef0d3db..2aa4d38 100644
 
  24   * Driver for /dev/crypto device (aka CryptoDev)
 
  26   * Copyright (c) 2011, 2012 OpenSSL Software Foundation, Inc.
 
  27 + * Copyright (c) 2014 Freescale Semiconductor, Inc.
 
  29   * Author: Nikos Mavrogiannopoulos
 
  31 diff --git a/cryptlib.c b/cryptlib.c
 
  32 index 4dd1847..ec6693e 100644
 
  36   * Copyright (c) 2010,2011 Nikos Mavrogiannopoulos <nmav@gnutls.org>
 
  37   * Portions Copyright (c) 2010 Michael Weiser
 
  38   * Portions Copyright (c) 2010 Phil Sutter
 
  40 - * Copyright 2012 Freescale Semiconductor, Inc.
 
  41 + * Copyright 2012-2014 Freescale Semiconductor, Inc.
 
  43   * This file is part of linux cryptodev.
 
  45 @@ -144,7 +143,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
 
  46                         if (alg->max_keysize > 0 &&
 
  47                                         unlikely((keylen < alg->min_keysize) ||
 
  48                                         (keylen > alg->max_keysize))) {
 
  49 -                               ddebug(1, "Wrong keylen '%zu' for algorithm '%s'. Use %u to %u.",
 
  50 +                               ddebug(1, "Wrong keylen '%u' for algorithm '%s'. Use %u to %u.",
 
  51                                                 keylen, alg_name, alg->min_keysize, alg->max_keysize);
 
  54 @@ -171,7 +170,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
 
  58 -               ddebug(1, "Setting key failed for %s-%zu.", alg_name, keylen*8);
 
  59 +               ddebug(1, "Setting key failed for %s-%u.", alg_name, keylen*8);
 
  63 @@ -338,7 +337,7 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
 
  65                 ret = crypto_ahash_setkey(hdata->async.s, mackey, mackeylen);
 
  67 -                       ddebug(1, "Setting hmac key failed for %s-%zu.",
 
  68 +                       ddebug(1, "Setting hmac key failed for %s-%u.",
 
  69                                         alg_name, mackeylen*8);
 
  72 diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h
 
  73 index d0cc542..e7edd97 100644
 
  74 --- a/crypto/cryptodev.h
 
  75 +++ b/crypto/cryptodev.h
 
  76 @@ -234,6 +234,13 @@ struct crypt_auth_op {
 
  77  #define        CRYPTO_ALG_FLAG_RNG_ENABLE      2
 
  78  #define        CRYPTO_ALG_FLAG_DSA_SHA         4
 
  90 @@ -249,7 +256,7 @@ struct crypt_kop {
 
  93         struct crparam  crk_param[CRK_MAXPARAM];
 
  94 -       enum curve_t curve_type; /* 0 == Discrete Log,
 
  95 +       enum ec_curve_t curve_type; /* 0 == Discrete Log,
 
  96                                 1 = EC_PRIME, 2 = EC_BINARY */
 
  99 diff --git a/cryptodev_int.h b/cryptodev_int.h
 
 100 index 5347cae..c83c885 100644
 
 101 --- a/cryptodev_int.h
 
 102 +++ b/cryptodev_int.h
 
 103 @@ -88,7 +88,7 @@ struct compat_crypt_kop {
 
 104         uint16_t        crk_oparams;
 
 106         struct compat_crparam   crk_param[CRK_MAXPARAM];
 
 107 -       enum curve_t curve_type; /* 0 == Discrete Log, 1 = EC_PRIME,
 
 108 +       enum ec_curve_t curve_type; /* 0 == Discrete Log, 1 = EC_PRIME,
 
 110         compat_uptr_t cookie;
 
 112 diff --git a/ioctl.c b/ioctl.c
 
 113 index 14888d6..20ab4ca 100644
 
 117   * Copyright (c) 2004 Michal Ludvig <mludvig@logix.net.nz>, SuSE Labs
 
 118   * Copyright (c) 2009,2010,2011 Nikos Mavrogiannopoulos <nmav@gnutls.org>
 
 119   * Copyright (c) 2010 Phil Sutter
 
 120 - * Copyright 2012 Freescale Semiconductor, Inc.
 
 121 + * Copyright 2012-2014 Freescale Semiconductor, Inc.
 
 123   * This file is part of linux cryptodev.
 
 125 @@ -501,6 +501,7 @@ cryptodev_open(struct inode *inode, struct file *filp)
 
 126         INIT_LIST_HEAD(&pcr->done.list);
 
 127         INIT_LIST_HEAD(&pcr->asym_completed_list);
 
 128         spin_lock_init(&pcr->completion_lock);
 
 130         INIT_WORK(&pcr->cryptask, cryptask_routine);
 
 132         init_waitqueue_head(&pcr->user_waiter);
 
 133 @@ -780,8 +781,11 @@ static int fill_kcop_from_cop(struct kernel_crypt_op *kcop, struct fcrypt *fcr)
 
 136                 rc = copy_from_user(kcop->iv, cop->iv, kcop->ivlen);
 
 138 +               if (unlikely(rc)) {
 
 139 +                       derr(1, "error copying IV (%d bytes), copy_from_user returned %d for address %p",
 
 140 +                                       kcop->ivlen, rc, cop->iv);
 
 146 diff --git a/main.c b/main.c
 
 147 index 14dcf40..6365911 100644
 
 152   * Copyright (c) 2004 Michal Ludvig <mludvig@logix.net.nz>, SuSE Labs
 
 153   * Copyright (c) 2009-2013 Nikos Mavrogiannopoulos <nmav@gnutls.org>
 
 154 + * Copyright (c) 2014 Freescale Semiconductor, Inc.
 
 156   * This file is part of linux cryptodev.