On 20 November 2014 04:13, Anders Roxell <[email protected]> wrote:

> On 2014-11-19 12:27, [email protected] wrote:
> > From: Alexandru Badicioiu <[email protected]>
> >
> > NULL session IV prevents using per operation IV (override_iv_ptr).
> > This fixes *_OVR_IV cunit tests segfaults.
> >
> > Signed-off-by: Alexandru Badicioiu <[email protected]>
>
> Reviewed-and-Tested-by: Anders Roxell <[email protected]>
>
 Reviewed-and-Tested-by:: Mike Holmes <[email protected]>

This does fix the crypto test sag fault found with the v8 crypto test patch.


> > ---
> >  platform/linux-generic/odp_crypto.c |   16 +++++++++-------
> >  1 files changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/platform/linux-generic/odp_crypto.c
> b/platform/linux-generic/odp_crypto.c
> > index 596c717..9ca2251 100644
> > --- a/platform/linux-generic/odp_crypto.c
> > +++ b/platform/linux-generic/odp_crypto.c
> > @@ -147,7 +147,7 @@ enum crypto_alg_err
> des_encrypt(odp_crypto_op_params_t *params,
> >  {
> >       uint8_t *data  = odp_packet_addr(params->out_pkt);
> >       uint32_t len   = params->cipher_range.length;
> > -     DES_cblock *iv;
> > +     DES_cblock *iv = NULL;
> >       DES_cblock iv_temp;
> >
> >       /*
> > @@ -155,8 +155,10 @@ enum crypto_alg_err
> des_encrypt(odp_crypto_op_params_t *params,
> >        * and if we are processing packets on parallel threads
> >        * we could get corruption.
> >        */
> > -     memcpy(iv_temp, session->cipher.iv.data, sizeof(iv_temp));
> > -     iv = &iv_temp;
> > +     if (session->cipher.iv.data) {
> > +             memcpy(iv_temp, session->cipher.iv.data, sizeof(iv_temp));
> > +             iv = &iv_temp;
> > +     }
> >
> >       /* Adjust pointer for beginning of area to cipher */
> >       data += params->cipher_range.offset;
> > @@ -165,6 +167,10 @@ enum crypto_alg_err
> des_encrypt(odp_crypto_op_params_t *params,
> >       if (params->override_iv_ptr)
> >               iv = (DES_cblock *)params->override_iv_ptr;
> >
> > +     /* No session or operation IV */
> > +     if (!iv)
> > +             return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
> > +
> >       /* Encrypt it */
> >       DES_ede3_cbc_encrypt(data,
> >                            data,
> > @@ -214,10 +220,6 @@ int process_des_params(odp_crypto_generic_session_t
> *session,
> >       if (!((0 == params->iv.length) || (8 == params->iv.length)))
> >               return -1;
> >
> > -     /* Verify IV pointer */
> > -     if (params->iv.length && !params->iv.data)
> > -             return -1;
> > -
> >       /* Set function */
> >       if (ODP_CRYPTO_OP_ENCODE == params->op)
> >               session->cipher.func = des_encrypt;
> > --
> > 1.7.3.4
> >
> >
> > _______________________________________________
> > lng-odp mailing list
> > [email protected]
> > http://lists.linaro.org/mailman/listinfo/lng-odp
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> http://lists.linaro.org/mailman/listinfo/lng-odp
>



-- 
*Mike Holmes*
Linaro  Sr Technical Manager
LNG - ODP
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to