• Martin Willi's avatar
    crypto: x86/chacha20 - Support partial lengths in 1-block SSSE3 variant · e4e72063
    Martin Willi authored
    Add a length argument to the single block function for SSSE3, so the
    block function may XOR only a partial length of the full block. Given
    that the setup code is rather cheap, the function does not process more
    than one block; this allows us to keep the block function selection in
    the C glue code.
    
    The required branching does not negatively affect performance for full
    block sizes. The partial XORing uses simple "rep movsb" to copy the
    data before and after doing XOR in SSE. This is rather efficient on
    modern processors; movsw can be slightly faster, but the additional
    complexity is probably not worth it.
    Signed-off-by: default avatarMartin Willi <martin@strongswan.org>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    e4e72063
chacha20_glue.c 3.87 KB