lkml.org 
[lkml]   [2020]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 07/12] crypto: caam/jr - add xts check for block length equal to zero
    Date
    From: Andrei Botila <andrei.botila@nxp.com>

    XTS should not return succes when dealing with block length equal to zero.
    This is different than the rest of the skcipher algorithms.

    Fixes: 31bb2f0da1b50 ("crypto: caam - check zero-length input")
    Cc: <stable@vger.kernel.org> # v5.4+
    Signed-off-by: Andrei Botila <andrei.botila@nxp.com>
    ---
    drivers/crypto/caam/caamalg.c | 7 ++++++-
    1 file changed, 6 insertions(+), 1 deletion(-)

    diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
    index ba70db61a76d..b5f8823e4300 100644
    --- a/drivers/crypto/caam/caamalg.c
    +++ b/drivers/crypto/caam/caamalg.c
    @@ -1790,7 +1790,12 @@ static inline int skcipher_crypt(struct skcipher_request *req, bool encrypt)
    u32 *desc;
    int ret = 0;

    - if (!req->cryptlen)
    + /*
    + * XTS is expected to return an error even for input length = 0
    + * Note that the case input length < block size will be caught during
    + * HW offloading and return an error.
    + */
    + if (!req->cryptlen && !ctx->fallback)
    return 0;

    if (ctx->fallback && (xts_skcipher_ivsize(req) ||
    --
    2.17.1
    \
     
     \ /
      Last update: 2020-09-21 09:33    [W:5.432 / U:0.212 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site