• Eric Biggers's avatar
    crypto: shash - remove support for nonzero alignmask · 345bfa3c
    Eric Biggers authored
    Currently, the shash API checks the alignment of all message, key, and
    digest buffers against the algorithm's declared alignmask, and for any
    unaligned buffers it falls back to manually aligned temporary buffers.
    
    This is virtually useless, however.  In the case of the message buffer,
    cryptographic hash functions internally operate on fixed-size blocks, so
    implementations end up needing to deal with byte-aligned data anyway
    because the length(s) passed to ->update might not be divisible by the
    block size.  Word-alignment of the message can theoretically be helpful
    for CRCs, like what was being done in crc32c-sparc64.  But in practice
    it's better for the algorithms to use unaligned accesses or align the
    message themselves.  A similar argument applies to the key and digest.
    
    In any case, no shash algorithms actually set a nonzero alignmask
    anymore.  Therefore, remove support for it from shash.  The benefit is
    that all the code to handle "misaligned" buffers in the shash API goes
    away, reducing the overhead of the shash API.
    Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    345bfa3c
shash.c 16 KB