diff mbox

[3/5] linux-generic: crypto: fix crypto_alg_err enum return values

Message ID 1423051213-20795-4-git-send-email-taras.kondratiuk@linaro.org
State New
Headers show

Commit Message

Taras Kondratiuk Feb. 4, 2015, noon UTC
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
 platform/linux-generic/odp_crypto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Maxim Uvarov Feb. 17, 2015, 9:30 p.m. UTC | #1
Robbie, Alex, please review that patch.

Maxim.

On 02/04/2015 03:00 PM, Taras Kondratiuk wrote:
> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
> ---
>   platform/linux-generic/odp_crypto.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
> index 46766fa..fa7d51f 100644
> --- a/platform/linux-generic/odp_crypto.c
> +++ b/platform/linux-generic/odp_crypto.c
> @@ -160,7 +160,7 @@ enum crypto_alg_err des_encrypt(odp_crypto_op_params_t *params,
>   	else if (session->cipher.iv.data)
>   		iv_ptr = session->cipher.iv.data;
>   	else
> -		return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
> +		return ODP_CRYPTO_ALG_ERR_KEY_SIZE;
>   
>   	/*
>   	 * Create a copy of the IV.  The DES library modifies IV
> @@ -198,7 +198,7 @@ enum crypto_alg_err des_decrypt(odp_crypto_op_params_t *params,
>   	else if (session->cipher.iv.data)
>   		iv_ptr = session->cipher.iv.data;
>   	else
> -		return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
> +		return ODP_CRYPTO_ALG_ERR_KEY_SIZE;
>   
>   	/*
>   	 * Create a copy of the IV.  The DES library modifies IV
Mike Holmes Feb. 20, 2015, 4:53 p.m. UTC | #2
This issue is a blocker for ODP 1.0 being able to be compiled by clang,
what is the way forward ?

odp_crypto.c:164:10: error: implicit conversion from enumeration type 'enum
      odp_crypto_ses_create_err' to different enumeration type
      'enum crypto_alg_err' [-Werror,-Wenum-conversion]
                return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;


Mike

On 17 February 2015 at 16:47, Robbie King (robking) <robking@cisco.com>
wrote:

> I believe the correct fix should be to add a new error code,
> ODP_CRYPTO_ALG_ERR_KEY_SIZE is not appropriate for the detected
> error.  Please add the following to crypto_alg_err and return it
> instead.  This would happen when the session is created without
> specifying an IV value, and then on a per packet basis it is not
> passing the IV value either (using override_iv_ptr).
>
> ODP_CRYPTO_ALG_ERR_IV_INVALID  /**< IV value not specified */
>
> -----Original Message-----
> From: Maxim Uvarov [mailto:maxim.uvarov@linaro.org]
> Sent: Tuesday, February 17, 2015 4:30 PM
> To: lng-odp@lists.linaro.org
> Cc: Robbie King (robking); Alexandru Badicioiu; Maxim Uvarov
> Subject: Re: [lng-odp] [PATCH 3/5] linux-generic: crypto: fix
> crypto_alg_err enum return values
>
> Robbie, Alex, please review that patch.
>
> Maxim.
>
> On 02/04/2015 03:00 PM, Taras Kondratiuk wrote:
> > Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
> > ---
> >   platform/linux-generic/odp_crypto.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/platform/linux-generic/odp_crypto.c
> b/platform/linux-generic/odp_crypto.c
> > index 46766fa..fa7d51f 100644
> > --- a/platform/linux-generic/odp_crypto.c
> > +++ b/platform/linux-generic/odp_crypto.c
> > @@ -160,7 +160,7 @@ enum crypto_alg_err
> des_encrypt(odp_crypto_op_params_t *params,
> >       else if (session->cipher.iv.data)
> >               iv_ptr = session->cipher.iv.data;
> >       else
> > -             return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
> > +             return ODP_CRYPTO_ALG_ERR_KEY_SIZE;
> >
> >       /*
> >        * Create a copy of the IV.  The DES library modifies IV
> > @@ -198,7 +198,7 @@ enum crypto_alg_err
> des_decrypt(odp_crypto_op_params_t *params,
> >       else if (session->cipher.iv.data)
> >               iv_ptr = session->cipher.iv.data;
> >       else
> > -             return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
> > +             return ODP_CRYPTO_ALG_ERR_KEY_SIZE;
> >
> >       /*
> >        * Create a copy of the IV.  The DES library modifies IV
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Mike Holmes Feb. 20, 2015, 5:23 p.m. UTC | #3
I don't think so, which is why I prodded the thread, I hopped Taras might
have the bandwidth, for a re-spin :)
I think other patches in this series are good to go though, just reviewing
them now.

On 20 February 2015 at 12:11, Robbie King (robking) <robking@cisco.com>
wrote:

>  Sorry, did a new patch set with my recommended change come out and I
> missed it?
>
>
>
> *From:* Mike Holmes [mailto:mike.holmes@linaro.org]
> *Sent:* Friday, February 20, 2015 11:54 AM
> *To:* Robbie King (robking)
> *Cc:* Maxim Uvarov; lng-odp@lists.linaro.org
>
> *Subject:* Re: [lng-odp] [PATCH 3/5] linux-generic: crypto: fix
> crypto_alg_err enum return values
>
>
>
> This issue is a blocker for ODP 1.0 being able to be compiled by clang,
> what is the way forward ?
>
>
>
> odp_crypto.c:164:10: error: implicit conversion from enumeration type 'enum
>
>       odp_crypto_ses_create_err' to different enumeration type
>
>       'enum crypto_alg_err' [-Werror,-Wenum-conversion]
>
>                 return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
>
>
>
>
>
> Mike
>
>
>
> On 17 February 2015 at 16:47, Robbie King (robking) <robking@cisco.com>
> wrote:
>
> I believe the correct fix should be to add a new error code,
> ODP_CRYPTO_ALG_ERR_KEY_SIZE is not appropriate for the detected
> error.  Please add the following to crypto_alg_err and return it
> instead.  This would happen when the session is created without
> specifying an IV value, and then on a per packet basis it is not
> passing the IV value either (using override_iv_ptr).
>
> ODP_CRYPTO_ALG_ERR_IV_INVALID  /**< IV value not specified */
>
>
> -----Original Message-----
> From: Maxim Uvarov [mailto:maxim.uvarov@linaro.org]
> Sent: Tuesday, February 17, 2015 4:30 PM
> To: lng-odp@lists.linaro.org
> Cc: Robbie King (robking); Alexandru Badicioiu; Maxim Uvarov
> Subject: Re: [lng-odp] [PATCH 3/5] linux-generic: crypto: fix
> crypto_alg_err enum return values
>
> Robbie, Alex, please review that patch.
>
> Maxim.
>
> On 02/04/2015 03:00 PM, Taras Kondratiuk wrote:
> > Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
> > ---
> >   platform/linux-generic/odp_crypto.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/platform/linux-generic/odp_crypto.c
> b/platform/linux-generic/odp_crypto.c
> > index 46766fa..fa7d51f 100644
> > --- a/platform/linux-generic/odp_crypto.c
> > +++ b/platform/linux-generic/odp_crypto.c
> > @@ -160,7 +160,7 @@ enum crypto_alg_err
> des_encrypt(odp_crypto_op_params_t *params,
> >       else if (session->cipher.iv.data)
> >               iv_ptr = session->cipher.iv.data;
> >       else
> > -             return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
> > +             return ODP_CRYPTO_ALG_ERR_KEY_SIZE;
> >
> >       /*
> >        * Create a copy of the IV.  The DES library modifies IV
> > @@ -198,7 +198,7 @@ enum crypto_alg_err
> des_decrypt(odp_crypto_op_params_t *params,
> >       else if (session->cipher.iv.data)
> >               iv_ptr = session->cipher.iv.data;
> >       else
> > -             return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
> > +             return ODP_CRYPTO_ALG_ERR_KEY_SIZE;
> >
> >       /*
> >        * Create a copy of the IV.  The DES library modifies IV
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
>
> --
>
> *Mike Holmes*
>
> Linaro  Sr Technical Manager
>
> LNG - ODP
>
diff mbox

Patch

diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 46766fa..fa7d51f 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -160,7 +160,7 @@  enum crypto_alg_err des_encrypt(odp_crypto_op_params_t *params,
 	else if (session->cipher.iv.data)
 		iv_ptr = session->cipher.iv.data;
 	else
-		return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
+		return ODP_CRYPTO_ALG_ERR_KEY_SIZE;
 
 	/*
 	 * Create a copy of the IV.  The DES library modifies IV
@@ -198,7 +198,7 @@  enum crypto_alg_err des_decrypt(odp_crypto_op_params_t *params,
 	else if (session->cipher.iv.data)
 		iv_ptr = session->cipher.iv.data;
 	else
-		return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
+		return ODP_CRYPTO_ALG_ERR_KEY_SIZE;
 
 	/*
 	 * Create a copy of the IV.  The DES library modifies IV