• Eric Biggers's avatar
    crypto: adiantum - add fast path for single-page messages · dadf5e56
    Eric Biggers authored
    When the source scatterlist is a single page, optimize the first hash
    step of adiantum to use crypto_shash_digest() instead of
    init/update/final, and use the same local kmap for both hashing the bulk
    part and loading the narrow part of the source data.
    
    Likewise, when the destination scatterlist is a single page, optimize
    the second hash step of adiantum to use crypto_shash_digest() instead of
    init/update/final, and use the same local kmap for both hashing the bulk
    part and storing the narrow part of the destination data.
    
    In some cases these optimizations improve performance significantly.
    
    Note: ideally, for optimal performance each architecture should
    implement the full "adiantum(xchacha12,aes)" algorithm and fully
    optimize the contiguous buffer case to use no indirect calls.  That's
    not something I've gotten around to doing, though.  This commit just
    makes a relatively small change that provides some benefit with the
    existing template-based approach.
    Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    dadf5e56
adiantum.c 20.5 KB