2019-12-30 10:11:19

by R W van Schagen

[permalink] [raw]
Subject: Internal crypto test fail: changed 'req->iv'

I am writing a module for the EIP93 crypto engine. From what I have
been reading on this mailing list, the driver should return the updated
IV in order for the caller to “resume” or “continue” with this IV in
another call.

A code-snippet:

int ivsize = crypto_skcipher_ivsize(skcipher);

If (ivsize)
memcpy(req->iv, rctx->lastiv, ivsize);

Where rctx->lastiv was read from the hardware itself.

The fail message I am getting is:
[ 57.290000] alg: skcipher: changed 'req->iv'
[ 57.370000] alg: skcipher: eip93-cbc-aes encryption co
rrupted request struct on test vector 0, cfg="in-place"
[ 57.380000] alg: skcipher: changed 'req->iv'
[ 57.460000] alg: skcipher: eip93-ctr-aes encryption corrupted
request struct on test vector 0, cfg="in-place"
[ 57.470000] alg: skcipher: changed 'req->iv'
[ 57.560000] alg: skcipher: eip93-rfc3686(ctr)-aes encryption
corrupted request struct on test vector 0, cfg="in-place"
[ 57.570000] alg: skcipher: changed 'req->iv’

Where/How should I return the new/updated IV ?

Thanks,

Richard van Schagen


2019-12-30 15:12:36

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: Internal crypto test fail: changed 'req->iv'

On Mon, 30 Dec 2019 at 11:10, Richard van Schagen <[email protected]> wrote:
>
> I am writing a module for the EIP93 crypto engine. From what I have
> been reading on this mailing list, the driver should return the updated
> IV in order for the caller to “resume” or “continue” with this IV in
> another call.
>
> A code-snippet:
>
> int ivsize = crypto_skcipher_ivsize(skcipher);
>
> If (ivsize)
> memcpy(req->iv, rctx->lastiv, ivsize);
>
> Where rctx->lastiv was read from the hardware itself.
>
> The fail message I am getting is:
> [ 57.290000] alg: skcipher: changed 'req->iv'
> [ 57.370000] alg: skcipher: eip93-cbc-aes encryption co
> rrupted request struct on test vector 0, cfg="in-place"
> [ 57.380000] alg: skcipher: changed 'req->iv'
> [ 57.460000] alg: skcipher: eip93-ctr-aes encryption corrupted
> request struct on test vector 0, cfg="in-place"
> [ 57.470000] alg: skcipher: changed 'req->iv'
> [ 57.560000] alg: skcipher: eip93-rfc3686(ctr)-aes encryption
> corrupted request struct on test vector 0, cfg="in-place"
> [ 57.570000] alg: skcipher: changed 'req->iv’
>
> Where/How should I return the new/updated IV ?
>

Are you sure you are not making req->iv point to a different buffer?