• Christian Lamparter's avatar
    crypto: crypto4xx - overhaul crypto4xx_build_pd() · cd4dcd6d
    Christian Lamparter authored
    This patch overhauls and fixes code related to crypto4xx_build_pd()
    
     * crypto4xx_build_pd() did not handle chained source scatterlist.
       This is fixed by replacing the buggy indexed-access of &src[idx]
       with sg_next() in the gather array setup loop.
    
     * The redundant is_hash, direction, save_iv and pd_ctl members
       in the crypto4xx_ctx struct have been removed.
        - is_hash can be derived from the crypto_async_request parameter.
        - direction is already part of the security association's
          bf.dir bitfield.
        - save_iv is unused.
        - pd_ctl always had the host_ready bit enabled anyway.
          (the hash_final case is rather pointless, since the ahash
           code has been deactivated).
    
     * make crypto4xx_build_pd()'s caller responsible for converting
       the IV to the LE32 format.
    
     * change crypto4xx_ahash_update() and crypto4xx_ahash_digest() to
       initialize a temporary destination scatterlist. This allows the
       removal of an ugly cast of req->result (which is a pointer to an
       u8-array) to a scatterlist pointer.
    
     * change crypto4xx_build_pd() return type to int. After all
       it returns -EINPROGRESS/-EBUSY.
    
     * fix crypto4xx_build_pd() thread-unsafe sa handling.
    Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    cd4dcd6d
crypto4xx_core.c 34.4 KB